Skip to content

Commit 3d2fa53

Browse files
Naveen KajeTacoGrandeTX
authored andcommitted
NRF52: Fix vector table
Ensure that vector table gets initialized properly. The table that we initialize in startup_nrf52840.S gets wiped out as the section is declared as noinit. Fix this by implementing the weak function mbed_sdk_init that inits the vector table.
1 parent 13dd0e7 commit 3d2fa53

File tree

1 file changed

+4
-11
lines changed

1 file changed

+4
-11
lines changed

targets/TARGET_NORDIC/TARGET_NRF5x/TARGET_NRF52/reloc_vector_table.c

Lines changed: 4 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -47,15 +47,7 @@
4747
#include "nrf_dfu_mbr.h"
4848
#endif
4949

50-
#if defined(__CC_ARM) || (defined(__ARMCC_VERSION) && (__ARMCC_VERSION >= 6010050))
51-
__attribute__ ((section(".bss.nvictable"),zero_init))
52-
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
53-
#elif defined(__GNUC__)
54-
__attribute__ ((section(".nvictable")))
55-
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
56-
#elif defined(__ICCARM__)
57-
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS] @ ".nvictable";
58-
#endif
50+
uint32_t nrf_dispatch_vector[NVIC_NUM_VECTORS];
5951

6052
extern uint32_t __Vectors[];
6153

@@ -113,12 +105,13 @@ void nrf_reloc_vector_table(void)
113105
#endif
114106
}
115107

116-
#if (STDIO_UART_RTS != NC)
117108
void mbed_sdk_init(void)
118109
{
110+
#if (STDIO_UART_RTS != NC)
119111
gpio_t rts;
120112
gpio_init_out(&rts, STDIO_UART_RTS);
121113
/* Set STDIO_UART_RTS as gpio driven low */
122114
gpio_write(&rts, 0);
123-
}
124115
#endif
116+
nrf_reloc_vector_table();
117+
}

0 commit comments

Comments
 (0)