Skip to content

Conversation

@fdcavalcanti
Copy link
Contributor

@fdcavalcanti fdcavalcanti commented Nov 17, 2025

Summary

  • boards/arm/samv7: remove unused options on defconfig
    Remove the unused Nuttshell and RAMTEST to free up some space on boot partition.

This should fix linker issues reported in nuttx-apps #3200.

Impact

Affects common linker script for arm/samv7 when using MCUBoot.

Testing

Before changes:

$ make -j10
[...]
Register: mcuboot_loader
Register: ramtest
Register: sh
Register: nsh
[...]
LD: nuttx
arm-none-eabi-ld: /home/fdcavalcanti/nuttxspace1/nuttx/nuttx section `.text' will not fit in region `flash'
arm-none-eabi-ld: region `flash' overflowed by 3672 bytes
make[1]: *** [Makefile:217: nuttx] Error 1
make: *** [tools/Unix.mk:552: nuttx] Error 2

After changes:

$ make -j10
Create version.h
[...]
Register: mcuboot_loader
Register: ramtest
Register: sh
Register: nsh
[...]
LD: nuttx
CP: nuttx.bin

@fdcavalcanti fdcavalcanti requested a review from cederom November 17, 2025 14:24
@github-actions github-actions bot added Board: arm Size: XS The size of the change in this PR is very small labels Nov 17, 2025
@fdcavalcanti
Copy link
Contributor Author

If someone has this board to validate the changes it would be greatly appreciated.

@cederom
Copy link
Contributor

cederom commented Nov 17, 2025

If someone has this board to validate the changes it would be greatly appreciated.

I have only SAM[L21,R21,W25]. These V70/V71 looks far more expensive and I already bought some rPI boards so probably not going to buy them sorry :-(

I guess if there are no users with the boards, and the build is fixed, that is okay, will ask on the mailing list :-)

@matiamic
Copy link
Contributor

Hi, I still have one SAMV71-XULT borrowed from Elektroline.cz from GSoC. I suppose I could run some tests with it.

@fdcavalcanti
Copy link
Contributor Author

Hi, I still have one SAMV71-XULT borrowed from Elektroline.cz from GSoC. I suppose I could run some tests with it.

Thank you very much @matiamic!
Please try same70-qmtech/mcuboot-loader. Ideally this should OTA but given the changes, ostest should be good enough!

@cederom
Copy link
Contributor

cederom commented Nov 18, 2025

@TimJTi told on the mailing list he has some spare boards with SAMv7 and can share for testing, big thank you Tim! I would be grateful to take one board for NXDART, anyone else needs one? :-)

@fdcavalcanti fdcavalcanti marked this pull request as draft November 19, 2025 11:20
@TimJTi
Copy link
Contributor

TimJTi commented Nov 19, 2025

@TimJTi told on the mailing list he has some spare boards with SAMv7 and can share for testing, big thank you Tim! I would be grateful to take one board for NXDART, anyone else needs one? :-)

I have found 1 x SAMV71-XULT and have emailed you 👍

Remove the unused Nuttshell and RAMTEST to free up some space on
boot partition.

Signed-off-by: Filipe Cavalcanti <[email protected]>
@fdcavalcanti fdcavalcanti force-pushed the bugfix/samv7-mcuboot-fix-flash-img branch from 39d3955 to 60c9b81 Compare November 19, 2025 17:31
@fdcavalcanti fdcavalcanti changed the title boards/arm/samv7: fix default flash image size when using MCUBoot boards/arm/samv7: remove unused options on defconfig Nov 19, 2025
@fdcavalcanti fdcavalcanti marked this pull request as ready for review November 19, 2025 17:32
@fdcavalcanti
Copy link
Contributor Author

I have changed the defconfig.
@matiamic could you please test this one? :)

@cederom
Copy link
Contributor

cederom commented Nov 20, 2025

  • For me this looks good, thank you @fdcavalcanti :-)
  • We can wait for @pkarashchenko and @matiamic feedback as the only active users of this target?
  • I will get the board from @TimJTi (thank you again Tim!!) not sooner than next week. Not to block further other works, as soon as target familiar users provide feedback we can try to merge and I will test as soon as I have the board :-)

Copy link
Contributor

@michallenc michallenc left a comment

Choose a reason for hiding this comment

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

These changes should be ok based on what I use on custom SAMv71 boards.

@cederom
Copy link
Contributor

cederom commented Nov 20, 2025

@pkarashchenko ?

@matiamic
Copy link
Contributor

matiamic commented Nov 20, 2025

Hi, I brought the changes from the changed defconfig to samv71-xult's defconfig. Compilation OK, execution gets stuck on

*** Booting MCUboot build fefc398cc13ebbc527e297fe9df78cd98a359d75 ***
Unable to find bootable image

But that behavior is the same for the build without the changes. And it makes sense as I am providing no firmware image.

I tried to provide a valid image by following the steps in the same-70-qmtech:mcuboot-loader defconfig documentation and then copying the result to a FAT32 SD card, but it seem this is not the way this is supposed to work:) - the result is the same and it seems that there is more elaborate description of the process in samv71-xult's board documentation, but I didn't have the guts to dive into it).

@cederom
Copy link
Contributor

cederom commented Nov 20, 2025

  • Thanks for testing @matiamic :-)
  • I guess the bootloader part updated here requires the OS image, which needs to be compiled and flashed as different firmware configuration at different address.
  • Only bootloader components are updated in this PR, but not old bootloader image size, so the new mcuboot fits in the existing memory map already, and not regions are changed either for bootloader or the OS image, so it should be compatible.
  • I will play with it too when the board arrives :-)

Copy link
Contributor

@cederom cederom left a comment

Choose a reason for hiding this comment

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

Big Thank You @fdcavalcanti Amazin Work!! :-)

@fdcavalcanti
Copy link
Contributor Author

@pkarashchenko could you please take a look?

@cederom
Copy link
Contributor

cederom commented Nov 26, 2025

Okay I just got the SAMv7 board from @TimJTi delivered!
AGAIN BIG THANK YOU TIM!!
Will get into it now :-)

@cederom
Copy link
Contributor

cederom commented Nov 26, 2025

Okay first steps working :-) Can flash with OpenOCD over the built-in Atmel debug probe (luckily its generic cmsis-dap.cfg compatible), nsh builds and works :-)

% uname -a
FreeBSD hexagon 14.3-RELEASE-p5 FreeBSD 14.3-RELEASE-p5 GENERIC amd64

% ./tools/configure.sh -B samv71-xult:nsh
(..)
% gmake -j24
(..)
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:      127608 B         2 MB      6.08%
            sram:       10560 B       384 KB      2.69%
CP: nuttx.bin

% openocd -f interface/cmsis-dap.cfg -c 'transport select swd' -c 'set CHIPNAME atsamv71q21' -f target/atsamv.cfg -c 'reset_config srst_only' -c init -c targets -c 'reset halt' -c 'program nuttx.bin 0x400000' -c 'reset halt' -c 'atsamv gpnvm set 1' -c 'reset run' -c shutdown
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
atsamv71q21
Info : flash bank command
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = ATML2407121800000086
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bd11477
Info : [atsamv71q21.cpu] Cortex-M7 r1p1 processor detected
Info : [atsamv71q21.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for atsamv71q21.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamv71q21.cpu    cortex_m   little atsamv71q21.cpu    running

[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097e msp: 0x20402d40
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097e msp: 0x20402d40
** Programming Started **
Info : device id = 0xa1220e01
Info : erasing lock regions 0-7...
Info : erasing lock region 0
Info : erasing lock region 1
Info : erasing lock region 2
Info : erasing lock region 3
Info : erasing lock region 4
Info : erasing lock region 5
Info : erasing lock region 6
Info : erasing lock region 7
** Programming Finished **
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097e msp: 0x20402d40
shutdown command invoked

% cu -l /dev/cuaU0 -s 115200
Connected

nsh> uname -a
NuttX 12.11.0 8f91054b1d Nov 27 2025 00:00:24 arm samv71-xult
nsh> help
help usage:  help [-v] [<cmd>]

    .           cp          expr        mkdir       rm          uname
    [           cmp         false       mkfatfs     rmdir       umount
    ?           dirname     fdinfo      mkrd        set         unset
    alias       df          free        mount       sleep       uptime
    unalias     dmesg       help        mv          source      usleep
    basename    echo        hexdump     pidof       test        watch
    break       env         kill        printf      time        xd
    cat         exec        pkill       ps          true        wait
    cd          exit        ls          pwd         truncate

Builtin Apps:
    dd         i2c        nsh        ramtest    sh

So far so good :-)

Now into this mcuboot stuff :-) https://nuttx.apache.org/docs/latest/platforms/arm/samv7/boards/samv71-xult/index.html#mcuboot-loader

@cederom
Copy link
Contributor

cederom commented Nov 26, 2025

  • This is the nuttx master branch test run just to make sure things work here and learn how things work.
  • I know this fix is for same70-qmtech while I have samv71-xult with a bit different MCU and there is external RAM and Flash onboard. Will try to set it to qmtech like setup when I know how things work on this board.
  1. samv71-xult:mcuboot-loader:
% ./tools/configure.sh -B samv71-xult:mcuboot-loader
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
CP: arch/dummy/Kconfig to /tmp/nuttx/nuttx/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /tmp/nuttx/nuttx/boards/dummy/dummy_kconfig
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
LN: include/arch to arch/arm/include
LN: include/arch/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/include
LN: drivers/platform to /tmp/nuttx/nuttx/drivers/dummy
LN: include/arch/chip to /tmp/nuttx/nuttx/arch/arm/include/samv7
LN: arch/arm/src/chip to /tmp/nuttx/nuttx/arch/arm/src/samv7
LN: arch/arm/src/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/../common
LN: arch/arm/src/board/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/src
mkkconfig in /tmp/nuttx/nuttx-apps/audioutils
mkkconfig in /tmp/nuttx/nuttx-apps/benchmarks
mkkconfig in /tmp/nuttx/nuttx-apps/boot
mkkconfig in /tmp/nuttx/nuttx-apps/canutils
mkkconfig in /tmp/nuttx/nuttx-apps/crypto
mkkconfig in /tmp/nuttx/nuttx-apps/database
mkkconfig in /tmp/nuttx/nuttx-apps/examples/mcuboot
mkkconfig in /tmp/nuttx/nuttx-apps/examples/module
mkkconfig in /tmp/nuttx/nuttx-apps/examples/rust
mkkconfig in /tmp/nuttx/nuttx-apps/examples/sotest
mkkconfig in /tmp/nuttx/nuttx-apps/examples
mkkconfig in /tmp/nuttx/nuttx-apps/fsutils
mkkconfig in /tmp/nuttx/nuttx-apps/games
mkkconfig in /tmp/nuttx/nuttx-apps/graphics
mkkconfig in /tmp/nuttx/nuttx-apps/industry
mkkconfig in /tmp/nuttx/nuttx-apps/inertial
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters/luamodules
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters
mkkconfig in /tmp/nuttx/nuttx-apps/logging
mkkconfig in /tmp/nuttx/nuttx-apps/lte
mkkconfig in /tmp/nuttx/nuttx-apps/math
mkkconfig in /tmp/nuttx/nuttx-apps/mlearning
mkkconfig in /tmp/nuttx/nuttx-apps/netutils
mkkconfig in /tmp/nuttx/nuttx-apps/sdr
mkkconfig in /tmp/nuttx/nuttx-apps/system
mkkconfig in /tmp/nuttx/nuttx-apps/tee
mkkconfig in /tmp/nuttx/nuttx-apps/testing/arch
mkkconfig in /tmp/nuttx/nuttx-apps/testing/cxx
mkkconfig in /tmp/nuttx/nuttx-apps/testing/drivers
mkkconfig in /tmp/nuttx/nuttx-apps/testing/fs
mkkconfig in /tmp/nuttx/nuttx-apps/testing/libc
mkkconfig in /tmp/nuttx/nuttx-apps/testing/mm
mkkconfig in /tmp/nuttx/nuttx-apps/testing/sched
mkkconfig in /tmp/nuttx/nuttx-apps/testing
mkkconfig in /tmp/nuttx/nuttx-apps/videoutils
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/bluetooth
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/ieee802154
mkkconfig in /tmp/nuttx/nuttx-apps/wireless
mkkconfig in /tmp/nuttx/nuttx-apps
#
# configuration written to .config
#

% /usr/bin/time -h gmake -j24
Create version.h
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
Downloading MCUboot-fefc398cc13ebbc527e297fe9df78cd98a359d75 from github.com/mcu-tools/mcuboot
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0   0     0   0     0     0     0  --:--:-- --:--:-- --:--:--     0
100  1669k   0  1669k   0     0  1969k     0  --:--:-- --:--:-- --:--:--  9093k
Unpacking: fefc398cc13ebbc527e297fe9df78cd98a359d75.tar.gz -> mcuboot
Register: mcuboot_loader
Register: ramtest
Register: dd
Register: nsh
Register: sh
chip/sam_clockconfig.c: In function 'sam_enabledefaultmaster':
chip/sam_clockconfig.c:303:2: warning: #warning REVISIT [-Wcpp]
  303 | #warning REVISIT
      |  ^~~~~~~
CC:  chip/sam_timerisr.c chip/sam_start.c: In function 'sam_tcmenable':
chip/sam_start.c:109:2: warning: #warning Missing logic [-Wcpp]
  109 | #warning Missing logic
      |  ^~~~~~~
chip/sam_xdmac.c: In function 'sam_physramaddr':
CC:  net/lib_addrconfig.c chip/sam_xdmac.c:444:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  444 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
CC:  common/arm_initialize.c chip/sam_xdmac.c: In function 'sam_virtramaddr':
chip/sam_xdmac.c:450:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  450 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:      103736 B       128 KB     79.14%
            sram:       23708 B       384 KB      6.03%
CP: nuttx.bin
        6,49s real              33,42s user             13,41s sys

% grep CONFIG_BOARD_LATE_INITIALIZE=y .config
CONFIG_BOARD_LATE_INITIALIZE=y
% grep CONFIG_BOOT_MCUBOOT=y .config
CONFIG_BOOT_MCUBOOT=y
% grep CONFIG_MCUBOOT_BOOTLOADER=y .config
CONFIG_MCUBOOT_BOOTLOADER=y
% grep CONFIG_SAMV7_FORMAT_MCUBOOT=y .config
CONFIG_SAMV7_FORMAT_MCUBOOT=y
% grep CONFIG_INIT_ENTRYPOINT="mcuboot_loader_main" .config
% grep RAM_SIZE .config
CONFIG_RAM_SIZE=393216

% openocd -f interface/cmsis-dap.cfg \
        -c 'transport select swd' \
        -c 'set CHIPNAME atsamv71q21' \
        -f target/atsamv.cfg \
        -c 'reset_config srst_only' \
        -c init -c targets \
        -c 'reset halt' \
        -c 'program nuttx.bin 0x400000' \
        -c 'reset halt' \
        -c 'atsamv gpnvm set 1' \
        -c 'reset run' -c shutdown
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
atsamv71q21
Info : flash bank command
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = ATML2407121800000086
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bd11477
Info : [atsamv71q21.cpu] Cortex-M7 r1p1 processor detected
Info : [atsamv71q21.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for atsamv71q21.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamv71q21.cpu    cortex_m   little atsamv71q21.cpu    running

[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097e msp: 0x20402d40
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097e msp: 0x20402d40
** Programming Started **
Info : device id = 0xa1220e01
Info : erasing lock regions 0-6...
Info : erasing lock region 0
Info : erasing lock region 1
Info : erasing lock region 2
Info : erasing lock region 3
Info : erasing lock region 4
Info : erasing lock region 5
Info : erasing lock region 6
** Programming Finished **
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
shutdown command invoked

% cu -l /dev/cuaU0 -s 115200
Connected
<-- NO NSH HERE.
  1. samv71-xult:mcuboot-swap-test:
% ./tools/configure.sh -B samv71-xult:mcuboot-swap-test
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
CP: arch/dummy/Kconfig to /tmp/nuttx/nuttx/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /tmp/nuttx/nuttx/boards/dummy/dummy_kconfig
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
LN: include/arch to arch/arm/include
LN: include/arch/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/include
LN: drivers/platform to /tmp/nuttx/nuttx/drivers/dummy
LN: include/arch/chip to /tmp/nuttx/nuttx/arch/arm/include/samv7
LN: arch/arm/src/chip to /tmp/nuttx/nuttx/arch/arm/src/samv7
LN: arch/arm/src/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/../common
LN: arch/arm/src/board/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/src
mkkconfig in /tmp/nuttx/nuttx-apps/audioutils
mkkconfig in /tmp/nuttx/nuttx-apps/benchmarks
mkkconfig in /tmp/nuttx/nuttx-apps/boot
mkkconfig in /tmp/nuttx/nuttx-apps/canutils
mkkconfig in /tmp/nuttx/nuttx-apps/crypto
mkkconfig in /tmp/nuttx/nuttx-apps/database
mkkconfig in /tmp/nuttx/nuttx-apps/examples/mcuboot
mkkconfig in /tmp/nuttx/nuttx-apps/examples/module
mkkconfig in /tmp/nuttx/nuttx-apps/examples/rust
mkkconfig in /tmp/nuttx/nuttx-apps/examples/sotest
mkkconfig in /tmp/nuttx/nuttx-apps/examples
mkkconfig in /tmp/nuttx/nuttx-apps/fsutils
mkkconfig in /tmp/nuttx/nuttx-apps/games
mkkconfig in /tmp/nuttx/nuttx-apps/graphics
mkkconfig in /tmp/nuttx/nuttx-apps/industry
mkkconfig in /tmp/nuttx/nuttx-apps/inertial
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters/luamodules
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters
mkkconfig in /tmp/nuttx/nuttx-apps/logging
mkkconfig in /tmp/nuttx/nuttx-apps/lte
mkkconfig in /tmp/nuttx/nuttx-apps/math
mkkconfig in /tmp/nuttx/nuttx-apps/mlearning
mkkconfig in /tmp/nuttx/nuttx-apps/netutils
mkkconfig in /tmp/nuttx/nuttx-apps/sdr
mkkconfig in /tmp/nuttx/nuttx-apps/system
mkkconfig in /tmp/nuttx/nuttx-apps/tee
mkkconfig in /tmp/nuttx/nuttx-apps/testing/arch
mkkconfig in /tmp/nuttx/nuttx-apps/testing/cxx
mkkconfig in /tmp/nuttx/nuttx-apps/testing/drivers
mkkconfig in /tmp/nuttx/nuttx-apps/testing/fs
mkkconfig in /tmp/nuttx/nuttx-apps/testing/libc
mkkconfig in /tmp/nuttx/nuttx-apps/testing/mm
mkkconfig in /tmp/nuttx/nuttx-apps/testing/sched
mkkconfig in /tmp/nuttx/nuttx-apps/testing
mkkconfig in /tmp/nuttx/nuttx-apps/videoutils
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/bluetooth
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/ieee802154
mkkconfig in /tmp/nuttx/nuttx-apps/wireless
mkkconfig in /tmp/nuttx/nuttx-apps
#
# configuration written to .config
#

% /usr/bin/time -h gmake -j24
Create version.h
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
Downloading MCUboot-fefc398cc13ebbc527e297fe9df78cd98a359d75 from github.com/mcu-tools/mcuboot
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0   0     0   0     0     0     0  --:--:-- --:--:-- --:--:--     0
100  1669k   0  1669k   0     0  2058k     0  --:--:-- --:--:-- --:--:--  3901k
Unpacking: fefc398cc13ebbc527e297fe9df78cd98a359d75.tar.gz -> mcuboot
Register: dd
Register: ramtest
Register: nsh
Register: sh
Register: mcuboot_confirm
Register: mcuboot_set_img
Register: mcuboot_version
CC:  chip/sam_uid.c chip/sam_start.c: In function 'sam_tcmenable':
CC:  misc/lib_crc16ccitt.c chip/sam_start.c:109:2: warning: #warning Missing logic [-Wcpp]
  109 | #warning Missing logic
      |  ^~~~~~~
CC:  chip/sam_timerisr.c chip/sam_clockconfig.c: In function 'sam_enabledefaultmaster':
chip/sam_clockconfig.c:303:2: warning: #warning REVISIT [-Wcpp]
  303 | #warning REVISIT
      |  ^~~~~~~
CC:  common/arm_nputs.c chip/sam_xdmac.c: In function 'sam_physramaddr':
chip/sam_xdmac.c:444:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  444 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
chip/sam_xdmac.c: In function 'sam_virtramaddr':
chip/sam_xdmac.c:450:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  450 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:       98212 B     916992 B     10.71%
            sram:       10000 B       384 KB      2.54%
CP: nuttx.bin
        6,83s real              33,75s user             14,37s sys

<--- Python Venv launch here + some modules install.

(venv3.11embedded) ../nuttx-apps/boot/mcuboot/mcuboot/scripts/imgtool.py sign \
  --key ../nuttx-apps/boot/mcuboot/mcuboot/root-rsa-2048.pem --align 8 \
  --version 1.0.0 --header-size 0x200 --pad-header --slot-size 0xe0000 \
  nuttx.bin mcuboot_nuttx.app.swap.test.confirm-v1.bin
image.py: sign the payload

(venv3.11embedded) openocd -f interface/cmsis-dap.cfg \
        -c 'transport select swd' \
        -c 'set CHIPNAME atsamv71q21' \
        -f target/atsamv.cfg \
        -c 'reset_config srst_only' \
        -c init -c targets \
        -c 'reset halt' \
        -c 'program mcuboot_nuttx.app.swap.test.confirm-v1.bin 0x420000' \
        -c 'reset halt' \
        -c 'atsamv gpnvm set 1' \
        -c 'reset run' -c shutdown
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
atsamv71q21
Info : flash bank command
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = ATML2407121800000086
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bd11477
Info : [atsamv71q21.cpu] Cortex-M7 r1p1 processor detected
Info : [atsamv71q21.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for atsamv71q21.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamv71q21.cpu    cortex_m   little atsamv71q21.cpu    halted

[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
** Programming Started **
Info : device id = 0xa1220e01
Info : erasing lock regions 8-14...
Info : erasing lock region 8
Info : erasing lock region 9
Info : erasing lock region 10
Info : erasing lock region 11
Info : erasing lock region 12
Info : erasing lock region 13
Info : erasing lock region 14
** Programming Finished **
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
shutdown command invoked

(venv3.11embedded) cu -l /dev/cuaU0 -s 115200
Connected

nsh> uname -a
NuttX 12.11.0 70455f1890 Nov 27 2025 00:58:10 arm samv71-xult
nsh> help
help usage:  help [-v] [<cmd>]

    .           cp          expr        mkdir       rm          uname
    [           cmp         false       mkrd        rmdir       umount
    ?           dirname     fdinfo      mount       set         unset
    alias       df          free        mv          sleep       uptime
    unalias     dmesg       help        pidof       source      usleep
    basename    echo        hexdump     printf      test        watch
    break       env         kill        ps          time        xd
    cat         exec        pkill       pwd         true        wait
    cd          exit        ls          reboot      truncate

Builtin Apps:
    dd                 mcuboot_set_img    nsh                sh
    mcuboot_confirm    mcuboot_version    ramtest
nsh> mcuboot_version
Image version 1.0.0.0
nsh> mcuboot_confirm
Application Image successfully confirmed!
nsh> reboot*** Booting MCUboot build fefc398cc13ebbc527e297fe9df78cd98a359d75 ***
Booting from /dev/ota0...

NuttShell (NSH) NuttX-12.11.0
nsh> uname -a
NuttX 12.11.0 70455f1890 Nov 27 2025 00:58:10 arm samv71-xult
nsh> help
help usage:  help [-v] [<cmd>]

    .           cp          expr        mkdir       rm          uname
    [           cmp         false       mkrd        rmdir       umount
    ?           dirname     fdinfo      mount       set         unset
    alias       df          free        mv          sleep       uptime
    unalias     dmesg       help        pidof       source      usleep
    basename    echo        hexdump     printf      test        watch
    break       env         kill        ps          time        xd
    cat         exec        pkill       pwd         true        wait
    cd          exit        ls          reboot      truncate

Builtin Apps:
    dd                 mcuboot_set_img    nsh                sh
    mcuboot_confirm    mcuboot_version    ramtest
  1. samv71-xult:mcuboot-update-agent:
(venv3.11embedded) ./tools/configure.sh -B samv71-xult:mcuboot-update-agent
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
CP: arch/dummy/Kconfig to /tmp/nuttx/nuttx/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /tmp/nuttx/nuttx/boards/dummy/dummy_kconfig
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
LN: include/arch to arch/arm/include
LN: include/arch/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/include
LN: drivers/platform to /tmp/nuttx/nuttx/drivers/dummy
LN: include/arch/chip to /tmp/nuttx/nuttx/arch/arm/include/samv7
LN: arch/arm/src/chip to /tmp/nuttx/nuttx/arch/arm/src/samv7
LN: arch/arm/src/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/../common
LN: arch/arm/src/board/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/src
mkkconfig in /tmp/nuttx/nuttx-apps/audioutils
mkkconfig in /tmp/nuttx/nuttx-apps/benchmarks
mkkconfig in /tmp/nuttx/nuttx-apps/boot
mkkconfig in /tmp/nuttx/nuttx-apps/canutils
mkkconfig in /tmp/nuttx/nuttx-apps/crypto
mkkconfig in /tmp/nuttx/nuttx-apps/database
mkkconfig in /tmp/nuttx/nuttx-apps/examples/mcuboot
mkkconfig in /tmp/nuttx/nuttx-apps/examples/module
mkkconfig in /tmp/nuttx/nuttx-apps/examples/rust
mkkconfig in /tmp/nuttx/nuttx-apps/examples/sotest
mkkconfig in /tmp/nuttx/nuttx-apps/examples
mkkconfig in /tmp/nuttx/nuttx-apps/fsutils
mkkconfig in /tmp/nuttx/nuttx-apps/games
mkkconfig in /tmp/nuttx/nuttx-apps/graphics
mkkconfig in /tmp/nuttx/nuttx-apps/industry
mkkconfig in /tmp/nuttx/nuttx-apps/inertial
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters/luamodules
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters
mkkconfig in /tmp/nuttx/nuttx-apps/logging
mkkconfig in /tmp/nuttx/nuttx-apps/lte
mkkconfig in /tmp/nuttx/nuttx-apps/math
mkkconfig in /tmp/nuttx/nuttx-apps/mlearning
mkkconfig in /tmp/nuttx/nuttx-apps/netutils
mkkconfig in /tmp/nuttx/nuttx-apps/sdr
mkkconfig in /tmp/nuttx/nuttx-apps/system
mkkconfig in /tmp/nuttx/nuttx-apps/tee
mkkconfig in /tmp/nuttx/nuttx-apps/testing/arch
mkkconfig in /tmp/nuttx/nuttx-apps/testing/cxx
mkkconfig in /tmp/nuttx/nuttx-apps/testing/drivers
mkkconfig in /tmp/nuttx/nuttx-apps/testing/fs
mkkconfig in /tmp/nuttx/nuttx-apps/testing/libc
mkkconfig in /tmp/nuttx/nuttx-apps/testing/mm
mkkconfig in /tmp/nuttx/nuttx-apps/testing/sched
mkkconfig in /tmp/nuttx/nuttx-apps/testing
mkkconfig in /tmp/nuttx/nuttx-apps/videoutils
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/bluetooth
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/ieee802154
mkkconfig in /tmp/nuttx/nuttx-apps/wireless
mkkconfig in /tmp/nuttx/nuttx-apps
#
# configuration written to .config
#

(venv3.11embedded) /usr/bin/time -h gmake -j24
Create version.h
Downloading MCUboot-fefc398cc13ebbc527e297fe9df78cd98a359d75 from github.com/mcu-tools/mcuboot
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0   0     0   0     0     0     0  --:--:-- --:--:-- --:--:--     0LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
  0     0   0     0   0     0     0     0  --:--:-- --:--:-- --:--:--     0
100  1669k   0  1669k   0     0  2032k     0  --:--:-- --:--:-- --:--:-- 15442k
Unpacking: fefc398cc13ebbc527e297fe9df78cd98a359d75.tar.gz -> mcuboot
Register: sh
Register: nsh
Register: dd
Register: ping
Register: mcuboot_agent
Register: i2c
Register: telnetd
CC:  sched/sched_lock.c mtd/at24xx.c:135:4: warning: #warning "Assuming MTD driver block size is the same as the FLASH page size" [-Wcpp]
  135 | #  warning "Assuming MTD driver block size is the same as the FLASH page size"
      |    ^~~~~~~
chip/sam_start.c: In function 'sam_tcmenable':
chip/sam_start.c:109:2: warning: #warning Missing logic [-Wcpp]
  109 | #warning Missing logic
      |  ^~~~~~~
chip/sam_clockconfig.c: In function 'sam_enabledefaultmaster':
CC:  iob/iob_initialize.c chip/sam_clockconfig.c:303:2: warning: #warning REVISIT [-Wcpp]
  303 | #warning REVISIT
      |  ^~~~~~~
CC:  chip/sam_hsmci_clkdiv.c chip/sam_xdmac.c: In function 'sam_physramaddr':
chip/sam_xdmac.c:444:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  444 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
chip/sam_xdmac.c: In function 'sam_virtramaddr':
chip/sam_xdmac.c:450:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  450 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:      242492 B     916992 B     26.44%
            sram:       33244 B       384 KB      8.45%
CP: nuttx.bin
        7,47s real              47,25s user             17,50s sys

(venv3.11embedded) grep CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT=y .config
CONFIG_EXAMPLES_MCUBOOT_UPDATE_AGENT=y
(venv3.11embedded) grep CONFIG_SAMV7_FORMAT_MCUBOOT=y .config
CONFIG_SAMV7_FORMAT_MCUBOOT=y
(venv3.11embedded) grep CONFIG_INIT_ENTRYPOINT="nsh_main" .config

(venv3.11embedded) ../nuttx-apps/boot/mcuboot/mcuboot/scripts/imgtool.py sign \
  --key ../nuttx-apps/boot/mcuboot/mcuboot/root-rsa-2048.pem --align 8 \
  --version 1.0.0 --header-size 0x200 --pad-header --slot-size 0xe0000 \
  --confirm nuttx.bin mcuboot_nuttx.update.agent.bin

image.py: sign the payload

(venv3.11embedded) openocd -f interface/cmsis-dap.cfg \
        -c 'transport select swd' \
        -c 'set CHIPNAME atsamv71q21' \
        -f target/atsamv.cfg \
        -c 'reset_config srst_only' \
        -c init -c targets \
        -c 'reset halt' \
        -c 'program mcuboot_nuttx.update.agent.bin 0x420000' \
        -c 'reset halt' \
        -c 'atsamv gpnvm set 1' \
        -c 'reset run' -c shutdown
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
atsamv71q21
Info : flash bank command
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = ATML2407121800000086
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bd11477
Info : [atsamv71q21.cpu] Cortex-M7 r1p1 processor detected
Info : [atsamv71q21.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for atsamv71q21.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamv71q21.cpu    cortex_m   little atsamv71q21.cpu    running

[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
** Programming Started **
Info : device id = 0xa1220e01
Info : erasing lock regions 8-63...
Info : erasing lock region 8
Info : erasing lock region 9
Info : erasing lock region 10
Info : erasing lock region 11
Info : erasing lock region 12
Info : erasing lock region 13
Info : erasing lock region 14
Info : erasing lock region 15
Info : erasing lock region 16
Info : erasing lock region 17
Info : erasing lock region 18
Info : erasing lock region 19
Info : erasing lock region 20
Info : erasing lock region 21
Info : erasing lock region 22
Info : erasing lock region 23
Info : erasing lock region 24
Info : erasing lock region 25
Info : erasing lock region 26
Info : erasing lock region 27
Info : erasing lock region 28
Info : erasing lock region 29
Info : erasing lock region 30
Info : erasing lock region 31
Info : erasing lock region 32
Info : erasing lock region 33
Info : erasing lock region 34
Info : erasing lock region 35
Info : erasing lock region 36
Info : erasing lock region 37
Info : erasing lock region 38
Info : erasing lock region 39
Info : erasing lock region 40
Info : erasing lock region 41
Info : erasing lock region 42
Info : erasing lock region 43
Info : erasing lock region 44
Info : erasing lock region 45
Info : erasing lock region 46
Info : erasing lock region 47
Info : erasing lock region 48
Info : erasing lock region 49
Info : erasing lock region 50
Info : erasing lock region 51
Info : erasing lock region 52
Info : erasing lock region 53
Info : erasing lock region 54
Info : erasing lock region 55
Info : erasing lock region 56
Info : erasing lock region 57
Info : erasing lock region 58
Info : erasing lock region 59
Info : erasing lock region 60
Info : erasing lock region 61
Info : erasing lock region 62
Info : erasing lock region 63
** Programming Finished **
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
shutdown command invoked

(venv3.11embedded) cu -l /dev/cuaU0 -s 115200
Connected

nsh> uname -a
NuttX SAMV71-XULT 12.11.0 70455f1890 Nov 27 2025 01:26:18 arm samv71-xult
nsh> help
help usage:  help [-v] [<cmd>]

    .           cp          false       ls          pwd         truncate
    [           cmp         fdinfo      mkdir       reboot      uname
    ?           dirname     free        mkfatfs     rm          umount
    addroute    delroute    get         mkrd        rmdir       unset
    alias       df          help        mount       route       uptime
    unalias     dmesg       hexdump     mv          set         usleep
    arp         echo        ifconfig    nslookup    sleep       watch
    basename    env         ifdown      pidof       source      wget
    break       exec        ifup        printf      test        xd
    cat         exit        kill        ps          time        wait
    cd          expr        pkill       put         true

Builtin Apps:
    dd               mcuboot_agent    ping             telnetd
    i2c              nsh              sh
  1. samv71-xult:mcuboot-slot-confirm:
(venv3.11embedded) ./tools/configure.sh -B samv71-xult:mcuboot-slot-confirm
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
CP: arch/dummy/Kconfig to /tmp/nuttx/nuttx/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /tmp/nuttx/nuttx/boards/dummy/dummy_kconfig
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
LN: include/arch to arch/arm/include
LN: include/arch/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/include
LN: drivers/platform to /tmp/nuttx/nuttx/drivers/dummy
LN: include/arch/chip to /tmp/nuttx/nuttx/arch/arm/include/samv7
LN: arch/arm/src/chip to /tmp/nuttx/nuttx/arch/arm/src/samv7
LN: arch/arm/src/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/../common
LN: arch/arm/src/board/board to /tmp/nuttx/nuttx/boards/arm/samv7/samv71-xult/src
mkkconfig in /tmp/nuttx/nuttx-apps/audioutils
mkkconfig in /tmp/nuttx/nuttx-apps/benchmarks
mkkconfig in /tmp/nuttx/nuttx-apps/boot
mkkconfig in /tmp/nuttx/nuttx-apps/canutils
mkkconfig in /tmp/nuttx/nuttx-apps/crypto
mkkconfig in /tmp/nuttx/nuttx-apps/database
mkkconfig in /tmp/nuttx/nuttx-apps/examples/mcuboot
mkkconfig in /tmp/nuttx/nuttx-apps/examples/module
mkkconfig in /tmp/nuttx/nuttx-apps/examples/rust
mkkconfig in /tmp/nuttx/nuttx-apps/examples/sotest
mkkconfig in /tmp/nuttx/nuttx-apps/examples
mkkconfig in /tmp/nuttx/nuttx-apps/fsutils
mkkconfig in /tmp/nuttx/nuttx-apps/games
mkkconfig in /tmp/nuttx/nuttx-apps/graphics
mkkconfig in /tmp/nuttx/nuttx-apps/industry
mkkconfig in /tmp/nuttx/nuttx-apps/inertial
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters/luamodules
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters
mkkconfig in /tmp/nuttx/nuttx-apps/logging
mkkconfig in /tmp/nuttx/nuttx-apps/lte
mkkconfig in /tmp/nuttx/nuttx-apps/math
mkkconfig in /tmp/nuttx/nuttx-apps/mlearning
mkkconfig in /tmp/nuttx/nuttx-apps/netutils
mkkconfig in /tmp/nuttx/nuttx-apps/sdr
mkkconfig in /tmp/nuttx/nuttx-apps/system
mkkconfig in /tmp/nuttx/nuttx-apps/tee
mkkconfig in /tmp/nuttx/nuttx-apps/testing/arch
mkkconfig in /tmp/nuttx/nuttx-apps/testing/cxx
mkkconfig in /tmp/nuttx/nuttx-apps/testing/drivers
mkkconfig in /tmp/nuttx/nuttx-apps/testing/fs
mkkconfig in /tmp/nuttx/nuttx-apps/testing/libc
mkkconfig in /tmp/nuttx/nuttx-apps/testing/mm
mkkconfig in /tmp/nuttx/nuttx-apps/testing/sched
mkkconfig in /tmp/nuttx/nuttx-apps/testing
mkkconfig in /tmp/nuttx/nuttx-apps/videoutils
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/bluetooth
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/ieee802154
mkkconfig in /tmp/nuttx/nuttx-apps/wireless
mkkconfig in /tmp/nuttx/nuttx-apps
#
# configuration written to .config
#

(venv3.11embedded) grep CONFIG_EXAMPLES_MCUBOOT_SLOT_CONFIRM=y .config
CONFIG_EXAMPLES_MCUBOOT_SLOT_CONFIRM=y
(venv3.11embedded) grep CONFIG_SAMV7_FORMAT_MCUBOOT=y .config
CONFIG_SAMV7_FORMAT_MCUBOOT=y
(venv3.11embedded) grep CONFIG_INIT_ENTRYPOINT="nsh_main" .config
(venv3.11embedded)

(venv3.11embedded) /usr/bin/time -h gmake -j24
Create version.h
Downloading MCUboot-fefc398cc13ebbc527e297fe9df78cd98a359d75 from github.com/mcu-tools/mcuboot
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
  % Total    % Received % Xferd  Average Speed   Time    Time     Time  Current
                                 Dload  Upload   Total   Spent    Left  Speed
  0     0   0     0   0     0     0     0  --:--:-- --:--:-- --:--:--     0
100  1669k   0  1669k   0     0  1997k     0  --:--:-- --:--:-- --:--:-- 14244k
Unpacking: fefc398cc13ebbc527e297fe9df78cd98a359d75.tar.gz -> mcuboot
Register: dd
Register: nsh
Register: sh
Register: ramtest
Register: mcuboot_confirm
chip/sam_start.c: In function 'sam_tcmenable':
chip/sam_start.c:109:2: warning: #warning Missing logic [-Wcpp]
  109 | #warning Missing logic
      |  ^~~~~~~
chip/sam_clockconfig.c: In function 'sam_enabledefaultmaster':
chip/sam_clockconfig.c:303:2: warning: #warning REVISIT [-Wcpp]
  303 | #warning REVISIT
      |  ^~~~~~~
CC:  common/arm_lowputs.c chip/sam_xdmac.c: In function 'sam_physramaddr':
chip/sam_xdmac.c:444:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  444 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
chip/sam_xdmac.c: In function 'sam_virtramaddr':
chip/sam_xdmac.c:450:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  450 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:       97836 B     916992 B     10.67%
            sram:       10000 B       384 KB      2.54%
CP: nuttx.bin
        6,27s real              33,23s user             14,04s sys


(venv3.11embedded) ../nuttx-apps/boot/mcuboot/mcuboot/scripts/imgtool.py sign \
  --key ../nuttx-apps/boot/mcuboot/mcuboot/root-rsa-2048.pem --align 8 \
  --version 2.0.0 --header-size 0x200 --pad-header --slot-size 0xe0000 \
  nuttx.bin mcuboot_nuttx.slot.confirm.bin
image.py: sign the payload


(venv3.11embedded) python -m http.server 8080
Serving HTTP on :: port 8080 (http://[::]:8080/) ...
::ffff:127.0.0.1 - - [27/Nov/2025 01:36:12] "GET /mcuboot_nuttx.slot.confirm.bin HTTP/1.1" 200 -

<-- different shell

% wget localhost:8080/mcuboot_nuttx.slot.confirm.bin -O test.bin
Prepended http:// to 'localhost:8080/mcuboot_nuttx.slot.confirm.bin'
--2025-11-27 01:37:52--  http://localhost:8080/mcuboot_nuttx.slot.confirm.bin
Resolving localhost (localhost)... 127.0.0.1, ::1
Connecting to localhost (localhost)|127.0.0.1|:8080... connected.
HTTP request sent, awaiting response... 200 OK
Length: 98684 (96K) [application/octet-stream]
Saving to: ‘test.bin’

test.bin                                        100%[======================================================================================================>]  96,37K  --.-KB/s    in 0s

2025-11-27 01:37:52 (2,12 GB/s) - ‘test.bin’ saved [98684/98684]

% md5sum mcuboot_nuttx.slot.confirm.bin test.bin
7bf1ce4a60075580d03dfd6e51b4d10f  mcuboot_nuttx.slot.confirm.bin
7bf1ce4a60075580d03dfd6e51b4d10f  test.bin

% cu -l /dev/cuaU0 -s 115200
Connected

nsh> help
help usage:  help [-v] [<cmd>]

    .           cp          false       ls          pwd         truncate
    [           cmp         fdinfo      mkdir       reboot      uname
    ?           dirname     free        mkfatfs     rm          umount
    addroute    delroute    get         mkrd        rmdir       unset
    alias       df          help        mount       route       uptime
    unalias     dmesg       hexdump     mv          set         usleep
    arp         echo        ifconfig    nslookup    sleep       watch
    basename    env         ifdown      pidof       source      wget
    break       exec        ifup        printf      test        xd
    cat         exit        kill        ps          time        wait
    cd          expr        pkill       put         true

Builtin Apps:
    dd               mcuboot_agent    ping             telnetd
    i2c              nsh              sh
nsh> ifconfig
eth0    Link encap:Ethernet HWaddr XXX at UP mtu 576
        inet addr:XXX DRaddr:XXX Mask:XXX

        RX: Received Fragment Errors   Bytes
            0000000b 00000010 00000000 554
            IPv4     ARP      Dropped
            00000003 00000002 00000006
        TX: Queued   Sent     Errors   Timeouts Bytes
            00000003 00000003 00000000 00000000 3b2
        Total Errors: 00000000

             IPv4   TCP   UDP  ICMP
Received     0003  0000  0003  0000
Dropped      0000  0000  0000  0000
  IPv4        VHL: 0000   Frg: 0000
  Checksum   0000  0000  0000  ----
  TCP         ACK: 0000   SYN: 0000
              RST: 0000  0000
  Type       0000  ----  ----  0000
Sent         0003  0000  0003  0000
  Rexmit     ----  0000  ----  ----
nsh> ping XXX
PING XXX 56 bytes of data
56 bytes from XXX: icmp_seq=0 time=0.0 ms
56 bytes from XXX: icmp_seq=1 time=0.0 ms
56 bytes from XXX: icmp_seq=2 time=0.0 ms
56 bytes from XXX: icmp_seq=3 time=0.0 ms
56 bytes from XXX: icmp_seq=4 time=0.0 ms
56 bytes from XXX: icmp_seq=5 time=0.0 ms
56 bytes from XXX: icmp_seq=6 time=0.0 ms
56 bytes from XXX: icmp_seq=7 time=0.0 ms
56 bytes from XXX: icmp_seq=8 time=0.0 ms
56 bytes from XXX: icmp_seq=9 time=0.0 ms
10 packets transmitted, 10 received, 0% packet loss, time 10100 ms
rtt min/avg/max/mdev = 0.000/0.000/0.000/0.000 ms

<-- looks like nsh linelen is too short to handle all url so i had to put it into the env variable.

nsh> set FW http://XXX:8080/mcuboot_nuttx.slot.confirm.bin
nsh> echo $FW
http://XXX:8080/mcuboot_nuttx.slot.confirm.bin

nsh> mcuboot_agent $FW
MCUboot Update Agent example
Downloading from http://XXX:8080/mcuboot_nuttx.slot.confirm.bin
Firmware Update size: 98684 bytes
Received: 4096     of 98684 bytes [4%]
Received: 8192     of 98684 bytes [8%]
Received: 12288    of 98684 bytes [12%]
Received: 15008    of 98684 bytes [15%]
Received: 18760    of 98684 bytes [19%]
Received: 20368    of 98684 bytes [20%]
Received: 23048    of 98684 bytes [23%]
Received: 23584    of 98684 bytes [23%]
Received: 24120    of 98684 bytes [24%]
Received: 25192    of 98684 bytes [25%]
Received: 29288    of 98684 bytes [29%]
Received: 33384    of 98684 bytes [33%]
Received: 37480    of 98684 bytes [37%]
Received: 41576    of 98684 bytes [42%]
Received: 45560    of 98684 bytes [46%]
Received: 49656    of 98684 bytes [50%]
Received: 53600    of 98684 bytes [54%]
Received: 57696    of 98684 bytes [58%]
Received: 61640    of 98684 bytes [62%]
Received: 65736    of 98684 bytes [66%]
Received: 69680    of 98684 bytes [70%]
Received: 73776    of 98684 bytes [74%]
Received: 77720    of 98684 bytes [78%]
Received: 81816    of 98684 bytes [82%]
Received: 85912    of 98684 bytes [87%]
Received: 90008    of 98684 bytes [91%]
Received: 94104    of 98684 bytes [95%]
Received: 97552    of 98684 bytes [98%]
Received: 98088    of 98684 bytes [99%]
Received: 98684    of 98684 bytes [100%]
Application Image successfully downloaded!
Requested update for next boot. Restarting...
*** Booting MCUboot build fefc398cc13ebbc527e297fe9df78cd98a359d75 ***
Booting from /dev/ota0...

NuttShell (NSH) NuttX-12.11.0
nsh> uname -a
NuttX 12.11.0 70455f1890 Nov 27 2025 01:34:02 arm samv71-xult
nsh> help
help usage:  help [-v] [<cmd>]

    .           cp          expr        mkdir       rm          uname
    [           cmp         false       mkrd        rmdir       umount
    ?           dirname     fdinfo      mount       set         unset
    alias       df          free        mv          sleep       uptime
    unalias     dmesg       help        pidof       source      usleep
    basename    echo        hexdump     printf      test        watch
    break       env         kill        ps          time        xd
    cat         exec        pkill       pwd         true        wait
    cd          exit        ls          reboot      truncate

Builtin Apps:
    dd                 nsh                sh
    mcuboot_confirm    ramtest
  • Okay so all steps from the documentation works here with some minor tweaks :-)
  • Lets now try to run same70-qmtech on the XULT board.

@cederom
Copy link
Contributor

cederom commented Nov 27, 2025

(venv3.11embedded) ./tools/configure.sh -B same70-qmtech:nsh
  Copy files
  Select CONFIG_HOST_BSD=y
  Refreshing...
CP: arch/dummy/Kconfig to /tmp/nuttx/nuttx/arch/dummy/dummy_kconfig
CP: boards/dummy/Kconfig to /tmp/nuttx/nuttx/boards/dummy/dummy_kconfig
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
LN: include/arch to arch/arm/include
LN: include/arch/board to /tmp/nuttx/nuttx/boards/arm/samv7/same70-qmtech/include
LN: drivers/platform to /tmp/nuttx/nuttx/drivers/dummy
LN: include/arch/chip to /tmp/nuttx/nuttx/arch/arm/include/samv7
LN: arch/arm/src/chip to /tmp/nuttx/nuttx/arch/arm/src/samv7
LN: arch/arm/src/board to /tmp/nuttx/nuttx/boards/arm/samv7/same70-qmtech/../common
LN: arch/arm/src/board/board to /tmp/nuttx/nuttx/boards/arm/samv7/same70-qmtech/src
mkkconfig in /tmp/nuttx/nuttx-apps/audioutils
mkkconfig in /tmp/nuttx/nuttx-apps/benchmarks
mkkconfig in /tmp/nuttx/nuttx-apps/boot
mkkconfig in /tmp/nuttx/nuttx-apps/canutils
mkkconfig in /tmp/nuttx/nuttx-apps/crypto
mkkconfig in /tmp/nuttx/nuttx-apps/database
mkkconfig in /tmp/nuttx/nuttx-apps/examples/mcuboot
mkkconfig in /tmp/nuttx/nuttx-apps/examples/module
mkkconfig in /tmp/nuttx/nuttx-apps/examples/rust
mkkconfig in /tmp/nuttx/nuttx-apps/examples/sotest
mkkconfig in /tmp/nuttx/nuttx-apps/examples
mkkconfig in /tmp/nuttx/nuttx-apps/fsutils
mkkconfig in /tmp/nuttx/nuttx-apps/games
mkkconfig in /tmp/nuttx/nuttx-apps/graphics
mkkconfig in /tmp/nuttx/nuttx-apps/industry
mkkconfig in /tmp/nuttx/nuttx-apps/inertial
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters/luamodules
mkkconfig in /tmp/nuttx/nuttx-apps/interpreters
mkkconfig in /tmp/nuttx/nuttx-apps/logging
mkkconfig in /tmp/nuttx/nuttx-apps/lte
mkkconfig in /tmp/nuttx/nuttx-apps/math
mkkconfig in /tmp/nuttx/nuttx-apps/mlearning
mkkconfig in /tmp/nuttx/nuttx-apps/netutils
mkkconfig in /tmp/nuttx/nuttx-apps/sdr
mkkconfig in /tmp/nuttx/nuttx-apps/system
mkkconfig in /tmp/nuttx/nuttx-apps/tee
mkkconfig in /tmp/nuttx/nuttx-apps/testing/arch
mkkconfig in /tmp/nuttx/nuttx-apps/testing/cxx
mkkconfig in /tmp/nuttx/nuttx-apps/testing/drivers
mkkconfig in /tmp/nuttx/nuttx-apps/testing/fs
mkkconfig in /tmp/nuttx/nuttx-apps/testing/libc
mkkconfig in /tmp/nuttx/nuttx-apps/testing/mm
mkkconfig in /tmp/nuttx/nuttx-apps/testing/sched
mkkconfig in /tmp/nuttx/nuttx-apps/testing
mkkconfig in /tmp/nuttx/nuttx-apps/videoutils
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/bluetooth
mkkconfig in /tmp/nuttx/nuttx-apps/wireless/ieee802154
mkkconfig in /tmp/nuttx/nuttx-apps/wireless
mkkconfig in /tmp/nuttx/nuttx-apps
#
# configuration written to .config
#
(venv3.11embedded) /usr/bin/time -h gmake -j24
Create version.h
LN: platform/board to /tmp/nuttx/nuttx-apps/platform/dummy
Register: nsh
Register: sh
Register: dd
Register: ramtest
CC:  inttypes/lib_strtoumax.c chip/sam_start.c: In function 'sam_tcmenable':
chip/sam_start.c:109:2: warning: #warning Missing logic [-Wcpp]
  109 | #warning Missing logic
      |  ^~~~~~~
CC:  chip/sam_systemreset.c chip/sam_clockconfig.c: In function 'sam_enabledefaultmaster':
chip/sam_clockconfig.c:303:2: warning: #warning REVISIT [-Wcpp]
  303 | #warning REVISIT
      |  ^~~~~~~
CC:  misc/lib_umask.c chip/sam_xdmac.c: In function 'sam_physramaddr':
chip/sam_xdmac.c:444:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  444 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
chip/sam_xdmac.c: In function 'sam_virtramaddr':
chip/sam_xdmac.c:450:2: warning: #warning REVISIT -- Do DCTM address need to be remapped for DMA? [-Wcpp]
  450 | #warning REVISIT -- Do DCTM address need to be remapped for DMA?
      |  ^~~~~~~
LD: nuttx
Memory region         Used Size  Region Size  %age Used
           flash:      113772 B       512 KB     21.70%
            sram:       10136 B       256 KB      3.87%
CP: nuttx.bin
        5,97s real              32,20s user             14,54s sys

(venv3.11embedded) openocd -f interface/cmsis-dap.cfg \
        -c 'transport select swd' \
        -c 'set CHIPNAME atsamv71q21' \
        -f target/atsamv.cfg \
        -c 'reset_config srst_only' \
        -c init -c targets \
        -c 'reset halt' \
        -c 'program nuttx.bin 0x400000' \
        -c 'reset halt' \
        -c 'atsamv gpnvm set 1' \
        -c 'reset run' -c shutdown
Open On-Chip Debugger 0.12.0
Licensed under GNU GPL v2
For bug reports, read
        http://openocd.org/doc/doxygen/bugs.html
swd
atsamv71q21
Info : flash bank command
srst_only separate srst_gates_jtag srst_open_drain connect_deassert_srst

Info : CMSIS-DAP: SWD supported
Info : CMSIS-DAP: FW Version = 03.25.01B6
Info : CMSIS-DAP: Serial# = ATML2407121800000086
Info : CMSIS-DAP: Interface Initialised (SWD)
Info : SWCLK/TCK = 1 SWDIO/TMS = 1 TDI = 1 TDO = 1 nTRST = 0 nRESET = 1
Info : CMSIS-DAP: Interface ready
Info : clock speed 1800 kHz
Info : SWD DPIDR 0x0bd11477
Info : [atsamv71q21.cpu] Cortex-M7 r1p1 processor detected
Info : [atsamv71q21.cpu] target has 8 breakpoints, 4 watchpoints
Info : starting gdb server for atsamv71q21.cpu on 3333
Info : Listening on port 3333 for gdb connections
    TargetName         Type       Endian TapName            State
--  ------------------ ---------- ------ ------------------ ------------
 0* atsamv71q21.cpu    cortex_m   little atsamv71q21.cpu    running

[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040097c msp: 0x2040609c
** Programming Started **
Info : device id = 0xa1220e01
Info : erasing lock regions 0-6...
Info : erasing lock region 0
Info : erasing lock region 1
Info : erasing lock region 2
Info : erasing lock region 3
Info : erasing lock region 4
Info : erasing lock region 5
Info : erasing lock region 6
** Programming Finished **
[atsamv71q21.cpu] halted due to debug-request, current mode: Thread
xPSR: 0x01000000 pc: 0x0040098e msp: 0x20402b98
shutdown command invoked

(venv3.11embedded) cu -l /dev/cuaU0 -s 115200
Connected

<--- no nsh on the debug probe uart, probably different RX/TX map.
<--- RX=D0/PD28, TX=D1/PD30 does not work with external usb-to-uart.
  • Okay so this is different MCU (SAMV70 vs SAMV71).
  • UART also seems to have different routing and I was not able to access NSH over neither debug probe nor bare uart pins mentioned in the qmtech documentation.
  • Not to damage the XULT board I will not play further because not only MCU internals may differ but also surrounding onboard peripherals.
  • Looks like we have to simulate SAMV70's mcuboot setup on the SAMV71 board?
  • Tomorrow I will retry XULT steps performed on master before but using new mcuboot just to confirm the updated mcuboot still works here :-)

@michallenc
Copy link
Contributor

* UART also seems to have different routing and I was not able to access NSH over pins.

Hi, SAMv70 and SAMv71 MCUs should be basically the same (if the number of pins is the same, they ship it in 70, 100 and 144 pin variant if I recall), the difference will likely be just between UART pins routing. And peripherals on Xult vs QMTECH might be connected differently.

SAMv7-Xult board has serial console on USART1 compared to UART0 on QMTECH and it is routed to the debug USB, the same CMSIS-DAP appears on. It's actually an interesting design from Microchip.

There are two MCUs on Xult board, one is SAM and other is the older 16 bit PIC from Atmel's series that works as a bootloader and programmer. USART1 from SAM MCU is actually routed there and PIC creates CDC-ACM USB device on USB debug port that can be used both as a programmer and debug console. They used the same design on 32 bit PIC32CZ, but with SAMe70 as a bootloader and programmer 😄

@pkarashchenko
Copy link
Contributor

I will be able to look into this EOW (probably on Friday or Saturday). I'll provide my feedback

@pkarashchenko
Copy link
Contributor

pkarashchenko commented Nov 29, 2025

As an alternative to this I was experimenting with

CONFIG_SAMV7_OTA_PRIMARY_SLOT_OFFSET=0x24000
CONFIG_SAMV7_OTA_SCRATCH_OFFSET=0x74000
CONFIG_SAMV7_OTA_SCRATCH_SIZE=0x6000
CONFIG_SAMV7_OTA_SECONDARY_SLOT_OFFSET=0x4C000

So basically update boards/arm/samv7/common/Kconfig to:

if SAMV7_FORMAT_MCUBOOT

comment "MCUboot Application Image OTA Update support"

config SAMV7_OTA_PRIMARY_SLOT_OFFSET
	hex "MCUboot application image primary slot offset"
	default 0x24000

config SAMV7_OTA_PRIMARY_SLOT_DEVPATH
	string "Application image primary slot device path"
	default "/dev/ota0"

config SAMV7_OTA_SECONDARY_SLOT_OFFSET
	hex "MCUboot application image secondary slot offset"
	default 0x4C000  if SAMV7_MEM_FLASH_512
	default 0x84000  if SAMV7_MEM_FLASH_1024
	default 0x104000 if SAMV7_MEM_FLASH_2048

config SAMV7_OTA_SECONDARY_SLOT_DEVPATH
	string "Application image secondary slot device path"
	default "/dev/ota1"

config SAMV7_OTA_SLOT_SIZE
	hex "MCUboot application image slot size (in bytes)"
	default 0x28000  if SAMV7_MEM_FLASH_512
	default 0x60000  if SAMV7_MEM_FLASH_1024
	default 0xe0000  if SAMV7_MEM_FLASH_2048

config SAMV7_OTA_SCRATCH_OFFSET
	hex "MCUboot scratch partition offset"
	default 0x74000  if SAMV7_MEM_FLASH_512
	default 0xe4000  if SAMV7_MEM_FLASH_1024
	default 0x1e4000 if SAMV7_MEM_FLASH_2048

config SAMV7_OTA_SCRATCH_DEVPATH
	string "Scratch partition device path"
	default "/dev/otascratch"

config SAMV7_OTA_SCRATCH_SIZE
	hex "MCUboot scratch partition size (in bytes)"
	default 0x6000  if SAMV7_MEM_FLASH_512
	default 0x1C000

endif # SAMV7_FORMAT_MCUBOOT

and extend MCUboot loader maximum size from 128K to 144K and reducing scratch area. What do you think?

@michallenc
Copy link
Contributor

michallenc commented Nov 30, 2025

@pkarashchenko it's a possibility, but I think we shouldn't give more space to the bootloader unless really necessary - and there are options we can disable without affecting its functionality. Reducing scratch size means more copying and erasing in that area, thus more flash wear. The current size 128 kB also has an advantage that we can fit the bootloader into first flash's sector.

@pkarashchenko
Copy link
Contributor

pkarashchenko commented Nov 30, 2025

@pkarashchenko it's a possibility, but I think we shouldn't give more space to the bootloader unless really necessary - and there are options we can disable without affecting its functionality. Reducing scratch size means more copying and erasing in that area, thus more flash wear. The current size 128 kB also has an advantage that we can fit the bootloader into first flash's sector.

Ok. Then we can disable some functionality. I tried to compile the current configuration with the current MCUboot hash and see that the result binary is close to 128K (uses 99.6% of allocated flash). Taking into consideration wear leveling is good, but what if the next MCUboot version will add some code and the resulting image will overflow the allocated size for 100bytes more? There are not many things to disable left. And having nsh for bootloader sometimes is useful. At least in my case I was adding some command to display version information or initiating OTA update by a command. SAMe70 512Kb flash variant is not very usable in terms of MCUboot and was here for demo purposes, so we can ever drop that configuration and keep only options with bigger flash. I'm just looking for some solution that is usable and scalable. The bigger flash SAMv7 options still have a sufficient scratch area.
I do not have any objections on the current change if that is needed to unblock merge of the other change however think that we need some better scalable solution

@michallenc
Copy link
Contributor

@pkarashchenko it's a possibility, but I think we shouldn't give more space to the bootloader unless really necessary - and there are options we can disable without affecting its functionality. Reducing scratch size means more copying and erasing in that area, thus more flash wear. The current size 128 kB also has an advantage that we can fit the bootloader into first flash's sector.

Ok. Then we can disable some functionality. I tried to compile the current configuration with the current MCUboot hash and see that the result binary is close to 128K (uses 99.6% of allocated flash). Taking into consideration wear leveling is good, but what if the next MCUboot version will add some code and the resulting image will overflow the allocated size for 100bytes more? There are not many things to disable left. And having nsh for bootloader sometimes is useful. At least in my case I was adding some command to display version information or initiating OTA update by a command. SAMe70 512Kb flash variant is not very usable in terms of MCUboot and was here for demo purposes, so we can ever drop that configuration and keep only options with bigger flash. I'm just looking for some solution that is usable and scalable. The bigger flash SAMv7 options still have a sufficient scratch area. I do not have any objections on the current change if that is needed to unblock merge of the other change however think that we need some better scalable solution

Oh, I expected we would be around 60 kB with these changes and have a lot of reserved space. Ok then, that changes things and I suppose we can reserve more space for the bootloader.

@pkarashchenko
Copy link
Contributor

I tried to add one more page (16Kb) for bootloader that should put us to the safe stop I hope.

1 similar comment
@pkarashchenko
Copy link
Contributor

I tried to add one more page (16Kb) for bootloader that should put us to the safe stop I hope.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Board: arm Size: XS The size of the change in this PR is very small

Projects

None yet

Development

Successfully merging this pull request may close these issues.

8 participants