@@ -25,13 +25,15 @@ void HardFault_Handler(void) __attribute__((weak, alias("Undefined_Handler")
25
25
{{ ("void " ~ vector_table[pos] ~ "(void)") | lbuild.pad(47)}}__attribute__((weak, alias("Undefined_Handler")));
26
26
%% endif
27
27
%% endfor
28
-
28
+ %#
29
29
// ----------------------------------------------------------------------------
30
30
typedef void (* const FunctionPointer)(void);
31
31
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
+ %#
35
37
// Define the vector table
36
38
modm_section(".vector_rom")
37
39
FunctionPointer vectorsRom[] =
@@ -41,19 +43,21 @@ FunctionPointer vectorsRom[] =
41
43
NMI_Handler, // -14: Non Maskable Interrupt handler
42
44
HardFault_Handler, // -13: hard fault handler
43
45
%% for pos in range(4 - 16, highest_irq)
44
- %% if pos in vector_table
46
+ %% if pos in vector_table
45
47
{{ (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
47
51
Undefined_Handler, // {{ (pos|string).rjust(3) }}
48
- %% endif
52
+ %% endif
49
53
%% endfor
50
54
};
51
55
%% if vector_table_location == "ram"
52
56
// reserve space for the remapped vector table in RAM
53
57
modm_section(".vector_ram")
54
58
FunctionPointer vectorsRam[sizeof(vectorsRom) / sizeof(FunctionPointer)];
55
59
%% endif
56
-
60
+ %#
57
61
// ----------------------------------------------------------------------------
58
62
// Ignore redeclaration of interrupt handlers in vendor headers
59
63
#pragma GCC diagnostic push
@@ -64,7 +68,7 @@ FunctionPointer vectorsRam[sizeof(vectorsRom) / sizeof(FunctionPointer)];
64
68
%% if with_assert
65
69
#include <modm/architecture/interface/assert.h>
66
70
%% endif
67
-
71
+ %#
68
72
void Undefined_Handler(void)
69
73
{
70
74
%% if with_assert
0 commit comments