Disable write buffering on debug builds.

In mbed_start_application() there was a code that was supposed to
set DISDEFWBUF to one when running a debug build. However, this code
was in the wrong place, as this function is only called from
bootloader.

Move the code to correct place so that standalone applications use it
as well.

For the reference of DISDEFWBUF bit, see
http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.dui0552a/CHDCBHEE.html
pull/12336/head
Seppo Takalo 2020-01-30 16:19:28 +02:00
parent 44add981ff
commit c352488412
3 changed files with 20 additions and 11 deletions

View File

@ -71,17 +71,6 @@ void mbed_start_application(uintptr_t address)
powerdown_scb(address);
mbed_mpu_manager_deinit();
#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);

View File

@ -77,6 +77,16 @@ void mbed_copy_nvic(void)
void mbed_init(void)
{
#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
mbed_copy_nvic();
mbed_sdk_init();
#if DEVICE_USTICKER && MBED_CONF_TARGET_INIT_US_TICKER_AT_BOOT

View File

@ -73,6 +73,16 @@ uint32_t mbed_stack_isr_size = 0;
void mbed_init(void)
{
#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
mbed_mpu_manager_init();
mbed_cpy_nvic();
mbed_sdk_init();