device: s/device_handles/device_deps/ in linker scripts Use the "device_deps" naming scheme to emphasize we are storing device dependencies. The fact we are using device handles to store them is an implementation detail. Signed-off-by: Gerard Marull-Paretas <gerard.marull@nordicsemi.no>
diff --git a/CMakeLists.txt b/CMakeLists.txt index 11a9dff..d295a0c 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt
@@ -942,8 +942,8 @@ ) set_property(GLOBAL APPEND PROPERTY GENERATED_APP_SOURCE_FILES device_deps.c) - # gen_device_deps runs on `__device_handles_pass1` so pass this info to the linker script generator - list(APPEND LINKER_PASS_${ZEPHYR_CURRENT_LINKER_PASS}_DEFINE "LINKER_DEVICE_HANDLES_PASS1") + # gen_device_deps runs on `__device_deps_pass1` so pass this info to the linker script generator + list(APPEND LINKER_PASS_${ZEPHYR_CURRENT_LINKER_PASS}_DEFINE "LINKER_DEVICE_DEPS_PASS1") endif() if(CONFIG_CODE_DATA_RELOCATION)
diff --git a/cmake/linker_script/common/common-rom.cmake b/cmake/linker_script/common/common-rom.cmake index 811a681..4417d10 100644 --- a/cmake/linker_script/common/common-rom.cmake +++ b/cmake/linker_script/common/common-rom.cmake
@@ -185,9 +185,9 @@ zephyr_linker_section(NAME zephyr_dbg_info KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT}) zephyr_linker_section_configure(SECTION zephyr_dbg_info INPUT ".zephyr_dbg_info" KEEP) -zephyr_linker_section(NAME device_handles KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} ENDALIGN 16) -zephyr_linker_section_configure(SECTION device_handles INPUT .__device_handles_pass1* KEEP SORT NAME PASS LINKER_DEVICE_HANDLES_PASS1) -zephyr_linker_section_configure(SECTION device_handles INPUT .__device_handles_pass2* KEEP SORT NAME PASS NOT LINKER_DEVICE_HANDLES_PASS1) +zephyr_linker_section(NAME device_deps KVMA RAM_REGION GROUP RODATA_REGION NOINPUT ${XIP_ALIGN_WITH_INPUT} ENDALIGN 16) +zephyr_linker_section_configure(SECTION device_deps INPUT .__device_deps_pass1* KEEP SORT NAME PASS LINKER_DEVICE_DEPS_PASS1) +zephyr_linker_section_configure(SECTION device_deps INPUT .__device_deps_pass2* KEEP SORT NAME PASS NOT LINKER_DEVICE_DEPS_PASS1) zephyr_iterable_section(NAME _static_thread_data KVMA RAM_REGION GROUP RODATA_REGION SUBALIGN 4)
diff --git a/include/zephyr/device.h b/include/zephyr/device.h index 53a9771..0b48744 100644 --- a/include/zephyr/device.h +++ b/include/zephyr/device.h
@@ -778,7 +778,7 @@ /** @brief Linker section were device handles are placed. */ #define Z_DEVICE_HANDLES_SECTION \ - __attribute__((__section__(".__device_handles_pass1"))) + __attribute__((__section__(".__device_deps_pass1"))) #ifdef __cplusplus #define Z_DEVICE_HANDLES_EXTERN extern
diff --git a/include/zephyr/linker/common-ram.ld b/include/zephyr/linker/common-ram.ld index a298393..269d56b 100644 --- a/include/zephyr/linker/common-ram.ld +++ b/include/zephyr/linker/common-ram.ld
@@ -43,9 +43,9 @@ #endif #if defined(CONFIG_HAS_DYNAMIC_DEVICE_HANDLES) - SECTION_DATA_PROLOGUE(device_handles,,) + SECTION_DATA_PROLOGUE(device_deps,,) { -#include "device-handles.ld" +#include "device-deps.ld" } GROUP_DATA_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) #endif /* CONFIG_HAS_DYNAMIC_DEVICE_HANDLES */
diff --git a/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld b/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld index 3c677cd..b7acb08 100644 --- a/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld +++ b/include/zephyr/linker/common-rom/common-rom-kernel-devices.ld
@@ -65,8 +65,8 @@ #endif /* CONFIG_PCIE */ #if !defined(CONFIG_HAS_DYNAMIC_DEVICE_HANDLES) - SECTION_DATA_PROLOGUE(device_handles,,) + SECTION_DATA_PROLOGUE(device_deps,,) { -#include <zephyr/linker/device-handles.ld> +#include <zephyr/linker/device-deps.ld> } GROUP_ROM_LINK_IN(RAMABLE_REGION, ROMABLE_REGION) #endif /* !CONFIG_HAS_DYNAMIC_DEVICE_HANDLES */
diff --git a/include/zephyr/linker/device-deps.ld b/include/zephyr/linker/device-deps.ld new file mode 100644 index 0000000..f3d848b --- /dev/null +++ b/include/zephyr/linker/device-deps.ld
@@ -0,0 +1,13 @@ +/* + * Copyright (c) 2021 Intel Corporation. + * + * SPDX-License-Identifier: Apache-2.0 + */ + +__device_deps_start = .; +#ifdef LINKER_DEVICE_DEPS_PASS1 +KEEP(*(SORT(.__device_deps_pass1*))); +#else +KEEP(*(SORT(.__device_deps_pass2*))); +#endif /* LINKER_DEVICE_DEPS_PASS1 */ +__device_deps_end = .;
diff --git a/include/zephyr/linker/device-handles.ld b/include/zephyr/linker/device-handles.ld deleted file mode 100644 index aed8589..0000000 --- a/include/zephyr/linker/device-handles.ld +++ /dev/null
@@ -1,13 +0,0 @@ -/* - * Copyright (c) 2021 Intel Corporation. - * - * SPDX-License-Identifier: Apache-2.0 - */ - -__device_handles_start = .; -#ifdef LINKER_DEVICE_HANDLES_PASS1 -KEEP(*(SORT(.__device_handles_pass1*))); -#else -KEEP(*(SORT(.__device_handles_pass2*))); -#endif /* LINKER_DEVICE_HANDLES_PASS1 */ -__device_handles_end = .;
diff --git a/scripts/build/gen_device_deps.py b/scripts/build/gen_device_deps.py index 799b913..bbebb55 100755 --- a/scripts/build/gen_device_deps.py +++ b/scripts/build/gen_device_deps.py
@@ -107,7 +107,7 @@ ] ctype = ( '{:s}Z_DECL_ALIGN(device_handle_t) ' - '__attribute__((__section__(".__device_handles_pass2")))' + '__attribute__((__section__(".__device_deps_pass2")))' ).format('const ' if not dynamic_handles else '') return [ # The `extern` line pretends this was first declared in some .h
diff --git a/scripts/build/gen_relocate_app.py b/scripts/build/gen_relocate_app.py index 1e3067c..9082b62 100644 --- a/scripts/build/gen_relocate_app.py +++ b/scripts/build/gen_relocate_app.py
@@ -74,7 +74,7 @@ >>> SectionKind.for_section_with_name(".rodata.str1.4") <SectionKind.RODATA: 'rodata'> - >>> SectionKind.for_section_with_name(".device_handles") + >>> SectionKind.for_section_with_name(".device_deps") None """ if ".text." in name: