cancel
Showing results for 
Search instead for 
Did you mean: 

Not able to debug code executing from QSPI memory in stm32cubeide

Rohit1
Associate II

Hello, I wrote two separate codes for this, 1st one is bootloader and 2nd is my application code. Bootloader will jump to the application code which is placed in QSPI memory. Code is executing and running fine, But the issue is I am not able to debug my application code. It is something that my debugger is not able to halt code in the main of my application code. it is showing following error....issue.png

Can someone please tell me, how to give access of QSPI memory to set breakpoint or to halt code in main of application code. I am using STM32L476 disc board and STM32cubeIDE.

7 REPLIES 7

Not my tool of choice..

Can't you create a Debug Script to walk the MCU through clocks, pins, peripheral and memory-mapping?

Get QSPI up in SystemInit()

Perhaps you can make a small wedge-loader in Internal Flash such there is enough code to bring up the QSPI, and for the debugger to place an initial breakpoint. Is the address suggestive of main() ??

STM32CubeIDE should be able to do this...

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

@Nawres GHARBI @Aziz BRIGUI 

Some way of using the External Loader Init() function to get a memory mapped context up on a system?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

Thanks for reply,

But when I tried to debug using OPENOCD, it is showing "Error: Cortex-M Flash Patch Breakpoint rev 1 cannot handle HW breakpoint above address 0x1FFFFFFE" 

Can we extend the range of FPB? Coz QSPI memory starts from 0x90000000...

@Aziz BRIGUI @Semer CHERNI  could you help ?

Semer CHERNI
ST Employee

Hello @Rohit1 

First let me thank you for posting.

Could you share the debug configuration. And if possible could you share a simplistic version of you project which show the issue for analysis.

BR,

Semer.

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 @Semer CHERNI 

I refer this video for my project, in which I created 2 separate projects.

1. Custom_bootloader in which I initialize and set the QSPI in memory mapped mode and then jump to the User_Application.Bootloader_code_1.png

2.User_Application in which I am toggling LED. 

Application_2.png

and made changes in linker file and set vector table to QSPI Memory address

Flsh.ld_app.pngststem_vtor.png

When I tried to debug, it is jumping to the Reset_Handler of the User_Application code and after that it should halt in the main() of application, but it is not halting in main(), Application code is running i.e., LED is toggling but code is not halting.

Bootloader_code_2.png

App_reset_handler.png

Application_2.png

And I tried to debut it using OpenOCD, I got following warning and errors after jumping to the user application

openocd.png

and I got "Error:Cortex-M Flash Patch Breakpoint rev.1 cannot handle HW breakpoint above address 0x1FFFFFFE"

Debug configurations:debug_configuration.png

debug_conf2.png

I flash user application in qspi memory using external loader.

Thanx in advance

Did you solve your problem ?

I have exactly the same issue. 

I can debug the apllication from QSPI normally using STM32CubeIDE 1.12.1, but not using any more recent version after that. But if you copy the GDB Server from 1.12.1 overwriting the one from 1.13.x or 1.14.x, breakpoints works again in NOR.

I suspect GDB Server in recent versions defaults to "soft brekpoints" in QSPI region, instead of "hardware breakpoints", and obviously fails to insert them.

Cfr. see https://www.openstm32.org/forumthread8403

I'm still on 1.12.1 for this issue!