bl2u.ld.S 2.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118
  1. /*
  2. * Copyright (c) 2015-2020, 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. {
  17. . = BL2U_BASE;
  18. ASSERT(. == ALIGN(PAGE_SIZE),
  19. "BL2U_BASE address is not aligned on a page boundary.")
  20. #if SEPARATE_CODE_AND_RODATA
  21. .text . : {
  22. __TEXT_START__ = .;
  23. *bl2u_entrypoint.o(.text*)
  24. *(SORT_BY_ALIGNMENT(.text*))
  25. *(.vectors)
  26. . = ALIGN(PAGE_SIZE);
  27. __TEXT_END__ = .;
  28. } >RAM
  29. /* .ARM.extab and .ARM.exidx are only added because Clang need them */
  30. .ARM.extab . : {
  31. *(.ARM.extab* .gnu.linkonce.armextab.*)
  32. } >RAM
  33. .ARM.exidx . : {
  34. *(.ARM.exidx* .gnu.linkonce.armexidx.*)
  35. } >RAM
  36. .rodata . : {
  37. __RODATA_START__ = .;
  38. *(SORT_BY_ALIGNMENT(.rodata*))
  39. RODATA_COMMON
  40. . = ALIGN(PAGE_SIZE);
  41. __RODATA_END__ = .;
  42. } >RAM
  43. #else
  44. ro . : {
  45. __RO_START__ = .;
  46. *bl2u_entrypoint.o(.text*)
  47. *(SORT_BY_ALIGNMENT(.text*))
  48. *(SORT_BY_ALIGNMENT(.rodata*))
  49. RODATA_COMMON
  50. *(.vectors)
  51. __RO_END_UNALIGNED__ = .;
  52. /*
  53. * Memory page(s) mapped to this section will be marked as
  54. * read-only, executable. No RW data from the next section must
  55. * creep in. Ensure the rest of the current memory page is unused.
  56. */
  57. . = ALIGN(PAGE_SIZE);
  58. __RO_END__ = .;
  59. } >RAM
  60. #endif
  61. /*
  62. * Define a linker symbol to mark start of the RW memory area for this
  63. * image.
  64. */
  65. __RW_START__ = . ;
  66. DATA_SECTION >RAM
  67. STACK_SECTION >RAM
  68. BSS_SECTION >RAM
  69. XLAT_TABLE_SECTION >RAM
  70. #if USE_COHERENT_MEM
  71. /*
  72. * The base address of the coherent memory section must be page-aligned (4K)
  73. * to guarantee that the coherent data are stored on their own pages and
  74. * are not mixed with normal data. This is required to set up the correct
  75. * memory attributes for the coherent data page tables.
  76. */
  77. coherent_ram (NOLOAD) : ALIGN(PAGE_SIZE) {
  78. __COHERENT_RAM_START__ = .;
  79. *(tzfw_coherent_mem)
  80. __COHERENT_RAM_END_UNALIGNED__ = .;
  81. /*
  82. * Memory page(s) mapped to this section will be marked
  83. * as device memory. No other unexpected data must creep in.
  84. * Ensure the rest of the current memory page is unused.
  85. */
  86. . = ALIGN(PAGE_SIZE);
  87. __COHERENT_RAM_END__ = .;
  88. } >RAM
  89. #endif
  90. /*
  91. * Define a linker symbol to mark end of the RW memory area for this
  92. * image.
  93. */
  94. __RW_END__ = .;
  95. __BL2U_END__ = .;
  96. __BSS_SIZE__ = SIZEOF(.bss);
  97. ASSERT(. <= BL2U_LIMIT, "BL2U image has exceeded its limit.")
  98. }