bl2u.ld.S 2.8 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  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. . = BL2U_BASE;
  17. ASSERT(. == ALIGN(PAGE_SIZE),
  18. "BL2U_BASE address is not aligned on a page boundary.")
  19. #if SEPARATE_CODE_AND_RODATA
  20. .text . : {
  21. __TEXT_START__ = .;
  22. *bl2u_entrypoint.o(.text*)
  23. *(SORT_BY_ALIGNMENT(.text*))
  24. *(.vectors)
  25. . = ALIGN(PAGE_SIZE);
  26. __TEXT_END__ = .;
  27. } >RAM
  28. /* .ARM.extab and .ARM.exidx are only added because Clang needs them */
  29. .ARM.extab . : {
  30. *(.ARM.extab* .gnu.linkonce.armextab.*)
  31. } >RAM
  32. .ARM.exidx . : {
  33. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  34. } >RAM
  35. .rodata . : {
  36. __RODATA_START__ = .;
  37. *(SORT_BY_ALIGNMENT(.rodata*))
  38. RODATA_COMMON
  39. . = ALIGN(PAGE_SIZE);
  40. __RODATA_END__ = .;
  41. } >RAM
  42. #else /* SEPARATE_CODE_AND_RODATA */
  43. .ro . : {
  44. __RO_START__ = .;
  45. *bl2u_entrypoint.o(.text*)
  46. *(SORT_BY_ALIGNMENT(.text*))
  47. *(SORT_BY_ALIGNMENT(.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. STACK_SECTION >RAM
  63. BSS_SECTION >RAM
  64. XLAT_TABLE_SECTION >RAM
  65. #if USE_COHERENT_MEM
  66. /*
  67. * The base address of the coherent memory section must be page-aligned to
  68. * guarantee that the coherent data are stored on their own pages and are
  69. * not mixed with normal data. This is required to set up the correct
  70. * memory attributes for the coherent data page tables.
  71. */
  72. .coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
  73. __COHERENT_RAM_START__ = .;
  74. *(.tzfw_coherent_mem)
  75. __COHERENT_RAM_END_UNALIGNED__ = .;
  76. /*
  77. * Memory page(s) mapped to this section will be marked as device
  78. * memory. No other unexpected data must creep in. Ensure the rest of
  79. * the current memory page is unused.
  80. */
  81. . = ALIGN(PAGE_SIZE);
  82. __COHERENT_RAM_END__ = .;
  83. } >RAM
  84. #endif /* USE_COHERENT_MEM */
  85. __RW_END__ = .;
  86. __BL2U_END__ = .;
  87. __BSS_SIZE__ = SIZEOF(.bss);
  88. ASSERT(. <= BL2U_LIMIT, "BL2U image has exceeded its limit.")
  89. }