From e375363bbb31a35f60f594d204304b36fbe4a9b0 Mon Sep 17 00:00:00 2001 From: David Garske Date: Thu, 19 Jan 2023 13:06:05 -0800 Subject: [PATCH] Add CMake `QSPI_FLASH` and `OCTOSPI_FLASH` options. --- CMakeLists.txt | 21 ++++++++++++++++++++- test-app/CMakeLists.txt | 16 ++++++++++++++-- 2 files changed, 34 insertions(+), 3 deletions(-) diff --git a/CMakeLists.txt b/CMakeLists.txt index b3dc8d0f..f9787c55 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -113,6 +113,8 @@ add_option( add_option("SIGN" "Configure Digital Signatures Algorithm (default: ECC256)" "ECC256" "ECC256;ECC384;ECC521;ED25519;ED448;NONE;RSA2048;RSA4096") add_option("SPI_FLASH" "Use external SPI flash drivers (default: disabled)" "no" "yes;no") +add_option("QSPI_FLASH" "Use external QSPI flash drivers (default: disabled)" "no" "yes;no") +add_option("OCTOSPI_FLASH" "Use external OCTOSPI flash drivers (default: disabled)" "no" "yes;no") add_option("SPMATH" "Use SP Math (default: disabled)" "no" "yes;no") add_option("WOLFBOOT_TARGET" "Target platform to build for (default: stm32h7)" "stm32h7" "stm32f4;stm32h7;stm32l0;stm32u5;x86_64_efi;sim") @@ -461,6 +463,14 @@ if(SPI_FLASH) set(EXT_FLASH ON) endif() +if(OCTOSPI_FLASH) + set(QSPI_FLASH ON) +endif() + +if(QSPI_FLASH) + set(EXT_FLASH ON) +endif() + if(UART_FLASH) set(EXT_FLASH ON) endif() @@ -568,6 +578,15 @@ if(SPI_FLASH) list(APPEND WOLFBOOT_FLASH_SOURCES hal/spi/spi_drv_${SPI_TARGET}.c src/spi_flash.c) endif() +if(QSPI_FLASH) + list(APPEND WOLFBOOT_DEFS QSPI_FLASH) + list(APPEND WOLFBOOT_FLASH_SOURCES hal/spi/spi_drv_${SPI_TARGET}.c src/qspi_flash.c) +endif() + +if(OCTOSPI_FLASH) + list(APPEND WOLFBOOT_DEFS OCTOSPI_FLASH) +endif() + if(UART_FLASH) list(APPEND WOLFBOOT_DEFS UART_FLASH) list(APPEND WOLFBOOT_FLASH_SOURCES hal/uart/uart_drv_${UART_TARGET}.c src/uart_flash.c) @@ -591,7 +610,7 @@ target_sources(wolfboothal PRIVATE include/hal.h hal/${WOLFBOOT_TARGET}.c ${WOLF ${PARTITION_SOURCE}) target_link_libraries(wolfboothal target user_settings) target_compile_definitions(wolfboothal PRIVATE ${WOLFBOOT_DEFS}) -target_include_directories(wolfboothal PRIVATE include) +target_include_directories(wolfboothal PRIVATE ${WOLFBOOT_ROOT} include) target_compile_options(wolfboothal PRIVATE ${WOLFBOOT_COMPILE_OPTIONS} ${EXTRA_COMPILE_OPTIONS}) if(PYTHON_KEYTOOLS) diff --git a/test-app/CMakeLists.txt b/test-app/CMakeLists.txt index 8a3163b5..26903d46 100644 --- a/test-app/CMakeLists.txt +++ b/test-app/CMakeLists.txt @@ -55,6 +55,15 @@ endif() if(SPI_FLASH) list(APPEND TEST_APP_COMPILE_DEFINITIONS SPI_FLASH) + list(APPEND APP_SOURCES ../hal/spi/spi_drv_${SPI_TARGET}.c ../src/spi_flash.c) +endif() +if(OCTOSPI_FLASH) + set(QSPI_FLASH ON) + list(APPEND TEST_APP_COMPILE_DEFINITIONS OCTOSPI_FLASH) +endif() +if(QSPI_FLASH) + list(APPEND TEST_APP_COMPILE_DEFINITIONS QSPI_FLASH) + list(APPEND APP_SOURCES ../hal/spi/spi_drv_${SPI_TARGET}.c ../src/qspi_flash.c) endif() math(EXPR WOLFBOOT_TEST_APP_ADDRESS "${WOLFBOOT_PARTITION_BOOT_ADDRESS} + ${IMAGE_HEADER_SIZE}" @@ -95,7 +104,10 @@ add_executable(image) target_sources(image PRIVATE ${APP_SOURCES}) -target_include_directories(image PRIVATE ../include ${CMAKE_CURRENT_BINARY_DIR}) +target_include_directories(image PRIVATE + ../ + ../include + ${CMAKE_CURRENT_BINARY_DIR}) target_link_libraries(image wolfboot target) @@ -118,7 +130,7 @@ if(WOLFBOOT_TARGET IN_LIST ARM_TARGETS) # add boot address to cache unset(${PLATFORM_NAME}_BOOT_ADDRESS CACHE) set(${PLATFORM_NAME}_BOOT_ADDRESS ${WOLFBOOT_PARTITION_BOOT_ADDRESS} CACHE INTERNAL "") - + gen_wolfboot_factory_image(${PLATFORM_NAME} image) else() gen_wolfboot_signed_image(image)