link_descriptor_trng_r1.ld 4.4 KB

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