Linkage: Put the stack at the end of the CCM

This commit is contained in:
Romain Goyet
2015-05-03 20:44:48 +02:00
parent f504528463
commit 7521af7457
3 changed files with 18 additions and 6 deletions

View File

@@ -21,7 +21,7 @@ test: test.elf
$(GDB) -x test/gdb_script.gdb test.elf
test.elf: $(objs) test/runner.o
@$(LD) -T boot/stm32f429_flash.ld $(objs) test/runner.o -o $@
@$(LD) -T boot/stm32f429.ld $(objs) test/runner.o -o $@
boot.hex: boot.elf
@echo "OBJCOPY $@"
@@ -33,7 +33,7 @@ boot.bin: boot.elf
boot.elf: $(objs) src/freertos_blinky.o
@echo "LD $@"
@$(LD) -T boot/stm32f429_flash.ld $(objs) src/freertos_blinky.o -o $@
@$(LD) -T boot/stm32f429.ld $(objs) src/freertos_blinky.o -o $@
%.o: %.c
@echo "CC $@"

View File

@@ -7,6 +7,8 @@ extern const void * _data_section_start_ram;
extern const void * _data_section_end_ram;
extern const void * _bss_section_start_ram;
extern const void * _bss_section_end_ram;
extern const void * _stack_start;
extern const void * _stack_end;
void _start(void);
@@ -24,7 +26,7 @@ typedef void(*ISR)(void);
ISR InitialisationVector[INITIALISATION_VECTOR_SIZE]
__attribute__((section(".isr_vector_table")))
= {
0x2001FFF0, //FIXME: This is the stack pointer!
(ISR)&_stack_start,
_start,
0,
0,

View File

@@ -10,8 +10,11 @@
* to be stored in Flash. */
MEMORY {
FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 2048K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192K
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 64K
RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 192K
/* We're splitting the CCM in two, this way we're sure nothing will use the
* stack space. */
CCM (rwx) : ORIGIN = 0x10000000, LENGTH = 60K
CCM_STACK (rw) : ORIGIN = 0x1000F000, LENGTH = 4K
}
SECTIONS {
@@ -33,7 +36,6 @@ SECTIONS {
*(.isr_vector_table)
} >FLASH
.text : {
. = ALIGN(4);
*(.text)
@@ -76,4 +78,12 @@ SECTIONS {
*(.bss)
_bss_section_end_ram = .;
} >RAM
.ccm : {
. = ALIGN(8);
_stack_end = .;
. = . + LENGTH(CCM_STACK) - 8;
. = ALIGN(8);
_stack_start = .;
} >CCM_STACK
}