Skip to content

Commit be36ece

Browse files
committed
trusted-firmware-m: upstream fixes for the STM platforms
This commit contains some required upstream fixes for the STM platforms to work with the new TF-M build system. This commit shall be reverted, once review.trustedfirmware.org/c/TF-M/trusted-firmware-m/+/5910 is merged. Signed-off-by: Ioannis Glaropoulos <[email protected]>
1 parent c7cd1b4 commit be36ece

File tree

3 files changed

+15
-10
lines changed

3 files changed

+15
-10
lines changed

trusted-firmware-m/platform/ext/target/stm/common/stm32l5xx/CMakeLists.txt

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -78,6 +78,7 @@ target_sources(platform_s
7878
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_pwr_ex.c
7979
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gpio.c
8080
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart.c
81+
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_uart_ex.c
8182
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_rcc.c
8283
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_gtzc.c
8384
$<$<BOOL:${TFM_PARTITION_PLATFORM}>:${CMAKE_CURRENT_SOURCE_DIR}/secure/tfm_platform_system>
@@ -151,7 +152,6 @@ if(BL2)
151152
${CMAKE_CURRENT_SOURCE_DIR}/bl2/low_level_device.c
152153
${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_flash.c
153154
${CMAKE_CURRENT_SOURCE_DIR}/CMSIS_Driver/low_level_com.c
154-
${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c
155155
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal.c
156156
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash.c
157157
${CMAKE_CURRENT_SOURCE_DIR}/stm32l5xx_hal/Src/stm32l5xx_hal_flash_ex.c
@@ -176,7 +176,7 @@ if(BL2)
176176
# object files. For this reason, the file mailbox_ipc_intr is linked directly to
177177
# the ns binary as an object file. This issue does not affect armclang, but the
178178
# fix is compatible.
179-
target_sources(tfm_s
179+
target_sources(bl2
180180
PRIVATE
181181
${CMAKE_CURRENT_SOURCE_DIR}/Native_Driver/tick.c
182182
)
@@ -185,20 +185,25 @@ endif()
185185
install(FILES
186186
${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/stm_tool.py
187187
${CMAKE_CURRENT_SOURCE_DIR}/../../../../../../bl2/ext/mcuboot/scripts/macro_parser.py
188-
DESTINATION ./scripts/ )
188+
DESTINATION ${CMAKE_BINARY_DIR}/scripts/ )
189+
190+
if (${CMAKE_C_COMPILER_ID} STREQUAL GNU)
191+
set(PREPROCESSOR_FILE ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/gcc/preprocess.sh)
192+
endif()
189193

190194
install(FILES ${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/regression.sh
195+
${PREPROCESSOR_FILE}
191196
${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/TFM_UPDATE.sh
192197
${CMAKE_CURRENT_SOURCE_DIR}/boards/scripts/postbuild.sh
193198
PERMISSIONS OWNER_EXECUTE OWNER_WRITE OWNER_READ
194-
DESTINATION ./ )
199+
DESTINATION ${CMAKE_BINARY_DIR}/ )
195200

196-
if (TEST_S)
201+
if (TEST_S OR TEST_NS)
197202
#the define FLASH_LAYOUT_FOR_TEST
198203
#increase SECURE and NON SECURE IMAGE and modify the content of low_level_device.c from BL2 (low_level_flash.c)
199204
set(FLAGS_FOR_BL2_PREPROCESSING
200205
"#define FLASH_LAYOUT_FOR_TEST\n"
201-
"#define BL2\n"
206+
"#define BL2\n"
202207
)
203208
add_definitions("-DFLASH_LAYOUT_FOR_TEST")
204209
else()

trusted-firmware-m/platform/ext/target/stm/nucleo_l552ze_q/CMakeLists.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,8 +36,8 @@ endif()
3636

3737
install(FILES ${NUCLEO_L552ZE_Q_DIR}/include/flash_layout.h
3838
${NUCLEO_L552ZE_Q_DIR}/include/region_defs.h
39-
DESTINATION ./ )
39+
DESTINATION ${CMAKE_BINARY_DIR}/ )
4040
set (BL2_FILE_TO_PREPROCESS ${CMAKE_CURRENT_BINARY_DIR}/image_macros_to_preprocess_bl2.c)
4141
file(WRITE ${BL2_FILE_TO_PREPROCESS} ${BL2_PREPROCESSING})
4242
install(FILES ${BL2_FILE_TO_PREPROCESS}
43-
DESTINATION ./ )
43+
DESTINATION ${CMAKE_BINARY_DIR}/ )

trusted-firmware-m/platform/ext/target/stm/nucleo_l552ze_q/include/flash_layout.h

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@
6565

6666
/* area for BL2 code protected by hdp */
6767
#define FLASH_AREA_BL2_OFFSET (0x0)
68-
#define FLASH_AREA_BL2_SIZE (0x11000)
68+
#define FLASH_AREA_BL2_SIZE (0xd800)
6969
/* HDP area end at this address */
7070
#define FLASH_BL2_HDP_END (FLASH_AREA_BL2_OFFSET+FLASH_AREA_BL2_SIZE-1)
7171
/* area for BL2 code not protected by hdp */
@@ -113,7 +113,7 @@
113113
#define FLASH_ITS_AREA_OFFSET (FLASH_PS_AREA_OFFSET+FLASH_PS_AREA_SIZE)
114114
#define FLASH_ITS_AREA_SIZE (0x2000) /* 8 KB */
115115

116-
#define FLASH_S_PARTITION_SIZE (0x2B000) /* S partition */
116+
#define FLASH_S_PARTITION_SIZE (0x2D000) /* S partition */
117117
#define FLASH_NS_PARTITION_SIZE (0x9000) /* NS partition */
118118
#define FLASH_PARTITION_SIZE (FLASH_S_PARTITION_SIZE+FLASH_NS_PARTITION_SIZE)
119119
/* Secure image primary slot */

0 commit comments

Comments
 (0)