stm32.ld.S 1.4 KB

1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556575859606162636465666768697071727374757677787980818283
  1. ENTRY(vector_table)
  2. MEMORY
  3. {
  4. FLASH (rx) : ORIGIN = FLASH_BASE, LENGTH = FLASH_LEN
  5. #if MCU == STM32F1
  6. RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
  7. #elif MCU == STM32F7
  8. RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 64K
  9. EXT_RAM (rwx) : ORIGIN = 0x20010000, LENGTH = 64K /* 192K - U_BUF_SZ */
  10. #elif MCU == AT32F4
  11. RAM (rwx) : ORIGIN = 0x20000000, LENGTH = 32K
  12. #endif
  13. }
  14. SECTIONS
  15. {
  16. .text : {
  17. _stext = .;
  18. *(.vector_table)
  19. *(.text)
  20. *(.text*)
  21. *(.rodata)
  22. *(.rodata*)
  23. KEEP (*(.init))
  24. KEEP (*(.fini))
  25. . = ALIGN(4);
  26. _etext = .;
  27. } >FLASH
  28. #if MCU == STM32F1 || MCU == AT32F4
  29. .flags : {
  30. _reset_flag = .;
  31. . = . + 4;
  32. } >RAM
  33. #endif
  34. .data : AT (_etext) {
  35. . = ALIGN(4);
  36. _sdat = .;
  37. *(.data)
  38. *(.data*)
  39. . = ALIGN(4);
  40. _edat = .;
  41. _ldat = LOADADDR(.data);
  42. } >RAM
  43. .bss : {
  44. . = ALIGN(8);
  45. _irq_stackbottom = .;
  46. . = . + 512;
  47. _irq_stacktop = .;
  48. _thread_stackbottom = .;
  49. . = . + 1024;
  50. _thread_stacktop = .;
  51. _sbss = .;
  52. *(.bss)
  53. *(.bss*)
  54. . = ALIGN(4);
  55. _ebss = .;
  56. #if MCU == STM32F1 || MCU == AT32F4
  57. u_buf = .;
  58. #endif
  59. } >RAM
  60. #if MCU == STM32F7
  61. .ext_ram (NOLOAD) : {
  62. _ext_ram_start = .;
  63. _reset_flag = .;
  64. . = . + 4;
  65. *(.ext_ram)
  66. . = ALIGN(4);
  67. _ext_ram_end = .;
  68. u_buf = .; /* 128K */
  69. } >EXT_RAM
  70. #endif
  71. /DISCARD/ : {
  72. *(.eh_frame)
  73. }
  74. .ARM.attributes 0 : { *(.ARM.attributes) }
  75. }