MEMORY { flash : org = 0x08000000, len = 256k sram1 : org = 0x20000000, len = 48k sram2 : org = 0x10000000, len = 16k } SECTIONS { __Periph_base = 0x40000000; __Pwr_base = __Periph_base + 0x7000; /* By default the start of the stack is at the top of sram1. */ PROVIDE(_stack_start = ORIGIN(sram1) + LENGTH(sram1)); /* Vector-offset table. */ .vectors ORIGIN(flash) : ALIGN(0x04) { LONG(_stack_start); /* Store the start of the stack. */ KEEP(*(.on_reset)); . = ORIGIN(flash) + 0x0dc; } >flash /** Init routines */ _sinits = ADDR(.vectors) + SIZEOF(.vectors); .inits _sinits : ALIGN(0x04) { KEEP(*(SORT_BY_NAME(.inits .inits.*))); _einits = .; . = ALIGN(0x04); } > flash /** Text data is stored after the vector table. */ PROVIDE(_stext = ADDR(.inits) + SIZEOF(.inits)); .text _stext : ALIGN(0x04) { *(.text .text.*); . = ALIGN(0x04); _etext = .; /* Readonly data should be stored in flash. */ *(.rodata .rodata.*) } >flash /* the data segment where static data is stored. This is linked to reference * variables in sram2, but the data is stored persistently in the flash. * * The Application has to load the data from the flash to */ .data : ALIGN(0x04) { __data_load = LOADADDR(.data); __data_store_start = .; *(.data .data.*); __data_store_end = .; } > sram2 AT > flash /* block starting symbol (bss). This is data initialized to 0. The application * is responsible for zeroing out this data. */ .bss : ALIGN(0x04) { __bss_start = .; *(.bss .bss.*); __bss_end = .; } > sram2 /* Sections that should be discarded. */ /DISCARD/ : { *(.ARM.exidx); *(.ARM.exidx.*); *(.ARM.extab.*); } }