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>
This commit is contained in:
Gerard Marull-Paretas 2023-06-14 10:15:12 +02:00 committed by Anas Nashif
commit e5335f345a
2 changed files with 15 additions and 3 deletions

View file

@ -897,6 +897,10 @@ zephyr_get_include_directories_for_lang(C
)
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 @@ if(CONFIG_HAS_DTS)
${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}