/* * Linker script for a ARM M0 based System-on-Chip * * This version is an ASIC version with ROM for code and RAM for data */ /* * Declare the memory units supported in this system. */ MEMORY { ROM (rx) : ORIGIN = 0x00000000, LENGTH = 16K RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 256 } /* * Map 'sections' generated by the compiler into the memory * units declared above. * * The standard sections are: * * .text : for code * .data : for initialised data * .bss : for uninitialised data * * Other sections may also exist dependent on the particular * compiler and even in response to compiler directives in the * source code. */ SECTIONS { /* * The '.text' section contains code and read-only data * we would like this to go into ROM */ .text : { _stext = .; /* Provide the name for the start of this section */ CREATE_OBJECT_SYMBOLS KEEP(*(.vectors)) /* Include the vector table first */ *(.text) *(.text.*) . = ALIGN(4); /* Align the start of the rodata part */ *(.rodata) *(.rodata.*) . = ALIGN(4); /* Align the end of the section */ _etext = .; /* Provide the name for the end of this section */ } > ROM = 0 /* * The '.data' section contains initialised data * this goes into ROM but must be copied to RAM by * the Reset Handler code before the code is run */ .data : { . = ALIGN(4); /* Align the start of the section */ _sdata = .; /* Provide the name for the start of this section */ *(.data) *(.data.*) . = ALIGN(4); /* Align the end of the section */ _edata = .; /* Provide the name for the end of this section */ } > RAM AT > ROM /* * The '.bss' section contains uninitialised data * we would like this to go into RAM * * In spite of the "uninitialised" description, it is * usual to initialise this data to zero - * this is a job for the Reset Handler code. */ .bss : { . = ALIGN(4); /* Align the start of the section */ _sbss = .; /* Provide the name for the start of this section */ *(.bss) *(.bss.*) . = ALIGN(4); /* Align the end of the section */ _ebss = .; /* Provide the name for the end of this section */ } > RAM /* * The following line assigns a symbol for the "bottom" of * the the stack. This symbol is used in the vector table in * order to initialise the stack pointer */ _estack = ORIGIN(RAM) + LENGTH(RAM); /* * Exception frames are not supported by this embedded system * so we will discard the 'ARM.exidx' section */ /DISCARD/ : { *(.ARM.exidx*) } } /* * The ENTRY section can be used to tell an emulator where * to start executing the code */ ENTRY(ResetHandler)