spificonfig.ld 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149
  1. /****************************************************************************
  2. * configs/lpc4370-link2/scripts/spificonfig.ld
  3. *
  4. * Copyright (C) 2012 Gregory Nutt. All rights reserved.
  5. * Author: Gregory Nutt <gnutt@nuttx.org>
  6. *
  7. * Redistribution and use in source and binary forms, with or without
  8. * modification, are permitted provided that the following conditions
  9. * are met:
  10. *
  11. * 1. Redistributions of source code must retain the above copyright
  12. * notice, this list of conditions and the following disclaimer.
  13. * 2. Redistributions in binary form must reproduce the above copyright
  14. * notice, this list of conditions and the following disclaimer in
  15. * the documentation and/or other materials provided with the
  16. * distribution.
  17. * 3. Neither the name NuttX nor the names of its contributors may be
  18. * used to endorse or promote products derived from this software
  19. * 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
  24. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  25. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  26. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  27. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  28. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  29. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  30. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  31. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  32. * POSSIBILITY OF SUCH DAMAGE.
  33. *
  34. ****************************************************************************/
  35. /*
  36. * Power-Up Reset Overview
  37. * -----------------------
  38. *
  39. * The ARM core starts executing code on reset with the program counter set
  40. * to 0x0000 0000. The LPC43xx contains a shadow pointer register that
  41. * allows areas of memory to be mapped to address 0x0000 0000. The default,
  42. * reset value of the shadow pointer is 0x1040 0000 so that on reset code in
  43. * the boot ROM is always executed first.
  44. *
  45. * The boot starts after reset is released. The IRC is selected as CPU clock
  46. * and the Cortex-M4 starts the boot loader. By default the JTAG access to the
  47. * chip is disabled at reset. The boot ROM determines the boot mode based on
  48. * the OTP BOOT_SRC value or reset state pins. For flash-based parts, the part
  49. * boots from internal flash by default. Otherwse, the boot ROM copies the
  50. * image to internal SRAM at location 0x1000 0000, sets the ARM's shadow
  51. * pointer to 0x1000 0000, and jumps to that location.
  52. *
  53. * Of course, using JTAG the executable image can be also loaded directly
  54. * into and executed from SRAM.
  55. */
  56. /* The LPC4370 on the LPC4370-Link2 has the following memory resources:
  57. *
  58. * 1. 4096Kb of SPIFI FLASH beginning at address 0x1400:0000
  59. * 2. 264KB of total SRAM:
  60. * a. 128KB of SRAM in the CPU block beginning at address 0x1000:0000
  61. * b. 72KB beginning at address 0x1008:0000 and
  62. * c. 64KB of AHB SRAM in three banks beginning at addresses 0x2000:0000,
  63. * 0x2000:8000 and 0x2000:C000.
  64. * 3. No internal FLASH
  65. *
  66. * Here we assume that:
  67. *
  68. * 1. We will be running out of SPIFI flash at 0x1400:0000, and
  69. * 2. All .data and .bss will all fit into the 128KB CPU SRAM block.
  70. */
  71. MEMORY
  72. {
  73. progmem (rx) : ORIGIN = 0x14000000, LENGTH = 1024K
  74. datamem (rwx) : ORIGIN = 0x10000000, LENGTH = 128K
  75. }
  76. OUTPUT_ARCH(arm)
  77. ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
  78. EXTERN(_vectors) /* Force the vectors to be included in the output */
  79. SECTIONS
  80. {
  81. .text : {
  82. _stext = ABSOLUTE(.);
  83. *(.vectors)
  84. *(EXCLUDE_FILE (*spifilib*) .text .text.*)
  85. *(.fixup)
  86. *(.gnu.warning)
  87. *(EXCLUDE_FILE (*spifilib*) .rodata .rodata.*)
  88. *(.gnu.linkonce.t.*)
  89. *(.glue_7)
  90. *(.glue_7t)
  91. *(.got)
  92. *(.gcc_except_table)
  93. *(.gnu.linkonce.r.*)
  94. _etext = ABSOLUTE(.);
  95. } > progmem
  96. .init_section : {
  97. _sinit = ABSOLUTE(.);
  98. *(.init_array .init_array.*)
  99. _einit = ABSOLUTE(.);
  100. } > progmem
  101. .ARM.extab : {
  102. *(.ARM.extab*)
  103. } > progmem
  104. __exidx_start = ABSOLUTE(.);
  105. .ARM.exidx : {
  106. *(.ARM.exidx*)
  107. } > progmem
  108. __exidx_end = ABSOLUTE(.);
  109. _eronly = ABSOLUTE(.);
  110. .data : {
  111. _sdata = ABSOLUTE(.);
  112. *spifilib*(.text .text.*)
  113. *spifilib*( .rodata .rodata.*)
  114. *(.data .data.*)
  115. *(.gnu.linkonce.d.*)
  116. CONSTRUCTORS
  117. _edata = ABSOLUTE(.);
  118. } > datamem AT > progmem
  119. .bss : { /* BSS */
  120. _sbss = ABSOLUTE(.);
  121. *(.bss .bss.*)
  122. *(.gnu.linkonce.b.*)
  123. *(COMMON)
  124. _ebss = ABSOLUTE(.);
  125. } > datamem
  126. /* Stabs debugging sections. */
  127. .stab 0 : { *(.stab) }
  128. .stabstr 0 : { *(.stabstr) }
  129. .stab.excl 0 : { *(.stab.excl) }
  130. .stab.exclstr 0 : { *(.stab.exclstr) }
  131. .stab.index 0 : { *(.stab.index) }
  132. .stab.indexstr 0 : { *(.stab.indexstr) }
  133. .comment 0 : { *(.comment) }
  134. .debug_abbrev 0 : { *(.debug_abbrev) }
  135. .debug_info 0 : { *(.debug_info) }
  136. .debug_line 0 : { *(.debug_line) }
  137. .debug_pubnames 0 : { *(.debug_pubnames) }
  138. .debug_aranges 0 : { *(.debug_aranges) }
  139. }