Skip to content

Commit 175f3e4

Browse files
committed
[core] Add RTT control block address into interrupt vector table
1 parent aacb439 commit 175f3e4

File tree

2 files changed

+14
-9
lines changed

2 files changed

+14
-9
lines changed

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

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -352,6 +352,7 @@ def build(env):
352352
"with_assert": env.has_module(":architecture:assert"),
353353
"with_fpu": env.get("float-abi", "soft") != "soft",
354354
"with_multicore": env.has_module(":platform:multicore"),
355+
"with_rtt": env.has_module(":rtt"),
355356
"with_msplim": sum(c.isnumeric() for c in core) == 2,
356357
"enable_icache": env.get("enable_icache", False),
357358
"enable_dcache": enable_dcache,

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

Lines changed: 13 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -25,13 +25,15 @@ void HardFault_Handler(void) __attribute__((weak, alias("Undefined_Handler")
2525
{{ ("void " ~ vector_table[pos] ~ "(void)") | lbuild.pad(47)}}__attribute__((weak, alias("Undefined_Handler")));
2626
%% endif
2727
%% endfor
28-
28+
%#
2929
// ----------------------------------------------------------------------------
3030
typedef void (* const FunctionPointer)(void);
3131

32-
// defined in the linkerscript
33-
extern uint32_t __main_stack_top[];
34-
32+
extern uint32_t __main_stack_top[]; // from linkerscript
33+
%% if with_rtt
34+
extern uint32_t _SEGGER_RTT; // from modm:rtt
35+
%% endif
36+
%#
3537
// Define the vector table
3638
modm_section(".vector_rom")
3739
FunctionPointer vectorsRom[] =
@@ -41,19 +43,21 @@ FunctionPointer vectorsRom[] =
4143
NMI_Handler, // -14: Non Maskable Interrupt handler
4244
HardFault_Handler, // -13: hard fault handler
4345
%% for pos in range(4 - 16, highest_irq)
44-
%% if pos in vector_table
46+
%% if pos in vector_table
4547
{{ (vector_table[pos] ~ ",") | lbuild.pad(39) }}// {{ (pos|string).rjust(3) }}
46-
%% else
48+
%% elif with_rtt and pos == -8
49+
(FunctionPointer)(((uint32_t)&_SEGGER_RTT) + 2ul),
50+
%% else
4751
Undefined_Handler, // {{ (pos|string).rjust(3) }}
48-
%% endif
52+
%% endif
4953
%% endfor
5054
};
5155
%% if vector_table_location == "ram"
5256
// reserve space for the remapped vector table in RAM
5357
modm_section(".vector_ram")
5458
FunctionPointer vectorsRam[sizeof(vectorsRom) / sizeof(FunctionPointer)];
5559
%% endif
56-
60+
%#
5761
// ----------------------------------------------------------------------------
5862
// Ignore redeclaration of interrupt handlers in vendor headers
5963
#pragma GCC diagnostic push
@@ -64,7 +68,7 @@ FunctionPointer vectorsRam[sizeof(vectorsRom) / sizeof(FunctionPointer)];
6468
%% if with_assert
6569
#include <modm/architecture/interface/assert.h>
6670
%% endif
67-
71+
%#
6872
void Undefined_Handler(void)
6973
{
7074
%% if with_assert

0 commit comments

Comments
 (0)