sections.ld 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141
  1. /*
  2. * Copyright 2012 by Embedded Technologies s.r.o
  3. *
  4. * Redistribution and use in source and binary forms, with or without
  5. * modification, are permitted provided that the following conditions
  6. * are met:
  7. *
  8. * 1. Redistributions of source code must retain the above copyright
  9. * notice, this list of conditions and the following disclaimer.
  10. * 2. Redistributions in binary form must reproduce the above copyright
  11. * notice, this list of conditions and the following disclaimer in the
  12. * documentation and/or other materials provided with the distribution.
  13. * 3. Neither the name of the copyright holders nor the names of
  14. * contributors may be used to endorse or promote products derived
  15. * from this software without specific prior written permission.
  16. *
  17. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  18. * ``AS IS'' AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  19. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  20. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  21. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  22. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  23. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  24. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  25. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY,
  26. * OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF
  27. * THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF
  28. * SUCH DAMAGE.
  29. *
  30. * For additional information see http://www.ethernut.de/
  31. */
  32. SECTIONS
  33. {
  34. .text :
  35. {
  36. PROVIDE (__vectors_start = .) ;
  37. KEEP(*(.vectors))
  38. /* Emit a CFM Key */
  39. . = __flashbar + 0x400;
  40. LONG (0x01234567) /* Backdoor Key */
  41. LONG (0x89abcdef) /* Backdoor Key */
  42. LONG (0xffffffff) /* Sector Protection */
  43. LONG (0x00000000) /* Supervisor Access */
  44. LONG (0x00000000) /* Data Access */
  45. LONG (0xffffffff) /* Security Word */
  46. KEEP(*(.init0)) /* Basic CPU initialization (family dependant code). */
  47. KEEP(*(.init1))
  48. KEEP(*(.init2)) /* Set up stack pointer. */
  49. KEEP(*(.init3))
  50. KEEP(*(.init4)) /* External Memories initialization (board dependant code). */
  51. KEEP(*(.init5))
  52. KEEP(*(.init6)) /* Initialize memory regions */
  53. KEEP(*(.init7))
  54. KEEP(*(.init8)) /* Relocate vectors, Enable interrupts */
  55. KEEP(*(.init9))
  56. KEEP(*(.init10)) /* CPU and Peripherals Initialization (family dependant code). */
  57. KEEP(*(.init11))
  58. KEEP(*(.init12)) /* C++ constructors (NOT implemented yet). */
  59. KEEP(*(.init13))
  60. KEEP(*(.init14)) /* Enter Nut/OS Initialization. */
  61. *(.text)
  62. *(.text.*)
  63. *(.gnu.linkonce.t.* .gcc_except_table .gcc_except_table.*)
  64. /* following table is used in InitRegions() */
  65. . = ALIGN(4);
  66. PROVIDE (__regions_start = .) ;
  67. LONG (__dataint_start)
  68. LONG (__dataint_size)
  69. LONG (__dataint_load_start)
  70. LONG (__data_start)
  71. LONG (__data_size)
  72. LONG (__data_load_start)
  73. LONG (__bssint_start)
  74. LONG (__bssint_size)
  75. LONG (__bssint_start) /* No init data */
  76. LONG (__bss_start)
  77. LONG (__bss_size)
  78. LONG (__bss_start) /* No init data */
  79. PROVIDE (__regions_end = .);
  80. } > REGION_TEXT AT > REGION_LOAD
  81. .rodata : ALIGN (4)
  82. {
  83. *(.rodata)
  84. *(.rodata.*)
  85. *(.gnu.linkonce.r.*)
  86. } > REGION_RODATA AT > REGION_LOAD
  87. .dataint : ALIGN(4)
  88. {
  89. PROVIDE (__dataint_start = .) ;
  90. *(.dataint)
  91. *(.dataint.*)
  92. . = ALIGN(4);
  93. PROVIDE (__dataint_end = .) ;
  94. } > REGION_DATA_INT AT > REGION_LOAD
  95. PROVIDE (__dataint_size = SIZEOF(.dataint));
  96. PROVIDE (__dataint_load_start = LOADADDR(.dataint));
  97. .bssint : ALIGN (4)
  98. {
  99. PROVIDE (__bssint_start = .) ;
  100. *(.bssint)
  101. *(.bssint.*)
  102. PROVIDE (__bssint_end = .) ;
  103. } > REGION_BSS_INT AT > REGION_LOAD
  104. PROVIDE (__bssint_size = SIZEOF(.bssint));
  105. .data : ALIGN(4)
  106. {
  107. PROVIDE (__data_start = .) ;
  108. *(.data)
  109. *(.data.*)
  110. *(.gnu.linkonce.d.*)
  111. . = ALIGN(4);
  112. PROVIDE (__data_end = .) ;
  113. } > REGION_DATA AT > REGION_LOAD
  114. PROVIDE (__data_size = SIZEOF(.data));
  115. PROVIDE (__data_load_start = LOADADDR(.data));
  116. .bss : ALIGN (4)
  117. {
  118. PROVIDE (__bss_start = .) ;
  119. *(.bss)
  120. *(.bss.*)
  121. *(.gnu.linkonce.b.*)
  122. *(COMMON)
  123. PROVIDE (__bss_end = .) ;
  124. } > REGION_BSS AT > REGION_LOAD
  125. PROVIDE (__bss_size = SIZEOF(.bss));
  126. }