Disable write buffer in debug builds (M3/M4)

As part of work to improve the debugging of exceptions, have
Mbed OS make an effort to make exceptions more precise in debug builds
at the cost of performance.

Related pyOCD work:

   https://github.com/mbedmicro/pyOCD/pull/430
pull/8655/head
Kevin Bracey 2018-11-06 16:45:45 +02:00
parent f04904c6e8
commit bd413f1d82
1 changed files with 11 additions and 0 deletions

View File

@ -71,6 +71,17 @@ void mbed_start_application(uintptr_t address)
powerdown_scb(address);
mbed_mpu_free();
#ifdef MBED_DEBUG
// Configs to make debugging easier
#ifdef SCnSCB_ACTLR_DISDEFWBUF_Msk
// Disable write buffer to make BusFaults (eg write to ROM via NULL pointer) precise.
// Possible on Cortex-M3 and M4, not on M0, M7 or M33.
// Would be less necessary if ROM was write-protected in MPU to give a
// precise MemManage exception.
SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;
#endif
#endif
sp = *((void **)address + 0);
pc = *((void **)address + 1);
start_new_application(sp, pc);