forked from auracaster/openocd
cortex_m: make bit fields in cortex_m unsigned.
Expression like (0xffff << 16) evaluate to type int, which is not able to hold that value, producing a warning when compiling with -fsanitize=undefined. This patch makes most of the cortex_m constants unsigned using the BIT() macro or appending "ul" when possible to fix the undefined behavior warning. Signed-off-by: iosabi <iosabi@protonmail.com> Change-Id: I7af194305ef612d7a32e74eaf9f11dd85fa87f32 Reviewed-on: http://openocd.zylin.com/5583 Tested-by: jenkins Reviewed-by: Antonio Borneo <borneo.antonio@gmail.com> Reviewed-by: Christopher Head <chead@zaber.com> Reviewed-by: Tomas Vanek <vanekt@fbl.cz>
This commit is contained in:
@@ -129,7 +129,7 @@ static int cortex_m_write_debug_halt_mask(struct target *target,
|
||||
struct armv7m_common *armv7m = &cortex_m->armv7m;
|
||||
|
||||
/* mask off status bits */
|
||||
cortex_m->dcb_dhcsr &= ~((0xFFFF << 16) | mask_off);
|
||||
cortex_m->dcb_dhcsr &= ~((0xFFFFul << 16) | mask_off);
|
||||
/* create new register mask */
|
||||
cortex_m->dcb_dhcsr |= DBGKEY | C_DEBUGEN | mask_on;
|
||||
|
||||
|
||||
Reference in New Issue
Block a user