libucmx_stm32l0.ld 2.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105
  1. /*
  2. * Copyright (C) 2009 Uwe Hermann <uwe@hermann-uwe.de>
  3. *
  4. * This library is free software: you can redistribute it and/or modify
  5. * it under the terms of the GNU Lesser General Public License as published by
  6. * the Free Software Foundation, either version 3 of the License, or
  7. * (at your option) any later version.
  8. *
  9. * This library is distributed in the hope that it will be useful,
  10. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  11. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  12. * GNU Lesser General Public License for more details.
  13. *
  14. * You should have received a copy of the GNU Lesser General Public License
  15. * along with this library. If not, see <http://www.gnu.org/licenses/>.
  16. */
  17. /* Generic linker script for STM32 targets using unicore-mx. */
  18. /* Memory regions must be defined in the ld script which includes this one. */
  19. /* Enforce emmition of the vector table. */
  20. EXTERN (vector_table)
  21. /* Define the entry point of the output file. */
  22. ENTRY(reset_handler)
  23. /* Define sections. */
  24. SECTIONS
  25. {
  26. .text : {
  27. *(.vectors) /* Vector table */
  28. *(.text*) /* Program code */
  29. . = ALIGN(4);
  30. *(.rodata*) /* Read-only data */
  31. . = ALIGN(4);
  32. } >rom
  33. /* C++ Static constructors/destructors, also used for __attribute__
  34. * ((constructor)) and the likes */
  35. .preinit_array : {
  36. . = ALIGN(4);
  37. __preinit_array_start = .;
  38. KEEP (*(.preinit_array))
  39. __preinit_array_end = .;
  40. } >rom
  41. .init_array : {
  42. . = ALIGN(4);
  43. __init_array_start = .;
  44. KEEP (*(SORT(.init_array.*)))
  45. KEEP (*(.init_array))
  46. __init_array_end = .;
  47. } >rom
  48. .fini_array : {
  49. . = ALIGN(4);
  50. __fini_array_start = .;
  51. KEEP (*(.fini_array))
  52. KEEP (*(SORT(.fini_array.*)))
  53. __fini_array_end = .;
  54. } >rom
  55. /*
  56. * Another section used by C++ stuff, appears when using newlib with
  57. * 64bit (long long) printf support
  58. */
  59. .ARM.extab : {
  60. *(.ARM.extab*)
  61. } >rom
  62. .ARM.exidx : {
  63. __exidx_start = .;
  64. *(.ARM.exidx*)
  65. __exidx_end = .;
  66. } >rom
  67. . = ALIGN(4);
  68. _etext = .;
  69. .data : {
  70. _data = .;
  71. *(.data*) /* Read-write initialized data */
  72. . = ALIGN(4);
  73. _edata = .;
  74. } >ram AT >rom
  75. _data_loadaddr = LOADADDR(.data);
  76. .bss : {
  77. _bss = .;
  78. *(.bss*) /* Read-write zero initialized data */
  79. *(COMMON)
  80. . = ALIGN(4);
  81. _ebss = .;
  82. } >ram
  83. /*
  84. * The .eh_frame section appears to be used for C++ exception handling.
  85. * You may need to fix this if you're using C++.
  86. */
  87. /DISCARD/ : { *(.eh_frame) }
  88. . = ALIGN(4);
  89. end = .;
  90. }
  91. PROVIDE(_stack = ORIGIN(ram) + LENGTH(ram));