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 | |
| 11 | zephyr_linker_section(NAME device KVMA RAM_REGION GROUP RODATA_REGION) |
Gerard Marull-Paretas | e42f58e | 2022-10-11 17:17:18 +0200 | [diff] [blame] | 12 | zephyr_linker_section_obj_level(SECTION device LEVEL EARLY) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 13 | zephyr_linker_section_obj_level(SECTION device LEVEL PRE_KERNEL_1) |
| 14 | zephyr_linker_section_obj_level(SECTION device LEVEL PRE_KERNEL_2) |
| 15 | zephyr_linker_section_obj_level(SECTION device LEVEL POST_KERNEL) |
| 16 | zephyr_linker_section_obj_level(SECTION device LEVEL APPLICATION) |
| 17 | zephyr_linker_section_obj_level(SECTION device LEVEL SMP) |
| 18 | |
| 19 | if(CONFIG_GEN_SW_ISR_TABLE AND NOT CONFIG_DYNAMIC_INTERRUPTS) |
| 20 | # ld align has been changed to subalign to provide identical behavior scatter vs. ld. |
| 21 | zephyr_linker_section(NAME sw_isr_table KVMA FLASH GROUP RODATA_REGION SUBALIGN ${CONFIG_ARCH_SW_ISR_TABLE_ALIGN} NOINPUT) |
| 22 | zephyr_linker_section_configure( |
| 23 | SECTION sw_isr_table |
| 24 | INPUT ".gnu.linkonce.sw_isr_table*" |
| 25 | ) |
| 26 | endif() |
| 27 | |
| 28 | zephyr_linker_section(NAME initlevel_error KVMA RAM_REGION GROUP RODATA_REGION NOINPUT) |
| 29 | zephyr_linker_section_configure(SECTION initlevel_error INPUT ".z_init_[_A-Z0-9]*" KEEP SORT NAME) |
| 30 | # How to do cross linker ? |
| 31 | # ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.") |
| 32 | |
| 33 | |
| 34 | if(CONFIG_CPLUSPLUS) |
| 35 | zephyr_linker_section(NAME ctors KVMA RAM_REGION GROUP RODATA_REGION NOINPUT) |
| 36 | # |
| 37 | # The compiler fills the constructor pointers table below, |
| 38 | # hence symbol __CTOR_LIST__ must be aligned on word |
Nazar Kazakov | 9713f0d | 2022-02-24 12:00:55 +0000 | [diff] [blame] | 39 | # boundary. To align with the C++ standard, the first element |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 40 | # of the array contains the number of actual constructors. The |
| 41 | # last element is NULL. |
| 42 | # |
| 43 | # ToDo: Checkup on scatter loading. How to manage ? |
| 44 | # https://www.keil.com/support/man/docs/armlink/armlink_pge1362066006368.htm |
| 45 | # https://developer.arm.com/documentation/dui0378/g/The-ARM-C-and-C---Libraries |
| 46 | # if(CONFIG_64BIT) |
| 47 | # . = ALIGN(8); |
| 48 | # __CTOR_LIST__ = .; |
| 49 | # QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2) |
| 50 | # KEEP(*(SORT_BY_NAME(".ctors*"))) |
| 51 | # QUAD(0) |
| 52 | # __CTOR_END__ = .; |
| 53 | # else() |
| 54 | # . = ALIGN(4); |
| 55 | # __CTOR_LIST__ = .; |
| 56 | # LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2) |
| 57 | # KEEP(*(SORT_BY_NAME(".ctors*"))) |
| 58 | # LONG(0) |
| 59 | # __CTOR_END__ = .; |
| 60 | # endif() |
| 61 | # } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
| 62 | # |
| 63 | # SECTION_PROLOGUE(init_array,,) |
| 64 | # { |
| 65 | # . = ALIGN(4); |
| 66 | # __init_array_start = .; |
| 67 | # KEEP(*(SORT_BY_NAME(".init_array*"))) |
| 68 | # __init_array_end = .; |
| 69 | # } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) |
| 70 | endif() |
| 71 | |
| 72 | if(CONFIG_USERSPACE) |
| 73 | # Build-time assignment of permissions to kernel objects to |
| 74 | # threads declared with K_THREAD_DEFINE() |
| 75 | zephyr_linker_section( |
| 76 | NAME z_object_assignment_area |
| 77 | VMA FLASH NOINPUT |
| 78 | SUBALIGN 4 |
| 79 | ) |
| 80 | zephyr_linker_section_configure( |
| 81 | SECTION z_object_assignment |
| 82 | INPUT ".z_object_assignment.static.*" |
| 83 | KEEP SORT NAME |
| 84 | ) |
| 85 | endif() |
| 86 | |
| 87 | zephyr_linker_section( |
| 88 | NAME app_shmem_regions |
| 89 | KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} |
| 90 | ) |
| 91 | zephyr_linker_section_configure( |
| 92 | SECTION app_shmem_regions |
| 93 | INPUT ".app_regions.*" |
| 94 | KEEP SORT NAME |
| 95 | ) |
| 96 | |
| 97 | if(CONFIG_NET_SOCKETS) |
| 98 | zephyr_iterable_section(NAME net_socket_register KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 99 | endif() |
| 100 | |
| 101 | |
| 102 | if(CONFIG_NET_L2_PPP) |
| 103 | zephyr_iterable_section(NAME ppp_protocol_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 104 | endif() |
| 105 | |
| 106 | zephyr_iterable_section(NAME bt_l2cap_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 107 | |
| 108 | if(CONFIG_BT_BREDR) |
| 109 | zephyr_iterable_section(NAME bt_l2cap_br_fixed_chan KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 110 | endif() |
| 111 | |
| 112 | if(CONFIG_BT_CONN) |
| 113 | zephyr_iterable_section(NAME bt_conn_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 114 | endif() |
| 115 | |
| 116 | zephyr_iterable_section(NAME bt_gatt_service_static KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 117 | |
| 118 | if(CONFIG_BT_MESH) |
| 119 | zephyr_iterable_section(NAME bt_mesh_subnet_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 120 | zephyr_iterable_section(NAME bt_mesh_app_key_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 121 | |
| 122 | zephyr_iterable_section(NAME bt_mesh_hb_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 123 | endif() |
| 124 | |
| 125 | if(CONFIG_BT_MESH_FRIEND) |
| 126 | zephyr_iterable_section(NAME bt_mesh_friend_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 127 | endif() |
| 128 | |
| 129 | if(CONFIG_BT_MESH_LOW_POWER) |
| 130 | zephyr_iterable_section(NAME bt_mesh_lpn_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 131 | endif() |
| 132 | |
| 133 | if(CONFIG_BT_MESH_PROXY) |
| 134 | zephyr_iterable_section(NAME bt_mesh_proxy_cb KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 135 | endif() |
| 136 | |
| 137 | if(CONFIG_EC_HOST_CMD) |
| 138 | zephyr_iterable_section(NAME ec_host_cmd_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 139 | endif() |
| 140 | |
| 141 | if(CONFIG_SETTINGS) |
| 142 | zephyr_iterable_section(NAME settings_handler_static KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 143 | endif() |
| 144 | |
Maureen Helm | eee3d8f | 2022-08-16 19:09:18 -0500 | [diff] [blame] | 145 | if(CONFIG_SENSOR_INFO) |
| 146 | zephyr_iterable_section(NAME sensor_info KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 147 | endif() |
| 148 | |
Jamie McCrae | d755710 | 2022-12-09 09:42:17 +0000 | [diff] [blame^] | 149 | if(CONFIG_MCUMGR) |
| 150 | zephyr_iterable_section(NAME mcumgr_handler KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 151 | endif() |
| 152 | |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 153 | zephyr_iterable_section(NAME k_p4wq_initparam KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 154 | |
| 155 | if(CONFIG_EMUL) |
Abe Levkoy | 63d75cc | 2022-05-23 12:28:48 -0600 | [diff] [blame] | 156 | zephyr_linker_section(NAME emulators_section GROUP RODATA_REGION ${XIP_ALIGN_WITH_INPUT}) |
| 157 | zephyr_linker_section_configure(SECTION emulators_section INPUT ".emulators" KEEP SORT NAME) |
Torsten Rasmussen | 3804029 | 2021-05-06 11:49:35 +0200 | [diff] [blame] | 158 | endif() |
| 159 | |
| 160 | if(CONFIG_DNS_SD) |
| 161 | zephyr_iterable_section(NAME dns_sd_rec KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 162 | endif() |
| 163 | |
| 164 | if(CONFIG_PCIE) |
| 165 | zephyr_linker_section(NAME irq_alloc GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 166 | zephyr_linker_section_configure(SECTION irq_alloc INPUT ".irq_alloc*" KEEP SORT NAME) |
| 167 | endif() |
| 168 | |
| 169 | zephyr_linker_section(NAME log_strings KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 170 | zephyr_linker_section_configure(SECTION log_strings INPUT ".log_strings*" KEEP SORT NAME) |
| 171 | |
| 172 | zephyr_linker_section(NAME log_const KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 173 | zephyr_linker_section_configure(SECTION log_const INPUT ".log_const_*" KEEP SORT NAME) |
| 174 | |
| 175 | zephyr_linker_section(NAME log_backends KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 176 | zephyr_linker_section_configure(SECTION log_backends INPUT ".log_backends.*" KEEP) |
| 177 | |
| 178 | zephyr_iterable_section(NAME shell KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 179 | |
| 180 | zephyr_linker_section(NAME shell_root_cmds KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 181 | zephyr_linker_section_configure(SECTION shell_root_cmds INPUT ".shell_root_cmd_*" KEEP SORT NAME) |
| 182 | |
| 183 | zephyr_linker_section(NAME font_entry KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 184 | zephyr_linker_section_configure(SECTION font_entry INPUT "._cfb_font.*" KEEP SORT NAME) |
| 185 | |
| 186 | zephyr_iterable_section(NAME tracing_backend KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4) |
| 187 | |
| 188 | zephyr_linker_section(NAME zephyr_dbg_info KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) |
| 189 | zephyr_linker_section_configure(SECTION zephyr_dbg_info INPUT ".zephyr_dbg_info" KEEP) |
| 190 | |
| 191 | zephyr_linker_section(NAME device_handles KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} ENDALIGN 16) |
Jordan Yates | 28b2e55 | 2021-10-20 20:19:28 +1000 | [diff] [blame] | 192 | zephyr_linker_section_configure(SECTION device_handles INPUT .__device_handles_pass1* KEEP SORT NAME PASS LINKER_DEVICE_HANDLES_PASS1) |
| 193 | zephyr_linker_section_configure(SECTION device_handles INPUT .__device_handles_pass2* KEEP SORT NAME PASS NOT LINKER_DEVICE_HANDLES_PASS1) |