diff --git a/soc/xtensa/intel_apl_adsp/CMakeLists.txt b/soc/xtensa/intel_apl_adsp/CMakeLists.txt index 8f9300b9c95..5e46b193e6b 100644 --- a/soc/xtensa/intel_apl_adsp/CMakeLists.txt +++ b/soc/xtensa/intel_apl_adsp/CMakeLists.txt @@ -7,3 +7,5 @@ zephyr_library_sources(soc.c) zephyr_library_sources(main_entry.S) zephyr_library_sources_ifdef(CONFIG_SMP soc_mp.c) + +add_subdirectory(common) diff --git a/soc/xtensa/intel_apl_adsp/bootloader.cmake b/soc/xtensa/intel_apl_adsp/bootloader.cmake new file mode 100644 index 00000000000..5444124938b --- /dev/null +++ b/soc/xtensa/intel_apl_adsp/bootloader.cmake @@ -0,0 +1,20 @@ +# 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 + ) diff --git a/soc/xtensa/intel_apl_adsp/common/CMakeLists.txt b/soc/xtensa/intel_apl_adsp/common/CMakeLists.txt new file mode 100644 index 00000000000..d1ca770e079 --- /dev/null +++ b/soc/xtensa/intel_apl_adsp/common/CMakeLists.txt @@ -0,0 +1,6 @@ +# Intel CAVS SoC family CMake file +# +# Copyright (c) 2020 Intel Corporation +# SPDX-License-Identifier: Apache-2.0 + +include(bootloader.cmake) diff --git a/boards/xtensa/up_squared_adsp/CMakeLists.txt b/soc/xtensa/intel_apl_adsp/common/bootloader.cmake similarity index 64% rename from boards/xtensa/up_squared_adsp/CMakeLists.txt rename to soc/xtensa/intel_apl_adsp/common/bootloader.cmake index 7d3f9fb4151..15d77f0a686 100644 --- a/boards/xtensa/up_squared_adsp/CMakeLists.txt +++ b/soc/xtensa/intel_apl_adsp/common/bootloader.cmake @@ -2,29 +2,29 @@ # # SPDX-License-Identifier: Apache-2.0 -if(EXISTS ${BOARD_DIR}/bootloader/CMakeLists.txt) +set(SOC_FAMILY intel_apl_adsp) + +if(EXISTS ${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader/CMakeLists.txt) if(USING_OUT_OF_TREE_BOARD) set(build_dir boards/${ARCH}/${BOARD}/bootloader) else() unset(build_dir) endif() - add_subdirectory(${BOARD_DIR}/bootloader ${build_dir}) + add_subdirectory(${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader ${build_dir}) endif() -set(sof_module ${PROJECT_SOURCE_DIR}/../modules/audio/sof) - 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/boards/xtensa/${BOARD}/bootloader/libbase_module.a + 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/boards/xtensa/${BOARD}/bootloader/libboot_module.a - COMMAND ${CMAKE_OBJCOPY} --add-section .module=mod-boot.bin --set-section-flags .module=load,readonly ${CMAKE_BINARY_DIR}/zephyr/boards/xtensa/${BOARD}/bootloader/bootloader.elf ${CMAKE_BINARY_DIR}/zephyr/bootloader.elf.mod + 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 ) diff --git a/boards/xtensa/up_squared_adsp/bootloader/CMakeLists.txt b/soc/xtensa/intel_apl_adsp/common/bootloader/CMakeLists.txt similarity index 93% rename from boards/xtensa/up_squared_adsp/bootloader/CMakeLists.txt rename to soc/xtensa/intel_apl_adsp/common/bootloader/CMakeLists.txt index 4696d1decc9..674e2f621f5 100644 --- a/boards/xtensa/up_squared_adsp/bootloader/CMakeLists.txt +++ b/soc/xtensa/intel_apl_adsp/common/bootloader/CMakeLists.txt @@ -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${BOARD_DIR}/bootloader/boot_ldr.x) +target_link_libraries(bootloader PRIVATE -T${SOC_DIR}/${ARCH}/${SOC_FAMILY}/common/bootloader/boot_ldr.x) if(CONFIG_XTENSA_HAL) target_link_libraries(bootloader PRIVATE XTENSA_HAL) diff --git a/boards/xtensa/up_squared_adsp/bootloader/base_module.c b/soc/xtensa/intel_apl_adsp/common/bootloader/base_module.c similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/base_module.c rename to soc/xtensa/intel_apl_adsp/common/bootloader/base_module.c diff --git a/boards/xtensa/up_squared_adsp/bootloader/boot_entry.S b/soc/xtensa/intel_apl_adsp/common/bootloader/boot_entry.S similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/boot_entry.S rename to soc/xtensa/intel_apl_adsp/common/bootloader/boot_entry.S diff --git a/boards/xtensa/up_squared_adsp/bootloader/boot_ldr.x b/soc/xtensa/intel_apl_adsp/common/bootloader/boot_ldr.x similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/boot_ldr.x rename to soc/xtensa/intel_apl_adsp/common/bootloader/boot_ldr.x diff --git a/boards/xtensa/up_squared_adsp/bootloader/boot_loader.c b/soc/xtensa/intel_apl_adsp/common/bootloader/boot_loader.c similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/boot_loader.c rename to soc/xtensa/intel_apl_adsp/common/bootloader/boot_loader.c diff --git a/boards/xtensa/up_squared_adsp/bootloader/boot_module.c b/soc/xtensa/intel_apl_adsp/common/bootloader/boot_module.c similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/boot_module.c rename to soc/xtensa/intel_apl_adsp/common/bootloader/boot_module.c diff --git a/boards/xtensa/up_squared_adsp/bootloader/manifest.h b/soc/xtensa/intel_apl_adsp/common/bootloader/manifest.h similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/manifest.h rename to soc/xtensa/intel_apl_adsp/common/bootloader/manifest.h diff --git a/boards/xtensa/up_squared_adsp/bootloader/start_address.S b/soc/xtensa/intel_apl_adsp/common/bootloader/start_address.S similarity index 100% rename from boards/xtensa/up_squared_adsp/bootloader/start_address.S rename to soc/xtensa/intel_apl_adsp/common/bootloader/start_address.S