From c7e084e75b791eb05f7bb71383eb5d4d93a3617b Mon Sep 17 00:00:00 2001 From: Erwan Gouriou Date: Thu, 14 Mar 2024 16:47:57 +0100 Subject: [PATCH] boards: st: nucleo_l552ze_q: Populate ns flash partitions Rather than providing flash partitions in samples, provide default partition (no tests) as part of the board ns variant default configuration. Update or remove related overlays. Update ns variant yaml file to specify actual flash available for the ns application (36K). Additionaly, fix comment in b_u585i_iot02a_ns. Signed-off-by: Erwan Gouriou --- .../b_u585i_iot02a_stm32u585xx_ns.dts | 4 +- .../nucleo_l552ze_q_stm32l552xx_ns.dts | 45 ++++++++++++++++ .../nucleo_l552ze_q_stm32l552xx_ns.yaml | 2 +- .../nucleo_l552ze_q_stm32l552xx_ns.overlay | 54 ------------------- .../nucleo_l552ze_q_stm32l552xx_ns.overlay | 6 ++- 5 files changed, 53 insertions(+), 58 deletions(-) delete mode 100644 samples/tfm_integration/tfm_ipc/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay diff --git a/boards/st/b_u585i_iot02a/b_u585i_iot02a_stm32u585xx_ns.dts b/boards/st/b_u585i_iot02a/b_u585i_iot02a_stm32u585xx_ns.dts index 5ced0baa1a..e8a7d0f5f2 100644 --- a/boards/st/b_u585i_iot02a/b_u585i_iot02a_stm32u585xx_ns.dts +++ b/boards/st/b_u585i_iot02a/b_u585i_iot02a_stm32u585xx_ns.dts @@ -54,12 +54,12 @@ label = "image-0-nonsecure"; reg = <0x00098000 DT_SIZE_K(512)>; }; - /* Secure image primary slot */ + /* Secure image secondary slot */ slot1_partition: partition@118000 { label = "image-1"; reg = <0x00118000 DT_SIZE_K(384)>; }; - /* Non-secure image primary slot */ + /* Non-secure image secondary slot */ slot1_ns_partition: partition@178000 { label = "image-1-nonsecure"; reg = <0x00178000 DT_SIZE_K(512)>; diff --git a/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.dts b/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.dts index 3f4b0661e8..d18c84cae1 100644 --- a/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.dts +++ b/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.dts @@ -19,6 +19,7 @@ zephyr,shell-uart = &lpuart1; zephyr,sram = &sram0; zephyr,flash = &flash0; + zephyr,code-partition = &slot0_ns_partition; }; aliases { @@ -26,3 +27,47 @@ sw0 = &user_button; }; }; + +&flash0 { + + partitions { + compatible = "fixed-partitions"; + #address-cells = <1>; + #size-cells = <1>; + + /* + * Following flash partition is compatible with requirements + * given in TFM configuration given for current board: + * multiple image boot, no tests. + * It might require adjustment depending on evolutions on TFM. + */ + + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 DT_SIZE_K(80)>; + read-only; + }; + /* Secure image primary slot */ + slot0_partition: partition@14000 { + label = "image-0"; + reg = <0x00014000 DT_SIZE_K(180)>; + }; + /* Non-secure image primary slot */ + slot0_ns_partition: partition@41000 { + label = "image-0-nonsecure"; + reg = <0x00041000 DT_SIZE_K(36)>; + }; + /* Secure image secondary slot */ + slot1_partition: partition@4a000 { + label = "image-1"; + reg = <0x0004a000 DT_SIZE_K(180)>; + }; + /* Non-secure image secondary slot */ + slot1_ns_partition: partition@77000 { + label = "image-1-nonsecure"; + reg = <0x00077000 DT_SIZE_K(36)>; + }; + /* Applicative Non Volatile Storage */ + /* Not available in this config, use secure storage */ + }; +}; diff --git a/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.yaml b/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.yaml index 186f873ff8..5b831b341a 100644 --- a/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.yaml +++ b/boards/st/nucleo_l552ze_q/nucleo_l552ze_q_stm32l552xx_ns.yaml @@ -9,5 +9,5 @@ supported: - gpio - dac ram: 192 -flash: 328 +flash: 36 vendor: st diff --git a/samples/tfm_integration/tfm_ipc/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay b/samples/tfm_integration/tfm_ipc/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay deleted file mode 100644 index 6432673ddf..0000000000 --- a/samples/tfm_integration/tfm_ipc/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay +++ /dev/null @@ -1,54 +0,0 @@ -/* - * Copyright (c) 2020 Linaro Limited. - * - * SPDX-License-Identifier: Apache-2.0 - */ - - - /* This partition table should be used along with TFM configuration: - * - TEST_S=OFF (NO REGRESSION) - * - TFM_PSA_API=ON (IPC) - * - * In this configuration, TFM binary does not include tests. - * The partition sizes are compatible with the TF-M platform - * flash_layout.h. - */ - -/ { - chosen { - zephyr,code-partition = &slot1_partition; - }; -}; - -&flash0 { - - partitions { - compatible = "fixed-partitions"; - #address-cells = <1>; - #size-cells = <1>; - - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 DT_SIZE_K(80)>; - read-only; - }; - /* Secure image primary slot */ - slot0_partition: partition@14000 { - label = "image-0"; - reg = <0x00014000 DT_SIZE_K(180)>; - }; - /* Non-secure image primary slot */ - slot1_partition: partition@41000 { - label = "image-1"; - reg = <0x00041000 DT_SIZE_K(36)>; - }; - /* - * The flash starting at 0x7F000 and ending at - * 0x80000 is reserved for the application. - */ - storage_partition: partition@7f000 { - label = "storage"; - reg = <0x0007F000 DT_SIZE_K(4)>; - }; - }; -}; diff --git a/samples/tfm_integration/tfm_regression_test/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay b/samples/tfm_integration/tfm_regression_test/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay index 01744d106f..7d1e21d173 100644 --- a/samples/tfm_integration/tfm_regression_test/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay +++ b/samples/tfm_integration/tfm_regression_test/boards/nucleo_l552ze_q_stm32l552xx_ns.overlay @@ -13,10 +13,14 @@ / { chosen { - zephyr,code-partition = &slot1_partition; + zephyr,code-partition = &slot0_ns_partition; }; }; + +/delete-node/ &slot1_partition; +/delete-node/ &slot1_ns_partition; + &flash0 { partitions {