stm32wb55xx_ram_fw.ld 6.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196
  1. /**
  2. *****************************************************************************
  3. **
  4. ** File : stm32wb55xx_flash_cm4.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 = 0x20000000, LENGTH = 0x30000
  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. } >RAM1
  70. /* The program code and other data goes into FLASH */
  71. .text :
  72. {
  73. . = ALIGN(4);
  74. *(.text) /* .text sections (code) */
  75. *(.text*) /* .text* sections (code) */
  76. *(.glue_7) /* glue arm to thumb code */
  77. *(.glue_7t) /* glue thumb to arm code */
  78. *(.eh_frame)
  79. KEEP (*(.init))
  80. KEEP (*(.fini))
  81. . = ALIGN(4);
  82. _etext = .; /* define a global symbols at end of code */
  83. } >RAM1
  84. /* Constant data goes into FLASH */
  85. .rodata :
  86. {
  87. . = ALIGN(4);
  88. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  89. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  90. . = ALIGN(4);
  91. } >RAM1
  92. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  93. .ARM : {
  94. __exidx_start = .;
  95. *(.ARM.exidx*)
  96. __exidx_end = .;
  97. } >RAM1
  98. .preinit_array :
  99. {
  100. PROVIDE_HIDDEN (__preinit_array_start = .);
  101. KEEP (*(.preinit_array*))
  102. PROVIDE_HIDDEN (__preinit_array_end = .);
  103. } >RAM1
  104. .init_array :
  105. {
  106. PROVIDE_HIDDEN (__init_array_start = .);
  107. KEEP (*(SORT(.init_array.*)))
  108. KEEP (*(.init_array*))
  109. PROVIDE_HIDDEN (__init_array_end = .);
  110. } >RAM1
  111. .fini_array :
  112. {
  113. PROVIDE_HIDDEN (__fini_array_start = .);
  114. KEEP (*(SORT(.fini_array.*)))
  115. KEEP (*(.fini_array*))
  116. PROVIDE_HIDDEN (__fini_array_end = .);
  117. } >RAM1
  118. /* used by the startup to initialize data */
  119. _sidata = LOADADDR(.data);
  120. /* Initialized data sections goes into RAM, load LMA copy after code */
  121. .data :
  122. {
  123. . = ALIGN(4);
  124. _sdata = .; /* create a global symbol at data start */
  125. *(.data) /* .data sections */
  126. *(.data*) /* .data* sections */
  127. . = ALIGN(4);
  128. _edata = .; /* define a global symbol at data end */
  129. } >RAM1 AT> RAM1
  130. /* Uninitialized data section */
  131. . = ALIGN(4);
  132. .bss :
  133. {
  134. /* This is used by the startup in order to initialize the .bss secion */
  135. _sbss = .; /* define a global symbol at bss start */
  136. __bss_start__ = _sbss;
  137. *(.bss)
  138. *(.bss*)
  139. *(COMMON)
  140. . = ALIGN(4);
  141. _ebss = .; /* define a global symbol at bss end */
  142. __bss_end__ = _ebss;
  143. } >RAM1
  144. /* User_heap_stack section, used to check that there is enough RAM left */
  145. ._user_heap_stack(DSECT) :
  146. {
  147. . = ALIGN(8);
  148. __heap_start__ = .;
  149. . = ORIGIN(RAM1) + LENGTH(RAM1) - _Min_Stack_Size;
  150. __heap_end__ = .;
  151. . = . + _Min_Stack_Size;
  152. . = ALIGN(8);
  153. } >RAM1
  154. /* Free Flash space, that can be used for internal storage */
  155. /*.free_flash(DSECT):
  156. {
  157. __free_flash_start__ = .;
  158. . = ORIGIN(FLASH) + LENGTH(FLASH);
  159. } >FLASH*/
  160. /* Remove information from the standard libraries */
  161. /DISCARD/ :
  162. {
  163. libc.a ( * )
  164. libm.a ( * )
  165. libgcc.a ( * )
  166. }
  167. .ARM.attributes 0 : { *(.ARM.attributes) }
  168. ._sram2a_start : { . = ALIGN(4); __sram2a_start__ = .; } >RAM2A
  169. MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM2A
  170. MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM2A
  171. MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM2A
  172. ._sram2a_free : { . = ALIGN(4); __sram2a_free__ = .; } >RAM2A
  173. ._sram2b_start : { . = ALIGN(4); __sram2b_start__ = .; } >RAM2B
  174. }