Skip to content

Commit 3b01d63

Browse files
committed
[cortex-m] Enable vector table remapping option for M0+ devices
Almost all Cortex-M0+ devices support vector table relocation using SCB->VTOR. This includes all STM32 and SAM M0+ devices.
1 parent 45fb650 commit 3b01d63

File tree

2 files changed

+4
-2
lines changed

2 files changed

+4
-2
lines changed

src/modm/platform/core/cortex/module.lb

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -204,7 +204,7 @@ def prepare(module, options):
204204
memories = listify(options[":target"].get_driver("core")["memory"])
205205

206206
# Cortex-M0 does not have remappable vector table, so it will remain in Flash
207-
if not options[":target"].has_driver("core:cortex-m0*"):
207+
if options[":target"].get_driver("core")["type"] != "cortex-m0":
208208
default_location = "rom"
209209
if any((m["name"] == "ccm" and "x" in m["access"]) or m["name"] == "dtcm" for m in memories):
210210
default_location = "ram"

src/modm/platform/core/cortex/startup.c.in

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -102,10 +102,12 @@ void __modm_startup(void)
102102
SCB_EnableICache();
103103
%% endif
104104

105-
%% if "m0" not in core
105+
%% if core != "cortex-m0"
106106
// Set the vector table location
107107
SCB->VTOR = (uint32_t)__vector_table_{{ vector_table_location }}_start;
108+
%% endif
108109

110+
%% if "m0" not in core
109111
// Enable trapping of divide by zero for UDIV/SDIV instructions.
110112
SCB->CCR |= SCB_CCR_DIV_0_TRP_Msk;
111113
%% endif

0 commit comments

Comments
 (0)