forked from auracaster/openocd
adi_v5: enforce check on AP number value
The AP number value is restricted in 8 bits unsigned by ADI-v5 specification. Nevertheless, an "invalid" value is used by target cortex-m to force an automatic detection of the AP. Replace magic numbers by using new macros for AP max number and for the value of AP invalid. Check the value passed through -ap-num flag during configuration. Change-Id: Ic19a367db0ab11c0ebd070750eca0647d25279a5 Signed-off-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-on: http://openocd.zylin.com/4668 Tested-by: jenkins Reviewed-by: Matthias Welwarsky <matthias@welwarsky.de>
This commit is contained in:
committed by
Matthias Welwarsky
parent
2a3b709aa5
commit
11019a824d
@@ -431,6 +431,10 @@ static int cti_configure(Jim_GetOptInfo *goi, struct arm_cti_object *cti)
|
||||
e = Jim_GetOpt_Wide(goi, &w);
|
||||
if (e != JIM_OK)
|
||||
return e;
|
||||
if (w < 0 || w > DP_APSEL_MAX) {
|
||||
Jim_SetResultString(goi->interp, "-ap-num is invalid", -1);
|
||||
return JIM_ERR;
|
||||
}
|
||||
cti->ap_num = (uint32_t)w;
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user