Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 1 | # originates from common-rom.ld |
| 2 | |
| 3 | zephyr_linker_section(NAME init KVMA RAM_REGION GROUP RODATA_REGION) |
Gerard Marull-Paretas | e42f58e | 2022-10-11 17:17:18 +0200 | [diff] [blame] | 4 | zephyr_linker_section_obj_level(SECTION init LEVEL EARLY) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 5 | zephyr_linker_section_obj_level(SECTION init LEVEL PRE_KERNEL_1) |
| 6 | zephyr_linker_section_obj_level(SECTION init LEVEL PRE_KERNEL_2) |
| 7 | zephyr_linker_section_obj_level(SECTION init LEVEL POST_KERNEL) |
| 8 | zephyr_linker_section_obj_level(SECTION init LEVEL APPLICATION) |
| 9 | zephyr_linker_section_obj_level(SECTION init LEVEL SMP) |
| 10 | |
Gerard Marull-Paretas | d0e58ad | 2023-04-26 10:30:28 +0200 | [diff] [blame] | 11 | zephyr_iterable_section(NAME device NUMERIC KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 12 | |
| 13 | if(CONFIG_GEN_SW_ISR_TABLE AND NOT CONFIG_DYNAMIC_INTERRUPTS) |
| 14 | # ld align has been changed to subalign to provide identical behavior scatter vs. ld. |
| 15 | zephyr_linker_section(NAME sw_isr_table KVMA FLASH GROUP RODATA_REGION SUBALIGN ${CONFIG_ARCH_SW_ISR_TABLE_ALIGN} NOINPUT) |
| 16 | zephyr_linker_section_configure( |
| 17 | SECTION sw_isr_table |
| 18 | INPUT ".gnu.linkonce.sw_isr_table*" |
| 19 | ) |
| 20 | endif() |
| 21 | |
| 22 | zephyr_linker_section(NAME initlevel_error KVMA RAM_REGION GROUP RODATA_REGION NOINPUT) |
| 23 | zephyr_linker_section_configure(SECTION initlevel_error INPUT ".z_init_[_A-Z0-9]*" KEEP SORT NAME) |
| 24 | # How to do cross linker ? |
| 25 | # ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.") |
| 26 | |
| 27 | |
Stephanos Ioannidis | 4a64bfe | 2022-12-09 06:16:44 +0900 | [diff] [blame] | 28 | if(CONFIG_CPP) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 29 | zephyr_linker_section(NAME ctors KVMA RAM_REGION GROUP RODATA_REGION NOINPUT) |
| 30 | # |
| 31 | # The compiler fills the constructor pointers table below, |
| 32 | # hence symbol __CTOR_LIST__ must be aligned on word |
Nazar Kazakov | 9713f0d | 2022-02-24 12:00:55 +0000 | [diff] [blame] | 33 | # boundary. To align with the C++ standard, the first element |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 34 | # of the array contains the number of actual constructors. The |
| 35 | # last element is NULL. |
| 36 | # |
| 37 | # ToDo: Checkup on scatter loading. How to manage ? |
| 38 | # https://www.keil.com/support/man/docs/armlink/armlink_pge1362066006368.htm |
| 39 | # https://developer.arm.com/documentation/dui0378/g/The-ARM-C-and-C---Libraries |
| 40 | # if(CONFIG_64BIT) |
| 41 | # . = ALIGN(8); |
| 42 | # __CTOR_LIST__ = .; |
| 43 | # QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) |
| 44 | # KEEP(*(SORT_BY_NAME(".ctors*"))) |
| 45 | # QUAD(0) |
| 46 | # __CTOR_END__ = .; |
| 47 | # else() |
| 48 | # . = ALIGN(4); |
| 49 | # __CTOR_LIST__ = .; |
| 50 | # LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
| 51 | # KEEP(*(SORT_BY_NAME(".ctors*"))) |
| 52 | # LONG(0) |
| 53 | # __CTOR_END__ = .; |
| 54 | # endif() |
| 55 | # } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
| 56 | # |
| 57 | # SECTION_PROLOGUE(init_array,,) |
| 58 | # { |
| 59 | # . = ALIGN(4); |
| 60 | # __init_array_start = .; |
| 61 | # KEEP(*(SORT_BY_NAME(".init_array*"))) |
| 62 | # __init_array_end = .; |
| 63 | # } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
| 64 | endif() |
| 65 | |
| 66 | if(CONFIG_USERSPACE) |
| 67 | # Build-time assignment of permissions to kernel objects to |
| 68 | # threads declared with K_THREAD_DEFINE() |
| 69 | zephyr_linker_section( |
| 70 | NAME z_object_assignment_area |
| 71 | VMA FLASH NOINPUT |
| 72 | SUBALIGN 4 |
| 73 | ) |
| 74 | zephyr_linker_section_configure( |
| 75 | SECTION z_object_assignment |
| 76 | INPUT ".z_object_assignment.static.*" |
| 77 | KEEP SORT NAME |
| 78 | ) |
| 79 | endif() |
| 80 | |
| 81 | zephyr_linker_section( |
| 82 | NAME app_shmem_regions |
| 83 | KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} |
| 84 | ) |
| 85 | zephyr_linker_section_configure( |
| 86 | SECTION app_shmem_regions |
| 87 | INPUT ".app_regions.*" |
| 88 | KEEP SORT NAME |
| 89 | ) |
| 90 | |
| 91 | if(CONFIG_NET_SOCKETS) |
| 92 | zephyr_iterable_section(NAME net_socket_register KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 93 | endif() |
| 94 | |
| 95 | |
| 96 | if(CONFIG_NET_L2_PPP) |
| 97 | zephyr_iterable_section(NAME ppp_protocol_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 98 | endif() |
| 99 | |
| 100 | zephyr_iterable_section(NAME bt_l2cap_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 101 | |
| 102 | if(CONFIG_BT_BREDR) |
| 103 | zephyr_iterable_section(NAME bt_l2cap_br_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 104 | endif() |
| 105 | |
| 106 | if(CONFIG_BT_CONN) |
| 107 | zephyr_iterable_section(NAME bt_conn_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 108 | endif() |
| 109 | |
| 110 | zephyr_iterable_section(NAME bt_gatt_service_static KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 111 | |
| 112 | if(CONFIG_BT_MESH) |
| 113 | zephyr_iterable_section(NAME bt_mesh_subnet_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 114 | zephyr_iterable_section(NAME bt_mesh_app_key_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 115 | |
| 116 | zephyr_iterable_section(NAME bt_mesh_hb_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 117 | endif() |
| 118 | |
| 119 | if(CONFIG_BT_MESH_FRIEND) |
| 120 | zephyr_iterable_section(NAME bt_mesh_friend_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 121 | endif() |
| 122 | |
| 123 | if(CONFIG_BT_MESH_LOW_POWER) |
| 124 | zephyr_iterable_section(NAME bt_mesh_lpn_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 125 | endif() |
| 126 | |
| 127 | if(CONFIG_BT_MESH_PROXY) |
| 128 | zephyr_iterable_section(NAME bt_mesh_proxy_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 129 | endif() |
| 130 | |
| 131 | if(CONFIG_EC_HOST_CMD) |
| 132 | zephyr_iterable_section(NAME ec_host_cmd_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 133 | endif() |
| 134 | |
| 135 | if(CONFIG_SETTINGS) |
| 136 | zephyr_iterable_section(NAME settings_handler_static KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 137 | endif() |
| 138 | |
Guangfu Hu | 335278d | 2023-05-19 10:26:13 +0800 | [diff] [blame] | 139 | if(CONFIG_SENSING) |
| 140 | zephyr_iterable_section(NAME sensing_sensor_info KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 141 | endif() |
| 142 | |
Maureen Helm | eee3d8f | 2022-08-16 19:09:18 -0500 | [diff] [blame] | 143 | if(CONFIG_SENSOR_INFO) |
| 144 | zephyr_iterable_section(NAME sensor_info KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 145 | endif() |
| 146 | |
Yuval Peress | ed380de | 2023-04-25 23:17:46 -0600 | [diff] [blame] | 147 | if(CONFIG_SENSOR_ASYNC_API) |
| 148 | zephyr_iterable_section(NAME sensor_decoder_api KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 149 | endif() |
| 150 | |
Jamie McCrae | d755710 | 2022-12-09 09:42:17 +0000 | [diff] [blame] | 151 | if(CONFIG_MCUMGR) |
| 152 | zephyr_iterable_section(NAME mcumgr_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 153 | endif() |
| 154 | |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 155 | zephyr_iterable_section(NAME k_p4wq_initparam KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 156 | |
| 157 | if(CONFIG_EMUL) |
Kumar Gala | 5c4d184 | 2023-04-07 11:39:45 -0500 | [diff] [blame] | 158 | zephyr_iterable_section(NAME emul KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 159 | endif() |
| 160 | |
| 161 | if(CONFIG_DNS_SD) |
| 162 | zephyr_iterable_section(NAME dns_sd_rec KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 163 | endif() |
| 164 | |
| 165 | if(CONFIG_PCIE) |
Kumar Gala | 7469ad4 | 2023-04-18 15:48:56 -0500 | [diff] [blame] | 166 | zephyr_iterable_section(NAME irq_alloc KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 167 | endif() |
| 168 | |
Kumar Gala | caea9dc | 2023-03-16 05:55:18 +0000 | [diff] [blame] | 169 | zephyr_iterable_section(NAME log_strings KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 170 | |
Kumar Gala | bae0a5b | 2023-03-16 05:50:14 +0000 | [diff] [blame] | 171 | zephyr_iterable_section(NAME log_const KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 172 | |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 173 | zephyr_iterable_section(NAME shell KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 174 | |
Kumar Gala | 6b5139c | 2023-03-15 22:41:45 +0000 | [diff] [blame] | 175 | zephyr_iterable_section(NAME shell_root_cmds KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 176 | |
| 177 | zephyr_iterable_section(NAME shell_subcmds KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 178 | |
| 179 | zephyr_iterable_section(NAME shell_dynamic_subcmds KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 180 | |
Kumar Gala | 47cf000 | 2023-04-18 13:56:26 -0500 | [diff] [blame] | 181 | zephyr_iterable_section(NAME cfb_font KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 182 | |
| 183 | zephyr_iterable_section(NAME tracing_backend KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 184 | |
| 185 | zephyr_linker_section(NAME zephyr_dbg_info KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 186 | zephyr_linker_section_configure(SECTION zephyr_dbg_info INPUT ".zephyr_dbg_info" KEEP) |
| 187 | |
Gerard Marull-Paretas | 48b201c | 2023-06-14 14:30:41 +0200 | [diff] [blame] | 188 | if (CONFIG_DEVICE_DEPS) |
| 189 | zephyr_linker_section(NAME device_deps KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} ENDALIGN 16) |
| 190 | zephyr_linker_section_configure(SECTION device_deps INPUT .__device_deps_pass1* KEEP SORT NAME PASS LINKER_DEVICE_DEPS_PASS1) |
| 191 | zephyr_linker_section_configure(SECTION device_deps INPUT .__device_deps_pass2* KEEP SORT NAME PASS NOT LINKER_DEVICE_DEPS_PASS1) |
| 192 | endif() |
Kumar Gala | 61f9d4b | 2023-03-17 15:27:31 +0000 | [diff] [blame] | 193 | |
| 194 | zephyr_iterable_section(NAME _static_thread_data KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Kumar Gala | ddddfd5 | 2023-03-16 17:52:14 +0000 | [diff] [blame] | 195 | |
| 196 | if (CONFIG_BT_IAS) |
| 197 | zephyr_iterable_section(NAME bt_ias_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 198 | endif() |
| 199 | |
| 200 | if (CONFIG_LOG) |
| 201 | zephyr_iterable_section(NAME log_link KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Kumar Gala | 9a77f3d | 2023-03-16 18:01:20 +0000 | [diff] [blame] | 202 | zephyr_iterable_section(NAME log_backend KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
Kumar Gala | ddddfd5 | 2023-03-16 17:52:14 +0000 | [diff] [blame] | 203 | endif() |
| 204 | |
| 205 | if (CONFIG_HTTP_SERVER) |
| 206 | zephyr_iterable_section(NAME http_service_desc KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 207 | endif() |
| 208 | |
| 209 | if(CONFIG_INPUT) |
| 210 | zephyr_iterable_section(NAME input_listener KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 211 | endif() |
| 212 | |
| 213 | if(CONFIG_USBD_MSC_CLASS) |
| 214 | zephyr_iterable_section(NAME usbd_msc_lun KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 215 | endif() |
Rodrigo Peixoto | 7e44469 | 2023-07-22 12:55:48 -0300 | [diff] [blame] | 216 | |
| 217 | if(CONFIG_ZBUS) |
| 218 | zephyr_iterable_section(NAME zbus_channel KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 219 | zephyr_iterable_section(NAME zbus_channel_observation KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 220 | endif() |