bl2u.ld.S 3.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123
  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. __TEXT_START__ = .;
  24. *bl2u_entrypoint.o(.text*)
  25. *(SORT_BY_ALIGNMENT(.text*))
  26. *(.vectors)
  27. __TEXT_END_UNALIGNED__ = .;
  28. . = ALIGN(PAGE_SIZE);
  29. __TEXT_END__ = .;
  30. } >RAM
  31. /* .ARM.extab and .ARM.exidx are only added because Clang needs them */
  32. .ARM.extab . : {
  33. *(.ARM.extab* .gnu.linkonce.armextab.*)
  34. } >RAM
  35. .ARM.exidx . : {
  36. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  37. } >RAM
  38. .rodata . : {
  39. __RODATA_START__ = .;
  40. *(SORT_BY_ALIGNMENT(.rodata*))
  41. RODATA_COMMON
  42. __RODATA_END_UNALIGNED__ = .;
  43. . = ALIGN(PAGE_SIZE);
  44. __RODATA_END__ = .;
  45. } >RAM
  46. #else /* SEPARATE_CODE_AND_RODATA */
  47. .ro . : {
  48. __RO_START__ = .;
  49. *bl2u_entrypoint.o(.text*)
  50. *(SORT_BY_ALIGNMENT(.text*))
  51. *(SORT_BY_ALIGNMENT(.rodata*))
  52. RODATA_COMMON
  53. *(.vectors)
  54. __RO_END_UNALIGNED__ = .;
  55. /*
  56. * Memory page(s) mapped to this section will be marked as read-only,
  57. * executable. No RW data from the next section must creep in. Ensure
  58. * that the rest of the current memory page is unused.
  59. */
  60. . = ALIGN(PAGE_SIZE);
  61. __RO_END__ = .;
  62. } >RAM
  63. #endif /* SEPARATE_CODE_AND_RODATA */
  64. __RW_START__ = .;
  65. DATA_SECTION >RAM
  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
  74. * memory 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 the rest of
  83. * 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. __BL2U_END__ = .;
  91. __BSS_SIZE__ = SIZEOF(.bss);
  92. ASSERT(. <= BL2U_LIMIT, "BL2U image has exceeded its limit.")
  93. RAM_REGION_END = .;
  94. }