sections.h 3.9 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135
  1. /*
  2. * Copyright (c) 2013-2014, Wind River Systems, Inc.
  3. *
  4. * SPDX-License-Identifier: Apache-2.0
  5. */
  6. /**
  7. * @file
  8. * @brief Definitions of various linker Sections.
  9. *
  10. * Linker Section declarations used by linker script, C files and Assembly
  11. * files.
  12. */
  13. #ifndef ZEPHYR_INCLUDE_LINKER_SECTIONS_H_
  14. #define ZEPHYR_INCLUDE_LINKER_SECTIONS_H_
  15. #define _TEXT_SECTION_NAME text
  16. #define _RODATA_SECTION_NAME rodata
  17. #define _CTOR_SECTION_NAME ctors
  18. /* Linker issue with XIP where the name "data" cannot be used */
  19. #define _DATA_SECTION_NAME datas
  20. #define _BSS_SECTION_NAME bss
  21. #define _NOINIT_SECTION_NAME noinit
  22. #define _APP_SMEM_SECTION_NAME app_smem
  23. #define _APP_DATA_SECTION_NAME app_datas
  24. #define _APP_BSS_SECTION_NAME app_bss
  25. #define _APP_NOINIT_SECTION_NAME app_noinit
  26. #define _APP_SMEM_PINNED_SECTION_NAME app_smem_pinned
  27. #define _UNDEFINED_SECTION_NAME undefined
  28. /* Interrupts */
  29. #define _IRQ_VECTOR_TABLE_SECTION_NAME .gnu.linkonce.irq_vector_table
  30. #define _IRQ_VECTOR_TABLE_SECTION_SYMS .gnu.linkonce.irq_vector_table*
  31. #define _SW_ISR_TABLE_SECTION_NAME .gnu.linkonce.sw_isr_table
  32. #define _SW_ISR_TABLE_SECTION_SYMS .gnu.linkonce.sw_isr_table*
  33. /* Architecture-specific sections */
  34. #if defined(CONFIG_ARM)
  35. #define _KINETIS_FLASH_CONFIG_SECTION_NAME kinetis_flash_config
  36. #define _TI_CCFG_SECTION_NAME .ti_ccfg
  37. #define _CCM_DATA_SECTION_NAME .ccm_data
  38. #define _CCM_BSS_SECTION_NAME .ccm_bss
  39. #define _CCM_NOINIT_SECTION_NAME .ccm_noinit
  40. #define _ITCM_SECTION_NAME .itcm
  41. #define _DTCM_DATA_SECTION_NAME .dtcm_data
  42. #define _DTCM_BSS_SECTION_NAME .dtcm_bss
  43. #define _DTCM_NOINIT_SECTION_NAME .dtcm_noinit
  44. #endif
  45. #define _IMX_BOOT_CONF_SECTION_NAME .boot_hdr.conf
  46. #define _IMX_BOOT_DATA_SECTION_NAME .boot_hdr.data
  47. #define _IMX_BOOT_IVT_SECTION_NAME .boot_hdr.ivt
  48. #define _IMX_BOOT_DCD_SECTION_NAME .boot_hdr.dcd_data
  49. #define _STM32_SDRAM1_SECTION_NAME .stm32_sdram1
  50. #define _STM32_SDRAM2_SECTION_NAME .stm32_sdram2
  51. #define _ACT_S2_NOT_SAVE_SECTION_NAME .act_s2_not_save_mem
  52. #define _ACT_SLEEP_DATA_SECTION_NAME .sleep.data
  53. #define _STM32_BACKUP_SRAM_SECTION_NAME .stm32_backup_sram
  54. #ifdef CONFIG_NOCACHE_MEMORY
  55. #define _NOCACHE_SECTION_NAME nocache
  56. #endif
  57. #if defined(CONFIG_LINKER_USE_BOOT_SECTION)
  58. #define BOOT_TEXT_SECTION_NAME boot_text
  59. #define BOOT_BSS_SECTION_NAME boot_bss
  60. #define BOOT_RODATA_SECTION_NAME boot_rodata
  61. #define BOOT_DATA_SECTION_NAME boot_data
  62. #define BOOT_NOINIT_SECTION_NAME boot_noinit
  63. #endif
  64. #if defined(CONFIG_LINKER_USE_PINNED_SECTION)
  65. #define PINNED_TEXT_SECTION_NAME pinned_text
  66. #define PINNED_BSS_SECTION_NAME pinned_bss
  67. #define PINNED_RODATA_SECTION_NAME pinned_rodata
  68. #define PINNED_DATA_SECTION_NAME pinned_data
  69. #define PINNED_NOINIT_SECTION_NAME pinned_noinit
  70. #endif
  71. /* Short section references for use in ASM files */
  72. #if defined(_ASMLANGUAGE)
  73. /* Various text section names */
  74. #define TEXT text
  75. /* Various data type section names */
  76. #define BSS bss
  77. #define RODATA rodata
  78. #define DATA data
  79. #define NOINIT noinit
  80. #if defined(CONFIG_LINKER_USE_BOOT_SECTION)
  81. #define BOOT_TEXT BOOT_TEXT_SECTION_NAME
  82. #define BOOT_BSS BOOT_BSS_SECTION_NAME
  83. #define BOOT_RODATA BOOT_RODATA_SECTION_NAME
  84. #define BOOT_DATA BOOT_DATA_SECTION_NAME
  85. #define BOOT_NOINIT BOOT_NOINIT_SECTION_NAME
  86. #else
  87. #define BOOT_TEXT TEXT
  88. #define BOOT_BSS BSS
  89. #define BOOT_RODATA RODATA
  90. #define BOOT_DATA DATA
  91. #define BOOT_NOINIT NOINIT
  92. #endif /* CONFIG_LINKER_USE_BOOT_SECTION */
  93. #if defined(CONFIG_LINKER_USE_PINNED_SECTION)
  94. #define PINNED_TEXT PINNED_TEXT_SECTION_NAME
  95. #define PINNED_BSS PINNED_BSS_SECTION_NAME
  96. #define PINNED_RODATA PINNED_RODATA_SECTION_NAME
  97. #define PINNED_DATA PINNED_DATA_SECTION_NAME
  98. #define PINNED_NOINIT PINNED_NOINIT_SECTION_NAME
  99. #else
  100. #define PINNED_TEXT TEXT
  101. #define PINNED_BSS BSS
  102. #define PINNED_RODATA RODATA
  103. #define PINNED_DATA DATA
  104. #define PINNED_NOINIT NOINIT
  105. #endif /* CONFIG_LINKER_USE_PINNED_SECTION */
  106. #endif /* _ASMLANGUAGE */
  107. #include <linker/section_tags.h>
  108. #endif /* ZEPHYR_INCLUDE_LINKER_SECTIONS_H_ */