Skip to content

boards/nucleo-h743zi: Add nxboot bootloader support#18509

Merged
acassis merged 1 commit intoapache:masterfrom
neilberkman:boards/nucleo-h743zi-nxboot
Mar 11, 2026
Merged

boards/nucleo-h743zi: Add nxboot bootloader support#18509
acassis merged 1 commit intoapache:masterfrom
neilberkman:boards/nucleo-h743zi-nxboot

Conversation

@neilberkman
Copy link
Contributor

@neilberkman neilberkman commented Mar 8, 2026

Summary

Add nxboot bootloader board integration for nucleo-h743zi.

nxboot uses a three-slot layout (primary, secondary, tertiary) with no scratch partition.

  • add STM32_APP_FORMAT_NXBOOT board support and nxboot-specific OTA slot defaults
  • gate scratch partition configuration on MCUboot, where it applies
  • select nxboot linker scripts in the board build logic
  • add tertiary OTA partition support in stm32_progmem.c
  • add nxboot-loader and nxboot-app defconfigs and linker scripts
  • validate the fixed nxboot flash layout used by this board so mismatched config values fail at build time instead of producing a silently broken image

Impact

  • affects only boards/arm/stm32h7/nucleo-h743zi
  • no expected impact on non-nxboot board configurations
  • no expected impact on runtime behavior outside the new nxboot configurations
  • invalid nxboot layout settings now fail at build time instead of generating a bad image layout

Testing

Both configs build successfully. Loader flashed and verified on hardware (Nucleo-H743ZI, ST-LINK V2J47M34). See hardware verification comment.

@neilberkman neilberkman force-pushed the boards/nucleo-h743zi-nxboot branch 3 times, most recently from 1ac04fc to 1ff00ac Compare March 8, 2026 18:28
@linguini1
Copy link
Contributor

Hi @neilberkman , thanks for the patch!

Please take a look at the contributing guide :) Your PR description is a good summary, but still needs the impact & testing sections from the template.

@github-actions github-actions bot added Arch: arm Issues related to ARM (32-bit) architecture Size: L The size of the change in this PR is large Board: arm labels Mar 8, 2026
@linguini1 linguini1 requested a review from michallenc March 8, 2026 19:19
@neilberkman neilberkman force-pushed the boards/nucleo-h743zi-nxboot branch from 7578f46 to adfb88d Compare March 8, 2026 20:04
@neilberkman
Copy link
Contributor Author

Force-pushed an update to add the missing Signed-off-by on the top commit and fix the cmake-format issue in boards/arm/stm32h7/nucleo-h743zi/src/CMakeLists.txt. The PR description still includes the detailed Impact and Testing sections.

@neilberkman
Copy link
Contributor Author

CI failure in Linux (arm-13) is due to pre-existing Clang warnings in the nxboot app code (this PR is the first to build nxboot with Clang). Fix submitted: apache/nuttx-apps#3419

@acassis acassis requested a review from michallenc March 9, 2026 20:49
@acassis
Copy link
Contributor

acassis commented Mar 9, 2026

@neilberkman nice work, please fix this issue:

Configuration/Tool: nucleo-h743zi/nxboot-loader,CONFIG_ARM_TOOLCHAIN_CLANG
2026-03-08 22:18:56
------------------------------------------------------------------------------------
  Cleaning...
  Configuring...
  Disabling CONFIG_ARM_TOOLCHAIN_GNU_EABI
  Enabling CONFIG_ARM_TOOLCHAIN_CLANG
  Building NuttX...
Error: loader/flash.c:140:54: error: format specifies type 'long' but the argument has type 'off_t' (aka 'int') [-Werror,-Wformat]
  140 |       syslog(LOG_ERR, "Could not seek to %ld: %s\n", off, strerror(errno));
      |                                          ~~~         ^~~
      |                                          %d
Error: loader/flash.c:148:15: error: format specifies type 'long' but the argument has type 'off_t' (aka 'int') [-Werror,-Wformat]
  147 |       syslog(LOG_ERR, "Write to offset %ld failed %s\n",
      |                                        ~~~
      |                                        %d
  148 |               off, strerror(errno));
      |               ^~~
Error: loader/flash.c:198:54: error: format specifies type 'long' but the argument has type 'off_t' (aka 'int') [-Werror,-Wformat]
  198 |       syslog(LOG_ERR, "Could not seek to %ld: %s\n", off, strerror(errno));
      |                                          ~~~         ^~~
      |                                          %d
Error: loader/flash.c:205:59: error: format specifies type 'long' but the argument has type 'off_t' (aka 'int') [-Werror,-Wformat]
  205 |       syslog(LOG_ERR, "Read from offset %ld failed %s\n", off,
      |                                         ~~~               ^~~
      |                                         %d
4 errors generated.
make[2]: *** [/github/workspace/sources/apps/Application.mk:239: loader/flash.c.github.workspace.sources.apps.boot.nxboot.o] Error 1
Error: nxboot_main.c:132:17: error: passing an object that undergoes default argument promotion to 'va_start' has undefined behavior [-Werror,-Wvarargs]
  132 |   va_start(arg, type);
      |                 ^
nxboot_main.c:127:43: note: parameter of type 'enum progress_type_e' is declared here
  127 | void nxboot_progress(enum progress_type_e type, ...)
      |                                           ^
1 error generated.
make[2]: *** [/github/workspace/sources/apps/Application.mk:330: nxboot_main.c.github.workspace.sources.apps.boot.nxboot.o] Error 1
make[2]: Target 'all' not remade because of errors.
make[1]: *** [Makefile:54: /github/workspace/sources/apps/boot/nxboot_all] Error 2
make[1]: Target 'all' not remade because of errors.
make: *** [tools/LibTargets.mk:248: /github/workspace/sources/apps/libapps.a] Error 2
make: Target 'all' not remade because of errors.
/github/workspace/sources/nuttx/tools/testbuild.sh: line 385: /github/workspace/sources/nuttx/../nuttx/nuttx.manifest: No such file or directory
  [1/1] Normalize nucleo-h743zi/nxboot-loader

@neilberkman do you have plans to participate of the GSoC and contribute the two partitions support to NXBoot?

https://cwiki.apache.org/confluence/display/COMDEV/GSoC+2026+Ideas+list

@neilberkman
Copy link
Contributor Author

neilberkman commented Mar 9, 2026

Thanks @acassis! These are pre-existing Clang warnings in the nxboot app code. This PR is the first defconfig that builds nxboot with Clang, so they hadn't been caught before. Fix submitted: apache/nuttx-apps#3419. CI on that PR has one failed job (risc-v-05) which died at Docker Login (infra issue, not a build failure). All jobs that actually built passed. Will rebase this PR once that merges.

Re two-partition support for nxboot, would be great to see that happen. I won't be able to take it on myself though.

Copy link
Contributor

@linguini1 linguini1 left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

not yet tested on target hardware

Does this mean the patch hasn't been tested on the nucleo yet? If so, I think we should hold off on merge until it can be tested.

neilberkman added a commit to neilberkman/tardigrade that referenced this pull request Mar 10, 2026
When the nxboot board support PR (apache/nuttx#18509) is already
merged, the Kconfig text won't match the old patterns. Treat
missing old text as already-patched instead of raising.

Signed-off-by: Neil Berkman <neil@xuku.com>
@neilberkman neilberkman force-pushed the boards/nucleo-h743zi-nxboot branch from adfb88d to b422c10 Compare March 10, 2026 13:49
Add nxboot bootloader board integration for nucleo-h743zi.

nxboot uses a three-slot layout (primary, secondary, tertiary) with
no scratch partition.

- add STM32_APP_FORMAT_NXBOOT board support and nxboot-specific OTA
  slot defaults
- gate scratch partition configuration on MCUboot, where it applies
- select nxboot linker scripts in the board build logic
- add tertiary OTA partition support in stm32_progmem.c
- add nxboot-loader and nxboot-app defconfigs and linker scripts
- validate the fixed nxboot flash layout used by this board so
  mismatched config values fail at build time instead of producing
  a silently broken image

Signed-off-by: Neil Berkman <neil@xuku.com>
@neilberkman neilberkman force-pushed the boards/nucleo-h743zi-nxboot branch from b422c10 to a029bac Compare March 10, 2026 14:06
@neilberkman
Copy link
Contributor Author

neilberkman commented Mar 11, 2026

Hardware verification on Nucleo-H743ZI (ST-LINK V2J47M34).

nucleo-h743zi:nxboot-loader and nucleo-h743zi:nxboot-app both build successfully. Loader flashed and verified via OpenOCD:

Info : Device: STM32H74x/75x
Info : flash size probed value 2048k
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
** Programming Finished **
** Verified OK **

Loader boots and runs correctly on target. Serial output (USART3, 115200 8N1, via ST-Link virtual COM port):

*** nxboot ***
*** nxboot **Could not find bootable image.
*
Validating recovery image
Validating primary image
Validating update image
ERROR: No bootable image found

"No bootable image found" is expected — the OTA slots are empty. The bootloader validated all three slots correctly.

NSH console also verified. Switching the entrypoint to nsh_main (one config change, no code changes) confirms the full board support stack works end-to-end:

image-3
NuttShell (NSH) NuttX-12.12.0
Welcome to NuttX nxboot Loader!
nsh>

@neilberkman neilberkman requested a review from linguini1 March 11, 2026 07:52
@acassis
Copy link
Contributor

acassis commented Mar 11, 2026

Hardware verification on Nucleo-H743ZI (ST-LINK V2J47M34).

nucleo-h743zi:nxboot-loader and nucleo-h743zi:nxboot-app both build successfully. Loader flashed and verified via OpenOCD:

Info : Device: STM32H74x/75x
Info : flash size probed value 2048k
Info : STM32H7 flash has dual banks
Info : Bank (0) size is 1024 kb, base address is 0x08000000
** Programming Finished **
** Verified OK **

Loader boots and runs correctly on target. Serial output (USART3, 115200 8N1, via ST-Link virtual COM port):

*** nxboot ***
*** nxboot **Could not find bootable image.
*
Validating recovery image
Validating primary image
Validating update image
ERROR: No bootable image found

"No bootable image found" is expected — the OTA slots are empty. The bootloader validated all three slots correctly.

NSH console also verified. Switching the entrypoint to nsh_main (one config change, no code changes) confirms the full board support stack works end-to-end:
image-3

NuttShell (NSH) NuttX-12.12.0
Welcome to NuttX nxboot Loader!
nsh>

I think this Hercules serial console doesn't have VT102 support, it explains why you see this "[K". I think TeraTerm has support.

@acassis acassis merged commit 107b7a9 into apache:master Mar 11, 2026
43 of 49 checks passed
neilberkman added a commit to neilberkman/tardigrade that referenced this pull request Mar 12, 2026
build_public_target.py now checks if the NuttX tree already has
STM32_APP_FORMAT_NXBOOT in Kconfig (apache/nuttx#18509). If so, source
patches are skipped — only fixture files are installed as a safety net.
--skip-patches flag for explicit override.

3 new tests for upstream detection. README updated.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
neilberkman added a commit to neilberkman/tardigrade that referenced this pull request Mar 12, 2026
build_public_target.py now checks if the NuttX tree already has
STM32_APP_FORMAT_NXBOOT in Kconfig (apache/nuttx#18509). If so, source
patches are skipped — only fixture files are installed as a safety net.
--skip-patches flag for explicit override.

3 new tests for upstream detection. README updated.
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Arch: arm Issues related to ARM (32-bit) architecture Board: arm Size: L The size of the change in this PR is large

Projects

None yet

Development

Successfully merging this pull request may close these issues.

6 participants