common_ifs.ld 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103
  1. /* Memory layout for internal flash storage configuration:
  2. FLASH_ISR .isr_vector
  3. FLASH_TEXT .text
  4. FLASH_TEXT .data
  5. RAM .data
  6. RAM .bss
  7. RAM .heap
  8. RAM .stack
  9. */
  10. ENTRY(Reset_Handler)
  11. /* define output sections */
  12. SECTIONS
  13. {
  14. /* The startup code goes first into FLASH */
  15. .isr_vector :
  16. {
  17. . = ALIGN(4);
  18. KEEP(*(.isr_vector)) /* Startup code */
  19. /* This first flash block is 16K annd the isr vectors only take up
  20. about 400 bytes. So we pull in a couple of object files to pad it
  21. out. */
  22. . = ALIGN(4);
  23. /* NOTE: If you update the list of files contained in .isr_vector,
  24. then be sure to also update smhal/Makefile where it forcibly
  25. builds each of these files with -Os */
  26. */ff.o(.text*)
  27. */vfs_fat_*.o(.text*)
  28. */py/formatfloat.o(.text*)
  29. */py/parsenum.o(.text*)
  30. */py/mpprint.o(.text*)
  31. . = ALIGN(4);
  32. } >FLASH_ISR
  33. /* The program code and other data goes into FLASH */
  34. .text :
  35. {
  36. . = ALIGN(4);
  37. *(.text*) /* .text* sections (code) */
  38. *(.rodata*) /* .rodata* sections (constants, strings, etc.) */
  39. /* *(.glue_7) */ /* glue arm to thumb code */
  40. /* *(.glue_7t) */ /* glue thumb to arm code */
  41. . = ALIGN(4);
  42. _etext = .; /* define a global symbol at end of code */
  43. } >FLASH_TEXT
  44. /* used by the startup to initialize data */
  45. _sidata = LOADADDR(.data);
  46. /* This is the initialized data section
  47. The program executes knowing that the data is in the RAM
  48. but the loader puts the initial values in the FLASH (inidata).
  49. It is one task of the startup to copy the initial values from FLASH to RAM. */
  50. .data :
  51. {
  52. . = ALIGN(4);
  53. _sdata = .; /* create a global symbol at data start; used by startup code in order to initialise the .data section in RAM */
  54. *(.data*) /* .data* sections */
  55. . = ALIGN(4);
  56. _edata = .; /* define a global symbol at data end; used by startup code in order to initialise the .data section in RAM */
  57. } >RAM AT> FLASH_TEXT
  58. /* Uninitialized data section */
  59. .bss :
  60. {
  61. . = ALIGN(4);
  62. _sbss = .; /* define a global symbol at bss start; used by startup code */
  63. *(.bss*)
  64. *(COMMON)
  65. . = ALIGN(4);
  66. _ebss = .; /* define a global symbol at bss end; used by startup code and GC */
  67. } >RAM
  68. /* this is to define the start of the heap, and make sure we have a minimum size */
  69. .heap :
  70. {
  71. . = ALIGN(4);
  72. . = . + _minimum_heap_size;
  73. . = ALIGN(4);
  74. } >RAM
  75. /* this just checks there is enough RAM for the stack */
  76. .stack :
  77. {
  78. . = ALIGN(4);
  79. . = . + _minimum_stack_size;
  80. . = ALIGN(4);
  81. } >RAM
  82. .ARM.attributes 0 : { *(.ARM.attributes) }
  83. }