stm32l476-mdk.ld 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125
  1. /****************************************************************************
  2. * configs/stm32l476-mdk/scripts/stm32l476-mdk.ld
  3. *
  4. * Copyright (C) 2016, 2017 Gregory Nutt. All rights reserved.
  5. * Author: Gregory Nutt <gnutt@nuttx.org>
  6. * Sebastien Lorquet <sebastien@lorquet.fr>
  7. * dev@ziggurat29.com
  8. *
  9. * Redistribution and use in source and binary forms, with or without
  10. * modification, are permitted provided that the following conditions
  11. * are met:
  12. *
  13. * 1. Redistributions of source code must retain the above copyright
  14. * notice, this list of conditions and the following disclaimer.
  15. * 2. Redistributions in binary form must reproduce the above copyright
  16. * notice, this list of conditions and the following disclaimer in
  17. * the documentation and/or other materials provided with the
  18. * distribution.
  19. * 3. Neither the name NuttX nor the names of its contributors may be
  20. * used to endorse or promote products derived from this software
  21. * without specific prior written permission.
  22. *
  23. * THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS
  24. * "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT
  25. * LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS
  26. * FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE
  27. * COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT,
  28. * INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING,
  29. * BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS
  30. * OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED
  31. * AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT
  32. * LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN
  33. * ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
  34. * POSSIBILITY OF SUCH DAMAGE.
  35. *
  36. ****************************************************************************/
  37. /* The STM32L476VG has 1024Kb of FLASH beginning at address 0x0800:0000,
  38. * 96Kb of SRAM beginning at address 0x2000:0000, and 32Kb of SRAM2 beginning
  39. * at address 0x1000:0000. The SRAM2 has special properties (e.g. parity
  40. * check, separate power domain for retention in low power modes, write
  41. * protection). Alas, it is non-contiguous with main SRAM.
  42. * When booting from FLASH,
  43. * FLASH memory is aliased to address 0x0000:0000 where the code expects to
  44. * begin execution by jumping to the entry point in the 0x0800:0000 address
  45. * range.
  46. */
  47. MEMORY
  48. {
  49. flash (rx) : ORIGIN = 0x08000000, LENGTH = 1024K
  50. sram (rwx) : ORIGIN = 0x20000000, LENGTH = 96K
  51. sram2 (rwx) : ORIGIN = 0x10000000, LENGTH = 32K
  52. }
  53. OUTPUT_ARCH(arm)
  54. ENTRY(_stext)
  55. SECTIONS
  56. {
  57. .text : {
  58. _stext = ABSOLUTE(.);
  59. *(.vectors)
  60. *(.text .text.*)
  61. *(.fixup)
  62. *(.gnu.warning)
  63. *(.rodata .rodata.*)
  64. *(.gnu.linkonce.t.*)
  65. *(.glue_7)
  66. *(.glue_7t)
  67. *(.got)
  68. *(.gcc_except_table)
  69. *(.gnu.linkonce.r.*)
  70. _etext = ABSOLUTE(.);
  71. } > flash
  72. .init_section : {
  73. _sinit = ABSOLUTE(.);
  74. *(.init_array .init_array.*)
  75. _einit = ABSOLUTE(.);
  76. } > flash
  77. .ARM.extab : {
  78. *(.ARM.extab*)
  79. } > flash
  80. __exidx_start = ABSOLUTE(.);
  81. .ARM.exidx : {
  82. *(.ARM.exidx*)
  83. } > flash
  84. __exidx_end = ABSOLUTE(.);
  85. _eronly = ABSOLUTE(.);
  86. /* The STM32L476RG has 96Kb of SRAM beginning at the following address */
  87. .data : {
  88. _sdata = ABSOLUTE(.);
  89. *(.data .data.*)
  90. *(.gnu.linkonce.d.*)
  91. CONSTRUCTORS
  92. _edata = ABSOLUTE(.);
  93. } > sram AT > flash
  94. .bss : {
  95. _sbss = ABSOLUTE(.);
  96. *(.bss .bss.*)
  97. *(.gnu.linkonce.b.*)
  98. *(COMMON)
  99. _ebss = ABSOLUTE(.);
  100. } > sram
  101. /* Stabs debugging sections. */
  102. .stab 0 : { *(.stab) }
  103. .stabstr 0 : { *(.stabstr) }
  104. .stab.excl 0 : { *(.stab.excl) }
  105. .stab.exclstr 0 : { *(.stab.exclstr) }
  106. .stab.index 0 : { *(.stab.index) }
  107. .stab.indexstr 0 : { *(.stab.indexstr) }
  108. .comment 0 : { *(.comment) }
  109. .debug_abbrev 0 : { *(.debug_abbrev) }
  110. .debug_info 0 : { *(.debug_info) }
  111. .debug_line 0 : { *(.debug_line) }
  112. .debug_pubnames 0 : { *(.debug_pubnames) }
  113. .debug_aranges 0 : { *(.debug_aranges) }
  114. }