Skip to content

Commit

Permalink
boards: nxp: mimxrt11xx: fix non-optimal sector distribution
Browse files Browse the repository at this point in the history
- Optimize slot sizes for MCUBoot swap move algorithm
  for mimxrt1160/70 boards.
- Use DT_SIZE_K/M macros for slot sizes.
- Limit mcuboot max size to 128KB.

Signed-off-by: Andrej Butok <[email protected]>
  • Loading branch information
butok authored and nashif committed Jun 6, 2024
1 parent a42ada8 commit 5df6aa8
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 52 deletions.
17 changes: 8 additions & 9 deletions boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
is25wp128: is25wp128@0 {
compatible = "nxp,imx-flexspi-nor";
size = <134217728>;
size = <DT_SIZE_M(16*8)>;
reg = <0>;
spi-max-frequency = <133000000>;
status = "okay";
Expand All @@ -104,25 +104,24 @@
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
};
/* Note slot 0 has one additional sector,
* this is intended for use with the swap move algorithm
/* The MCUBoot swap-move algorithm uses the last 3 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 0x301000>;
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
};
slot1_partition: partition@321000 {
slot1_partition: partition@723000 {
label = "image-1";
reg = <0x00321000 0x300000>;
reg = <0x00723000 DT_SIZE_M(7)>;
};
storage_partition: partition@621000 {
storage_partition: partition@E23000 {
label = "storage";
reg = <0x00621000 DT_SIZE_K(1984)>;
reg = <0x00E23000 (DT_SIZE_M(2) - DT_SIZE_K(140))>;
};
};
};
Expand Down
16 changes: 8 additions & 8 deletions boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -191,7 +191,7 @@
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
is25wp128: is25wp128@0 {
compatible = "nxp,imx-flexspi-nor";
size = <134217728>;
size = <DT_SIZE_M(16*8)>;
reg = <0>;
spi-max-frequency = <133000000>;
status = "okay";
Expand All @@ -208,20 +208,20 @@
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
};
/* Note slot 0 has one additional sector,
* this is intended for use with the swap move algorithm
/* The MCUBoot swap-move algorithm uses the last 3 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 0x301000>;
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
};
slot1_partition: partition@321000 {
slot1_partition: partition@723000 {
label = "image-1";
reg = <0x00321000 0x300000>;
reg = <0x00723000 DT_SIZE_M(7)>;
};
storage_partition: partition@621000 {
storage_partition: partition@E23000 {
label = "storage";
reg = <0x00621000 DT_SIZE_K(1984)>;
reg = <0x00E23000 (DT_SIZE_M(2) - DT_SIZE_K(140))>;
};
};
};
Expand Down
21 changes: 8 additions & 13 deletions boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -22,20 +22,15 @@
status = "okay";
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
w25q512nw:w25q512nw@0 {
/* IS25WP128 flash chip not currently enabled */
compatible = "nxp,imx-flexspi-nor";
size = <DT_SIZE_M(512)>;
size = <DT_SIZE_M(64*8)>;
reg = <0>;
spi-max-frequency = <133000000>;
status = "okay";
jedec-id = [ef 60 20];
erase-block-size = <4096>;
write-block-size = <1>;

/*
* Partitions are present to support dual core operation.
* as flash write is not supported, MCUBoot is not enabled.
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
Expand All @@ -45,20 +40,20 @@
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
};
/* Note slot 0 has one additional sector,
* this is intended for use with the swap move algorithm
/* The MCUBoot swap-move algorithm uses the last 3 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 0x301000>;
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
};
slot1_partition: partition@321000 {
slot1_partition: partition@723000 {
label = "image-1";
reg = <0x00321000 0x300000>;
reg = <0x00723000 DT_SIZE_M(7)>;
};
storage_partition: partition@621000 {
storage_partition: partition@E23000 {
label = "storage";
reg = <0x00621000 DT_SIZE_K(1984)>;
reg = <0x00E23000 (DT_SIZE_M(50) - DT_SIZE_K(140))>;
};
};
};
Expand Down
26 changes: 11 additions & 15 deletions boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,9 @@
/ {
chosen {
zephyr,flash = &w25q512nw;
/delete-property/ zephyr,flash-controller;
/delete-property/ zephyr,code-partition;
zephyr,flash-controller = &w25q512nw;
zephyr,flash = &w25q512nw;
zephyr,code-partition = &slot0_partition;
};

aliases {
Expand All @@ -23,20 +24,15 @@
status = "okay";
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
w25q512nw:w25q512nw@0 {
/* IS25WP128 flash chip not currently enabled */
compatible = "nxp,imx-flexspi-nor";
size = <DT_SIZE_M(512)>;
size = <DT_SIZE_M(64*8)>;
reg = <0>;
spi-max-frequency = <133000000>;
status = "okay";
jedec-id = [ef 60 20];
erase-block-size = <4096>;
write-block-size = <1>;

/*
* Partitions are present to support dual core operation.
* as flash write is not supported, MCUBoot is not enabled.
*/
partitions {
compatible = "fixed-partitions";
#address-cells = <1>;
Expand All @@ -46,20 +42,20 @@
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
};
/* Note slot 0 has one additional sector,
* this is intended for use with the swap move algorithm
/* The MCUBoot swap-move algorithm uses the last 3 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 0x301000>;
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
};
slot1_partition: partition@321000 {
slot1_partition: partition@723000 {
label = "image-1";
reg = <0x00321000 0x300000>;
reg = <0x00723000 DT_SIZE_M(7)>;
};
storage_partition: partition@621000 {
storage_partition: partition@E23000 {
label = "storage";
reg = <0x00621000 DT_SIZE_K(1984)>;
reg = <0x00E23000 (DT_SIZE_M(50) - DT_SIZE_K(140))>;
};
};
};
Expand Down
16 changes: 9 additions & 7 deletions boards/nxp/vmu_rt1170/vmu_rt1170.dtsi
Original file line number Diff line number Diff line change
Expand Up @@ -178,7 +178,7 @@
ahb-prefetch;
ahb-read-addr-opt;
rx-clock-source = <1>;
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
mx25um51345g: mx25um51345g@0 {
compatible = "nxp,imx-flexspi-mx25um51345g";
/* MX25UM51245G is 64MB, 512MBit flash part */
Expand All @@ -194,22 +194,24 @@
compatible = "fixed-partitions";
#address-cells = <1>;
#size-cells = <1>;

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 DT_SIZE_K(128)>;
};
/* The MCUBoot swap-move algorithm uses the last 14 sectors
* of the primary slot0 for swap status and move.
*/
slot0_partition: partition@20000 {
label = "image-0";
reg = <0x00020000 DT_SIZE_K(3076)>;
reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(56))>;
};
slot1_partition: partition@321000 {
slot1_partition: partition@32E000 {
label = "image-1";
reg = <0x00321000 DT_SIZE_K(3072)>;
reg = <0x0032E000 DT_SIZE_M(3)>;
};
storage_partition: partition@621000 {
storage_partition: partition@62E000 {
label = "storage";
reg = <0x00621000 DT_SIZE_M(57)>;
reg = <0x0062E000 (DT_SIZE_M(58) - DT_SIZE_K(184))>;
};
};
};
Expand Down

0 comments on commit 5df6aa8

Please sign in to comment.