Implement a secure ICS protocol targeting LoRa Node151 microcontroller for controlling irrigation.
You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
 
 
 
 
 
 

217 lines
6.1 KiB

  1. /*
  2. ******************************************************************************
  3. **
  4. ** File : LinkerScript.ld
  5. **
  6. XXXX
  7. ** Set heap size, stack size and stack location according
  8. ** to application requirements.
  9. **
  10. ** Set memory bank area and size if external memory is used.
  11. **
  12. ** Target : STMicroelectronics STM32
  13. **
  14. ** Distribution: The file is distributed as is without any warranty
  15. ** of any kind.
  16. **
  17. *****************************************************************************
  18. ** @attention
  19. **
  20. ** <h2><center>&copy; COPYRIGHT(c) 2020 STMicroelectronics</center></h2>
  21. **
  22. ** Redistribution and use in source and binary forms, with or without modification,
  23. ** are permitted provided that the following conditions are met:
  24. ** 1. Redistributions of source code must retain the above copyright notice,
  25. ** this list of conditions and the following disclaimer.
  26. ** 2. Redistributions in binary form must reproduce the above copyright notice,
  27. ** this list of conditions and the following disclaimer in the documentation
  28. ** and/or other materials provided with the distribution.
  29. ** 3. Neither the name of STMicroelectronics nor the names of its contributors
  30. ** may be used to endorse or promote products derived from this software
  31. ** without specific prior written permission.
  32. **
  33. ** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
  34. ** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
  35. ** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE
  36. ** DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE
  37. ** FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL
  38. ** DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR
  39. ** SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER
  40. ** CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  41. ** OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  42. ** OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  43. **
  44. *****************************************************************************
  45. */
  46. /* Entry Point */
  47. ENTRY(Reset_Handler)
  48. /* Highest address of the user mode stack */
  49. _estack = ORIGIN(RAM) + LENGTH(RAM); /* end of "RAM" Ram type memory */
  50. _Min_Heap_Size = 0x200 ; /* required amount of heap */
  51. _Min_Stack_Size = 0x400 ; /* required amount of stack */
  52. _flash_page_size = 0x400 ; /* size of a flash page */
  53. /* Memories definition */
  54. MEMORY
  55. {
  56. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 20K
  57. FLASH (rx) : ORIGIN = 0x8000000, LENGTH = 64K
  58. }
  59. /* Sections */
  60. SECTIONS
  61. {
  62. /* The startup code into "FLASH" Rom type memory */
  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 into "FLASH" Rom type memory */
  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 into "FLASH" Rom type memory */
  84. .rodata :
  85. {
  86. . = ALIGN(4);
  87. *(.rodata) /* .rodata sections (constants, strings, etc.) */
  88. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  89. . = ALIGN(4);
  90. __start_set_sysinit_set = .;
  91. KEEP(*(set_sysinit_set)) /* sysinit linker sets */
  92. __stop_set_sysinit_set = .;
  93. } >FLASH
  94. .ARM.extab : {
  95. . = ALIGN(4);
  96. *(.ARM.extab* .gnu.linkonce.armextab.*)
  97. . = ALIGN(4);
  98. } >FLASH
  99. .ARM : {
  100. . = ALIGN(4);
  101. __exidx_start = .;
  102. *(.ARM.exidx*)
  103. __exidx_end = .;
  104. . = ALIGN(4);
  105. } >FLASH
  106. .preinit_array :
  107. {
  108. . = ALIGN(4);
  109. PROVIDE_HIDDEN (__preinit_array_start = .);
  110. KEEP (*(.preinit_array*))
  111. PROVIDE_HIDDEN (__preinit_array_end = .);
  112. . = ALIGN(4);
  113. } >FLASH
  114. .init_array :
  115. {
  116. . = ALIGN(4);
  117. PROVIDE_HIDDEN (__init_array_start = .);
  118. KEEP (*(SORT(.init_array.*)))
  119. KEEP (*(.init_array*))
  120. PROVIDE_HIDDEN (__init_array_end = .);
  121. . = ALIGN(4);
  122. } >FLASH
  123. .fini_array :
  124. {
  125. . = ALIGN(4);
  126. PROVIDE_HIDDEN (__fini_array_start = .);
  127. KEEP (*(SORT(.fini_array.*)))
  128. KEEP (*(.fini_array*))
  129. PROVIDE_HIDDEN (__fini_array_end = .);
  130. . = ALIGN(4);
  131. } >FLASH
  132. /* Used by the startup to initialize data */
  133. _sidata = LOADADDR(.data);
  134. /* Initialized data sections into "RAM" Ram type memory */
  135. .data :
  136. {
  137. . = ALIGN(4);
  138. _sdata = .; /* create a global symbol at data start */
  139. *(.data) /* .data sections */
  140. *(.data*) /* .data* sections */
  141. . = ALIGN(4);
  142. _edata = .; /* define a global symbol at data end */
  143. } >RAM AT> FLASH
  144. .savestate :
  145. {
  146. . = ALIGN(_flash_page_size);
  147. *(.savestate) /* save state */
  148. . = ALIGN(_flash_page_size);
  149. } >FLASH
  150. .savekeys :
  151. {
  152. . = ALIGN(_flash_page_size);
  153. *(.savekeys) /* save keys */
  154. . = ALIGN(_flash_page_size);
  155. } >FLASH
  156. /* Uninitialized data section into "RAM" Ram type memory */
  157. . = ALIGN(4);
  158. .bss :
  159. {
  160. /* This is used by the startup in order to initialize the .bss section */
  161. _sbss = .; /* define a global symbol at bss start */
  162. __bss_start__ = _sbss;
  163. *(.bss)
  164. *(.bss*)
  165. *(COMMON)
  166. . = ALIGN(4);
  167. _ebss = .; /* define a global symbol at bss end */
  168. __bss_end__ = _ebss;
  169. } >RAM
  170. /* User_heap_stack section, used to check that there is enough "RAM" Ram type memory left */
  171. ._user_heap_stack :
  172. {
  173. . = ALIGN(8);
  174. PROVIDE ( end = . );
  175. PROVIDE ( _end = . );
  176. . = . + _Min_Heap_Size;
  177. . = . + _Min_Stack_Size;
  178. . = ALIGN(8);
  179. } >RAM
  180. /* Remove information from the compiler libraries */
  181. /DISCARD/ :
  182. {
  183. libc.a ( * )
  184. libm.a ( * )
  185. libgcc.a ( * )
  186. }
  187. .ARM.attributes 0 : { *(.ARM.attributes) }
  188. }