link_descriptor_trng_r2.ld 4.6 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124
  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) .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) .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) .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) .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) .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) .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) .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) .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. .secbuf ALIGN(4) : {
  52. _secbuf_start = .;
  53. *(.secbuf)
  54. _secbuf_end = .;
  55. }
  56. ASSERT(!((ADDR(.loader_ext_dram) + SIZEOF(.loader_ext_dram)) > 0x11227BFF), "Error: loader_ext_dram over size!")
  57. /* etc region */
  58. . = etcBase;
  59. .loader_ext_etc ALIGN(4) : AT(ADDR(.got) + SIZEOF(.got) + SIZEOF(.loader_ext_dram)) {
  60. *handshake_*.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  61. *usbd.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  62. *usbtty.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  63. *circbuf.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  64. *tz_*.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  65. *device_apc.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  66. *efuse_self.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  67. *efuse_writer.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  68. *sec_efuse.o (.text .text.* .rodata .rodata.* .data .data.* .got .got.*)
  69. }
  70. /* loader_ext_etc will overwrite bss1, so its size could be the size of bss1. */
  71. /* However, we limit the size to 25 KB. */
  72. ASSERT(!((ADDR(.loader_ext_etc) + SIZEOF(.loader_ext_etc)) > 0x00108800), "Error: loader_ext_etc over size!")
  73. /* bss2 region */
  74. . = bss2Base;
  75. .bss2 ALIGN(16) : {
  76. _bss2_start = .;
  77. *(.bss)
  78. *(.bss.*)
  79. *(COMMON)
  80. /* make _bss1_end as 4 bytes alignment */
  81. . = ALIGN(4);
  82. _bss2_end = .;
  83. }
  84. /* bss1 region */
  85. . = bss1Base;
  86. .bss1 ALIGN(16) : {
  87. _bss1_start = .;
  88. *print.o (.log_sram_buf)
  89. *efi.o (.gpt_sram_buf)
  90. *efi.o (.gpt_sram_crc32_table)
  91. *efi.o (.gpt_sram_part_info)
  92. *efi.o (.gpt_sram_part_meta_info)
  93. *nand.o (.gpt_sram_buf)
  94. *nand.o (.gpt_sram_part_meta_info)
  95. /* make _bss1_end as 4 bytes alignment */
  96. . = ALIGN(4);
  97. _bss1_end = .;
  98. }
  99. /* stack region */
  100. . = stackBase;
  101. .stack ALIGN(4) : {
  102. _stack_start = .;
  103. *(.stack)
  104. _stack_end = .;
  105. }
  106. }