lpc1754.ld 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131
  1. /* Linker script for LPC1754
  2. *
  3. * Written 2010 by Ingo Korb
  4. *
  5. * Partially based on the linker scripts of avr-libc
  6. */
  7. OUTPUT_FORMAT(elf32-littlearm)
  8. ENTRY(_start)
  9. MEMORY
  10. {
  11. flash (rx) : ORIGIN = 0x00002100, LENGTH = 0x1df00 /* leave room for bootldr + metadata */
  12. ram (rwx) : ORIGIN = 0x10000000, LENGTH = 0x04000
  13. ahbram (rwx) : ORIGIN = 0x2007C000, LENGTH = 0x04000
  14. }
  15. SECTIONS
  16. {
  17. .text :
  18. {
  19. KEEP(*(.vectors))
  20. KEEP(*(.init))
  21. *(.text)
  22. *(.text.*)
  23. *(.gnu.linkonce.t.*)
  24. /* C++ con-/destructors */
  25. __ctors_start = . ;
  26. *(.ctors)
  27. __ctors_end = . ;
  28. __dtors_start = . ;
  29. *(.dtors)
  30. __dtors_end = . ;
  31. KEEP(SORT(*)(.ctors))
  32. KEEP(SORT(*)(.dtors))
  33. KEEP(*(.fini))
  34. __text_end = .;
  35. } > flash
  36. /* .ARM.exidx is sorted, so has to go in its own output section. */
  37. __exidx_start = .;
  38. .ARM.exidx :
  39. {
  40. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  41. } >flash
  42. __exidx_end = .;
  43. /* I hope this does what I think it does */
  44. .rodata : AT (ALIGN(__exidx_end,4))
  45. {
  46. *(.rodata)
  47. *(.rodata.*)
  48. *(.gnu.linkonce.r.*)
  49. __rodata_end = .;
  50. } > flash
  51. /* Data section */
  52. .data : AT (ALIGN(__rodata_end,4))
  53. {
  54. __data_start = .;
  55. *(.data)
  56. *(.data.*)
  57. *(.gnu.linkonce.d.*)
  58. __data_end = .;
  59. } > ram
  60. /* Addresses of in-rom data section */
  61. __data_load_start = LOADADDR(.data);
  62. __data_load_end = __data_load_start + SIZEOF(.data);
  63. . = ALIGN(4);
  64. /* BSS */
  65. .bss :
  66. {
  67. __bss_start__ = .;
  68. *(.bss)
  69. *(.bss.*)
  70. *(COMMON)
  71. __bss_end__ = .;
  72. } > ram
  73. /* second BSS in AHB ram */
  74. .ahbram (NOLOAD) :
  75. {
  76. __ahbram_start__ = .;
  77. *(.ahbram)
  78. *(.ahbram.*)
  79. __ahbram_end__ = .;
  80. } > ahbram
  81. __heap_start = ALIGN(__bss_end__, 4);
  82. /* Default stack starts at end of ram */
  83. PROVIDE(__stack = ORIGIN(ram) + LENGTH(ram)) ;
  84. /* Everyone seems to copy the stuff below straight from somewhere else, so I'll do that too */
  85. /* Stabs debugging sections. */
  86. .stab 0 : { *(.stab) }
  87. .stabstr 0 : { *(.stabstr) }
  88. .stab.excl 0 : { *(.stab.excl) }
  89. .stab.exclstr 0 : { *(.stab.exclstr) }
  90. .stab.index 0 : { *(.stab.index) }
  91. .stab.indexstr 0 : { *(.stab.indexstr) }
  92. .comment 0 : { *(.comment) }
  93. /* DWARF debug sections.
  94. Symbols in the DWARF debugging sections are relative to the beginning
  95. of the section so we begin them at 0. */
  96. /* DWARF 1 */
  97. .debug 0 : { *(.debug) }
  98. .line 0 : { *(.line) }
  99. /* GNU DWARF 1 extensions */
  100. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  101. .debug_sfnames 0 : { *(.debug_sfnames) }
  102. /* DWARF 1.1 and DWARF 2 */
  103. .debug_aranges 0 : { *(.debug_aranges) }
  104. .debug_pubnames 0 : { *(.debug_pubnames) }
  105. /* DWARF 2 */
  106. .debug_info 0 : { *(.debug_info) *(.gnu.linkonce.wi.*) }
  107. .debug_abbrev 0 : { *(.debug_abbrev) }
  108. .debug_line 0 : { *(.debug_line) }
  109. .debug_frame 0 : { *(.debug_frame) }
  110. .debug_str 0 : { *(.debug_str) }
  111. .debug_loc 0 : { *(.debug_loc) }
  112. .debug_macinfo 0 : { *(.debug_macinfo) }
  113. }