19#ifndef ZEPHYR_INCLUDE_LINKER_LINKER_DEFS_H_
20#define ZEPHYR_INCLUDE_LINKER_LINKER_DEFS_H_
34#define DT_NODE_HAS_STATUS(node, status) 0
47#define Z_LINK_ITERABLE(struct_type) \
48 _CONCAT(_##struct_type, _list_start) = .; \
49 KEEP(*(SORT_BY_NAME(._##struct_type.static.*))); \
50 _CONCAT(_##struct_type, _list_end) = .
52#define Z_LINK_ITERABLE_ALIGNED(struct_type, align) \
54 Z_LINK_ITERABLE(struct_type);
56#define Z_LINK_ITERABLE_GC_ALLOWED(struct_type) \
57 _CONCAT(_##struct_type, _list_start) = .; \
58 *(SORT_BY_NAME(._##struct_type.static.*)); \
59 _CONCAT(_##struct_type, _list_end) = .
75#define ITERABLE_SECTION_ROM(struct_type, subalign) \
76 SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
78 Z_LINK_ITERABLE(struct_type); \
79 } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
81#define Z_ITERABLE_SECTION_ROM(struct_type, subalign) \
82 ITERABLE_SECTION_ROM(struct_type, subalign)
96#define ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) \
97 SECTION_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
99 Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \
100 } GROUP_LINK_IN(ROMABLE_REGION)
102#define Z_ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign) \
103 ITERABLE_SECTION_ROM_GC_ALLOWED(struct_type, subalign)
119#define ITERABLE_SECTION_RAM(struct_type, subalign) \
120 SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
122 Z_LINK_ITERABLE(struct_type); \
123 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
125#define Z_ITERABLE_SECTION_RAM(struct_type, subalign) \
126 ITERABLE_SECTION_RAM(struct_type, subalign)
140#define ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) \
141 SECTION_DATA_PROLOGUE(struct_type##_area,,SUBALIGN(subalign)) \
143 Z_LINK_ITERABLE_GC_ALLOWED(struct_type); \
144 } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
146#define Z_ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign) \
147 ITERABLE_SECTION_RAM_GC_ALLOWED(struct_type, subalign)
159#define CREATE_OBJ_LEVEL(object, level) \
160 __##object##_##level##_start = .; \
161 KEEP(*(SORT(.z_##object##_##level[0-9]_*))); \
162 KEEP(*(SORT(.z_##object##_##level[1-9][0-9]_*)));
169#elif defined(_ASMLANGUAGE)
173GDATA(__bss_num_words)
175GDATA(__data_region_load_start)
176GDATA(__data_region_start)
177GDATA(__data_region_num_words)
194extern char _app_smem_start[];
195extern char _app_smem_end[];
196extern char _app_smem_size[];
197extern char _app_smem_rom_start[];
198extern char _app_smem_num_words[];
200#ifdef CONFIG_LINKER_USE_PINNED_SECTION
201extern char _app_smem_pinned_start[];
202extern char _app_smem_pinned_end[];
203extern char _app_smem_pinned_size[];
204extern char _app_smem_pinned_num_words[];
217extern char __kernel_ram_start[];
218extern char __kernel_ram_end[];
219extern char __kernel_ram_size[];
222extern char __bss_start[];
223extern char __bss_end[];
227extern char __data_region_load_start[];
228extern char __data_region_start[];
229extern char __data_region_end[];
234extern char z_mapped_start[];
235extern char z_mapped_end[];
239extern char __rom_region_start[];
240extern char __rom_region_end[];
241extern char __rom_region_size[];
244extern char _flash_used[];
247extern char _image_ram_start[];
248extern char _image_ram_end[];
250extern char __text_region_start[];
251extern char __text_region_end[];
252extern char __text_region_size[];
254extern char __rodata_region_start[];
255extern char __rodata_region_end[];
256extern char __rodata_region_size[];
258extern char _vector_start[];
259extern char _vector_end[];
261#if DT_NODE_HAS_STATUS(_NODE_RESERVED, okay)
265#ifdef CONFIG_SW_VECTOR_RELAY
266extern char __vector_relay_table[];
269#ifdef CONFIG_COVERAGE_GCOV
270extern char __gcov_bss_start[];
271extern char __gcov_bss_end[];
272extern char __gcov_bss_size[];
278#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_ccm), okay)
279extern char __ccm_data_rom_start[];
280extern char __ccm_start[];
281extern char __ccm_data_start[];
282extern char __ccm_data_end[];
283extern char __ccm_bss_start[];
284extern char __ccm_bss_end[];
285extern char __ccm_noinit_start[];
286extern char __ccm_noinit_end[];
287extern char __ccm_end[];
290#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_itcm), okay)
291extern char __itcm_start[];
292extern char __itcm_end[];
293extern char __itcm_size[];
294extern char __itcm_load_start[];
297#if DT_NODE_HAS_STATUS(DT_CHOSEN(zephyr_dtcm), okay)
298extern char __dtcm_data_start[];
299extern char __dtcm_data_end[];
300extern char __dtcm_bss_start[];
301extern char __dtcm_bss_end[];
302extern char __dtcm_noinit_start[];
303extern char __dtcm_noinit_end[];
304extern char __dtcm_data_load_start[];
305extern char __dtcm_start[];
306extern char __dtcm_end[];
312#ifdef CONFIG_ARM_FIRMWARE_HAS_SECURE_ENTRY_FUNCS
313extern char __sg_start[];
314extern char __sg_end[];
315extern char __sg_size[];
326#ifdef CONFIG_NOCACHE_MEMORY
327extern char _nocache_ram_start[];
328extern char _nocache_ram_end[];
329extern char _nocache_ram_size[];
338#ifdef CONFIG_ARCH_HAS_RAMFUNC_SUPPORT
339extern char __ramfunc_start[];
340extern char __ramfunc_end[];
341extern char __ramfunc_size[];
342extern char __ramfunc_load_start[];
351#ifdef CONFIG_USERSPACE
352extern char z_priv_stacks_ram_start[];
353extern char z_priv_stacks_ram_end[];
354extern char z_user_stacks_start[];
355extern char z_user_stacks_end[];
356extern char z_kobject_data_begin[];
359#ifdef CONFIG_THREAD_LOCAL_STORAGE
360extern char __tdata_start[];
361extern char __tdata_end[];
362extern char __tdata_size[];
363extern char __tdata_align[];
364extern char __tbss_start[];
365extern char __tbss_end[];
366extern char __tbss_size[];
367extern char __tbss_align[];
368extern char __tls_start[];
369extern char __tls_end[];
370extern char __tls_size[];
373#ifdef CONFIG_LINKER_USE_BOOT_SECTION
377extern char lnkr_boot_start[];
378extern char lnkr_boot_end[];
380extern char lnkr_boot_text_start[];
381extern char lnkr_boot_text_end[];
382extern char lnkr_boot_text_size[];
383extern char lnkr_boot_data_start[];
384extern char lnkr_boot_data_end[];
385extern char lnkr_boot_data_size[];
386extern char lnkr_boot_rodata_start[];
387extern char lnkr_boot_rodata_end[];
388extern char lnkr_boot_rodata_size[];
389extern char lnkr_boot_bss_start[];
390extern char lnkr_boot_bss_end[];
391extern char lnkr_boot_bss_size[];
392extern char lnkr_boot_noinit_start[];
393extern char lnkr_boot_noinit_end[];
394extern char lnkr_boot_noinit_size[];
397#ifdef CONFIG_LINKER_USE_PINNED_SECTION
403extern char lnkr_pinned_start[];
404extern char lnkr_pinned_end[];
406extern char lnkr_pinned_text_start[];
407extern char lnkr_pinned_text_end[];
408extern char lnkr_pinned_text_size[];
409extern char lnkr_pinned_data_start[];
410extern char lnkr_pinned_data_end[];
411extern char lnkr_pinned_data_size[];
412extern char lnkr_pinned_rodata_start[];
413extern char lnkr_pinned_rodata_end[];
414extern char lnkr_pinned_rodata_size[];
415extern char lnkr_pinned_bss_start[];
416extern char lnkr_pinned_bss_end[];
417extern char lnkr_pinned_bss_size[];
418extern char lnkr_pinned_noinit_start[];
419extern char lnkr_pinned_noinit_end[];
420extern char lnkr_pinned_noinit_size[];
423static inline bool lnkr_is_pinned(
uint8_t *addr)
425 if ((addr >= (
uint8_t *)lnkr_pinned_start) &&
426 (addr < (
uint8_t *)lnkr_pinned_end)) {
434static inline bool lnkr_is_region_pinned(
uint8_t *addr,
size_t sz)
436 if ((addr >= (
uint8_t *)lnkr_pinned_start) &&
437 ((addr + sz) < (
uint8_t *)lnkr_pinned_end)) {
Common toolchain abstraction.
#define DT_RESERVED_MEM_SYMBOLS()
Generate linker script symbols for all the reserved memory regions.
Definition: devicetree_reserved.h:59
Definitions of various linker Sections.
__UINT8_TYPE__ uint8_t
Definition: stdint.h:58