Call SystemInit before loading the .data section for TEENSY3.1 when using GCC_ARM

This is needed because it seems the watchdog otherwise resets the board
before SystemInit is reached even though I'm not sure why the watchdog
timer expires so early.
pull/1052/head
Christoph Plank 2015-03-22 00:16:51 +01:00
parent 8348517bbb
commit e66f9ff0aa
2 changed files with 9 additions and 2 deletions

View File

@ -192,6 +192,13 @@ __isr_vector:
.globl Reset_Handler .globl Reset_Handler
.type Reset_Handler, %function .type Reset_Handler, %function
Reset_Handler: Reset_Handler:
/*
* Call SystemInit before loading the .data section to prevent the watchdog
* from resetting the board.
*/
ldr r0, =SystemInit
blx r0
/* Loop to copy data from read only memory to RAM. The ranges /* Loop to copy data from read only memory to RAM. The ranges
* of copy from/to are specified by following symbols evaluated in * of copy from/to are specified by following symbols evaluated in
* linker script. * linker script.
@ -212,8 +219,6 @@ Reset_Handler:
.Lflash_to_ram_loop_end: .Lflash_to_ram_loop_end:
ldr r0, =SystemInit
blx r0
ldr r0, =_start ldr r0, =_start
bx r0 bx r0
.pool .pool

View File

@ -100,6 +100,8 @@ uint32_t SystemCoreClock = DEFAULT_SYSTEM_CLOCK;
-- SystemInit() -- SystemInit()
---------------------------------------------------------------------------- */ ---------------------------------------------------------------------------- */
void SystemInit (void) { void SystemInit (void) {
/* SystemInit MUST NOT use any variables from the .data section, as this section is not loaded yet! */
#if (DISABLE_WDOG) #if (DISABLE_WDOG)
/* Disable the WDOG module */ /* Disable the WDOG module */
/* WDOG_UNLOCK: WDOGUNLOCK=0xC520 */ /* WDOG_UNLOCK: WDOGUNLOCK=0xC520 */