bl2u.ld.S 3.2 KB

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