Important changes to forums and questions
All forums and questions are now archived. To start a new conversation or read the latest updates go to forums.mbed.com.
8 years ago. This question has been closed. Reason: Unclear question
Need Help with linker file for ARM GCC for target Tiva C
Hi,
I don't have experience with writing linker files for ARM GCC Compiler, I need help to understand how to make one for #mbed for my target.
here's the one which I use, which I believe it doesn't function the way it should be for mbed-OS
/* * Memory definition: * FLASH: start point 0x00, lenght 0x40000. * SRAM: start point 0x20000000 length 0x8000. */ MEMORY { FLASH (rx) : ORIGIN = 0x00000000, LENGTH = 0x00040000 RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 0x00008000 } /* * Sections definitions: * * .text - machine instructions. * .data - initialized data defined in the program. * .bss - un-initialized global and static variables (to be initialized to 0 before starting main). * .stack - just contains the pointer to the stack end at the right place. */ SECTIONS { /* This section it's the code, containing the NVIC Vector table that must start at 0x0 * Look at the LM4F120H5QR datasheet for details. (Table 2-8. Exception Types) */ .text : { _text = .; /* This is an index to the beginning of .text segment. */ KEEP(*(.nvic_table)) /* I should keep the NVIC ISR Table because it's needed by the processor to start. */ *(.text.*) /* This contains the code after the ISR table. */ *(.rodata.*) /* Read only data. */ _etext = .; /* This is an index to the end of .text segment. */ }>FLASH /* * .data segment must be placed in RAM but it's originally stored in FLASH * So I set the data segment in ram, but I specify the load address with the AT * keyword to set that right after the .text section. * (Look at the LD documentation. (Optional Section Attributes)) * Thanks https://github.com/utzig for the hints! */ .data : { _data = .; /* An index to the beginning of .data segment. */ *(.data.*) /* I should put there all my initialized data of my program. */ *(vtable) /* vtable it's generated by stellarisware to store the NVIC table in ram*/ _edata = .; /* And another index to the end of .data segment. */ }>RAM AT >FLASH __exidx_start = .; .ARM.exidx : { *(.ARM.exidx* .gnu.linkonce.armexidx.*) } > FLASH __exidx_end = .; /* * .bss contains the unitialized variables and must be set as 0x0 during runtime. * It should be loaded in RAM and particula care should be taken initializing them in the startup file. */ .bss : { _bss = .; /* This is an index to the beginning of .bss segment. */ *(.bss.*) /* The un-initialized data should go there. */ *(COMMON) /* All the other stuff should be put there */ _ebss = .; /* End index for .bss segment */ }>RAM }
And I would really appreciate it if someone provide me useful tutorial about this topic