link.lds 3.8 KB

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