diff options
Diffstat (limited to 'linker/linker_script.ld')
-rw-r--r-- | linker/linker_script.ld | 83 |
1 files changed, 47 insertions, 36 deletions
diff --git a/linker/linker_script.ld b/linker/linker_script.ld index ea6fc8a..8497768 100644 --- a/linker/linker_script.ld +++ b/linker/linker_script.ld @@ -8,66 +8,77 @@ MEMORY SECTIONS { /* This is where the code goes. */ - WAT = ORIGIN(flash); . = ORIGIN(flash); - TEXT_START = .; .text ALIGN(0x04) : { + . = ALIGN(0x04); + VECTORS_START = .; *(.vectors); /* All .vector sections go here. */ - *(.text); /* All .text sections go here. */ - } >flash - TEXT_STOP = .; - . = ALIGN(0x04); - - .data : ALIGN(0x04) { - /* Data segment as defined in the flash. */ - INIT_DATA_VALUES = LOADADDR(.data); + VECTORS_END = .; - /* Data segment where it will be in memory. */ - . = ALIGN(0x04); - DATA_SEGMENT_START = .; - *(.data); - . = ALIGN(0x1c); - DATA_SEGMENT_STOP = .; + TEXT_START = .; + *(.text); /* All .text sections go here. */ + TEXT_END = .; - INIT_ROUTINES_FLASH_START = - LOADADDR(.data) + (DATA_SEGMENT_STOP - DATA_SEGMENT_START); + /* Start the init sections. The inits sections are text sections which are + * executed in order during startup. */ INITS_START = .; + INIT_0_START = .; *(.init0); - INIT_0_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_0_END = .; + INIT_1_START = .; *(.init1); - INIT_1_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_1_END = .; + INIT_2_START = .; *(.init2); - INIT_2_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_2_END = .; + INIT_3_START = .; *(.init3); - INIT_3_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_3_END = .; + INIT_4_START = .; *(.init4); - INIT_4_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_4_END = .; + INIT_5_START = .; *(.init5); - INIT_5_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_5_END = .; + INIT_6_START = .; *(.init6); - INIT_6_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_6_END = .; + INIT_7_START = .; *(.init7); - INIT_7_END = ABSOLUTE(INIT_ROUTINES_FLASH_START) + (. - INITS_START); + INIT_7_END = .; INITS_END = .; - INIT_ROUTINES_FLASH_STOP = - LOADADDR(.data) + (INITS_END - DATA_SEGMENT_START); + FLASH_STOP = .; + } >flash AT >flash + + /* Data segment as defined in the flash. */ + DATA_VALUES_IN_FLASH = LOADADDR(.data); + + .data : ALIGN(0x04) { + + /* Data segment where it will be in memory. */ + . = ALIGN(0x04); + DATA_SEGMENT_START = .; + *(.data); + DATA_SEGMENT_STOP = .; /* Align by 4 so we can optimize the copier to use uint32's. */ . = ALIGN(0x04); *(.noinit); - } >sram1 AT>flash + } >sram2 AT>flash - . = ALIGN(0x04); - BSS_START = .; - .bss : { + .bss : ALIGN(0x04){ + . = ALIGN(0x04); + BSS_START = .; *(.bss); . = ALIGN(0x04); - } > sram1 - BSS_END = .; + BSS_END = .; + } > sram2 - HEAP_START = .; - HEAP_STOP = ORIGIN(sram1) + LENGTH(sram1); + .heap : ALIGN(0x04) { + HEAP_START = .; + HEAP_STOP = ABSOLUTE(ORIGIN(sram1) + LENGTH(sram1)); + } > sram1 } |