nuttx icon indicating copy to clipboard operation
nuttx copied to clipboard

nucleo-h743zi: add board files to support mcuboot

Open tito97sp opened this issue 3 years ago • 9 comments

Signed-off-by: Andres Sanchez [email protected]

Summary

This pull request add support of mcuboot secure booting for nucleo h743zi board.

The implementation copies the work done by @pkarashchenko for the samv7 board in #4880

Impact

Two new configurations has been added,

  • mcuboot-loader: app-based bootloader that implements mcuboot functionality

  • mcuboot-app: simple app with mcuboot-confirm as main entry application

It needs to be configured in the toolchain the mcuboot image signer applcation "imgtool.py" to automatically sign the images before flashing

Testing

tito97sp avatar Nov 27 '21 18:11 tito97sp

Hi @tito97sp please fix these small issues:

Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_boot_image.c:2:1: error: Relative file path does not match actual file
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_boot_image.c:106:2: error: C++ style comment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_boot_image.c:110:2: error: C++ style comment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_boot_image.c:111:0: error: TABs found.  First detected
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_boot_image.c:112:1: error: Right brace must be followed by a blank line
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_boot_image.c:168:0: error: Garbage follows right bracket
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c:329:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c:330:6: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c:331:79: error: Long line found
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_bringup.c:333:6: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:2:1: error: Relative file path does not match actual file
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:119:1: error: Too many blank lines
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:147:2: error: C++ style comment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:148:2: error: C++ style comment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:157:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:159:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:189:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:195:6: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:198:6: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:205:6: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:208:6: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:210:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:216:1: error: Too many blank lines
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:232:1: error: Too many blank lines
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:233:27: error: C++ style comment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:233:35: error: Mixed case identifier found
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:233:43: error: Mixed case identifier found
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:233:80: error: Long line found
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:239:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:240:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:241:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:246:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:247:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:248:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:254:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:257:4: error: Bad alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:258:2: error: Bad right brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:273:2: error: Bad left brace alignment
Error: /home/runner/work/incubator-nuttx/incubator-nuttx/nuttx/boards/arm/stm32h7/nucleo-h743zi/src/stm32_progmem.c:277:2: error: Bad right brace alignment

You can run nxstyle/checkpatch to confirm everything is fine

acassis avatar Nov 27 '21 19:11 acassis

When selected PROGMEM_OTA_PARTITION by STM32_FORMAT_MCUBOOT it inverts the values of the next FLAGS: MTD MTD_BYTE_WRITE MTD_PARTITION MTD_PROGMEM MTD_PROGMEM_ERASESTATE

If my configuration already had activated the MTD functionalit, when using the PROGMEM_OTA_PARTITION it becomes false and opossite if it was not activated.

Do you know why it is this happening?? I have it selected as default = n as suggested previously

tito97sp avatar Nov 28 '21 17:11 tito97sp

When selected PROGMEM_OTA_PARTITION by STM32_FORMAT_MCUBOOT it inverts the values of the next FLAGS: MTD MTD_BYTE_WRITE MTD_PARTITION MTD_PROGMEM MTD_PROGMEM_ERASESTATE

If my configuration already had activated the MTD functionalit, when using the PROGMEM_OTA_PARTITION it becomes false and opossite if it was not activated.

Do you know why it is this happening?? I have it selected as default = n as suggested previously

I do not fully understand what do you mean. Enabling PROGMEM_OTA_PARTITION should enable MTD, MTD_BYTE_WRITE, MTD_PARTITION, MTD_PROGMEM and MTD_PROGMEM_ERASESTATE. Because enabling is implicit it those will no longer reside in defconfig file, but will be generated correctly into .config and that is ok. If this does not answer your question you can email me to [email protected] with make menuconfig screenshots and defconfig file, so I can make a further look.

pkarashchenko avatar Nov 28 '21 19:11 pkarashchenko

Hi @tito97sp ,

I add #4939 with the intention to clean a little bit the MCUboot support for samv7. I think that change may help to avoid duplicate code between boards and have only one linker script based in a template model.

nandojve avatar Dec 04 '21 15:12 nandojve

@acassis @pkarashchenko is this patch ready for merge?

xiaoxiang781216 avatar Dec 08 '21 14:12 xiaoxiang781216

@tito97sp could you squash the intermediate change into one patch?

xiaoxiang781216 avatar Dec 10 '21 18:12 xiaoxiang781216

Hi @tito97sp ,

I strong recommend you organize code like #4981. That way almost enable to use MCUboot on any STM32H7 board, in a easy way. Otherwise people will start to duplicate your code, which is complete unnecessary.

My concerns around MCUboot is that starting thinking support only one board seems to be the easy way but is hard to maintain. I would like encourage you to create the common folder and put all necessary things there. Then, only enable support in your board.

nandojve avatar Dec 21 '21 13:12 nandojve

@acassis @pkarashchenko is this patch ready for merge?

It seams he fixed all the suggestions, but the CI is failing. Maybe @tito97sp needs to rebase it to the HEAD to fix these issues.

acassis avatar Jan 03 '22 13:01 acassis

@tito97sp do you have any plans when you can update this PR?

pkarashchenko avatar Mar 08 '22 20:03 pkarashchenko

something really strange with this PR. I see "merge" and the force-push CC: @xiaoxiang781216 @acassis @btashton

pkarashchenko avatar Aug 25 '22 08:08 pkarashchenko

look like the patch become to empty and confuse the github

xiaoxiang781216 avatar Aug 25 '22 09:08 xiaoxiang781216

Yes, I was confused with a message "tito97sp merged commit d940d55 into apache:master 2 days ago"

pkarashchenko avatar Aug 25 '22 12:08 pkarashchenko

@tito97sp will you submit a new PR?

xiaoxiang781216 avatar Aug 26 '22 05:08 xiaoxiang781216