xtensa: SOC_DIR usage cleanup.

This commit is a cleanup of the SOC_DIR usage.
This cleanup is a preparation for supporting a list of SOC_ROOT instead
of just allowing one SOC_ROOT.

Supporting a list of SOC_ROOTs allows for placing of SOC in Zephyr
modules. It also aligns how BOARD_ROOT supports a list, and thus usage
of n_ROOT in Zephyr becomes more consistent.

This commit introduces the following changes:
- soc/xtensa/intel_apl_adsp/bootloader.cmake removed.
  This file is not included elsewhere in the build system, and appears
  to be leftover from #25133. Almost identical content is found in
  `soc/xtensa/intel_apl_adsp/commonbootloader.cmake`
- Changed xtensa/intel_apl_adsp to named library. Using a named library
  allow fetching library files based on library name without the need to
  know build path (and thus removes the need for knowing `${SOC_DIR}`).
- Changed SOC_DIR/ARCH/SOC_FAMILY to use CMAKE_CURRENT_LIST_DIR for
  configure time commands, as CMake code is already located inside this
  path.
- Using generator expression for library files from other CMake targets.

Signed-off-by: Torsten Rasmussen <Torsten.Rasmussen@nordicsemi.no>
This commit is contained in:
Torsten Rasmussen 2020-07-02 10:16:28 +02:00 committed by Anas Nashif
commit 13153678cb
4 changed files with 11 additions and 31 deletions

View file

@ -1,6 +1,6 @@
# SPDX-License-Identifier: Apache-2.0
zephyr_library()
zephyr_library_named(${ARCH}_${SOC_NAME})
zephyr_library_include_directories(${ZEPHYR_BASE}/drivers)
zephyr_library_sources(adsp.c)
zephyr_library_sources(soc.c)

View file

@ -1,20 +0,0 @@
# Copyright (c) 2019 Intel Corporation
#
# SPDX-License-Identifier: Apache-2.0
add_subdirectory(${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader ${build_dir})
add_custom_target(
process_elf ALL
DEPENDS base_module
DEPENDS ${ZEPHYR_FINAL_EXECUTABLE}
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-apl.bin ${CMAKE_BINARY_DIR}/zephyr/soc/xtensa/${SOC_FAMILY}/common/bootloader/libbase_module.a
COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-apl.bin --set-section-flags .module=load,readonly ${CMAKE_BINARY_DIR}/zephyr/zephyr.elf ${CMAKE_BINARY_DIR}/zephyr/zephyr.elf.mod
)
add_custom_target(
process_bootloader ALL
DEPENDS bootloader boot_module
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-boot.bin ${CMAKE_BINARY_DIR}/zephyr/soc/xtensa/${SOC_FAMILY}/common/bootloader/libboot_module.a
COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-boot.bin --set-section-flags .module=load,readonly ${CMAKE_BINARY_DIR}/zephyr/soc/xtensa/${SOC_FAMILY}/common/bootloader/bootloader.elf ${CMAKE_BINARY_DIR}/zephyr/bootloader.elf.mod
)

View file

@ -4,27 +4,27 @@
set(SOC_FAMILY intel_apl_adsp)
if(EXISTS ${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader/CMakeLists.txt)
if(EXISTS ${CMAKE_CURRENT_LIST_DIR}/bootloader/CMakeLists.txt)
if(USING_OUT_OF_TREE_BOARD)
set(build_dir boards/${ARCH}/${BOARD}/bootloader)
else()
unset(build_dir)
endif()
add_subdirectory(${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader ${build_dir})
add_subdirectory(${CMAKE_CURRENT_LIST_DIR}/bootloader ${build_dir})
endif()
add_custom_target(
process_elf ALL
DEPENDS base_module
DEPENDS ${ZEPHYR_FINAL_EXECUTABLE}
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-apl.bin ${CMAKE_BINARY_DIR}/zephyr/soc/xtensa/${SOC_FAMILY}/common/bootloader/libbase_module.a
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-apl.bin $<TARGET_FILE:base_module>
COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-apl.bin --set-section-flags .module=load,readonly ${CMAKE_BINARY_DIR}/zephyr/zephyr.elf ${CMAKE_BINARY_DIR}/zephyr/zephyr.elf.mod
)
add_custom_target(
process_bootloader ALL
DEPENDS bootloader boot_module
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-boot.bin ${CMAKE_BINARY_DIR}/zephyr/soc/xtensa/${SOC_FAMILY}/common/bootloader/libboot_module.a
COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-boot.bin --set-section-flags .module=load,readonly ${CMAKE_BINARY_DIR}/zephyr/soc/xtensa/${SOC_FAMILY}/common/bootloader/bootloader.elf ${CMAKE_BINARY_DIR}/zephyr/bootloader.elf.mod
COMMAND ${CMAKE_OBJCOPY} --dump-section .data=mod-boot.bin $<TARGET_FILE:boot_module>
COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-boot.bin --set-section-flags .module=load,readonly $<TARGET_FILE:bootloader> ${CMAKE_BINARY_DIR}/zephyr/bootloader.elf.mod
)

View file

@ -4,12 +4,12 @@
add_library(base_module base_module.c)
target_include_directories(base_module PUBLIC
${SOC_DIR}/${ARCH}/${SOC_PATH}/include
$<TARGET_PROPERTY:${ARCH}_${SOC_NAME},SOURCE_DIR>/include
)
add_library(boot_module boot_module.c)
target_include_directories(boot_module PUBLIC
${SOC_DIR}/${ARCH}/${SOC_PATH}/include
$<TARGET_PROPERTY:${ARCH}_${SOC_NAME},SOURCE_DIR>/include
)
add_executable(bootloader
@ -29,8 +29,8 @@ target_include_directories(bootloader PUBLIC
./
${ZEPHYR_BASE}/include
${TOOLCHAIN_INCLUDES}
${SOC_DIR}/${ARCH}/${SOC_PATH}/
${SOC_DIR}/${ARCH}/${SOC_PATH}/include
$<TARGET_PROPERTY:${ARCH}_${SOC_NAME},SOURCE_DIR>/
$<TARGET_PROPERTY:${ARCH}_${SOC_NAME},SOURCE_DIR>/include
)
set_source_files_properties(boot_entry.S PROPERTIES COMPILE_FLAGS -DASSEMBLY)
@ -40,7 +40,7 @@ target_compile_options(bootloader PUBLIC -fno-inline-functions -mlongcalls -mtex
target_link_libraries(bootloader PUBLIC -Wl,--no-check-sections -ucall_user_start -Wl,-static -nostdlib)
target_link_libraries(bootloader PRIVATE -lhal -L${zephyr_sdk}/xtensa/intel_apl_adsp/xtensa-zephyr-elf/lib)
target_link_libraries(bootloader PRIVATE -T${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader/boot_ldr.x)
target_link_libraries(bootloader PRIVATE -T$<TARGET_PROPERTY:${ARCH}_${SOC_NAME},SOURCE_DIR>/common/bootloader/boot_ldr.x)
if(CONFIG_XTENSA_HAL)
target_link_libraries(bootloader PRIVATE XTENSA_HAL)