diff options
author | Michel Jaouen <michel.jaouen@st.com> | 2020-09-24 18:19:15 +0200 |
---|---|---|
committer | Tamas Ban <tamas.ban@arm.com> | 2020-10-27 13:15:40 +0000 |
commit | 0b161d79dfacb1d629521f611ccae88c4218b828 (patch) | |
tree | 930168feb6f1915e14abdb5949b1c9df96b0572e | |
parent | ca57edfcbfc6cd7274c049c54f4cacfe1ce3bd1b (diff) | |
download | trusted-firmware-m-0b161d79dfacb1d629521f611ccae88c4218b828.tar.gz |
Build: Fix stm targets after modern cmake merge
Change-Id: I7114177a5e877a986d8fd88a1c5fd2da005abe2c
Signed-off-by: Michel Jaouen <michel.jaouen@st.com>
-rw-r--r-- | platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt | 20 | ||||
-rwxr-xr-x | platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh | 7 | ||||
-rw-r--r-- | platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt | 4 | ||||
-rw-r--r-- | platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h | 28 | ||||
-rw-r--r-- | platform/ext/target/stm/readme.rst (renamed from platform/ext/target/stm/common/stm32l5xx/readme.rst) | 70 | ||||
-rw-r--r-- | platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt | 4 | ||||
-rw-r--r-- | platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h | 28 |
7 files changed, 92 insertions, 69 deletions
diff --git a/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt b/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt index 125ad4d890..01da0a84e0 100644 --- a/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt +++ b/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt @@ -152,7 +152,6 @@ if(BL2) ${CMAKE_CURRENT_SOURCE_DIR}/bl2/low_level_device.c ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_flash.c ${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_com.c - ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal.c ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c ${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c @@ -177,7 +176,7 @@ if(BL2) # object files. For this reason, the file mailbox_ipc_intr is linked directly to # the ns binary as an object file. This issue does not affect armclang, but the # fix is compatible. - target_sources(tfm_s + target_sources(bl2 PRIVATE ${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c ) @@ -186,20 +185,29 @@ endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/stm_tool.py ${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../bl2/ext/mcuboot/scripts/macro_parser.py - DESTINATION ./scripts/ ) + DESTINATION ${CMAKE_BINARY_DIR}/scripts/ ) + +if (${CMAKE_C_COMPILER_ID} STREQUAL GNU) + set(PREPROCESSOR_FILE ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/gcc/preprocess.sh) +elseif (${CMAKE_C_COMPILER_ID} STREQUAL ARMClang) + set(PREPROCESSOR_FILE ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/armclang/preprocess.sh) +else() + set(PREPROCESSOR_FILE ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/iar/preprocess.sh) +endif() install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/regression.sh + ${PREPROCESSOR_FILE} ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/TFM_UPDATE.sh ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/postbuild.sh PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ - DESTINATION ./ ) + DESTINATION ${CMAKE_BINARY_DIR} ) -if (TEST_S) +if (${TEST_S} OR ${TEST_NS}) #the define FLASH_LAYOUT_FOR_TEST #increase SECURE and NON SECURE IMAGE and modify the content of low_level_device.c from BL2 (low_level_flash.c) set(FLAGS_FOR_BL2_PREPROCESSING "#define FLASH_LAYOUT_FOR_TEST\n" - "#define BL2\n" + "#define BL2\n" ) add_definitions("-DFLASH_LAYOUT_FOR_TEST") else() diff --git a/platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh index 2d04ae0a84..5a965022b7 100755 --- a/platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh +++ b/platform/ext/target/stm/common/stm32l5xx/boards/scripts/TFM_UPDATE.sh @@ -17,6 +17,7 @@ echo "TFM UPDATE started" SCRIPT=$(readlink -f $0) # Absolute path this script SCRIPTPATH=`dirname $SCRIPT` +BINPATH="$SCRIPTPATH/bin" PATH="/C/Program Files/STMicroelectronics/STM32Cube/STM32CubeProgrammer/bin/":$PATH stm32programmercli="STM32_Programmer_CLI" connect_no_reset="-c port=SWD mode=HotPlug" @@ -34,12 +35,12 @@ nvcounter= boot=0x0c001000 unused= -$stm32programmercli $connect -d $SCRIPTPATH/tfm_s_signed.bin $slot0 -v +$stm32programmercli $connect -d $BINPATH/tfm_s_signed.bin $slot0 -v echo "TFM_Appli Secure Written" echo "Write TFM_Appli NonSecure" -$stm32programmercli $connect -d $SCRIPTPATH/tfm_ns_signed.bin $slot1 -v +$stm32programmercli $connect -d $BINPATH/tfm_ns_signed.bin $slot1 -v echo "TFM_Appli NonSecure Written" echo "Write TFM_SBSFU_Boot" -$stm32programmercli $connect -d $SCRIPTPATH/bl2.bin $boot -v +$stm32programmercli $connect -d $BINPATH/bl2.bin $boot -v echo "TFM_SBSFU_Boot Written" echo "TFM_UPDATE Done"
\ No newline at end of file diff --git a/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt b/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt index 1b6f465218..8b1fffe63e 100644 --- a/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt +++ b/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt @@ -36,8 +36,8 @@ endif() install(FILES ${NUCLEO_L552ZE_Q_DIR}/include/flash_layout.h ${NUCLEO_L552ZE_Q_DIR}/include/region_defs.h - DESTINATION ./ ) + DESTINATION ${CMAKE_BINARY_DIR} ) set (BL2_FILE_TO_PREPROCESS ${CMAKE_CURRENT_BINARY_DIR}/image_macros_to_preprocess_bl2.c) file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING}) install(FILES ${BL2_FILE_TO_PREPROCESS} - DESTINATION ./ ) + DESTINATION ${CMAKE_BINARY_DIR} ) diff --git a/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h b/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h index 783fb62d3b..857e9f6e07 100644 --- a/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h +++ b/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h @@ -27,24 +27,24 @@ * Flash layout on nucleo_l552ze_q with BL2 (multiple image boot): * * 0x0000_0000 BL2 - MCUBoot (72 KB) - * 0x0001_2000 NV counters area (4 KB) - * 0x0001_3000 Secure Storage Area (8 KB) - * 0x0001_5000 Internal Trusted Storage Area (8 KB) - * 0x0001_7000 Secure image primary slot (172 KB) - * 0x0004_1000 Non-secure image primary slot (36 KB) - * 0x0004_a000 Secure image secondary slot (176 KB) + * 0x0000_e000 NV counters area (4 KB) + * 0x0000_f000 Secure Storage Area (8 KB) + * 0x0001_1000 Internal Trusted Storage Area (8 KB) + * 0x0001_3000 Secure image primary slot (180 KB) + * 0x0004_0000 Non-secure image primary slot (36 KB) + * 0x0004_9000 Secure image secondary slot (180 KB) * 0x0007_6000 Non-secure image secondary slot (36 KB) * 0x0007_F000 Unused (4 KB) * * Flash layout on nucleo_l552ze_q with BL2 (multiple image boot, layout for test): * No Firmware update , ITS, PS in RAM. * 0x0000_0000 BL2 - MCUBoot (72 KB) - * 0x0001_2000 NV counters area (4 KB) - * 0x0001_3000 Secure Storage Area (8 KB) - * 0x0001_5000 Internal Trusted Storage Area (8 KB) - * 0x0001_7000 Secure image primary slot (224 KB) - * 0x0004_F000 Non-secure image primary slot (168 KB) - * 0x0007_9000 Unused (28K) + * 0x0000_e000 NV counters area (4 KB) + * 0x0000_f000 Secure Storage Area (8 KB) + * 0x0001_1000 Internal Trusted Storage Area (8 KB) + * 0x0001_3000 Secure image primary slot (224 KB) + * 0x0004_b000 Non-secure image primary slot (168 KB) + * 0x0007_5000 Unused (44K) * The size of a partition. This should be large enough to contain a S or NS * sw binary. Each FLASH_AREA_IMAGE contains two partitions. See Flash layout * above. @@ -65,7 +65,7 @@ /* area for BL2 code protected by hdp */ #define FLASH_AREA_BL2_OFFSET (0x0) -#define FLASH_AREA_BL2_SIZE (0x11000) +#define FLASH_AREA_BL2_SIZE (0xd800) /* HDP area end at this address */ #define FLASH_BL2_HDP_END (FLASH_AREA_BL2_OFFSET+FLASH_AREA_BL2_SIZE-1) /* area for BL2 code not protected by hdp */ @@ -113,7 +113,7 @@ #define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE) #define FLASH_ITS_AREA_SIZE (0x2000) /* 8 KB */ -#define FLASH_S_PARTITION_SIZE (0x2B000) /* S partition */ +#define FLASH_S_PARTITION_SIZE (0x2D000) /* S partition */ #define FLASH_NS_PARTITION_SIZE (0x9000) /* NS partition */ #define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE) /* Secure image primary slot */ diff --git a/platform/ext/target/stm/common/stm32l5xx/readme.rst b/platform/ext/target/stm/readme.rst index 9a7d34c83e..e9358198c4 100644 --- a/platform/ext/target/stm/common/stm32l5xx/readme.rst +++ b/platform/ext/target/stm/readme.rst @@ -1,52 +1,60 @@ -######### -stm32l5xx -######### -'platform/ext/stm/stm32l5xx' folder contains code that has been imported from -other projects available on https://github.com/STMicroelectronics. +STMicroelectronics +################## -*********** -Sub-folders -*********** +TF-M is supported on STM32L5 family -stm32l5xx_hal +https://www.st.com/en/microcontrollers-microprocessors/stm32l5-series.html + +https://www.st.com/resource/en/user_manual/dm00678763-getting-started-with-stm32cubel5-tfm-application-stmicroelectronics.pdf + + +***************** +Directory content +***************** + +stm/stm32l562e_dk: STM32L562E-DK +=================== +Discovery kit with STM32L562QE MCU : +https://www.st.com/en/evaluation-tools/stm32l562e-dk.html + +stm/nucleo_l552ze_q: NUCLEO-L552ZE-Q +================= +STM32 Nucleo-144 development board with STM32L552ZE MCU, SMPS, supports Arduino, ST Zio and morpho connectivity +https://www.st.com/en/evaluation-tools/nucleo-l552ze-q.html + + +stm/common/stm32l5xx/stm32l5xx_hal ============= Content from https://github.com/STMicroelectronics/stm32l5xx_hal_driver.git -Device +stm/common/stm32l5xx/Device ====== Content from https://github.com/STMicroelectronics/cmsis_device_l5.git -bl2 -=== +stm/common/stm32l5xx/bl2 +====== stm32l5xx bl2 code specific from https://github.com/STMicroelectronics/STM32CubeL5.git (Projects/STM32L562E-DK/Applications/TFM) -Secure +stm/common/stm32l5xx/secure ====== stm32l5xx Secure porting adaptation from https://github.com/STMicroelectronics/STM32CubeL5.git (Projects/STM32L562E-DK/Applications/TFM) -boards +stm/common/stm32l5xx/boards ====== Adaptation and tools specific to stm32 board using stm32l5xx soc from https://github.com/STMicroelectronics/STM32CubeL5.git (Projects/STM32L562E-DK/Applications/TFM) -CMSIS_Driver +stm/common/stm32l5xx/CMSIS_Driver ============ Flash and uart driver for stm32l5xx platform -Native Driver +stm/common/stm32l5xx/Native_Driver ============= random generator and tickless implementation -*********************** -Documentation on boards -*********************** -Following links provide information on the supported boards: -https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-discovery-kits/stm32l562e-dk.html - -https://www.st.com/content/st_com/en/products/evaluation-tools/product-evaluation-tools/mcu-mpu-eval-tools/stm32-mcu-mpu-eval-tools/stm32-nucleo-boards/nucleo-l552ze-q.html *************************************** Building and running software on target @@ -62,15 +70,21 @@ Configuration and Build GNUARM compilation is available for targets STM_NUCLEO_L552ZE_Q and STM_DISCO_L562QE and build the selected configuration as follow. -``>cmake --build ./ -- install`` +``> mkdir build && cd build`` + +``> cmake .. -DTFM_PLATFORM=stm/nucleo_l552ze_q -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -G"Unix Makefiles"`` + +``> cmake .. -DTFM_PLATFORM=stm/stm32l562e_dk -DCMAKE_TOOLCHAIN_FILE=../toolchain_GNUARM.cmake -G"Unix Makefiles"`` + +``> cmake --build ./ -- install`` Write software on target ======================== -In install folder: +In build folder: - - ``postbuild.sh``: Updates regression.sh and TFM_UPDATE.sh scripts according to flash_layout.h. - - ``regression.sh``: Sets platform option bytes config and erase platform. - - ``TFM_UPDATE.sh``: Writes bl2, secure, and non secure image in target. + - ``postbuild.sh``: Updates regression.sh and TFM_UPDATE.sh scripts according to flash_layout.h + - ``regression.sh``: Sets platform option bytes config and erase platform + - ``TFM_UPDATE.sh``: Writes bl2, secure, and non secure image in target Connect board to USB and Execute the 3 scripts in following order to update platform: diff --git a/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt b/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt index b72a45c995..06aac85797 100644 --- a/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt +++ b/platform/ext/target/stm/stm32l562e_dk/CMakeLists.txt @@ -36,8 +36,8 @@ endif() install(FILES ${STM32L563E_DK_DIR}/include/flash_layout.h ${STM32L563E_DK_DIR}/include/region_defs.h - DESTINATION ./ ) + DESTINATION ${CMAKE_BINARY_DIR} ) set (BL2_FILE_TO_PREPROCESS ${CMAKE_CURRENT_BINARY_DIR}/image_macros_to_preprocess_bl2.c) file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING}) install(FILES ${BL2_FILE_TO_PREPROCESS} - DESTINATION ./ ) + DESTINATION ${CMAKE_BINARY_DIR} ) diff --git a/platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h b/platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h index 940553f2c5..f9937b1db7 100644 --- a/platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h +++ b/platform/ext/target/stm/stm32l562e_dk/include/flash_layout.h @@ -27,24 +27,24 @@ * Flash layout on stm23l562e_dk with BL2 (multiple image boot): * * 0x0000_0000 BL2 - MCUBoot (72 KB) - * 0x0001_2000 NV counters area (4 KB) - * 0x0001_3000 Secure Storage Area (8 KB) - * 0x0001_5000 Internal Trusted Storage Area (8 KB) - * 0x0001_7000 Secure image primary slot (172 KB) - * 0x0004_1000 Non-secure image primary slot (36 KB) - * 0x0004_a000 Secure image secondary slot (176 KB) + * 0x0000_e000 NV counters area (4 KB) + * 0x0000_f000 Secure Storage Area (8 KB) + * 0x0001_1000 Internal Trusted Storage Area (8 KB) + * 0x0001_3000 Secure image primary slot (180 KB) + * 0x0004_0000 Non-secure image primary slot (36 KB) + * 0x0004_9000 Secure image secondary slot (180 KB) * 0x0007_6000 Non-secure image secondary slot (36 KB) * 0x0007_F000 Unused (4 KB) * * Flash layout on stm23l562e_dk with BL2 (multiple image boot, layout for test): * No Firmware update * 0x0000_0000 BL2 - MCUBoot (72 KB) - * 0x0001_2000 NV counters area (4 KB) - * 0x0001_3000 Secure Storage Area (8 KB) - * 0x0001_5000 Internal Trusted Storage Area (8 KB) - * 0x0001_7000 Secure image primary slot (224 KB) - * 0x0004_F000 Non-secure image primary slot (168 KB) - * 0x0007_9000 Unused (28K) + * 0x0000_e000 NV counters area (4 KB) + * 0x0000_f000 Secure Storage Area (8 KB) + * 0x0001_1000 Internal Trusted Storage Area (8 KB) + * 0x0001_3000 Secure image primary slot (224 KB) + * 0x0004_b000 Non-secure image primary slot (168 KB) + * 0x0007_5000 Unused (44K) * The size of a partition. This should be large enough to contain a S or NS * sw binary. Each FLASH_AREA_IMAGE contains two partitions. See Flash layout * above. @@ -65,7 +65,7 @@ /* area for BL2 code protected by hdp */ #define FLASH_AREA_BL2_OFFSET (0x0) -#define FLASH_AREA_BL2_SIZE (0x11000) +#define FLASH_AREA_BL2_SIZE (0xd800) /* HDP area end at this address */ #define FLASH_BL2_HDP_END (FLASH_AREA_BL2_OFFSET+FLASH_AREA_BL2_SIZE-1) /* area for BL2 code not protected by hdp */ @@ -113,7 +113,7 @@ #define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE) #define FLASH_ITS_AREA_SIZE (0x2000) /* 8 KB */ -#define FLASH_S_PARTITION_SIZE (0x2B000) /* S partition */ +#define FLASH_S_PARTITION_SIZE (0x2D000) /* S partition */ #define FLASH_NS_PARTITION_SIZE (0x9000) /* NS partition */ #define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE) /* Secure image primary slot */ |