stm32_generic.ld 1.6 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677
  1. /*
  2. GNU linker script for generic STM32xxx MCU
  3. */
  4. /* Specify the memory areas */
  5. MEMORY
  6. {
  7. FLASH_BL (rx) : ORIGIN = 0x08000000, LENGTH = 16K /* sector 0 (can be 32K) */
  8. RAM (xrw) : ORIGIN = 0x20000000, LENGTH = 32K
  9. }
  10. /* produce a link error if there is not this amount of RAM for these sections */
  11. _minimum_stack_size = 2K;
  12. /* Define tho top end of the stack. The stack is full descending so begins just
  13. above last byte of RAM. Note that EABI requires the stack to be 8-byte
  14. aligned for a call. */
  15. _estack = ORIGIN(RAM) + LENGTH(RAM);
  16. ENTRY(Reset_Handler)
  17. SECTIONS
  18. {
  19. /* The startup code goes first into FLASH */
  20. .isr_vector :
  21. {
  22. . = ALIGN(4);
  23. KEEP(*(.isr_vector)) /* Startup code */
  24. . = ALIGN(4);
  25. } >FLASH_BL
  26. /* The program code and other data goes into FLASH */
  27. .text :
  28. {
  29. . = ALIGN(4);
  30. *(.text*)
  31. *(.rodata*)
  32. . = ALIGN(4);
  33. _etext = .;
  34. } >FLASH_BL
  35. /* used by the startup to initialize data */
  36. _sidata = LOADADDR(.data);
  37. /* Initialized data section */
  38. .data :
  39. {
  40. . = ALIGN(4);
  41. _sdata = .;
  42. *(.data*)
  43. . = ALIGN(4);
  44. _edata = .;
  45. } >RAM AT> FLASH_BL
  46. /* Uninitialized data section */
  47. .bss :
  48. {
  49. . = ALIGN(4);
  50. _sbss = .;
  51. *(.bss*)
  52. *(COMMON)
  53. . = ALIGN(4);
  54. _ebss = .;
  55. } >RAM
  56. /* this just checks there is enough RAM for the stack */
  57. .stack :
  58. {
  59. . = ALIGN(4);
  60. . = . + _minimum_stack_size;
  61. . = ALIGN(4);
  62. } >RAM
  63. .ARM.attributes 0 : { *(.ARM.attributes) }
  64. }