stm32wb55xx_flash.ld 6.3 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198
  1. /**
  2. *****************************************************************************
  3. **
  4. ** File : stm32wb55xx_flash.ld
  5. **
  6. ** Abstract : System Workbench Minimal System calls file
  7. **
  8. ** For more information about which c-functions
  9. ** need which of these lowlevel functions
  10. ** please consult the Newlib libc-manual
  11. **
  12. ** Environment : System Workbench for MCU
  13. **
  14. ** Distribution: The file is distributed “as is,” without any warranty
  15. ** of any kind.
  16. **
  17. *****************************************************************************
  18. **
  19. ** <h2><center>&copy; COPYRIGHT(c) 2019 Ac6</center></h2>
  20. **
  21. ** Redistribution and use in source and binary forms, with or without modification,
  22. ** are permitted provided that the following conditions are met:
  23. ** 1. Redistributions of source code must retain the above copyright notice,
  24. ** this list of conditions and the following disclaimer.
  25. ** 2. Redistributions in binary form must reproduce the above copyright notice,
  26. ** this list of conditions and the following disclaimer in the documentation
  27. ** and/or other materials provided with the distribution.
  28. ** 3. Neither the name of Ac6 nor the names of its contributors
  29. ** may be used to endorse or promote products derived from this software
  30. ** without specific prior written permission.
  31. **
  32. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  33. ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  34. ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  35. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  36. ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  37. ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  38. ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  39. ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  40. ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  41. ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  42. **
  43. *****************************************************************************
  44. */
  45. /* Entry Point */
  46. ENTRY(Reset_Handler)
  47. /* Highest address of the user mode stack */
  48. _estack = 0x20030000; /* end of RAM */
  49. /* Generate a link error if heap and stack don't fit into RAM */
  50. _Min_Heap_Size = 0x400; /* required amount of heap */
  51. _Min_Stack_Size = 0x1000; /* required amount of stack */
  52. /* Specify the memory areas */
  53. MEMORY
  54. {
  55. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
  56. RAM1 (xrw) : ORIGIN = 0x20000008, LENGTH = 0x2FFF8
  57. RAM2A (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
  58. RAM2B (xrw) : ORIGIN = 0x20038000, LENGTH = 10K
  59. }
  60. /* Define output sections */
  61. SECTIONS
  62. {
  63. /* The startup code goes first into FLASH */
  64. .isr_vector :
  65. {
  66. . = ALIGN(4);
  67. KEEP(*(.isr_vector)) /* Startup code */
  68. . = ALIGN(4);
  69. } >FLASH
  70. /* The program code and other data goes into FLASH */
  71. .text :
  72. {
  73. . = ALIGN(4);
  74. *lib*.a:*(.text .text.*) /* code from libraries before apps */
  75. *(.text) /* .text sections (code) */
  76. *(.text*) /* .text* sections (code) */
  77. *(.glue_7) /* glue arm to thumb code */
  78. *(.glue_7t) /* glue thumb to arm code */
  79. *(.eh_frame)
  80. KEEP (*(.init))
  81. KEEP (*(.fini))
  82. . = ALIGN(4);
  83. _etext = .; /* define a global symbols at end of code */
  84. } >FLASH
  85. /* Constant data goes into FLASH */
  86. .rodata :
  87. {
  88. . = ALIGN(4);
  89. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  90. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  91. . = ALIGN(4);
  92. } >FLASH
  93. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  94. .ARM : {
  95. __exidx_start = .;
  96. *(.ARM.exidx*)
  97. __exidx_end = .;
  98. } >FLASH
  99. .preinit_array :
  100. {
  101. PROVIDE_HIDDEN (__preinit_array_start = .);
  102. KEEP (*(.preinit_array*))
  103. PROVIDE_HIDDEN (__preinit_array_end = .);
  104. } >FLASH
  105. .init_array :
  106. {
  107. PROVIDE_HIDDEN (__init_array_start = .);
  108. KEEP (*(SORT(.init_array.*)))
  109. KEEP (*(.init_array*))
  110. PROVIDE_HIDDEN (__init_array_end = .);
  111. } >FLASH
  112. .fini_array :
  113. {
  114. PROVIDE_HIDDEN (__fini_array_start = .);
  115. KEEP (*(SORT(.fini_array.*)))
  116. KEEP (*(.fini_array*))
  117. PROVIDE_HIDDEN (__fini_array_end = .);
  118. } >FLASH
  119. /* used by the startup to initialize data */
  120. _sidata = LOADADDR(.data);
  121. /* Initialized data sections goes into RAM, load LMA copy after code */
  122. .data :
  123. {
  124. . = ALIGN(4);
  125. _sdata = .; /* create a global symbol at data start */
  126. *(.data) /* .data sections */
  127. *(.data*) /* .data* sections */
  128. *(*_DRIVER_CONTEXT)
  129. . = ALIGN(4);
  130. _edata = .; /* define a global symbol at data end */
  131. } >RAM1 AT> FLASH
  132. /* Uninitialized data section */
  133. . = ALIGN(4);
  134. .bss :
  135. {
  136. /* This is used by the startup in order to initialize the .bss secion */
  137. _sbss = .; /* define a global symbol at bss start */
  138. __bss_start__ = _sbss;
  139. *(.bss)
  140. *(.bss*)
  141. *(COMMON)
  142. . = ALIGN(4);
  143. _ebss = .; /* define a global symbol at bss end */
  144. __bss_end__ = _ebss;
  145. } >RAM1
  146. /* User_heap_stack section, used to check that there is enough RAM left */
  147. /* DSECT: https://software-dl.ti.com/ccs/esd/documents/sdto_cgt_linker_special_section_types.html */
  148. ._user_heap_stack(DSECT):
  149. {
  150. . = ALIGN(8);
  151. __heap_start__ = .;
  152. . = ORIGIN(RAM1) + LENGTH(RAM1) - _Min_Stack_Size;
  153. __heap_end__ = .;
  154. . = . + _Min_Stack_Size;
  155. . = ALIGN(8);
  156. } >RAM1
  157. /* Free Flash space, that can be used for internal storage */
  158. .free_flash(DSECT):
  159. {
  160. __free_flash_start__ = .;
  161. . = ORIGIN(FLASH) + LENGTH(FLASH);
  162. } >FLASH
  163. /* Remove information from the standard libraries */
  164. /DISCARD/ :
  165. {
  166. libc.a ( * )
  167. libm.a ( * )
  168. libgcc.a ( * )
  169. }
  170. .ARM.attributes 0 : { *(.ARM.attributes) }
  171. ._sram2a_start : { . = ALIGN(4); __sram2a_start__ = .; } >RAM2A
  172. MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM2A
  173. MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM2A
  174. MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM2A
  175. ._sram2a_free : { . = ALIGN(4); __sram2a_free__ = .; } >RAM2A
  176. ._sram2b_start : { . = ALIGN(4); __sram2b_start__ = .; } >RAM2B
  177. }