-
Notifications
You must be signed in to change notification settings - Fork 8.1k
stm32: mcuboot: add support for mcuboot tests and samples #93862
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: main
Are you sure you want to change the base?
Changes from all commits
c65a97c
81c085b
062a2eb
8c240fa
920d124
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -19,6 +19,7 @@ | |
zephyr,shell-uart = &usart2; | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &slot0_partition; | ||
}; | ||
|
||
leds: leds { | ||
|
@@ -178,3 +179,32 @@ zephyr_udc0: &usb { | |
pinctrl-names = "default"; | ||
status = "okay"; | ||
}; | ||
|
||
&flash0 { | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 DT_SIZE_K(64)>; | ||
}; | ||
|
||
slot0_partition: partition@10000 { | ||
label = "image-0"; | ||
reg = <0x00010000 DT_SIZE_K(30)>; | ||
}; | ||
|
||
slot1_partition: partition@17800 { | ||
label = "image-1"; | ||
reg = <0x00017800 DT_SIZE_K(30)>; | ||
}; | ||
|
||
/* Set 4KB of storage at the end of 128KB flash */ | ||
storage_partition: partition@1f000 { | ||
label = "storage"; | ||
reg = <0x0001f000 DT_SIZE_K(4)>; | ||
}; | ||
Comment on lines
+204
to
+208
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. don't know what the sector size is but for nvs this would need to be at least 3 sectors to be usable There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Indeed sectors (named "pages" in th SoC refman) are 2kB large. |
||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -21,6 +21,7 @@ | |
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,canbus = &can1; | ||
zephyr,code-partition = &slot0_partition; | ||
}; | ||
|
||
leds: leds { | ||
|
@@ -149,10 +150,25 @@ | |
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
/* Set 6Kb of storage at the end of the 256Kb of flash */ | ||
storage_partition: partition@3e800 { | ||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 DT_SIZE_K(64)>; | ||
}; | ||
|
||
slot0_partition: partition@10000 { | ||
label = "image-0"; | ||
reg = <0x00010000 DT_SIZE_K(94)>; | ||
}; | ||
|
||
slot1_partition: partition@27800 { | ||
label = "image-1"; | ||
reg = <0x00027800 DT_SIZE_K(94)>; | ||
}; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Does this actually work? At least as I remember it, without a scratch partition, there are specific requirements for the sizes, and specifically one slot must be exactly one sector larger than the other (we'd have to look up which is which.) |
||
|
||
/* Set 4Kb of storage at the end of the 256Kb of flash */ | ||
storage_partition: partition@3f000 { | ||
label = "storage"; | ||
reg = <0x0003e800 DT_SIZE_K(6)>; | ||
reg = <0x0003f000 DT_SIZE_K(4)>; | ||
}; | ||
}; | ||
}; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -20,6 +20,7 @@ | |
zephyr,shell-uart = &usart2; | ||
zephyr,sram = &sram0; | ||
zephyr,flash = &flash0; | ||
zephyr,code-partition = &slot0_partition; | ||
}; | ||
|
||
leds: leds { | ||
|
@@ -167,6 +168,21 @@ | |
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 DT_SIZE_K(64)>; | ||
}; | ||
|
||
slot0_partition: partition@10000 { | ||
label = "image-0"; | ||
reg = <0x00010000 DT_SIZE_K(32)>; | ||
}; | ||
|
||
slot1_partition: partition@18000 { | ||
label = "image-1"; | ||
reg = <0x00018000 DT_SIZE_K(30)>; | ||
}; | ||
Comment on lines
+176
to
+184
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sizes are different? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Aren't the sizes required to be different? There is no scratch partition, so this is using one of the move algorithms. |
||
|
||
/* Set 2KB of storage at the end of 128KB flash */ | ||
storage_partition: partition@1f800 { | ||
label = "storage"; | ||
|
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -28,6 +28,7 @@ | |
zephyr,flash = &flash0; | ||
zephyr,dtcm = &dtcm; | ||
zephyr,canbus = &can1; | ||
zephyr,code-partition = &slot0_partition; | ||
}; | ||
|
||
leds: leds { | ||
|
@@ -235,3 +236,31 @@ zephyr_udc0: &usbotg_fs { | |
&vbat { | ||
status = "okay"; | ||
}; | ||
|
||
&flash0 { | ||
partitions { | ||
compatible = "fixed-partitions"; | ||
#address-cells = <1>; | ||
#size-cells = <1>; | ||
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 DT_SIZE_K(64)>; | ||
}; | ||
|
||
storage_partition: partition@10000 { | ||
label = "storage"; | ||
reg = <0x00010000 DT_SIZE_K(192)>; | ||
}; | ||
|
||
slot0_partition: partition@40000 { | ||
label = "image-0"; | ||
reg = <0x00040000 DT_SIZE_K(448)>; | ||
}; | ||
|
||
slot1_partition: partition@b0000 { | ||
label = "image-1"; | ||
reg = <0x000b0000 DT_SIZE_K(320)>; | ||
}; | ||
Comment on lines
+256
to
+264
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. sizes are very different? If using different sizes then the extra sector should be in slot 1 and swap using offset should be used rather than swap using move There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Thank you for your feedback. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Seen F746xx SoCs flash sectors distribution (rm0385 rev9/table 3/page 79), I think the sole supported layout requires: slot0 is 2x256kB, slot1 is 1x256kB, storage is 3x32kB (placed at flash start) and boot occupies a signle 128kB sector. |
||
}; | ||
}; |
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -177,17 +177,17 @@ stm32_lp_tick_source: &lptim1 { | |
|
||
boot_partition: partition@0 { | ||
label = "mcuboot"; | ||
reg = <0x00000000 DT_SIZE_K(34)>; | ||
reg = <0x00000000 DT_SIZE_K(64)>; | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. 48KB is the minimum MCUboot partition size, Flash sectors are atmost 4KB on this SoC, so why give more to MCUboot? There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I just based it on how the nucleo_wba55cg was added, and also compared the sizes of the flash sectors/pages in the refman and adapted with the rest so that it worked on the tests. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. |
||
}; | ||
|
||
slot0_partition: partition@8800 { | ||
slot0_partition: partition@10000 { | ||
label = "image-0"; | ||
reg = <0x00008800 DT_SIZE_K(240)>; | ||
reg = <0x000010000 DT_SIZE_K(192)>; | ||
}; | ||
|
||
slot1_partition: partition@44800 { | ||
slot1_partition: partition@40000 { | ||
label = "image-1"; | ||
reg = <0x00044800 DT_SIZE_K(234)>; | ||
reg = <0x00040000 DT_SIZE_K(192)>; | ||
}; | ||
|
||
/* Set 4Kb of storage at the end of the 512Kb of flash */ | ||
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Could you update the
flash:
tag in board specific YAML files to reflect the Zephyr application max flash size for each of these modified layouts?Uh oh!
There was an error while loading. Please reload this page.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
No, it's not a good idea, unless the target is meant to be used exclusively with MCUboot.
Instead, there should be a board
mcuboot
variant, with- sysbuild=true
in its YAML file and MIN(slot0,slot1) as flash size.