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