link.lds 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157
  1. /******************************************************************************
  2. *
  3. * Copyright (C) 2017 Texas Instruments Incorporated - http://www.ti.com/
  4. *
  5. * Redistribution and use in source and binary forms, with or without
  6. * modification, are permitted provided that the following conditions
  7. * are met:
  8. *
  9. * Redistributions of source code must retain the above copyright
  10. * notice, this list of conditions and the following disclaimer.
  11. *
  12. * Redistributions in binary form must reproduce the above copyright
  13. * notice, this list of conditions and the following disclaimer in the
  14. * documentation and/or other materials provided with the
  15. * distribution.
  16. *
  17. * Neither the name of Texas Instruments Incorporated nor the names of
  18. * its contributors may be used to endorse or promote products derived
  19. * from this software without specific prior written permission.
  20. *
  21. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  22. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  23. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR
  24. * A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT
  25. * OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL,
  26. * SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT
  27. * LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE,
  28. * DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY
  29. * THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT
  30. * (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE
  31. * OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
  32. *
  33. *****************************************************************************/
  34. MEMORY
  35. {
  36. FLASH (RX) : ORIGIN = 0x00000000, LENGTH = 0x00100000
  37. SRAM (WX) : ORIGIN = 0x20000000, LENGTH = 0x00040000
  38. }
  39. REGION_ALIAS("REGION_TEXT", FLASH);
  40. REGION_ALIAS("REGION_BSS", SRAM);
  41. REGION_ALIAS("REGION_DATA", SRAM);
  42. REGION_ALIAS("REGION_STACK", SRAM);
  43. REGION_ALIAS("REGION_HEAP", SRAM);
  44. REGION_ALIAS("REGION_ARM_EXIDX", FLASH);
  45. REGION_ALIAS("REGION_ARM_EXTAB", FLASH);
  46. SECTIONS {
  47. /* section for the interrupt vector area */
  48. PROVIDE (_intvecs_base_address =
  49. DEFINED(_intvecs_base_address) ? _intvecs_base_address : 0x0);
  50. .intvecs (_intvecs_base_address) : AT (_intvecs_base_address) {
  51. KEEP (*(.intvecs))
  52. } > REGION_TEXT
  53. PROVIDE (_vtable_base_address =
  54. DEFINED(_vtable_base_address) ? _vtable_base_address : 0x20000000);
  55. .vtable (_vtable_base_address) : AT (_vtable_base_address) {
  56. KEEP (*(.vtable))
  57. } > REGION_DATA
  58. .text : {
  59. CREATE_OBJECT_SYMBOLS
  60. KEEP (*(.text))
  61. *(.text.*)
  62. . = ALIGN(0x4);
  63. KEEP (*(.ctors))
  64. . = ALIGN(0x4);
  65. KEEP (*(.dtors))
  66. . = ALIGN(0x4);
  67. __init_array_start = .;
  68. KEEP (*(.init_array*))
  69. __init_array_end = .;
  70. KEEP (*(.init))
  71. KEEP (*(.fini*))
  72. /* section information for finsh shell */
  73. . = ALIGN(4);
  74. __fsymtab_start = .;
  75. KEEP(*(FSymTab))
  76. __fsymtab_end = .;
  77. . = ALIGN(4);
  78. __vsymtab_start = .;
  79. KEEP(*(VSymTab))
  80. __vsymtab_end = .;
  81. /* section information for initial. */
  82. . = ALIGN(4);
  83. __rt_init_start = .;
  84. KEEP(*(SORT(.rti_fn*)))
  85. __rt_init_end = .;
  86. . = ALIGN(4);
  87. } > REGION_TEXT AT> REGION_TEXT
  88. .rodata : {
  89. *(.rodata)
  90. *(.rodata.*)
  91. } > REGION_TEXT AT> REGION_TEXT
  92. .ARM.exidx : {
  93. __exidx_start = .;
  94. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  95. __exidx_end = .;
  96. } > REGION_ARM_EXIDX AT> REGION_ARM_EXIDX
  97. .ARM.extab : {
  98. KEEP (*(.ARM.extab* .gnu.linkonce.armextab.*))
  99. } > REGION_ARM_EXTAB AT> REGION_ARM_EXTAB
  100. __etext = .;
  101. .data : {
  102. __data_load__ = LOADADDR (.data);
  103. __data_start__ = .;
  104. KEEP (*(.data))
  105. KEEP (*(.data*))
  106. . = ALIGN (4);
  107. __data_end__ = .;
  108. } > REGION_DATA AT> REGION_TEXT
  109. .bss : {
  110. __bss_start__ = .;
  111. *(.shbss)
  112. KEEP (*(.bss))
  113. *(.bss.*)
  114. *(COMMON)
  115. . = ALIGN (4);
  116. __bss_end__ = .;
  117. } > REGION_BSS AT> REGION_BSS
  118. .heap : {
  119. __heap_start__ = .;
  120. end = __heap_start__;
  121. _end = end;
  122. __end = end;
  123. KEEP (*(.heap))
  124. __heap_end__ = .;
  125. __HeapLimit = __heap_end__;
  126. } > REGION_HEAP AT> REGION_HEAP
  127. .stack (NOLOAD) : ALIGN(0x8) {
  128. _stack = .;
  129. KEEP(*(.stack))
  130. } > REGION_STACK AT> REGION_STACK
  131. __StackTop = ORIGIN(REGION_STACK) + LENGTH(REGION_STACK);
  132. PROVIDE(__stack = __StackTop);
  133. __end = .;
  134. }