1# originates from common-rom.ld 2 3zephyr_linker_section(NAME init KVMA RAM_REGION GROUP RODATA_REGION) 4zephyr_linker_section_obj_level(SECTION init LEVEL EARLY) 5zephyr_linker_section_obj_level(SECTION init LEVEL PRE_KERNEL_1) 6zephyr_linker_section_obj_level(SECTION init LEVEL PRE_KERNEL_2) 7zephyr_linker_section_obj_level(SECTION init LEVEL POST_KERNEL) 8zephyr_linker_section_obj_level(SECTION init LEVEL APPLICATION) 9zephyr_linker_section_obj_level(SECTION init LEVEL SMP) 10 11zephyr_linker_section(NAME deferred_init_list KVMA RAM_REGION GROUP RODATA_REGION) 12zephyr_linker_section_configure(SECTION deferred_init_list INPUT ".z_deferred_init*" KEEP SORT NAME) 13 14zephyr_iterable_section(NAME device NUMERIC KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 15 16if(CONFIG_GEN_SW_ISR_TABLE AND NOT CONFIG_DYNAMIC_INTERRUPTS) 17 # ld align has been changed to subalign to provide identical behavior scatter vs. ld. 18 zephyr_linker_section(NAME sw_isr_table KVMA FLASH GROUP RODATA_REGION SUBALIGN ${CONFIG_ARCH_SW_ISR_TABLE_ALIGN} NOINPUT) 19 zephyr_linker_section_configure( 20 SECTION sw_isr_table 21 INPUT ".gnu.linkonce.sw_isr_table*" 22 ) 23endif() 24 25zephyr_linker_section(NAME initlevel_error KVMA RAM_REGION GROUP RODATA_REGION NOINPUT) 26zephyr_linker_section_configure(SECTION initlevel_error INPUT ".z_init_[_A-Z0-9]*" KEEP SORT NAME) 27# How to do cross linker ? 28# ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.") 29 30 31if(CONFIG_CPP) 32 zephyr_linker_section(NAME ctors KVMA RAM_REGION GROUP RODATA_REGION NOINPUT) 33 # 34 # The compiler fills the constructor pointers table below, 35 # hence symbol __CTOR_LIST__ must be aligned on word 36 # boundary. To align with the C++ standard, the first element 37 # of the array contains the number of actual constructors. The 38 # last element is NULL. 39 # 40# ToDo: Checkup on scatter loading. How to manage ? 41# https://www.keil.com/support/man/docs/armlink/armlink_pge1362066006368.htm 42# https://developer.arm.com/documentation/dui0378/g/The-ARM-C-and-C---Libraries 43# if(CONFIG_64BIT) 44# . = ALIGN(8); 45# __CTOR_LIST__ = .; 46# QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) 47# KEEP(*(SORT_BY_NAME(".ctors*"))) 48# QUAD(0) 49# __CTOR_END__ = .; 50# else() 51# . = ALIGN(4); 52# __CTOR_LIST__ = .; 53# LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) 54# KEEP(*(SORT_BY_NAME(".ctors*"))) 55# LONG(0) 56# __CTOR_END__ = .; 57# endif() 58# } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) 59# 60# SECTION_PROLOGUE(init_array,,) 61# { 62# . = ALIGN(4); 63# __init_array_start = .; 64# KEEP(*(SORT_BY_NAME(".init_array*"))) 65# __init_array_end = .; 66# } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) 67endif() 68 69if(CONFIG_USERSPACE) 70 # Build-time assignment of permissions to kernel objects to 71 # threads declared with K_THREAD_DEFINE() 72 zephyr_linker_section( 73 NAME k_object_assignment_area 74 VMA FLASH NOINPUT 75 SUBALIGN 4 76 ) 77 zephyr_linker_section_configure( 78 SECTION k_object_assignment 79 INPUT ".k_object_assignment.static.*" 80 KEEP SORT NAME 81 ) 82endif() 83 84zephyr_linker_section( 85 NAME app_shmem_regions 86 KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} 87) 88zephyr_linker_section_configure( 89 SECTION app_shmem_regions 90 INPUT ".app_regions.*" 91 KEEP SORT NAME 92) 93 94if(CONFIG_NET_SOCKETS) 95 zephyr_iterable_section(NAME net_socket_register KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 96endif() 97 98 99if(CONFIG_NET_L2_PPP) 100 zephyr_iterable_section(NAME ppp_protocol_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 101endif() 102 103zephyr_iterable_section(NAME bt_l2cap_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 104 105if(CONFIG_BT_CLASSIC) 106 zephyr_iterable_section(NAME bt_l2cap_br_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 107endif() 108 109if(CONFIG_BT_CONN) 110 zephyr_iterable_section(NAME bt_conn_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 111endif() 112 113zephyr_iterable_section(NAME bt_gatt_service_static KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 114 115if(CONFIG_BT_MESH) 116 zephyr_iterable_section(NAME bt_mesh_subnet_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 117 zephyr_iterable_section(NAME bt_mesh_app_key_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 118 119 zephyr_iterable_section(NAME bt_mesh_hb_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 120endif() 121 122if(CONFIG_BT_MESH_FRIEND) 123 zephyr_iterable_section(NAME bt_mesh_friend_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 124endif() 125 126if(CONFIG_BT_MESH_LOW_POWER) 127 zephyr_iterable_section(NAME bt_mesh_lpn_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 128endif() 129 130if(CONFIG_BT_MESH_PROXY) 131 zephyr_iterable_section(NAME bt_mesh_proxy_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 132endif() 133 134if(CONFIG_EC_HOST_CMD) 135 zephyr_iterable_section(NAME ec_host_cmd_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 136endif() 137 138if(CONFIG_SETTINGS) 139 zephyr_iterable_section(NAME settings_handler_static KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 140endif() 141 142if(CONFIG_SENSING) 143 zephyr_iterable_section(NAME sensing_sensor_info KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 144endif() 145 146if(CONFIG_SENSOR_INFO) 147 zephyr_iterable_section(NAME sensor_info KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 148endif() 149 150if(CONFIG_SENSOR_ASYNC_API) 151 zephyr_iterable_section(NAME sensor_decoder_api KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 152endif() 153 154if(CONFIG_MCUMGR) 155 zephyr_iterable_section(NAME mcumgr_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 156endif() 157 158zephyr_iterable_section(NAME k_p4wq_initparam KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 159 160if(CONFIG_EMUL) 161 zephyr_iterable_section(NAME emul KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 162endif() 163 164if(CONFIG_DNS_SD) 165 zephyr_iterable_section(NAME dns_sd_rec KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 166endif() 167 168if(CONFIG_PCIE) 169 zephyr_iterable_section(NAME irq_alloc KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 170endif() 171 172zephyr_iterable_section(NAME log_strings KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 173 174zephyr_iterable_section(NAME log_const KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 175 176zephyr_iterable_section(NAME shell KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 177 178zephyr_iterable_section(NAME shell_root_cmds KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 179 180zephyr_iterable_section(NAME shell_subcmds KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 181 182zephyr_iterable_section(NAME shell_dynamic_subcmds KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 183 184zephyr_iterable_section(NAME cfb_font KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 185 186zephyr_iterable_section(NAME tracing_backend KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 187 188zephyr_linker_section(NAME zephyr_dbg_info KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) 189zephyr_linker_section_configure(SECTION zephyr_dbg_info INPUT ".zephyr_dbg_info" KEEP) 190 191if(CONFIG_SYMTAB) 192 zephyr_linker_section(NAME symtab KVMA FLASH GROUP RODATA_REGION SUBALIGN 4 NOINPUT) 193 zephyr_linker_section_configure(SECTION symtab INPUT ".gnu.linkonce.symtab*") 194endif() 195 196if (CONFIG_DEVICE_DEPS) 197 zephyr_linker_section(NAME device_deps KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} ENDALIGN 16) 198 zephyr_linker_section_configure(SECTION device_deps INPUT .__device_deps_pass1* KEEP SORT NAME PASS LINKER_DEVICE_DEPS_PASS1) 199 zephyr_linker_section_configure(SECTION device_deps INPUT .__device_deps_pass2* KEEP SORT NAME PASS NOT LINKER_DEVICE_DEPS_PASS1) 200endif() 201 202zephyr_iterable_section(NAME _static_thread_data KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 203 204if (CONFIG_BT_IAS) 205 zephyr_iterable_section(NAME bt_ias_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 206endif() 207 208if (CONFIG_LOG) 209 zephyr_iterable_section(NAME log_link KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 210 zephyr_iterable_section(NAME log_backend KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 211endif() 212 213if (CONFIG_MULTI_LEVEL_INTERRUPTS) 214 zephyr_iterable_section(NAME intc_table KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) 215endif() 216 217if (CONFIG_HTTP_SERVER) 218 zephyr_iterable_section(NAME http_service_desc KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 219endif() 220 221if (CONFIG_COAP_SERVER) 222 zephyr_iterable_section(NAME coap_service KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 223endif() 224 225if (CONFIG_NET_MGMT) 226 zephyr_iterable_section(NAME net_mgmt_event_static_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 227endif() 228 229if(CONFIG_INPUT) 230 zephyr_iterable_section(NAME input_callback KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 231endif() 232 233if(CONFIG_USBD_MSC_CLASS) 234 zephyr_iterable_section(NAME usbd_msc_lun KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 235endif() 236 237if(CONFIG_ZBUS) 238 zephyr_iterable_section(NAME zbus_channel KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 239 zephyr_iterable_section(NAME zbus_observer KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 240 zephyr_iterable_section(NAME zbus_channel_observation KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 241endif() 242 243if(CONFIG_GNSS) 244 zephyr_iterable_section(NAME gnss_data_callback KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 245endif() 246 247if(CONFIG_GNSS_SATELLITES) 248 zephyr_iterable_section(NAME gnss_satellites_callback KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN ${CONFIG_LINKER_ITERABLE_SUBALIGN}) 249endif() 250