stm32wb55xx_flash_cm4.ld 5.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187
  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 = 0x200; /* required amount of heap */
  51. _Min_Stack_Size = 0x400; /* required amount of stack */
  52. /* Specify the memory areas */
  53. MEMORY
  54. {
  55. FLASH (rx) : ORIGIN = 0x08000000, LENGTH = 32K
  56. RAM1 (xrw) : ORIGIN = 0x20000008, LENGTH = 0x2FFF8
  57. RAM_SHARED (xrw) : ORIGIN = 0x20030000, LENGTH = 10K
  58. }
  59. /* Define output sections */
  60. SECTIONS
  61. {
  62. /* The startup code goes first into FLASH */
  63. .isr_vector :
  64. {
  65. . = ALIGN(4);
  66. KEEP(*(.isr_vector)) /* Startup code */
  67. . = ALIGN(4);
  68. } >FLASH
  69. /* The program code and other data goes into FLASH */
  70. .text :
  71. {
  72. . = ALIGN(4);
  73. *(.text) /* .text sections (code) */
  74. *(.text*) /* .text* sections (code) */
  75. *(.glue_7) /* glue arm to thumb code */
  76. *(.glue_7t) /* glue thumb to arm code */
  77. *(.eh_frame)
  78. KEEP (*(.init))
  79. KEEP (*(.fini))
  80. . = ALIGN(4);
  81. _etext = .; /* define a global symbols at end of code */
  82. } >FLASH
  83. /* Constant data goes into FLASH */
  84. .rodata :
  85. {
  86. . = ALIGN(4);
  87. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  88. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  89. . = ALIGN(4);
  90. } >FLASH
  91. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  92. .ARM : {
  93. __exidx_start = .;
  94. *(.ARM.exidx*)
  95. __exidx_end = .;
  96. } >FLASH
  97. .preinit_array :
  98. {
  99. PROVIDE_HIDDEN (__preinit_array_start = .);
  100. KEEP (*(.preinit_array*))
  101. PROVIDE_HIDDEN (__preinit_array_end = .);
  102. } >FLASH
  103. .init_array :
  104. {
  105. PROVIDE_HIDDEN (__init_array_start = .);
  106. KEEP (*(SORT(.init_array.*)))
  107. KEEP (*(.init_array*))
  108. PROVIDE_HIDDEN (__init_array_end = .);
  109. } >FLASH
  110. .fini_array :
  111. {
  112. PROVIDE_HIDDEN (__fini_array_start = .);
  113. KEEP (*(SORT(.fini_array.*)))
  114. KEEP (*(.fini_array*))
  115. PROVIDE_HIDDEN (__fini_array_end = .);
  116. } >FLASH
  117. /* used by the startup to initialize data */
  118. _sidata = LOADADDR(.data);
  119. /* Initialized data sections goes into RAM, load LMA copy after code */
  120. .data :
  121. {
  122. . = ALIGN(4);
  123. _sdata = .; /* create a global symbol at data start */
  124. *(.data) /* .data sections */
  125. *(.data*) /* .data* sections */
  126. . = ALIGN(4);
  127. _edata = .; /* define a global symbol at data end */
  128. } >RAM1 AT> FLASH
  129. /* Uninitialized data section */
  130. . = ALIGN(4);
  131. .bss :
  132. {
  133. /* This is used by the startup in order to initialize the .bss secion */
  134. _sbss = .; /* define a global symbol at bss start */
  135. __bss_start__ = _sbss;
  136. *(.bss)
  137. *(.bss*)
  138. *(COMMON)
  139. . = ALIGN(4);
  140. _ebss = .; /* define a global symbol at bss end */
  141. __bss_end__ = _ebss;
  142. } >RAM1
  143. /* User_heap_stack section, used to check that there is enough RAM left */
  144. ._user_heap_stack :
  145. {
  146. . = ALIGN(8);
  147. PROVIDE ( end = . );
  148. PROVIDE ( _end = . );
  149. . = . + _Min_Heap_Size;
  150. . = . + _Min_Stack_Size;
  151. . = ALIGN(8);
  152. } >RAM1
  153. /* Remove information from the standard libraries */
  154. /DISCARD/ :
  155. {
  156. libc.a ( * )
  157. libm.a ( * )
  158. libgcc.a ( * )
  159. }
  160. .ARM.attributes 0 : { *(.ARM.attributes) }
  161. MAPPING_TABLE (NOLOAD) : { *(MAPPING_TABLE) } >RAM_SHARED
  162. MB_MEM1 (NOLOAD) : { *(MB_MEM1) } >RAM_SHARED
  163. MB_MEM2 (NOLOAD) : { _sMB_MEM2 = . ; *(MB_MEM2) ; _eMB_MEM2 = . ; } >RAM_SHARED
  164. }