n32wb452_flash.ld 5.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182
  1. /**
  2. ****************************************************************************
  3. Copyright (c) 2019, Nations Technologies Inc.
  4. All rights reserved.
  5. ****************************************************************************
  6. Redistribution and use in source and binary forms, with or without
  7. modification, are permitted provided that the following conditions are met:
  8. - Redistributions of source code must retain the above copyright notice,
  9. this list of conditions and the disclaimer below.
  10. Nations' name may not be used to endorse or promote products derived from
  11. this software without specific prior written permission.
  12. DISCLAIMER: THIS SOFTWARE IS PROVIDED BY NATIONS "AS IS" AND ANY EXPRESS OR
  13. IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF
  14. MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NON-INFRINGEMENT ARE
  15. DISCLAIMED. IN NO EVENT SHALL NATIONS BE LIABLE FOR ANY DIRECT, INDIRECT,
  16. INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  17. LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA,
  18. OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF
  19. LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING
  20. NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE,
  21. EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  22. ****************************************************************************
  23. **/
  24. /* Entry Point */
  25. ENTRY(Reset_Handler)
  26. /* Highest address of the user mode stack */
  27. _estack = 0x20020000; /* end of RAM */
  28. /* Generate a link error if heap and stack don't fit into RAM */
  29. _Min_Heap_Size = 0x200; /* required amount of heap */
  30. _Min_Stack_Size = 0x800; /* required amount of stack */
  31. /* Specify the memory areas */
  32. MEMORY
  33. {
  34. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 512K
  35. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 128K
  36. }
  37. /* Define output sections */
  38. SECTIONS
  39. {
  40. /* The startup code goes first into FLASH */
  41. .isr_vector :
  42. {
  43. . = ALIGN(4);
  44. KEEP(*(.isr_vector)) /* Startup code */
  45. . = ALIGN(4);
  46. } >FLASH
  47. /* The program code and other data goes into FLASH */
  48. .text :
  49. {
  50. . = ALIGN(4);
  51. *(.text) /* .text sections (code) */
  52. *(.text*) /* .text* sections (code) */
  53. *(.glue_7) /* glue arm to thumb code */
  54. *(.glue_7t) /* glue thumb to arm code */
  55. *(.eh_frame)
  56. KEEP (*(.init))
  57. KEEP (*(.fini))
  58. /* section information for finsh shell */
  59. . = ALIGN(4);
  60. __fsymtab_start = .;
  61. KEEP(*(FSymTab))
  62. __fsymtab_end = .;
  63. . = ALIGN(4);
  64. __vsymtab_start = .;
  65. KEEP(*(VSymTab))
  66. __vsymtab_end = .;
  67. /* section information for initial. */
  68. . = ALIGN(4);
  69. __rt_init_start = .;
  70. KEEP(*(SORT(.rti_fn*)))
  71. __rt_init_end = .;
  72. . = ALIGN(4);
  73. _etext = .; /* define a global symbols at end of code */
  74. } >FLASH
  75. /* Constant data goes into FLASH */
  76. .rodata :
  77. {
  78. . = ALIGN(4);
  79. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  80. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  81. . = ALIGN(4);
  82. } >FLASH
  83. .ARM.extab : { *(.ARM.extab* .gnu.linkonce.armextab.*) } >FLASH
  84. .ARM : {
  85. __exidx_start = .;
  86. *(.ARM.exidx*)
  87. __exidx_end = .;
  88. } >FLASH
  89. .preinit_array :
  90. {
  91. PROVIDE_HIDDEN (__preinit_array_start = .);
  92. KEEP (*(.preinit_array*))
  93. PROVIDE_HIDDEN (__preinit_array_end = .);
  94. } >FLASH
  95. .init_array :
  96. {
  97. PROVIDE_HIDDEN (__init_array_start = .);
  98. KEEP (*(SORT(.init_array.*)))
  99. KEEP (*(.init_array*))
  100. PROVIDE_HIDDEN (__init_array_end = .);
  101. } >FLASH
  102. .fini_array :
  103. {
  104. PROVIDE_HIDDEN (__fini_array_start = .);
  105. KEEP (*(SORT(.fini_array.*)))
  106. KEEP (*(.fini_array*))
  107. PROVIDE_HIDDEN (__fini_array_end = .);
  108. } >FLASH
  109. /* used by the startup to initialize data */
  110. _sidata = LOADADDR(.data);
  111. /* Initialized data sections goes into RAM, load LMA copy after code */
  112. .data :
  113. {
  114. . = ALIGN(4);
  115. _sdata = .; /* create a global symbol at data start */
  116. *(.data) /* .data sections */
  117. *(.data*) /* .data* sections */
  118. . = ALIGN(4);
  119. _edata = .; /* define a global symbol at data end */
  120. } >RAM AT> FLASH
  121. /* Uninitialized data section */
  122. . = ALIGN(4);
  123. .bss :
  124. {
  125. /* This is used by the startup in order to initialize the .bss secion */
  126. _sbss = .; /* define a global symbol at bss start */
  127. __bss_start__ = _sbss;
  128. *(.bss)
  129. *(.bss*)
  130. *(COMMON)
  131. . = ALIGN(4);
  132. _ebss = .; /* define a global symbol at bss end */
  133. __bss_end__ = _ebss;
  134. } >RAM
  135. /* User_heap_stack section, used to check that there is enough RAM left */
  136. ._user_heap_stack :
  137. {
  138. . = ALIGN(4);
  139. PROVIDE ( end = . );
  140. PROVIDE ( _end = . );
  141. . = . + _Min_Heap_Size;
  142. . = . + _Min_Stack_Size;
  143. . = ALIGN(4);
  144. } >RAM
  145. /* Remove information from the standard libraries */
  146. /DISCARD/ :
  147. {
  148. libc.a ( * )
  149. libm.a ( * )
  150. libgcc.a ( * )
  151. }
  152. .ARM.attributes 0 : { *(.ARM.attributes) }
  153. }