cancel
Showing results for 
Search instead for 
Did you mean: 

NUCLEO-N657X0-Q: failed to start GDB server

cersoy
Associate

I am trying to start a debugger session to my new NUCLEO-N657X0-Q and getting the following error:

STMicroelectronics ST-LINK GDB server. Version 7.9.0
Copyright (c) 2024, STMicroelectronics. All rights reserved.

Starting server with the following options:
Persistent Mode : Disabled
Logging Level : 1
Listen Port Number : 61234
Status Refresh Delay : 15s
Verbose Mode : Disabled
SWD Debug : Enabled
InitWhile : Enabled

Target unknown error 32

Error in initializing ST-LINK device.
Reason: Unknown. Please check power and cabling to target.

 I am using the latest version of STM32CubeIDE (1.17.0)

The STM32CubeProgrammer (v2.18.0) is also unable to program any binaries on the board.  After changing the Reset Mode to "Hardware reset" I am able to connect to the board, but immediately get the error message: 

15:09:28:207 : UR connection mode is defined with the HWrst reset mode
15:09:28:364 : ST-LINK SN : 002F00453433511830343835
15:09:28:365 : ST-LINK FW : V3J15M7
15:09:28:365 : Board : NUCLEO-N657X0-Q
15:09:28:365 : Voltage : 3.27V
15:09:28:365 : SWD freq : 8000 KHz
15:09:28:365 : Connect mode: Normal
15:09:28:365 : Reset mode : Hardware reset
15:09:28:365 : Device ID : 0x486
15:09:28:365 : Revision ID : Rev A
15:09:28:365 : reset ap 1
15:09:28:365 : Reading data...
15:09:28:365 : r ap 1 @0x00000000 0x00000004 bytes Data 0x00000018
15:09:28:365 : r ap 1 @0x00000000 0x00000004 bytes Data 0x00000018
15:09:28:365 : Database: Config 0 is active.
15:09:28:461 : UPLOADING ...
15:09:28:461 : Size : 1024 Bytes
15:09:28:461 : Address : 0x8000000
15:09:28:462 : Read progress:
15:09:28:462 : Reading data...
15:09:28:462 : r ap 1 @0x08000000 0x00000400 bytes Data 0x00000018
15:09:28:541 : r ap 1 @0x08000000 0x00000400 bytes Data 0x00000011
15:09:28:541 : Error: Data read failed

 Unfortunately link to user manual UM3417, which is https://www.st.com/resource/en/user_manual/dm01122391.pdf (per STM32 Nucleo-144 boards data brief) is currently unavailable.  

I don't understand what I am doing wrong from the error messages, and can't access the user manual.  I would appreciate if someone can shed light on the issue I am seeing.

1 ACCEPTED SOLUTION

Accepted Solutions

Hello @cersoy 

First of all, all STM32N6 (SoC) documentation is available here:
https://www.st.com/en/microcontrollers-microprocessors/stm32n6-series/documentation.html

For the Nucleo-N657X0Q board, the documents are linked below:
https://www.st.com/en/evaluation-tools/nucleo-n657x0-q.html#documentation

Could you confirm the revision of your Nucleo board indicates on the bottom stickers, something like:
MB1940-N657X0Q-C01

The STM32N6 has no internal flash, so the 0x08000 000 memory area you're trying to read with STM32CubeProgrammer corresponds to the secure BootROM area. Do not attempt to erase the internal flash.

By default (Flash boot), when BOOT1 = 0 and BOOT0 = 0, after reset, the BOOTRom will copy a binary firmware from external Flash memory into internal SRAM2 to finally booting and executing it in SRAM2. 

If you try one of the examples provided in the STM32Cube_N6_V1.0.0 package, note that most of examples are linked and loaded in internal SRAM2. You should be able to debug them with STM32CubeIDE_V1.17.0 by configuring the STM32N6570 in Dev_Boot mode (see chapter 9 Boot modes in RM0486).
The following jumper settings must be as in the attached pdf file.
BOOT0 JP2 = 1
BOOT1 JP1 = 0
The Dev_Boot has been designed to open the STM32N6 debug port to external tools for debugging applications and programming/erasing internal or external memory and also to fuse OTP bits (see RM0486 section 5 OTP mapping).

In the STM32CubeProgrammer, to access the OCTOSpi external Flash memory, you'll need to select the MX25UM51245G_STM32N6570-NUCLEO external loader.
Following the Readme.html of the STM32Cube_FW_N6_V1.0.0\Projects\NUCLEO-N6570X0Q\Templates\Template_FSBL_LRUN example, the Readme.html file explains how to sign and permanently program the binary in this memory and execute it in Flash_Boot mode.

Let me know if it helps you. after confirming your configuration in Dev_Boot and if you are facing with some issue?

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.

View solution in original post

9 REPLIES 9
Amel NASRI
ST Employee

Hi @cersoy ,

Try to perform an STLink upgrade from STM32CubeProgrammer.

Regarding the user manual, it should be this one: Data brief - NUCLEO‑xxxxLx/xxxxXx/xxxxZx(-P/Q).

Where do you find the wrong link? Please let me know to fix it.

-Amel

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.

Thank you Amel for your prompt response.  On page 6 of the document you pointed out, there is a link to the user manual of this specific board:

Screenshot 2024-12-25 085156.png

link to UM3417 does not work.

I upgraded the STlink from the STprogrammer per your recommendation.  Below are the snippets:
Screenshot 2024-12-25 085552.png

But still no success accessing the board:
Screenshot 2024-12-25 085653.png

Are there any diagnostics I can collect to troubleshoot the problem.  Thanks again for your help.

What about a full erase of the chip? does it work?

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.

Below is what I am getting:

09:50:31:976 : Waiting for device n:1...
09:50:32:043 : ST-LINK SN : 002F00453433511830343835
09:50:32:044 : ST-LINK FW : V3J15M7
09:50:32:045 : Board : NUCLEO-N657X0-Q
09:50:32:046 : Voltage : 3.27V
09:50:32:049 : SWD freq : 8000 KHz
09:50:32:049 : Connect mode: Normal
09:50:32:049 : Reset mode : Hardware reset
09:50:32:052 : Device ID : 0x486
09:50:32:052 : Revision ID : Rev A
09:50:32:062 : reset ap 1
09:50:32:079 : Reading data...
09:50:32:082 : r ap 1 @0x00000000 0x00000004 bytes Data 0x00000018
09:50:32:183 : r ap 1 @0x00000000 0x00000004 bytes Data 0x00000018
09:50:32:184 : Database: Config 0 is active.
09:50:32:235 : MASS ERASE ...
09:50:32:235 : Mass erase operation failed.Please verify flash protection
09:50:32:235 : Please disconnect device n:1 and connect the next...

 without access to the user manual I don't know: if there is flash protection or not, and how to resolve it. Please advise.

Hi @cersoy ,

Try to check if there are some option bytes already set and that prevent flash erase.

You need the product reference manual (RM0486) rather than the mentioned user manual to understand the option bytes and the flash protection.

-Amel

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.

Hello @cersoy 

First of all, all STM32N6 (SoC) documentation is available here:
https://www.st.com/en/microcontrollers-microprocessors/stm32n6-series/documentation.html

For the Nucleo-N657X0Q board, the documents are linked below:
https://www.st.com/en/evaluation-tools/nucleo-n657x0-q.html#documentation

Could you confirm the revision of your Nucleo board indicates on the bottom stickers, something like:
MB1940-N657X0Q-C01

The STM32N6 has no internal flash, so the 0x08000 000 memory area you're trying to read with STM32CubeProgrammer corresponds to the secure BootROM area. Do not attempt to erase the internal flash.

By default (Flash boot), when BOOT1 = 0 and BOOT0 = 0, after reset, the BOOTRom will copy a binary firmware from external Flash memory into internal SRAM2 to finally booting and executing it in SRAM2. 

If you try one of the examples provided in the STM32Cube_N6_V1.0.0 package, note that most of examples are linked and loaded in internal SRAM2. You should be able to debug them with STM32CubeIDE_V1.17.0 by configuring the STM32N6570 in Dev_Boot mode (see chapter 9 Boot modes in RM0486).
The following jumper settings must be as in the attached pdf file.
BOOT0 JP2 = 1
BOOT1 JP1 = 0
The Dev_Boot has been designed to open the STM32N6 debug port to external tools for debugging applications and programming/erasing internal or external memory and also to fuse OTP bits (see RM0486 section 5 OTP mapping).

In the STM32CubeProgrammer, to access the OCTOSpi external Flash memory, you'll need to select the MX25UM51245G_STM32N6570-NUCLEO external loader.
Following the Readme.html of the STM32Cube_FW_N6_V1.0.0\Projects\NUCLEO-N6570X0Q\Templates\Template_FSBL_LRUN example, the Readme.html file explains how to sign and permanently program the binary in this memory and execute it in Flash_Boot mode.

Let me know if it helps you. after confirming your configuration in Dev_Boot and if you are facing with some issue?

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.

Thank you @RomainR. for the detailed explanation.  Below is the information you requested:


IMG_2142.png

Changing the position of jumper JP2 (BOOT1) from default 0 to 1 (as you suggested) fixed the issue on my side.  I am able to connect to board using the STprogrammer, upload binaries using the debugger, and stepped through the code.

The example I was using has the the linker script STM32N657X0HXQ_AXISRAM2_fsbl.ld, which locates the binary at 0x34180400 with the label ROM, that is indeed SRAM2 not flash.  

The descriptions of the jumpers on NUCLEO-N657X0-Q was the information I was missing and the PDF attached to your reply helped me resolve the issue. I'll refer to the reference manual STM32N6 (SoC) and the SDK examples for other boot modes supported.

 

FYI, I had the same issue. It works for me this way:

  1. You have to download and install the latest version of STM32CubeProgrammer (my old one was not working on STM32N6). It seems to come also with new driver and debug MCU FW.
  2. Change the BOOT1 jumper

Now I could start the debugger in STM32CubeIDE.

But how to create a BIN file and load on powerup (without debugger)?
As I understand:

  1. The image has to be signed, e.g. via:
    STM32_SigningTool_CLI.exe -bin Appli_FW.bin -nk -of 0x80000000 -t fsbl -o Appli_FW-trusted.bin -hv 2.3 -dump Appli_FW-trusted.bin
    What is this of 0x80000000? The external flash starts at 0x70000000. Does it mean, the code image at 0x80000000 and it is concatinated with the bootloader header at 0x70000000?
  2. It requires to build the MCU FW as Appli:
    Have a sub-project *_Appli and build this one.
    But which Linker Script to use?
    The STM32N657X0HXQ_LRUN.ld seems to build in the same way to load (via debugger) and execute from internal SRAM (loading and debugging with ST-LINK, with the BOOT1 changed, works as before, with the FSBL file generated, intended to be loaded and for debug when loaded and executed on internal SRAM)
  3. I tried to flash this file (after signing) - but power on does not executed my code:
    a) We have to use STM32CubeProgrammer
    b) We have to activate the external bootloader (for this board!)
    c) OK: I can erase entire chip (necessary to do manually?!)
    d) I can flash the signed image

But when changing back the BOOT1 jumper and a power cycle: I do not see that "my" code is executed.

How to create an external image so that the same program working with SRAM and ST-LINK debugger works also without debugger, at power on and loaded from external flash?
(so complicated and confusing...)