stm32f1.ld 3.1 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110
  1. /************************************************************************
  2. *
  3. * Copyright (c) 2012-2014 PX4 Development Team. All rights reserved.
  4. * Copyright (c) 2010 libopencm3 project (Uwe Hermann, Stephen Caudle)
  5. *
  6. * This program is free software: you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation, either version 3 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program. If not, see <http://www.gnu.org/licenses/>.
  18. *
  19. * LICENSE NOTE FOR EXTERNAL LIBOPENCM3 LIBRARY:
  20. *
  21. * The PX4 development team considers libopencm3 to be
  22. * still GPL, not LGPL licensed, as it is unclear if
  23. * each and every author agreed to the LGPS -> GPL change.
  24. *
  25. ***********************************************************************/
  26. /**
  27. * @file stm32f1.ld
  28. *
  29. * Linker script for ST STM32F1 bootloader (use first 4K of flash, 8K RAM).
  30. *
  31. * @author Uwe Hermann <uwe@hermann-uwe.de>
  32. * @author Stephen Caudle <scaudle@doceme.com>
  33. */
  34. /* Define memory regions. */
  35. MEMORY
  36. {
  37. rom (rx) : ORIGIN = 0x08000000, LENGTH = 4K
  38. ram (rwx) : ORIGIN = 0x20000000, LENGTH = 8K
  39. }
  40. /* Enforce emmission of the vector table. */
  41. EXTERN (vector_table)
  42. /* Define sections. */
  43. SECTIONS
  44. {
  45. . = ORIGIN(rom);
  46. .text : {
  47. *(.vectors) /* Vector table */
  48. *(.text*) /* Program code */
  49. . = ALIGN(4);
  50. *(.rodata*) /* Read-only data */
  51. . = ALIGN(4);
  52. _etext = .;
  53. } >rom
  54. /* C++ Static constructors/destructors, also used for __attribute__
  55. * ((constructor)) and the likes */
  56. .preinit_array : {
  57. . = ALIGN(4);
  58. __preinit_array_start = .;
  59. KEEP (*(.preinit_array))
  60. __preinit_array_end = .;
  61. } >rom
  62. .init_array : {
  63. . = ALIGN(4);
  64. __init_array_start = .;
  65. KEEP (*(SORT(.init_array.*)))
  66. KEEP (*(.init_array))
  67. __init_array_end = .;
  68. } >rom
  69. .fini_array : {
  70. . = ALIGN(4);
  71. __fini_array_start = .;
  72. KEEP (*(.fini_array))
  73. KEEP (*(SORT(.fini_array.*)))
  74. __fini_array_end = .;
  75. } >rom
  76. . = ORIGIN(ram);
  77. .data : AT(_etext) {
  78. _data = .;
  79. *(.data*) /* Read-write initialized data */
  80. . = ALIGN(4);
  81. _edata = .;
  82. } >ram
  83. _data_loadaddr = LOADADDR(.data);
  84. .bss : {
  85. *(.bss*) /* Read-write zero initialized data */
  86. *(COMMON)
  87. . = ALIGN(4);
  88. _ebss = .;
  89. } >ram AT >rom
  90. /*
  91. * The .eh_frame section appears to be used for C++ exception handling.
  92. * You may need to fix this if you're using C++.
  93. */
  94. /DISCARD/ : { *(.eh_frame) }
  95. . = ALIGN(4);
  96. end = .;
  97. }
  98. PROVIDE(_stack = 0x20002000);