link.lds 3.5 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142
  1. /* Define the flash max size */
  2. __max_flash_size = 1024k;
  3. __data_ram_size = 8k;
  4. __stack_ram_size = 4k;
  5. __comm_ram_size = 42k;
  6. __heap_ram_size = 70k;
  7. __base = 0x10000000;
  8. __data_vma = 0x11000;
  9. __stack_vma = __data_vma + __data_ram_size;
  10. __comm_vma = __stack_vma + __stack_ram_size;
  11. __heap_vma = __comm_vma + __comm_ram_size;
  12. __ram1_vma = 0x50000;
  13. MEMORY
  14. {
  15. init : org = __base, len = 512
  16. flash(rx) : org = __base + 512, len = __max_flash_size
  17. comm(rx) : org = __comm_vma, len = __comm_ram_size
  18. data : org = __data_vma, len = __data_ram_size
  19. stack : org = __stack_vma, len = __stack_ram_size
  20. heap : org = __heap_vma, len = __heap_ram_size
  21. ram1(rx) : org = __ram1_vma, len = 0x7a00
  22. }
  23. SECTIONS
  24. {
  25. .init : {
  26. *(.reset)
  27. } > init
  28. .ram1 __ram1_vma : {
  29. /* section information for initial */
  30. . = ALIGN(4);
  31. __rt_init_start = .;
  32. KEEP(*(SORT(.rti_fn*)))
  33. __rt_init_end = .;
  34. . = ALIGN(4);
  35. PROVIDE(__ctors_start__ = .);
  36. KEEP (*(SORT(.init_array.*)))
  37. KEEP (*(.init_array*))
  38. PROVIDE(__ctors_end__ = .);
  39. /* section information for at server */
  40. . = ALIGN(4);
  41. __rtatcmdtab_start = .;
  42. KEEP(*(RtAtCmdTab))
  43. __rtatcmdtab_end = .;
  44. . = ALIGN(4);
  45. *save-restore.o (.text* .rodata*)
  46. *libcpu*cpu*context_gcc.o (.text* .rodata*)
  47. *libcpu*cpu*interrupt.o (.text* .rodata*)
  48. *libcpu**.o (.rodata*)
  49. *components*drivers*misc*pin.o(.text*)
  50. *components*drivers*misc*adc.o(.text*)
  51. . = ALIGN(4);
  52. *src*ipc.o (.text* .rodata*)
  53. *src*irq.o (.text* .rodata*)
  54. *src*object.o (.text* .rodata*)
  55. *src*thread.o (.text* .rodata*)
  56. *src*timer.o (.text* .rodata*)
  57. *src*mempool.o (.text* .rodata*)
  58. *src*scheduler.o (.text* .rodata*)
  59. *src*clock.o (.text* .rodata*)
  60. *src*kservice.o (.text* .rodata*)
  61. *src*device.o (.text* .rodata*)
  62. *src*idle.o (.text* .rodata*)
  63. *src*components.o (.text* .rodata*)
  64. } > ram1 AT > flash
  65. .comm __comm_vma : {
  66. . = ALIGN(4);
  67. KEEP(*(.vector))
  68. *(.irq.cache)
  69. *(.irq*)
  70. *ab32vg1_hal**.o (.text* .rodata*)
  71. *drv_gpio.o (.text* .rodata*)
  72. *drv_usart.o (.rodata*)
  73. EXCLUDE_FILE(*lib_a**.o *unwind*.o) *(.srodata*)
  74. *(.rela*)
  75. *(.data*)
  76. *(.sdata*)
  77. *(.com_text*)
  78. } > comm AT > flash
  79. .bss (NOLOAD):
  80. {
  81. __bss_start = .;
  82. *(COMMON)
  83. *(.bss)
  84. *(.sbss)
  85. *(.buf*)
  86. __bss_end = .;
  87. } > data
  88. __bss_size = __bss_end - __bss_start;
  89. .stack (NOLOAD) : {
  90. __irq_stack_start = .;
  91. . = __stack_ram_size;
  92. __irq_stack = .;
  93. } > stack
  94. __irq_stack_size = __irq_stack - __irq_stack_start;
  95. .heap (NOLOAD) : {
  96. __heap_start = .;
  97. . = __heap_ram_size;
  98. __heap_end = .;
  99. } > heap
  100. .flash : {
  101. . = ALIGN(4);
  102. __fsymtab_start = .;
  103. KEEP(*(FSymTab))
  104. __fsymtab_end = .;
  105. . = ALIGN(4);
  106. __vsymtab_start = .;
  107. KEEP(*(VSymTab))
  108. __vsymtab_end = .;
  109. . = ALIGN(4);
  110. *(.text*)
  111. *(.rodata*)
  112. *(.srodata*)
  113. . = ALIGN(512);
  114. } > flash
  115. }
  116. /* Calc the lma */
  117. __bank_size = SIZEOF(.flash);
  118. __comm_lma = LOADADDR(.comm);
  119. __comm_size = SIZEOF(.comm);
  120. __ram1_lma = LOADADDR(.ram1);
  121. __ram1_size = SIZEOF(.ram1);