tsp.ld.S 3.2 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Copyright (c) 2013-2023, Arm Limited and Contributors. All rights reserved.
  3. *
  4. * SPDX-License-Identifier: BSD-3-Clause
  5. */
  6. #include <common/bl_common.ld.h>
  7. #include <lib/xlat_tables/xlat_tables_defs.h>
  8. OUTPUT_FORMAT(PLATFORM_LINKER_FORMAT)
  9. OUTPUT_ARCH(PLATFORM_LINKER_ARCH)
  10. ENTRY(tsp_entrypoint)
  11. MEMORY {
  12. RAM (rwx): ORIGIN = TSP_SEC_MEM_BASE, LENGTH = TSP_SEC_MEM_SIZE
  13. }
  14. SECTIONS {
  15. RAM_REGION_START = ORIGIN(RAM);
  16. RAM_REGION_LENGTH = LENGTH(RAM);
  17. . = BL32_BASE;
  18. ASSERT(. == ALIGN(PAGE_SIZE),
  19. "BL32_BASE address is not aligned on a page boundary.")
  20. #if SEPARATE_CODE_AND_RODATA
  21. .text . : {
  22. ASSERT(. == ALIGN(PAGE_SIZE),
  23. ".text address is not aligned on a page boundary.");
  24. __TEXT_START__ = .;
  25. *tsp_entrypoint.o(.text*)
  26. *(.text*)
  27. *(.vectors)
  28. __TEXT_END_UNALIGNED__ = .;
  29. . = ALIGN(PAGE_SIZE);
  30. __TEXT_END__ = .;
  31. } >RAM
  32. .rodata . : {
  33. __RODATA_START__ = .;
  34. *(.rodata*)
  35. RODATA_COMMON
  36. __RODATA_END_UNALIGNED__ = .;
  37. . = ALIGN(PAGE_SIZE);
  38. __RODATA_END__ = .;
  39. } >RAM
  40. #else /* SEPARATE_CODE_AND_RODATA */
  41. .ro . : {
  42. ASSERT(. == ALIGN(PAGE_SIZE),
  43. ".ro address is not aligned on a page boundary.");
  44. __RO_START__ = .;
  45. *tsp_entrypoint.o(.text*)
  46. *(.text*)
  47. *(.rodata*)
  48. RODATA_COMMON
  49. *(.vectors)
  50. __RO_END_UNALIGNED__ = .;
  51. /*
  52. * Memory page(s) mapped to this section will be marked as read-only,
  53. * executable. No RW data from the next section must creep in. Ensure
  54. * that the rest of the current memory page is unused.
  55. */
  56. . = ALIGN(PAGE_SIZE);
  57. __RO_END__ = .;
  58. } >RAM
  59. #endif /* SEPARATE_CODE_AND_RODATA */
  60. __RW_START__ = .;
  61. DATA_SECTION >RAM
  62. RELA_SECTION >RAM
  63. #ifdef TSP_PROGBITS_LIMIT
  64. ASSERT(. <= TSP_PROGBITS_LIMIT, "TSP progbits has exceeded its limit.")
  65. #endif /* TSP_PROGBITS_LIMIT */
  66. STACK_SECTION >RAM
  67. BSS_SECTION >RAM
  68. XLAT_TABLE_SECTION >RAM
  69. #if USE_COHERENT_MEM
  70. /*
  71. * The base address of the coherent memory section must be page-aligned to
  72. * guarantee that the coherent data are stored on their own pages and are
  73. * not mixed with normal data. This is required to set up the correct memory
  74. * attributes for the coherent data page tables.
  75. */
  76. .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
  77. __COHERENT_RAM_START__ = .;
  78. *(.tzfw_coherent_mem)
  79. __COHERENT_RAM_END_UNALIGNED__ = .;
  80. /*
  81. * Memory page(s) mapped to this section will be marked as device
  82. * memory. No other unexpected data must creep in. Ensure that the rest
  83. * of the current memory page is unused.
  84. */
  85. . = ALIGN(PAGE_SIZE);
  86. __COHERENT_RAM_END__ = .;
  87. } >RAM
  88. #endif /* USE_COHERENT_MEM */
  89. __RW_END__ = .;
  90. __BL32_END__ = .;
  91. /DISCARD/ : {
  92. *(.dynsym .dynstr .hash .gnu.hash)
  93. }
  94. __BSS_SIZE__ = SIZEOF(.bss);
  95. #if USE_COHERENT_MEM
  96. __COHERENT_RAM_UNALIGNED_SIZE__ =
  97. __COHERENT_RAM_END_UNALIGNED__ - __COHERENT_RAM_START__;
  98. #endif /* USE_COHERENT_MEM */
  99. ASSERT(. <= BL32_LIMIT, "BL32 image has exceeded its limit.")
  100. RAM_REGION_END = .;
  101. }