common-rom.ld 6.0 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228
  1. /* SPDX-License-Identifier: Apache-2.0 */
  2. SECTION_PROLOGUE(initlevel,,)
  3. {
  4. /*
  5. * link in initialization objects for all objects that are
  6. * automatically initialized by the kernel; the objects are
  7. * sorted in the order they will be initialized (i.e. ordered
  8. * by level, sorted by priority within a level)
  9. */
  10. __init_start = .;
  11. CREATE_OBJ_LEVEL(init, PRE_KERNEL_1)
  12. CREATE_OBJ_LEVEL(init, PRE_KERNEL_2)
  13. CREATE_OBJ_LEVEL(init, POST_KERNEL)
  14. CREATE_OBJ_LEVEL(init, APPLICATION)
  15. CREATE_OBJ_LEVEL(init, SMP)
  16. __init_end = .;
  17. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  18. SECTION_PROLOGUE(devices,,)
  19. {
  20. /* Link in devices objects, which are tied to the init ones;
  21. * the objects are thus sorted the same way as their init
  22. * object parent. See above and include/device.h.
  23. */
  24. __device_start = .;
  25. CREATE_OBJ_LEVEL(device, PRE_KERNEL_1)
  26. CREATE_OBJ_LEVEL(device, PRE_KERNEL_2)
  27. CREATE_OBJ_LEVEL(device, POST_KERNEL)
  28. CREATE_OBJ_LEVEL(device, APPLICATION)
  29. CREATE_OBJ_LEVEL(device, SMP)
  30. __device_end = .;
  31. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  32. #if defined(CONFIG_GEN_SW_ISR_TABLE) && !defined(CONFIG_DYNAMIC_INTERRUPTS)
  33. SECTION_PROLOGUE(sw_isr_table,,)
  34. {
  35. /*
  36. * Some arch requires an entry to be aligned to arch
  37. * specific boundary for using double word load
  38. * instruction. See include/sw_isr_table.h.
  39. */
  40. . = ALIGN(CONFIG_ARCH_SW_ISR_TABLE_ALIGN);
  41. *(_SW_ISR_TABLE_SECTION_SYMS)
  42. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  43. #endif
  44. /* verify we don't have rogue .z_init_<something> initlevel sections */
  45. SECTION_PROLOGUE(initlevel_error,,)
  46. {
  47. KEEP(*(SORT(.z_init_[_A-Z0-9]*)))
  48. }
  49. ASSERT(SIZEOF(initlevel_error) == 0, "Undefined initialization levels used.")
  50. #ifdef CONFIG_CPP_STATIC_INIT_GNU
  51. SECTION_PROLOGUE(_CTOR_SECTION_NAME,,)
  52. {
  53. /*
  54. * The compiler fills the constructor pointers table below,
  55. * hence symbol __CTOR_LIST__ must be aligned on word
  56. * boundary. To align with the C++ standard, the first elment
  57. * of the array contains the number of actual constructors. The
  58. * last element is NULL.
  59. */
  60. #ifdef CONFIG_64BIT
  61. . = ALIGN(8);
  62. __CTOR_LIST__ = .;
  63. QUAD((__CTOR_END__ - __CTOR_LIST__) / 8 - 2)
  64. KEEP(*(SORT_BY_NAME(".ctors*")))
  65. QUAD(0)
  66. __CTOR_END__ = .;
  67. #else
  68. . = ALIGN(4);
  69. __CTOR_LIST__ = .;
  70. LONG((__CTOR_END__ - __CTOR_LIST__) / 4 - 2)
  71. KEEP(*(SORT_BY_NAME(".ctors*")))
  72. LONG(0)
  73. __CTOR_END__ = .;
  74. #endif
  75. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  76. SECTION_PROLOGUE(init_array,,)
  77. {
  78. . = ALIGN(4);
  79. __init_array_start = .;
  80. KEEP(*(SORT_BY_NAME(".init_array*")))
  81. __init_array_end = .;
  82. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  83. #endif
  84. #ifdef CONFIG_USERSPACE
  85. /* Build-time assignment of permissions to kernel objects to
  86. * threads declared with K_THREAD_DEFINE()
  87. */
  88. ITERABLE_SECTION_ROM(z_object_assignment, 4)
  89. #endif
  90. SECTION_DATA_PROLOGUE(app_shmem_regions,,)
  91. {
  92. __app_shmem_regions_start = .;
  93. KEEP(*(SORT(.app_regions.*)));
  94. __app_shmem_regions_end = .;
  95. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  96. #if defined(CONFIG_NET_SOCKETS)
  97. ITERABLE_SECTION_ROM(net_socket_register, 4)
  98. #endif
  99. #if defined(CONFIG_NET_L2_PPP)
  100. ITERABLE_SECTION_ROM(ppp_protocol_handler, 4)
  101. #endif
  102. ITERABLE_SECTION_ROM(bt_l2cap_fixed_chan, 4)
  103. #if defined(CONFIG_BT_BREDR)
  104. ITERABLE_SECTION_ROM(bt_l2cap_br_fixed_chan, 4)
  105. #endif
  106. #if defined(CONFIG_BT_CONN)
  107. ITERABLE_SECTION_ROM(bt_conn_cb, 4)
  108. #endif
  109. ITERABLE_SECTION_ROM(bt_gatt_service_static, 4)
  110. #if defined(CONFIG_BT_MESH)
  111. ITERABLE_SECTION_ROM(bt_mesh_subnet_cb, 4)
  112. ITERABLE_SECTION_ROM(bt_mesh_app_key_cb, 4)
  113. ITERABLE_SECTION_ROM(bt_mesh_hb_cb, 4)
  114. #endif
  115. #if defined(CONFIG_BT_MESH_FRIEND)
  116. ITERABLE_SECTION_ROM(bt_mesh_friend_cb, 4)
  117. #endif
  118. #if defined(CONFIG_BT_MESH_LOW_POWER)
  119. ITERABLE_SECTION_ROM(bt_mesh_lpn_cb, 4)
  120. #endif
  121. #if defined(CONFIG_BT_MESH_GATT_PROXY)
  122. ITERABLE_SECTION_ROM(bt_mesh_proxy_cb, 4)
  123. #endif
  124. #if defined(CONFIG_EC_HOST_CMD)
  125. ITERABLE_SECTION_ROM(ec_host_cmd_handler, 4)
  126. #endif
  127. #if defined(CONFIG_SETTINGS)
  128. ITERABLE_SECTION_ROM(settings_handler_static, 4)
  129. #endif
  130. ITERABLE_SECTION_ROM(k_p4wq_initparam, 4)
  131. #if defined(CONFIG_EMUL)
  132. SECTION_DATA_PROLOGUE(emulators_section,,)
  133. {
  134. __emul_list_start = .;
  135. KEEP(*(SORT_BY_NAME(".emulators")));
  136. __emul_list_end = .;
  137. } GROUP_LINK_IN(ROMABLE_REGION)
  138. #endif /* CONFIG_EMUL */
  139. #if defined(CONFIG_DNS_SD)
  140. ITERABLE_SECTION_ROM(dns_sd_rec, 4)
  141. #endif
  142. #if defined(CONFIG_PCIE)
  143. SECTION_DATA_PROLOGUE(irq_alloc,,)
  144. {
  145. __irq_alloc_start = .;
  146. KEEP(*(SORT_BY_NAME("._irq_alloc*")));
  147. __irq_alloc_end = .;
  148. } GROUP_LINK_IN(ROMABLE_REGION)
  149. #endif /* CONFIG_PCIE */
  150. SECTION_DATA_PROLOGUE(log_strings_sections,,)
  151. {
  152. __log_strings_start = .;
  153. KEEP(*(SORT(.log_strings*)));
  154. __log_strings_end = .;
  155. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  156. SECTION_DATA_PROLOGUE(log_const_sections,,)
  157. {
  158. __log_const_start = .;
  159. KEEP(*(SORT(.log_const_*)));
  160. __log_const_end = .;
  161. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  162. SECTION_DATA_PROLOGUE(log_backends_sections,,)
  163. {
  164. __log_backends_start = .;
  165. KEEP(*("._log_backend.*"));
  166. __log_backends_end = .;
  167. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  168. ITERABLE_SECTION_ROM(shell, 4)
  169. SECTION_DATA_PROLOGUE(shell_root_cmds_sections,,)
  170. {
  171. __shell_root_cmds_start = .;
  172. KEEP(*(SORT(.shell_root_cmd_*)));
  173. __shell_root_cmds_end = .;
  174. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  175. SECTION_DATA_PROLOGUE(font_entry_sections,,)
  176. {
  177. __font_entry_start = .;
  178. KEEP(*(SORT_BY_NAME("._cfb_font.*")))
  179. __font_entry_end = .;
  180. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  181. ITERABLE_SECTION_ROM(tracing_backend, 4)
  182. SECTION_DATA_PROLOGUE(zephyr_dbg_info,,)
  183. {
  184. KEEP(*(".dbg_thread_info"));
  185. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)
  186. SECTION_DATA_PROLOGUE(device_handles,,)
  187. {
  188. __device_handles_start = .;
  189. #ifdef LINKER_ZEPHYR_FINAL
  190. KEEP(*(SORT(.__device_handles_pass2*)));
  191. #else /* LINKER_ZEPHYR_FINAL */
  192. KEEP(*(SORT(.__device_handles_pass1*)));
  193. #endif /* LINKER_ZEPHYR_FINAL */
  194. __device_handles_end = .;
  195. } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION)