Fixed initialization code for MK20D7 controllers.

Added flash configuration section to RTL and linker script.

git-svn-id: trunk@30972 -
This commit is contained in:
Jeppe Johansen 2015-06-02 22:59:03 +00:00
parent 096743d74d
commit db6093023b
2 changed files with 36 additions and 1 deletions

View File

@ -541,6 +541,11 @@ begin
Add(' {'); Add(' {');
Add(' _text_start = .;'); Add(' _text_start = .;');
Add(' KEEP(*(.init, .init.*))'); Add(' KEEP(*(.init, .init.*))');
if embedded_controllers[current_settings.controllertype].controllerunitstr='MK20D7' then
begin
Add(' . = 0x400;');
Add(' KEEP(*(.flash_config, *.flash_config.*))');
end;
Add(' *(.text, .text.*)'); Add(' *(.text, .text.*)');
Add(' *(.strings)'); Add(' *(.strings)');
Add(' *(.rodata, .rodata.*)'); Add(' *(.rodata, .rodata.*)');

View File

@ -21914,13 +21914,43 @@ procedure INT_PORTE_interrupt; external name 'INT_PORTE_interrupt';
{$i cortexm4f_start.inc} {$i cortexm4f_start.inc}
procedure FlashConfiguration; assembler; nostackframe;
label flash_conf;
asm
.section ".flash_config.flash_conf"
flash_conf:
.byte 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFF, 0xFE, 0xFF, 0xFF, 0xFF
.text
end;
procedure LowLevelStartup; assembler; nostackframe;
asm
// Unlock watchdog
ldr r0, .LWDOG_BASE
movw r1, #50464
strh r1, [r0, #0xE]
movw r1, #55592
strh r1, [r0, #0xE]
nop
nop
// Disable watchdog for now
movs r1, #0
strh r1, [r0, #0]
b Startup
.LWDOG_BASE:
.long 0x40052000
end;
procedure Vectors; assembler; nostackframe; procedure Vectors; assembler; nostackframe;
label interrupt_vectors; label interrupt_vectors;
asm asm
.section ".init.interrupt_vectors" .section ".init.interrupt_vectors"
interrupt_vectors: interrupt_vectors:
.long _stack_top .long _stack_top
.long Startup // int -15 .long LowLevelStartup // int -15
.long NonMaskableInt_interrupt // int -14 .long NonMaskableInt_interrupt // int -14
.long HardFault_interrupt // int -13 .long HardFault_interrupt // int -13
.long MemoryManagement_interrupt // int -12 .long MemoryManagement_interrupt // int -12