device: dynamic device handles were declared as const
When CONFIG_HAS_DYNAMIC_DEVICE_HANDLES is selected, devices handles are
placed in RAM region so that they can be modified at runtime. However,
the gen_handles.py script added the `const` attribute to the device
handle arrays regardless of this setting, leading to faults when running
the application. This may be an indicator that this feature is not
actively used.
Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/CMakeLists.txt b/CMakeLists.txt
index b2b8da8..90c60ba 100644
--- a/CMakeLists.txt
+++ b/CMakeLists.txt
@@ -897,6 +897,10 @@
)
if(CONFIG_HAS_DTS)
+ if(CONFIG_HAS_DYNAMIC_DEVICE_HANDLES)
+ set(dynamic_handles --dynamic-handles)
+ endif()
+
if(CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC)
set(number_of_dynamic_devices ${CONFIG_PM_DEVICE_POWER_DOMAIN_DYNAMIC_NUM})
else()
@@ -912,6 +916,7 @@
${ZEPHYR_BASE}/scripts/build/gen_handles.py
--output-source dev_handles.c
--output-graphviz dev_graph.dot
+ ${dynamic_handles}
--num-dynamic-devices ${number_of_dynamic_devices}
--kernel $<TARGET_FILE:${ZEPHYR_LINK_STAGE_EXECUTABLE}>
--zephyr-base ${ZEPHYR_BASE}