Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion ports/stm32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -669,7 +669,7 @@ $(BUILD)/firmware.elf: $(OBJ)

$(BUILD)/firmware-trusted.bin: $(BUILD)/firmware.bin
/bin/rm -f $@
$(STM32_CUBE_PROGRAMMER)/bin/STM32_SigningTool_CLI -bin $^ -nk -of 0x80000000 -t fsbl -o $@ -hv $(STM32_N6_HEADER_VERSION)
$(STM32_CUBE_PROGRAMMER)/bin/STM32_SigningTool_CLI -bin $^ -nk -of 0x80000000 -t fsbl -o $@ -hv $(STM32_N6_HEADER_VERSION) --align

# List of sources for qstr extraction
SRC_QSTR += $(SRC_C) $(SRC_CXX) $(SHARED_SRC_C) $(GEN_PINS_SRC)
Expand Down
38 changes: 38 additions & 0 deletions ports/stm32/boards/NUCLEO_N657X0/board.md
Original file line number Diff line number Diff line change
Expand Up @@ -15,3 +15,41 @@ Now mboot will be active.

Once the USB DFU port can be seen, the firmware below can be programmed as usual with
any DFU loader.

## Chip revision and signing header version

The STM32N657X0 chip is available in two silicon revisions, which require different
signing header versions when building the trusted firmware image. Check the revision
code printed on the chip package:

- **Rev code Z (Cut 1.1)**: use `STM32_N6_HEADER_VERSION = 2.1`
- **Rev code B (Cut 2.0)**: use `STM32_N6_HEADER_VERSION = 2.3` (default in
`mpconfigboard.mk`)

To override the version without modifying `mpconfigboard.mk`, pass it on the make
command line:

make -C ports/stm32/mboot BOARD=NUCLEO_N657X0 STM32_N6_HEADER_VERSION=2.3

## Flashing mboot and firmware together via ST-LINK

If the DFU device is not recognised by the host PC on CN8 after mboot is installed, a
reliable alternative is to program both mboot and the main MicroPython firmware directly
via the ST-LINK interface in a single step. This bypasses DFU mode entirely and writes
both images to the external SPI flash using `STM32_Programmer_CLI`:

STM32_Programmer_CLI \
-c port=SWD mode=HOTPLUG ap=1 \
-el <path-to-cubeprogrammer>/bin/ExternalLoader/MX25UM51245G_STM32N6570-NUCLEO.stldr \
-w mboot/build-NUCLEO_N657X0/firmware-trusted.bin 0x70000000 \
-w build-NUCLEO_N657X0/firmware.bin 0x70080000 \
-hardRst

Adjust `<path-to-cubeprogrammer>` to match the STM32CubeProgrammer installation on
your system. The first `-w` programs the trusted mboot image at the start of the
external SPI flash (0x70000000), and the second `-w` programs the main MicroPython
firmware at 0x70080000 (512KB into the flash, immediately after mboot).

This approach works regardless of whether the USB DFU device enumerates correctly, and
is especially useful on Rev code B boards where the signing header version or alignment
settings may need to be adjusted first.
2 changes: 1 addition & 1 deletion ports/stm32/boards/NUCLEO_N657X0/mpconfigboard.mk
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ SYSTEM_FILE = $(STM32LIB_CMSIS_BASE)/Source/Templates/system_stm32$(MCU_SERIES)x
else
SYSTEM_FILE = $(STM32LIB_CMSIS_BASE)/Source/Templates/system_stm32$(MCU_SERIES)xx_s.o
endif
STM32_N6_HEADER_VERSION = 2.1
STM32_N6_HEADER_VERSION = 2.3
DKEL = $(STM32_CUBE_PROGRAMMER)/bin/ExternalLoader/MX25UM51245G_STM32N6570-NUCLEO.stldr

ifeq ($(USE_MBOOT),1)
Expand Down
2 changes: 1 addition & 1 deletion ports/stm32/mboot/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -253,7 +253,7 @@ $(BUILD)/firmware.elf: $(OBJ)

$(BUILD)/firmware-trusted.bin: $(BUILD)/firmware.bin
/bin/rm -f $@
$(STM32_CUBE_PROGRAMMER)/bin/STM32_SigningTool_CLI -bin $^ -nk -of 0x80000000 -t fsbl -o $@ -hv $(STM32_N6_HEADER_VERSION)
$(STM32_CUBE_PROGRAMMER)/bin/STM32_SigningTool_CLI -bin $^ -nk -of 0x80000000 -t fsbl -o $@ -hv $(STM32_N6_HEADER_VERSION) --align

#########################################
# Rules to generate header files
Expand Down
Loading