ramconfig.ld 5.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150
  1. /****************************************************************************
  2. * configs/lpc4370-link2/scripts/ramconfig.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. * However, using JTAG the executable image can be also loaded directly into
  54. * and executed from SRAM.
  55. */
  56. /* The LPC4330 on the LPC4330-Xplorer 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 SRAM at 0x1000:0000, and
  69. * 2. All .data and .bss will all fit into the 72KB SRAM block.
  70. *
  71. * NOTE: That initialized data is kept in the program memory SRAM and copied
  72. * to .data SRAM. This is wasteful and unnecessary but provides a good test
  73. * for future, FLASH-resident code.
  74. */
  75. MEMORY
  76. {
  77. progmem (rx) : ORIGIN = 0x10000000, LENGTH = 128K
  78. datamem (rwx) : ORIGIN = 0x10080000, LENGTH = 72K
  79. }
  80. OUTPUT_ARCH(arm)
  81. ENTRY(__start) /* Treat __start as the anchor for dead code stripping */
  82. EXTERN(_vectors) /* Force the vectors to be included in the output */
  83. SECTIONS
  84. {
  85. .text : {
  86. _stext = ABSOLUTE(.);
  87. *(.vectors)
  88. *(.text .text.*)
  89. *(.fixup)
  90. *(.gnu.warning)
  91. *(.rodata .rodata.*)
  92. *(.gnu.linkonce.t.*)
  93. *(.glue_7)
  94. *(.glue_7t)
  95. *(.got)
  96. *(.gcc_except_table)
  97. *(.gnu.linkonce.r.*)
  98. _etext = ABSOLUTE(.);
  99. } > progmem
  100. .init_section : {
  101. _sinit = ABSOLUTE(.);
  102. *(.init_array .init_array.*)
  103. _einit = ABSOLUTE(.);
  104. } > progmem
  105. .ARM.extab : {
  106. *(.ARM.extab*)
  107. } > progmem
  108. __exidx_start = ABSOLUTE(.);
  109. .ARM.exidx : {
  110. *(.ARM.exidx*)
  111. } > progmem
  112. __exidx_end = ABSOLUTE(.);
  113. _eronly = ABSOLUTE(.);
  114. .data : {
  115. _sdata = ABSOLUTE(.);
  116. *(.data .data.*)
  117. *(.gnu.linkonce.d.*)
  118. CONSTRUCTORS
  119. _edata = ABSOLUTE(.);
  120. } > datamem AT > progmem
  121. .bss : { /* BSS */
  122. _sbss = ABSOLUTE(.);
  123. *(.bss .bss.*)
  124. *(.gnu.linkonce.b.*)
  125. *(COMMON)
  126. _ebss = ABSOLUTE(.);
  127. } > datamem
  128. /* Stabs debugging sections. */
  129. .stab 0 : { *(.stab) }
  130. .stabstr 0 : { *(.stabstr) }
  131. .stab.excl 0 : { *(.stab.excl) }
  132. .stab.exclstr 0 : { *(.stab.exclstr) }
  133. .stab.index 0 : { *(.stab.index) }
  134. .stab.indexstr 0 : { *(.stab.indexstr) }
  135. .comment 0 : { *(.comment) }
  136. .debug_abbrev 0 : { *(.debug_abbrev) }
  137. .debug_info 0 : { *(.debug_info) }
  138. .debug_line 0 : { *(.debug_line) }
  139. .debug_pubnames 0 : { *(.debug_pubnames) }
  140. .debug_aranges 0 : { *(.debug_aranges) }
  141. }