1/* SPDX-License-Identifier: Apache-2.0 */
2
3#include <zephyr/linker/iterable_sections.h>
4
5#if defined(CONFIG_NETWORKING)
6#ifndef NETWORK_RAM_SECTIONS
7#define NETWORK_RAM_SECTIONS \
8	ITERABLE_SECTION_RAM(net_if, Z_LINK_ITERABLE_SUBALIGN) \
9	ITERABLE_SECTION_RAM(net_if_dev, Z_LINK_ITERABLE_SUBALIGN) \
10	ITERABLE_SECTION_RAM(net_l2, Z_LINK_ITERABLE_SUBALIGN) \
11	ITERABLE_SECTION_RAM(eth_bridge, Z_LINK_ITERABLE_SUBALIGN)
12#endif
13#endif /* NETWORKING */
14
15#if defined(CONFIG_GEN_SW_ISR_TABLE) && defined(CONFIG_DYNAMIC_INTERRUPTS)
16	SECTION_DATA_PROLOGUE(sw_isr_table,,)
17	{
18		/*
19		 * Some arch requires an entry to be aligned to arch
20		 * specific boundary for using double word load
21		 * instruction.  See include/sw_isr_table.h.
22		 */
23		. = ALIGN(CONFIG_ARCH_SW_ISR_TABLE_ALIGN);
24		*(_SW_ISR_TABLE_SECTION_SYMS)
25	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
26
27#if defined(CONFIG_SHARED_INTERRUPTS)
28	SECTION_DATA_PROLOGUE(shared_sw_isr_table,,)
29	{
30		/* TODO: does this section require alignment? */
31		KEEP(*(_SHARED_SW_ISR_TABLE_SECTION_SYMS))
32	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
33#endif
34
35#endif
36
37        SECTION_DATA_PROLOGUE(device_states,,)
38        {
39		/* Device states used by the device objects. */
40                __device_states_start = .;
41		KEEP(*(".z_devstate"));
42		KEEP(*(".z_devstate.*"));
43                __device_states_end = .;
44        } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
45
46#ifdef CONFIG_PM_DEVICE
47	ITERABLE_SECTION_RAM(pm_device_slots, Z_LINK_ITERABLE_SUBALIGN)
48#endif
49
50#if defined(CONFIG_DEVICE_DEPS_DYNAMIC)
51	SECTION_DATA_PROLOGUE(device_deps,,)
52	{
53#include "device-deps.ld"
54	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
55#endif 	/* CONFIG_DEVICE_DEPS_DYNAMIC */
56
57	ITERABLE_SECTION_RAM_GC_ALLOWED(log_mpsc_pbuf, Z_LINK_ITERABLE_SUBALIGN)
58	ITERABLE_SECTION_RAM(log_msg_ptr, Z_LINK_ITERABLE_SUBALIGN)
59	ITERABLE_SECTION_RAM(log_dynamic, Z_LINK_ITERABLE_SUBALIGN)
60
61#ifdef CONFIG_USERSPACE
62	/* All kernel objects within are assumed to be either completely
63	 * initialized at build time, or initialized automatically at runtime
64	 * via iteration before the POST_KERNEL phase.
65	 *
66	 * These two symbols only used by gen_kobject_list.py
67	 */
68
69	_static_kernel_objects_begin = .;
70#endif /* CONFIG_USERSPACE */
71
72	ITERABLE_SECTION_RAM_GC_ALLOWED(k_timer, Z_LINK_ITERABLE_SUBALIGN)
73	ITERABLE_SECTION_RAM_GC_ALLOWED(k_mem_slab, Z_LINK_ITERABLE_SUBALIGN)
74	ITERABLE_SECTION_RAM_GC_ALLOWED(k_heap, Z_LINK_ITERABLE_SUBALIGN)
75	ITERABLE_SECTION_RAM_GC_ALLOWED(k_mutex, Z_LINK_ITERABLE_SUBALIGN)
76	ITERABLE_SECTION_RAM_GC_ALLOWED(k_stack, Z_LINK_ITERABLE_SUBALIGN)
77	ITERABLE_SECTION_RAM_GC_ALLOWED(k_msgq, Z_LINK_ITERABLE_SUBALIGN)
78	ITERABLE_SECTION_RAM_GC_ALLOWED(k_mbox, Z_LINK_ITERABLE_SUBALIGN)
79	ITERABLE_SECTION_RAM_GC_ALLOWED(k_pipe, Z_LINK_ITERABLE_SUBALIGN)
80	ITERABLE_SECTION_RAM_GC_ALLOWED(k_sem, Z_LINK_ITERABLE_SUBALIGN)
81	ITERABLE_SECTION_RAM_GC_ALLOWED(k_event, Z_LINK_ITERABLE_SUBALIGN)
82	ITERABLE_SECTION_RAM_GC_ALLOWED(k_queue, Z_LINK_ITERABLE_SUBALIGN)
83	ITERABLE_SECTION_RAM_GC_ALLOWED(k_fifo, Z_LINK_ITERABLE_SUBALIGN)
84	ITERABLE_SECTION_RAM_GC_ALLOWED(k_lifo, Z_LINK_ITERABLE_SUBALIGN)
85	ITERABLE_SECTION_RAM_GC_ALLOWED(k_condvar, Z_LINK_ITERABLE_SUBALIGN)
86	ITERABLE_SECTION_RAM_GC_ALLOWED(sys_mem_blocks_ptr, Z_LINK_ITERABLE_SUBALIGN)
87
88	ITERABLE_SECTION_RAM(net_buf_pool, Z_LINK_ITERABLE_SUBALIGN)
89
90#if defined(CONFIG_NETWORKING)
91	NETWORK_RAM_SECTIONS
92#endif /* NETWORKING */
93
94#if defined(CONFIG_PCIE)
95	ITERABLE_SECTION_RAM(pcie_dev, Z_LINK_ITERABLE_SUBALIGN)
96#endif /* PCIE */
97
98#if defined(CONFIG_USB_DEVICE_STACK)
99	SECTION_DATA_PROLOGUE(usb_descriptor,,SUBALIGN(1))
100	{
101		__usb_descriptor_start = .;
102		*(".usb.descriptor")
103		KEEP(*(SORT_BY_NAME(".usb.descriptor*")))
104		__usb_descriptor_end = .;
105	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
106
107	ITERABLE_SECTION_RAM(usb_cfg_data, Z_LINK_ITERABLE_SUBALIGN)
108#endif /* CONFIG_USB_DEVICE_STACK */
109
110#if defined(CONFIG_USB_DEVICE_BOS)
111	SECTION_DATA_PROLOGUE(usb_bos_desc,,SUBALIGN(1))
112	{
113		__usb_bos_desc_start = .;
114		*(".usb.bos_desc")
115		KEEP(*(SORT_BY_NAME(".usb.bos_desc*")))
116		__usb_bos_desc_end = .;
117	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
118#endif /* CONFIG_USB_DEVICE_BOS */
119
120#if defined(CONFIG_RTIO)
121	ITERABLE_SECTION_RAM(rtio, Z_LINK_ITERABLE_SUBALIGN)
122	ITERABLE_SECTION_RAM(rtio_iodev, Z_LINK_ITERABLE_SUBALIGN)
123	ITERABLE_SECTION_RAM(rtio_sqe_pool, Z_LINK_ITERABLE_SUBALIGN)
124	ITERABLE_SECTION_RAM(rtio_cqe_pool, Z_LINK_ITERABLE_SUBALIGN)
125#endif /* CONFIG_RTIO */
126
127#if defined(CONFIG_SENSING)
128	ITERABLE_SECTION_RAM(sensing_sensor, Z_LINK_ITERABLE_SUBALIGN)
129#endif /* CONFIG_SENSING */
130
131#if defined(CONFIG_ZBUS)
132	ITERABLE_SECTION_RAM(zbus_channel_observation_mask, 1)
133#endif /* CONFIG_ZBUS */
134
135#if defined(CONFIG_DEVICE_MUTABLE)
136	ITERABLE_SECTION_RAM(device_mutable, Z_LINK_ITERABLE_SUBALIGN)
137#endif
138
139#if defined(CONFIG_BT_ZEPHYR_NUS)
140	ITERABLE_SECTION_RAM(bt_nus_inst, Z_LINK_ITERABLE_SUBALIGN)
141#endif
142
143#ifdef CONFIG_USERSPACE
144	_static_kernel_objects_end = .;
145#endif
146