STM32_SEC_FLASH.ld 5.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /*
  2. Common part of the linker scripts for STR71x devices in FLASH mode
  3. (that is, the FLASH is seen at 0)
  4. Copyright RAISONANCE 2005
  5. You can use, modify and distribute thisfile freely, but without any waranty.
  6. */
  7. /* Sections Definitions */
  8. SECTIONS
  9. {
  10. /* for Cortex devices, the beginning of the startup code is stored in the .isr_vector section, which goes to FLASH */
  11. .isr_vector :
  12. {
  13. . = ALIGN(4);
  14. KEEP(*(.isr_vector)) /* Startup code */
  15. . = ALIGN(4);
  16. } >FLASH
  17. /* for some STRx devices, the beginning of the startup code is stored in the .flashtext section, which goes to FLASH */
  18. .flashtext :
  19. {
  20. . = ALIGN(4);
  21. *(.flashtext) /* Startup code */
  22. . = ALIGN(4);
  23. } >FLASH
  24. /* the program code is stored in the .text section, which goes to Flash */
  25. .text :
  26. {
  27. . = ALIGN(4);
  28. *(.text) /* remaining code */
  29. *(.text.*) /* remaining code */
  30. *(.rodata) /* read-only data (constants) */
  31. *(.rodata*)
  32. *(.glue_7)
  33. *(.glue_7t)
  34. . = ALIGN(4);
  35. _etext = .;
  36. /* This is used by the startup in order to initialize the .data secion */
  37. _sidata = _etext;
  38. } >FLASH
  39. /* This is the initialized data section
  40. The program executes knowing that the data is in the RAM
  41. but the loader puts the initial values in the FLASH (inidata).
  42. It is one task of the startup to copy the initial values from FLASH to RAM. */
  43. .data : AT ( _sidata )
  44. {
  45. . = ALIGN(4);
  46. /* This is used by the startup in order to initialize the .data secion */
  47. _sdata = . ;
  48. *(.data)
  49. *(.data.*)
  50. . = ALIGN(4);
  51. /* This is used by the startup in order to initialize the .data secion */
  52. _edata = . ;
  53. } >RAM
  54. /* This is the uninitialized data section */
  55. .bss :
  56. {
  57. . = ALIGN(4);
  58. /* This is used by the startup in order to initialize the .bss secion */
  59. _sbss = .;
  60. *(.bss)
  61. *(COMMON)
  62. . = ALIGN(4);
  63. /* This is used by the startup in order to initialize the .bss secion */
  64. _ebss = . ;
  65. } >RAM
  66. PROVIDE ( end = _ebss );
  67. PROVIDE ( _end = _ebss );
  68. /* This is the user stack section
  69. This is just to check that there is enough RAM left for the User mode stack
  70. It should generate an error if it's full.
  71. */
  72. ._usrstack :
  73. {
  74. . = ALIGN(4);
  75. _susrstack = . ;
  76. . = . + _Minimum_Stack_Size ;
  77. . = ALIGN(4);
  78. _eusrstack = . ;
  79. } >RAM
  80. /* this is the FLASH Bank1 */
  81. /* the C or assembly source must explicitly place the code or data there
  82. using the "section" attribute */
  83. .b1text :
  84. {
  85. *(.b1text) /* remaining code */
  86. *(.b1rodata) /* read-only data (constants) */
  87. *(.b1rodata*)
  88. } >FLASHB1
  89. /* this is the EXTMEM */
  90. /* the C or assembly source must explicitly place the code or data there
  91. using the "section" attribute */
  92. /* EXTMEM Bank0 */
  93. .eb0text :
  94. {
  95. *(.eb0text) /* remaining code */
  96. *(.eb0rodata) /* read-only data (constants) */
  97. *(.eb0rodata*)
  98. } >EXTMEMB0
  99. /* EXTMEM Bank1 */
  100. .eb1text :
  101. {
  102. *(.eb1text) /* remaining code */
  103. *(.eb1rodata) /* read-only data (constants) */
  104. *(.eb1rodata*)
  105. } >EXTMEMB1
  106. /* EXTMEM Bank2 */
  107. .eb2text :
  108. {
  109. *(.eb2text) /* remaining code */
  110. *(.eb2rodata) /* read-only data (constants) */
  111. *(.eb2rodata*)
  112. } >EXTMEMB2
  113. /* EXTMEM Bank0 */
  114. .eb3text :
  115. {
  116. *(.eb3text) /* remaining code */
  117. *(.eb3rodata) /* read-only data (constants) */
  118. *(.eb3rodata*)
  119. } >EXTMEMB3
  120. __exidx_start = .;
  121. __exidx_end = .;
  122. /* after that it's only debugging information. */
  123. /* remove the debugging information from the standard libraries */
  124. /DISCARD/ :
  125. {
  126. libc.a ( * )
  127. libm.a ( * )
  128. libgcc.a ( * )
  129. }
  130. /* Stabs debugging sections. */
  131. .stab 0 : { *(.stab) }
  132. .stabstr 0 : { *(.stabstr) }
  133. .stab.excl 0 : { *(.stab.excl) }
  134. .stab.exclstr 0 : { *(.stab.exclstr) }
  135. .stab.index 0 : { *(.stab.index) }
  136. .stab.indexstr 0 : { *(.stab.indexstr) }
  137. .comment 0 : { *(.comment) }
  138. /* DWARF debug sections.
  139. Symbols in the DWARF debugging sections are relative to the beginning
  140. of the section so we begin them at 0. */
  141. /* DWARF 1 */
  142. .debug 0 : { *(.debug) }
  143. .line 0 : { *(.line) }
  144. /* GNU DWARF 1 extensions */
  145. .debug_srcinfo 0 : { *(.debug_srcinfo) }
  146. .debug_sfnames 0 : { *(.debug_sfnames) }
  147. /* DWARF 1.1 and DWARF 2 */
  148. .debug_aranges 0 : { *(.debug_aranges) }
  149. .debug_pubnames 0 : { *(.debug_pubnames) }
  150. /* DWARF 2 */
  151. .debug_info 0 : { *(.debug_info .gnu.linkonce.wi.*) }
  152. .debug_abbrev 0 : { *(.debug_abbrev) }
  153. .debug_line 0 : { *(.debug_line) }
  154. .debug_frame 0 : { *(.debug_frame) }
  155. .debug_str 0 : { *(.debug_str) }
  156. .debug_loc 0 : { *(.debug_loc) }
  157. .debug_macinfo 0 : { *(.debug_macinfo) }
  158. /* SGI/MIPS DWARF 2 extensions */
  159. .debug_weaknames 0 : { *(.debug_weaknames) }
  160. .debug_funcnames 0 : { *(.debug_funcnames) }
  161. .debug_typenames 0 : { *(.debug_typenames) }
  162. .debug_varnames 0 : { *(.debug_varnames) }
  163. }