common.ld 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081
  1. /* define output sections */
  2. SECTIONS
  3. {
  4. /* The program code and other data goes into FLASH */
  5. .text :
  6. {
  7. . = ALIGN(4);
  8. KEEP(*(.isr_vector)) /* Startup code */
  9. *(.text) /* .text sections (code) */
  10. *(.text*) /* .text* sections (code) */
  11. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  12. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  13. /* *(.glue_7) */ /* glue arm to thumb code */
  14. /* *(.glue_7t) */ /* glue thumb to arm code */
  15. . = ALIGN(4);
  16. _etext = .; /* define a global symbol at end of code */
  17. } >FLASH_TEXT
  18. /*
  19. .ARM.extab :
  20. {
  21. *(.ARM.extab* .gnu.linkonce.armextab.*)
  22. } >FLASH
  23. .ARM :
  24. {
  25. __exidx_start = .;
  26. *(.ARM.exidx*)
  27. __exidx_end = .;
  28. } >FLASH
  29. */
  30. /* used by the startup to initialize data */
  31. _sidata = LOADADDR(.data);
  32. /* This is the initialized data section
  33. The program executes knowing that the data is in the RAM
  34. but the loader puts the initial values in the FLASH (inidata).
  35. It is one task of the startup to copy the initial values from FLASH to RAM. */
  36. .data :
  37. {
  38. . = ALIGN(4);
  39. _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
  40. _ram_start = .; /* create a global symbol at ram start for garbage collector */
  41. *(.data) /* .data sections */
  42. *(.data*) /* .data* sections */
  43. . = ALIGN(4);
  44. _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
  45. } >RAM AT>FLASH_TEXT
  46. /* Uninitialized data section */
  47. .bss :
  48. {
  49. . = ALIGN(4);
  50. _sbss = .; /* define a global symbol at bss start; used by startup code */
  51. *(.bss)
  52. *(.bss*)
  53. *(COMMON)
  54. . = ALIGN(4);
  55. _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
  56. } >RAM
  57. /* Remove information from the standard libraries */
  58. /*
  59. /DISCARD/ :
  60. {
  61. libc.a ( * )
  62. libm.a ( * )
  63. libgcc.a ( * )
  64. }
  65. */
  66. .ARM.attributes 0 : { *(.ARM.attributes) }
  67. }
  68. /* Define heap and stack areas */
  69. _ram_end = ORIGIN(RAM) + LENGTH(RAM);
  70. _estack = ORIGIN(RAM) + LENGTH(RAM);