-
Notifications
You must be signed in to change notification settings - Fork 8
How to Debug STM32N657? - pyOCD and uVision #335
Description
Experience report with questions
I want to get to familiarize myself with the STM32N657 (Nucleo). To do this, I am creating a few test programs. The first step is to create an FSBL (First Boot Loader) that controls the LEDs. Creating and compiling is no problem. The STM32N657 does not have internal flash memory. When the system is reset, the program is loaded from the external flash into the RAM by the system ROM. For the first test of the program, this loading process into the RAM can also be handled by the debugger.
pyOCD
When I start pyOCD, I get the following error message:
pyOCD reports that it cannot write to RAM. I have adapted the following entry in CubeMX+STM32N6.cbuild-run.yml:
name: Flash
access: rx
start: 0x34180400
size: 0x0003FC00
from-pack: Keil::STM32N6xx_DFP@1.0.0
name: Flash
access: rwx
After starting the debugger, no CM55 registers can be seen and the dissambler cannot be started. After the Memory Inspector, however, the content of the memory from address 0x34180400 was still 0.
In the debug console,
Program received signal SIGINT, Interrupt.
0x18003514 in ?? ()
is displayed as the last line. Address 0x18003514. See also uVision.
How do I configure pyOCD to start the debugger correctly?
uVision
I then tried to debug using the uVsion.
After starting the debugger you will see the following disassmbly
Here too, the processor is in the address range 0x18003A1A. By entering the following commands, I can load the program correctly and run it with up to the main() function.
LOAD $L@L.axf incremental // Load project binary
PC = _RDWORD(0x34180404); // Set Program Counter to Reset_Handler() address
g,main
I have saved these instructions in the debugLoad.ini file.
I then tried to load the debugLoad.ini file as an initialization file in the debug dialog. However, this does not result in the program being loaded correctly. The commands must be executed after the loading process. I have created the file myInclude.ini for this purpose.
define button "Setup", "include ..\\..\\..\\..\\debugLoad.ini"
I start this via the initialization file. The file is used to create a button in the debug toolbox. By pressing the button, the program can be started after loading. It is also possible to press the Reset button in the uVision interface and then restart the program. The program can then be tested in all points.
I have tested the GPIO_IOToggle example from the ST-N6 repository. This works completely with uVision. The described procedure is not necessary here. The program can be started there directly.
I can't explain the difference. I have used the same settings as in the ST-uVision project.
I would be very grateful if someone could explain the reason for this behavior.
Note: I have upgraded Keil Studio to CSolution 2.11.0. To test the new version, I copied the new CSolution files from .vcpk to the uVision directory cmsis-toolbox.
Note: With CSolution 2.10.0 I noticed that a clear of the Csolution project was performed when starting uVision. You had to recompile before the debugger could be started.
