Skip to content

Commit 5df6aa8

Browse files
butoknashif
authored andcommitted
boards: nxp: mimxrt11xx: fix non-optimal sector distribution
- 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 <andrey.butok@nxp.com>
1 parent a42ada8 commit 5df6aa8

File tree

5 files changed

+44
-52
lines changed

5 files changed

+44
-52
lines changed

‎boards/nxp/mimxrt1160_evk/mimxrt1160_evk.dtsi‎

Lines changed: 8 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -92,7 +92,7 @@
9292
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
9393
is25wp128: is25wp128@0 {
9494
compatible = "nxp,imx-flexspi-nor";
95-
size = <134217728>;
95+
size = <DT_SIZE_M(16*8)>;
9696
reg = <0>;
9797
spi-max-frequency = <133000000>;
9898
status = "okay";
@@ -104,25 +104,24 @@
104104
compatible = "fixed-partitions";
105105
#address-cells = <1>;
106106
#size-cells = <1>;
107-
108107
boot_partition: partition@0 {
109108
label = "mcuboot";
110109
reg = <0x00000000 DT_SIZE_K(128)>;
111110
};
112-
/* Note slot 0 has one additional sector,
113-
* this is intended for use with the swap move algorithm
111+
/* The MCUBoot swap-move algorithm uses the last 3 sectors
112+
* of the primary slot0 for swap status and move.
114113
*/
115114
slot0_partition: partition@20000 {
116115
label = "image-0";
117-
reg = <0x00020000 0x301000>;
116+
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
118117
};
119-
slot1_partition: partition@321000 {
118+
slot1_partition: partition@723000 {
120119
label = "image-1";
121-
reg = <0x00321000 0x300000>;
120+
reg = <0x00723000 DT_SIZE_M(7)>;
122121
};
123-
storage_partition: partition@621000 {
122+
storage_partition: partition@E23000 {
124123
label = "storage";
125-
reg = <0x00621000 DT_SIZE_K(1984)>;
124+
reg = <0x00E23000 (DT_SIZE_M(2) - DT_SIZE_K(140))>;
126125
};
127126
};
128127
};

‎boards/nxp/mimxrt1170_evk/mimxrt1170_evk.dtsi‎

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -191,7 +191,7 @@
191191
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
192192
is25wp128: is25wp128@0 {
193193
compatible = "nxp,imx-flexspi-nor";
194-
size = <134217728>;
194+
size = <DT_SIZE_M(16*8)>;
195195
reg = <0>;
196196
spi-max-frequency = <133000000>;
197197
status = "okay";
@@ -208,20 +208,20 @@
208208
label = "mcuboot";
209209
reg = <0x00000000 DT_SIZE_K(128)>;
210210
};
211-
/* Note slot 0 has one additional sector,
212-
* this is intended for use with the swap move algorithm
211+
/* The MCUBoot swap-move algorithm uses the last 3 sectors
212+
* of the primary slot0 for swap status and move.
213213
*/
214214
slot0_partition: partition@20000 {
215215
label = "image-0";
216-
reg = <0x00020000 0x301000>;
216+
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
217217
};
218-
slot1_partition: partition@321000 {
218+
slot1_partition: partition@723000 {
219219
label = "image-1";
220-
reg = <0x00321000 0x300000>;
220+
reg = <0x00723000 DT_SIZE_M(7)>;
221221
};
222-
storage_partition: partition@621000 {
222+
storage_partition: partition@E23000 {
223223
label = "storage";
224-
reg = <0x00621000 DT_SIZE_K(1984)>;
224+
reg = <0x00E23000 (DT_SIZE_M(2) - DT_SIZE_K(140))>;
225225
};
226226
};
227227
};

‎boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm4_B.overlay‎

Lines changed: 8 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -22,20 +22,15 @@
2222
status = "okay";
2323
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
2424
w25q512nw:w25q512nw@0 {
25-
/* IS25WP128 flash chip not currently enabled */
2625
compatible = "nxp,imx-flexspi-nor";
27-
size = <DT_SIZE_M(512)>;
26+
size = <DT_SIZE_M(64*8)>;
2827
reg = <0>;
2928
spi-max-frequency = <133000000>;
3029
status = "okay";
3130
jedec-id = [ef 60 20];
3231
erase-block-size = <4096>;
3332
write-block-size = <1>;
3433

35-
/*
36-
* Partitions are present to support dual core operation.
37-
* as flash write is not supported, MCUBoot is not enabled.
38-
*/
3934
partitions {
4035
compatible = "fixed-partitions";
4136
#address-cells = <1>;
@@ -45,20 +40,20 @@
4540
label = "mcuboot";
4641
reg = <0x00000000 DT_SIZE_K(128)>;
4742
};
48-
/* Note slot 0 has one additional sector,
49-
* this is intended for use with the swap move algorithm
43+
/* The MCUBoot swap-move algorithm uses the last 3 sectors
44+
* of the primary slot0 for swap status and move.
5045
*/
5146
slot0_partition: partition@20000 {
5247
label = "image-0";
53-
reg = <0x00020000 0x301000>;
48+
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
5449
};
55-
slot1_partition: partition@321000 {
50+
slot1_partition: partition@723000 {
5651
label = "image-1";
57-
reg = <0x00321000 0x300000>;
52+
reg = <0x00723000 DT_SIZE_M(7)>;
5853
};
59-
storage_partition: partition@621000 {
54+
storage_partition: partition@E23000 {
6055
label = "storage";
61-
reg = <0x00621000 DT_SIZE_K(1984)>;
56+
reg = <0x00E23000 (DT_SIZE_M(50) - DT_SIZE_K(140))>;
6257
};
6358
};
6459
};

‎boards/nxp/mimxrt1170_evk/mimxrt1170_evk_mimxrt1176_cm7_B.overlay‎

Lines changed: 11 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@
77
/ {
88
chosen {
99
zephyr,flash = &w25q512nw;
10-
/delete-property/ zephyr,flash-controller;
11-
/delete-property/ zephyr,code-partition;
10+
zephyr,flash-controller = &w25q512nw;
11+
zephyr,flash = &w25q512nw;
12+
zephyr,code-partition = &slot0_partition;
1213
};
1314

1415
aliases {
@@ -23,20 +24,15 @@
2324
status = "okay";
2425
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
2526
w25q512nw:w25q512nw@0 {
26-
/* IS25WP128 flash chip not currently enabled */
2727
compatible = "nxp,imx-flexspi-nor";
28-
size = <DT_SIZE_M(512)>;
28+
size = <DT_SIZE_M(64*8)>;
2929
reg = <0>;
3030
spi-max-frequency = <133000000>;
3131
status = "okay";
3232
jedec-id = [ef 60 20];
3333
erase-block-size = <4096>;
3434
write-block-size = <1>;
3535

36-
/*
37-
* Partitions are present to support dual core operation.
38-
* as flash write is not supported, MCUBoot is not enabled.
39-
*/
4036
partitions {
4137
compatible = "fixed-partitions";
4238
#address-cells = <1>;
@@ -46,20 +42,20 @@
4642
label = "mcuboot";
4743
reg = <0x00000000 DT_SIZE_K(128)>;
4844
};
49-
/* Note slot 0 has one additional sector,
50-
* this is intended for use with the swap move algorithm
45+
/* The MCUBoot swap-move algorithm uses the last 3 sectors
46+
* of the primary slot0 for swap status and move.
5147
*/
5248
slot0_partition: partition@20000 {
5349
label = "image-0";
54-
reg = <0x00020000 0x301000>;
50+
reg = <0x00020000 (DT_SIZE_M(7) + DT_SIZE_K(12))>;
5551
};
56-
slot1_partition: partition@321000 {
52+
slot1_partition: partition@723000 {
5753
label = "image-1";
58-
reg = <0x00321000 0x300000>;
54+
reg = <0x00723000 DT_SIZE_M(7)>;
5955
};
60-
storage_partition: partition@621000 {
56+
storage_partition: partition@E23000 {
6157
label = "storage";
62-
reg = <0x00621000 DT_SIZE_K(1984)>;
58+
reg = <0x00E23000 (DT_SIZE_M(50) - DT_SIZE_K(140))>;
6359
};
6460
};
6561
};

‎boards/nxp/vmu_rt1170/vmu_rt1170.dtsi‎

Lines changed: 9 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -178,7 +178,7 @@
178178
ahb-prefetch;
179179
ahb-read-addr-opt;
180180
rx-clock-source = <1>;
181-
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(16)>;
181+
reg = <0x400cc000 0x4000>, <0x30000000 DT_SIZE_M(64)>;
182182
mx25um51345g: mx25um51345g@0 {
183183
compatible = "nxp,imx-flexspi-mx25um51345g";
184184
/* MX25UM51245G is 64MB, 512MBit flash part */
@@ -194,22 +194,24 @@
194194
compatible = "fixed-partitions";
195195
#address-cells = <1>;
196196
#size-cells = <1>;
197-
198197
boot_partition: partition@0 {
199198
label = "mcuboot";
200199
reg = <0x00000000 DT_SIZE_K(128)>;
201200
};
201+
/* The MCUBoot swap-move algorithm uses the last 14 sectors
202+
* of the primary slot0 for swap status and move.
203+
*/
202204
slot0_partition: partition@20000 {
203205
label = "image-0";
204-
reg = <0x00020000 DT_SIZE_K(3076)>;
206+
reg = <0x00020000 (DT_SIZE_M(3) + DT_SIZE_K(56))>;
205207
};
206-
slot1_partition: partition@321000 {
208+
slot1_partition: partition@32E000 {
207209
label = "image-1";
208-
reg = <0x00321000 DT_SIZE_K(3072)>;
210+
reg = <0x0032E000 DT_SIZE_M(3)>;
209211
};
210-
storage_partition: partition@621000 {
212+
storage_partition: partition@62E000 {
211213
label = "storage";
212-
reg = <0x00621000 DT_SIZE_M(57)>;
214+
reg = <0x0062E000 (DT_SIZE_M(58) - DT_SIZE_K(184))>;
213215
};
214216
};
215217
};

0 commit comments

Comments
 (0)