Skip to content

Commit d063902

Browse files
authored
Merge pull request #12336 from SeppoTakalo/disable_writebuf
Disable write buffering on debug builds.
2 parents 370a936 + c352488 commit d063902

File tree

3 files changed

+20
-11
lines changed

3 files changed

+20
-11
lines changed

platform/source/mbed_application.c

Lines changed: 0 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -71,17 +71,6 @@ void mbed_start_application(uintptr_t address)
7171
powerdown_scb(address);
7272
mbed_mpu_manager_deinit();
7373

74-
#ifdef MBED_DEBUG
75-
// Configs to make debugging easier
76-
#ifdef SCnSCB_ACTLR_DISDEFWBUF_Msk
77-
// Disable write buffer to make BusFaults (eg write to ROM via NULL pointer) precise.
78-
// Possible on Cortex-M3 and M4, not on M0, M7 or M33.
79-
// Would be less necessary if ROM was write-protected in MPU to give a
80-
// precise MemManage exception.
81-
SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;
82-
#endif
83-
#endif
84-
8574
sp = *((void **)address + 0);
8675
pc = *((void **)address + 1);
8776
start_new_application(sp, pc);

platform/source/mbed_sdk_boot.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -77,6 +77,16 @@ void mbed_copy_nvic(void)
7777

7878
void mbed_init(void)
7979
{
80+
#ifdef MBED_DEBUG
81+
// Configs to make debugging easier
82+
#ifdef SCnSCB_ACTLR_DISDEFWBUF_Msk
83+
// Disable write buffer to make BusFaults (eg write to ROM via NULL pointer) precise.
84+
// Possible on Cortex-M3 and M4, not on M0, M7 or M33.
85+
// Would be less necessary if ROM was write-protected in MPU to give a
86+
// precise MemManage exception.
87+
SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;
88+
#endif
89+
#endif
8090
mbed_copy_nvic();
8191
mbed_sdk_init();
8292
#if DEVICE_USTICKER && MBED_CONF_TARGET_INIT_US_TICKER_AT_BOOT

rtos/source/TARGET_CORTEX/mbed_boot.c

Lines changed: 10 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -73,6 +73,16 @@ uint32_t mbed_stack_isr_size = 0;
7373

7474
void mbed_init(void)
7575
{
76+
#ifdef MBED_DEBUG
77+
// Configs to make debugging easier
78+
#ifdef SCnSCB_ACTLR_DISDEFWBUF_Msk
79+
// Disable write buffer to make BusFaults (eg write to ROM via NULL pointer) precise.
80+
// Possible on Cortex-M3 and M4, not on M0, M7 or M33.
81+
// Would be less necessary if ROM was write-protected in MPU to give a
82+
// precise MemManage exception.
83+
SCnSCB->ACTLR |= SCnSCB_ACTLR_DISDEFWBUF_Msk;
84+
#endif
85+
#endif
7686
mbed_mpu_manager_init();
7787
mbed_cpy_nvic();
7888
mbed_sdk_init();

0 commit comments

Comments
 (0)