link_descriptor_ext.ld 4.7 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. OUTPUT_ARCH(arm)
  2. ENTRY(_start)
  3. romBase = 0x00201000;
  4. bss1Base = 0x00102400;
  5. etcBase = 0x00102400;
  6. bss2Base = 0x00108900;
  7. dramBase = 0x11221000;
  8. stackBase = 0x00200000;
  9. MEMORY {
  10. bss1 : ORIGIN = bss1Base, LENGTH = 0x6500
  11. bss2 : ORIGIN = bss2Base, LENGTH = 0x5300
  12. rom : ORIGIN = romBase, LENGTH = 0x1F000
  13. dram : ORIGIN = dramBase, LENGTH = 0x6C00
  14. etc : ORIGIN = etcBase, LENGTH = 0x6800
  15. stack : ORIGIN = stackBase, LENGTH = 0xC00
  16. }
  17. SECTIONS {
  18. /* rom region */
  19. . = romBase;
  20. .start ALIGN(4) : {
  21. *(.text.start)
  22. }
  23. . = romBase + 0x01FC;
  24. .rom_info ALIGN(4) : {
  25. *(.data.rom_info)
  26. }
  27. .text ALIGN(4) : {
  28. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .text)
  29. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .text.*)
  30. }
  31. .rodata ALIGN(4) : {
  32. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .rodata)
  33. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .rodata.*)
  34. }
  35. .data ALIGN(4) : {
  36. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .data)
  37. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .data.*)
  38. }
  39. .got ALIGN(4) : {
  40. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .got)
  41. *(EXCLUDE_FILE(*tz_*.o *device_apc.o *handshake_*.o *usbd.o *usbtty.o *circbuf.o *dramc_*.o *emi_init.o *memory.o *efuse_self.o *efuse_writer.o *sec_efuse.o *efuse_runtime.o) .got.*)
  42. }
  43. __boot_end = .;
  44. /* dram region */
  45. . = dramBase;
  46. .loader_ext_dram ALIGN(4) : AT(ADDR(.got) + SIZEOF(.got)) {
  47. *dramc_*.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  48. *emi_init.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  49. *memory.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  50. }
  51. ASSERT(!((ADDR(.loader_ext_dram) + SIZEOF(.loader_ext_dram)) > 0x11227BFF), "Error: loader_ext_dram over size!")
  52. /* etc region */
  53. . = etcBase;
  54. .loader_ext_etc ALIGN(4) : AT(ADDR(.got) + SIZEOF(.got) + SIZEOF(.loader_ext_dram)) {
  55. *handshake_*.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  56. *usbd.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  57. *usbtty.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  58. *circbuf.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  59. *tz_*.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  60. *device_apc.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  61. *efuse_self.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  62. *efuse_writer.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  63. *sec_efuse.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  64. *efuse_runtime.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  65. }
  66. /* loader_ext_etc will overwrite bss1, so its size could be the size of bss1. */
  67. /* However, we limit the size to 25 KB. */
  68. ASSERT(!((ADDR(.loader_ext_etc) + SIZEOF(.loader_ext_etc)) > 0x00108800), "Error: loader_ext_etc over size!")
  69. /* bss2 region */
  70. . = bss2Base;
  71. .bss2 ALIGN(16) : {
  72. _bss2_start = .;
  73. *(.bss)
  74. *(.bss.*)
  75. *(COMMON)
  76. /* make _bss1_end as 4 bytes alignment */
  77. . = ALIGN(4);
  78. _bss2_end = .;
  79. }
  80. /* bss1 region */
  81. . = bss1Base;
  82. .bss1 ALIGN(16) : {
  83. _bss1_start = .;
  84. *print.o (.log_sram_buf)
  85. *efi.o (.gpt_sram_buf)
  86. *efi.o (.gpt_sram_crc32_table)
  87. *efi.o (.gpt_sram_part_info)
  88. *efi.o (.gpt_sram_part_meta_info)
  89. *nand.o (.gpt_sram_buf)
  90. *nand.o (.gpt_sram_part_meta_info)
  91. /* make _bss1_end as 4 bytes alignment */
  92. . = ALIGN(4);
  93. _bss1_end = .;
  94. }
  95. /* stack region */
  96. . = stackBase;
  97. .stack ALIGN(4) : {
  98. _stack_start = .;
  99. *(.stack)
  100. _stack_end = .;
  101. }
  102. }