n32g4fr_flash.ld 3.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164
  1. /*
  2. *****************************************************************************
  3. **
  4. ** File : n32g4fr.ld
  5. **
  6. ** Target : nationstech n32g4fr
  7. **
  8. **
  9. *****************************************************************************
  10. */
  11. /* Entry Point */
  12. ENTRY(Reset_Handler)
  13. /* Highest address of the user mode stack */
  14. _estack = 0x20020000; /* end of RAM */
  15. /* Generate a link error if heap and stack don't fit into RAM */
  16. _Min_Heap_Size = 0x300; /* required amount of heap */
  17. _Min_Stack_Size = 0x1000; /* required amount of stack */
  18. /* Specify the memory areas */
  19. MEMORY
  20. {
  21. FLASH (rx) : ORIGIN = 0x800c000, LENGTH = 464K
  22. RAM (xrw) : ORIGIN = 0x20004000, LENGTH = 128K
  23. }
  24. /* Define output sections */
  25. SECTIONS
  26. {
  27. /* The startup code goes first into FLASH */
  28. .isr_vector :
  29. {
  30. . = ALIGN(4);
  31. KEEP(*(.isr_vector)) /* Startup code */
  32. . = ALIGN(4);
  33. } >FLASH
  34. /* The program code and other data goes into FLASH */
  35. .text :
  36. {
  37. . = ALIGN(4);
  38. *(.text) /* .text sections (code) */
  39. *(.text*) /* .text* sections (code) */
  40. *(.glue_7) /* glue arm to thumb code */
  41. *(.glue_7t) /* glue thumb to arm code */
  42. *(.eh_frame)
  43. KEEP (*(.init))
  44. KEEP (*(.fini))
  45. /* section information for finsh shell */
  46. . = ALIGN(4);
  47. __fsymtab_start = .;
  48. KEEP(*(FSymTab))
  49. __fsymtab_end = .;
  50. . = ALIGN(4);
  51. __vsymtab_start = .;
  52. KEEP(*(VSymTab))
  53. __vsymtab_end = .;
  54. /* section information for initial. */
  55. . = ALIGN(4);
  56. __rt_init_start = .;
  57. KEEP(*(SORT(.rti_fn*)))
  58. __rt_init_end = .;
  59. . = ALIGN(4);
  60. _etext = .; /* define a global symbols at end of code */
  61. } >FLASH
  62. /* Constant data goes into FLASH */
  63. .rodata :
  64. {
  65. . = ALIGN(4);
  66. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  67. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  68. . = ALIGN(4);
  69. } >FLASH
  70. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  71. .ARM : {
  72. __exidx_start = .;
  73. *(.ARM.exidx*)
  74. __exidx_end = .;
  75. } >FLASH
  76. .preinit_array :
  77. {
  78. PROVIDE_HIDDEN (__preinit_array_start = .);
  79. KEEP (*(.preinit_array*))
  80. PROVIDE_HIDDEN (__preinit_array_end = .);
  81. } >FLASH
  82. .init_array :
  83. {
  84. PROVIDE_HIDDEN (__init_array_start = .);
  85. KEEP (*(SORT(.init_array.*)))
  86. KEEP (*(.init_array*))
  87. PROVIDE_HIDDEN (__init_array_end = .);
  88. } >FLASH
  89. .fini_array :
  90. {
  91. PROVIDE_HIDDEN (__fini_array_start = .);
  92. KEEP (*(SORT(.fini_array.*)))
  93. KEEP (*(.fini_array*))
  94. PROVIDE_HIDDEN (__fini_array_end = .);
  95. } >FLASH
  96. /* used by the startup to initialize data */
  97. _sidata = LOADADDR(.data);
  98. /* Initialized data sections goes into RAM, load LMA copy after code */
  99. .data :
  100. {
  101. . = ALIGN(4);
  102. _sdata = .; /* create a global symbol at data start */
  103. *(.data) /* .data sections */
  104. *(.data*) /* .data* sections */
  105. . = ALIGN(4);
  106. _edata = .; /* define a global symbol at data end */
  107. } >RAM AT> FLASH
  108. /* Uninitialized data section */
  109. . = ALIGN(4);
  110. .bss :
  111. {
  112. /* This is used by the startup in order to initialize the .bss secion */
  113. _sbss = .; /* define a global symbol at bss start */
  114. __bss_start__ = _sbss;
  115. *(.bss)
  116. *(.bss*)
  117. *(COMMON)
  118. . = ALIGN(4);
  119. _ebss = .; /* define a global symbol at bss end */
  120. __bss_end__ = _ebss;
  121. } >RAM
  122. /* User_heap_stack section, used to check that there is enough RAM left */
  123. ._user_heap_stack :
  124. {
  125. . = ALIGN(4);
  126. PROVIDE ( end = . );
  127. PROVIDE ( _end = . );
  128. . = . + _Min_Heap_Size;
  129. . = . + _Min_Stack_Size;
  130. . = ALIGN(4);
  131. } >RAM
  132. /* Remove information from the standard libraries */
  133. /DISCARD/ :
  134. {
  135. libc.a ( * )
  136. libm.a ( * )
  137. libgcc.a ( * )
  138. }
  139. .ARM.attributes 0 : { *(.ARM.attributes) }
  140. }