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