cancel
Showing results for 
Search instead for 
Did you mean: 

STM32N6 - NUCLEO board with external QSPI image booting?

tjaekel
Lead

My project works as FSBL. I can also generate it as an Appli project (using the linker script "STM32N657X0XQ_LRUN.ld" (as default selected)), similar code works with ST-LINK debugger.

But how to generate a signed image and flash to external QSPI memory and let it boot from there?
(nothing works).

Steps I did:

  1. I have my FSBL working (loading via ST-LINK debugger and running works)
  2. I have my Appi project (just added the stuff I want to do, e.g. flashing an LED), compile clean
  3. I can also load and run this project with ST-LINK debugger
  4. I have signed both BIN files (via the command line tool)
  5. I erase external QSPI (via STM32CubeProgrammer) - ATT: it needs to enable the external flash loader (done)!
  6. I flash one or the other signed BIN file - I can flash

But nothing shows me that my FW is running (after changing the BOOT1 jumper).
What is wrong?

The README in Template tells me this:

a)

In order to make the program work, you must do the following :

Set the boot mode in development mode (BOOT1 switch position is 2-3, BOOT0 switch position doesn’t matter).
Open your preferred toolchain
Select first the FSBL workspace
Rebuild all files from sub-project FSBL (if no modification is done on FSBL project, this step can be done only once)
Select the Appli workspace
Rebuild all files from sub-project Appli
Resort to CubeProgrammer to add a header to the generated Appli binary Project.bin with the following command
STM32_SigningTool_CLI.exe -bin Project.bin -nk -of 0x80000000 -t fsbl -o Project-trusted.bin -hv 2.3 -dump Project-trusted.bin
The resulting binary is Project-trusted.bin.
Next, in resorting again to CubeProgrammer, load the Appli binary and its header (Project-trusted.bin) in Nucleo board external Flash at address 0x7010’0000.
Load the FSBL binary in internal RAM using the IDE
Run the example

OK, done. But "Load the FSBL binary in internal RAM using the IDE" is exactly the same step without to flash the external QSPI memory. Sure, this works! But why to flash something before (and what?)?

b)

Next, this program can be run in boot from flash mode. This is done by following the instructions below:

Resort to CubeProgrammer to add a header to the generated binary FSBL.bin with the following command
STM32_SigningTool_CLI.exe -bin Project.bin -nk -of 0x80000000 -t fsbl -o FSBL-trusted.bin -hv 2.3 -dump FSBL-trusted.bin
The resulting binary is FSBL-trusted.bin.
In resorting again to CubeProgrammer, load the FSBL binary and its header (FSBL-trusted.bin) in Nucleo board external Flash at address 0x7000’0000.
Set the boot mode in boot from external Flash (BOOT0 switch position is 1-2 and BOOT1 switch position is 1-2).
Press the reset button. The code then executes in boot from external Flash mode.

This does not work at all!
Even I can erase (obviously, with external loader enabled, we have to do manually, "automatic" does not work) and I can flash this signed image file - But after changing the BOOT1 jumper - nothing! (my code is not running).
BTW: what is this "-of 0x80000000"? The external QSPI is at 0x70000000 (as I understand) and my files and the original FW flashed on received boards is never so large. What is this 0x70100000 address? ...

How to create and flash a signed FW BIN file after FSBL debug and it is working fine (with debugger)?
I want to see the same FW booting, without any debugger connected.

Is there any very simple project to see both working (FSBL and flashing it on external QSPI)?

1 REPLY 1
RomainR.
ST Employee

Hello @tjaekel 

You have duplicated lot of similar questions in many post below.
https://community.st.com/t5/stm32-mcus-boards-and-hardware/nucleo-n657x0-q-failed-to-start-gdb-server/m-p/756845#M23229

https://community.st.com/t5/stm32-mcus-boards-and-hardware/stm32n6-nucleo-board-not-as-1v8-possible/td-p/756852

I understand that you are looking for answers to your questions, but it is important that you focus one question per comment and also mark the answers that have been made to you as Accept as Solution if this is the case.

I suggest you do a simple test by starting with the following example and program it into the external OCTO Flash:
STM32Cube_FW_N6_V1.0.0\Projects\NUCLEO-N657X0-Q\Templates\Template

1. Configure your Nucleo-N6570X0-Q in DEV_BOOT Mode. Refer to the attached pdf document.
Then, do a Reset, the Red LED2 must be on.
2. Import and compile the firmware with STM32CubeIDE, you will get the following directory \Templates\Template\STM32CubeIDE\FSBL\Debug.
It should contain the following file: Template_FSBL.bin
3. Create a script that you name n6_flh_fsbl.bat and copy it in this same directory below:
\Templates\Template\STM32CubeIDE\FSBL\Debug.
4. Add the following code in the n6_flh_fsbl.bat script.

SET N6SIGN="C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_SigningTool_CLI.exe"
SET N6PROG="C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\STM32_Programmer_CLI.exe"
SET N6EXTLOADER="C:\Program Files\STMicroelectronics\STM32Cube\STM32CubeProgrammer\bin\ExternalLoader\MX25UM51245G_STM32N6570-NUCLEO.stldr"

REM Sign the N6 bin firmware te be understood by booROM.
%N6SIGN% -bin Template_FSBL.bin -nk -of 0x80000000 -t fsbl -o FSBL_trusted.bin -hv 2.3 -dump FSBL_trusted.bin
PAUSE

REM Flash the Trusted firmware in external NOR using External loader
%N6PROG% -c port=SWD mode=HOTPLUG ap=1 -w FSBL_trusted.bin 0x70000000 -el %N6EXTLOADER%

REM Change the STM32N6750-DK Board BOOT0/BOOT1 in Flash Boot mode (both in Left position) and reset the board.
PAUSE

5. Run the script and compare the logs with the 2 captures that I also attached.
- n6_flh_fsbl.bat_signing.png
- n6_flh_fsbl.bat_flash.png

6. Put the Nucleo-N6570X0-Q back in FLASH_BOOT Mode. Do a Reset and check that the 3 LEDs are flashing.

Let me know if this works.
And please mark the answers Accepted as Solution.

Best regards,

Romain,

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.