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, 4) \
9	ITERABLE_SECTION_RAM(net_if_dev, 4) \
10	ITERABLE_SECTION_RAM(net_l2, 4) \
11	ITERABLE_SECTION_RAM(eth_bridge, 4)
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#if CONFIG_PM_DEVICE
47	ITERABLE_SECTION_RAM(pm_device_slots, 4)
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, 4)
58	ITERABLE_SECTION_RAM(log_msg_ptr, 4)
59	ITERABLE_SECTION_RAM(log_dynamic, 4)
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, 4)
73	ITERABLE_SECTION_RAM_GC_ALLOWED(k_mem_slab, 4)
74	ITERABLE_SECTION_RAM_GC_ALLOWED(k_heap, 4)
75	ITERABLE_SECTION_RAM_GC_ALLOWED(k_mutex, 4)
76	ITERABLE_SECTION_RAM_GC_ALLOWED(k_stack, 4)
77	ITERABLE_SECTION_RAM_GC_ALLOWED(k_msgq, 4)
78	ITERABLE_SECTION_RAM_GC_ALLOWED(k_mbox, 4)
79	ITERABLE_SECTION_RAM_GC_ALLOWED(k_pipe, 4)
80	ITERABLE_SECTION_RAM_GC_ALLOWED(k_sem, 4)
81	ITERABLE_SECTION_RAM_GC_ALLOWED(k_event, 4)
82	ITERABLE_SECTION_RAM_GC_ALLOWED(k_queue, 4)
83	ITERABLE_SECTION_RAM_GC_ALLOWED(k_fifo, 4)
84	ITERABLE_SECTION_RAM_GC_ALLOWED(k_lifo, 4)
85	ITERABLE_SECTION_RAM_GC_ALLOWED(k_condvar, 4)
86	ITERABLE_SECTION_RAM_GC_ALLOWED(sys_mem_blocks_ptr, 4)
87
88	ITERABLE_SECTION_RAM(net_buf_pool, 4)
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, 4)
96#endif /* PCIE */
97
98#if defined(CONFIG_UART_MUX)
99	ITERABLE_SECTION_RAM(uart_mux, 4)
100#endif
101
102#if defined(CONFIG_USB_DEVICE_STACK)
103	SECTION_DATA_PROLOGUE(usb_descriptor,,SUBALIGN(1))
104	{
105		__usb_descriptor_start = .;
106		*(".usb.descriptor")
107		KEEP(*(SORT_BY_NAME(".usb.descriptor*")))
108		__usb_descriptor_end = .;
109	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
110
111	ITERABLE_SECTION_RAM(usb_cfg_data, 4)
112#endif /* CONFIG_USB_DEVICE_STACK */
113
114#if defined(CONFIG_USB_DEVICE_BOS)
115	SECTION_DATA_PROLOGUE(usb_bos_desc,,SUBALIGN(1))
116	{
117		__usb_bos_desc_start = .;
118		*(".usb.bos_desc")
119		KEEP(*(SORT_BY_NAME(".usb.bos_desc*")))
120		__usb_bos_desc_end = .;
121	} GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
122#endif /* CONFIG_USB_DEVICE_BOS */
123
124#if defined(CONFIG_RTIO)
125	ITERABLE_SECTION_RAM(rtio, 4)
126	ITERABLE_SECTION_RAM(rtio_iodev, 4)
127	ITERABLE_SECTION_RAM(rtio_sqe_pool, 4)
128	ITERABLE_SECTION_RAM(rtio_cqe_pool, 4)
129#endif /* CONFIG_RTIO */
130
131#if defined(CONFIG_SENSING)
132	ITERABLE_SECTION_RAM(sensing_sensor, 4)
133#endif /* CONFIG_SENSING */
134
135#if defined(CONFIG_ZBUS)
136	ITERABLE_SECTION_RAM(zbus_channel_observation_mask, 1)
137#endif /* CONFIG_ZBUS */
138
139#if defined(CONFIG_DEVICE_MUTABLE)
140	ITERABLE_SECTION_RAM(device_mutable, 4)
141#endif
142
143#ifdef CONFIG_USERSPACE
144	_static_kernel_objects_end = .;
145#endif
146