Skip to main content
Visitor II
April 30, 2025
Question

STM32N6 Debug Jump From FSBL to Secure Application

  • April 30, 2025
  • 4 replies
  • 1040 views

Currently, I have a project using a secure application for the STM32N6570-DK. I am able to run and debug the FSBL and Application with the system in Dev Boot, but have yet to be able to attach and debug when booting from the external flash (Boot1 and Boot0 both LOW).

I have placed the following code toward the beginning of my FSBL, and configured my  STM32CubeIDE debug to not load the program, and the not reset the chip when attaching for debug. However, I am still unable to attach and debug the system.

 __HAL_RCC_BSEC_CLK_ENABLE();
 BSEC->AP_UNLOCK = 0xB4;
 BSEC->DBGCR = 0xB4B4B400;
 __asm("bkpt 255");

 Has anyone been able to debug their application with the MCU booting from external flash?

    This topic has been closed for replies.

    4 replies

    Technical Moderator
    May 2, 2025

    Hi @aroby95 ,

    Probably you find some help in the article How to create an STM32N6 FSBL load and run (focus on second application case).

    -Amel

    ST Employee
    May 2, 2025

    Hi aroby95

     

    This post has been escalated to the ST Online Support Team for additional assistance.  We'll contact you directly.

     

    Regards

    Joe

    STMicro Support

    Visitor II
    June 3, 2025

    Hello @aroby95  @Joe WILLIAMS ,

    I’m experiencing the same issue. I wonder what the solution is?

    Best regards,

    Egemen Aksoy

    Graduate II
    June 8, 2025

    Hi,

    I use the following approach for the XIP configuration.

    The FSBL is without changes.

    In the Appli code, in main.c, add code as shown below. Make sure that the debugger does load symbols from Aplpli ELF only, and does not download the firmware, and does not reset the chip (see the pics below).

    Now you can power up (or reset) the board after flashing, run the Appli debug, set breakpoints and press the USER1 button to debug.

     BSP_PB_Init (BUTTON_USER1, BUTTON_MODE_GPIO);
     // loop that can be used to catch the application for debug.Set mini to 1, build and flash target as normally.
     // Set BOOT1 switch to the left position, press reset without removing cable.
     // Use the Connect to running debug config to connect, then change mini value from watch.
     // For breakpoints to work they seem to need to be manually changed to ahrdware breakpoint
     static volatile int debugFlag = 1;
     while (debugFlag == 1 && BSP_PB_GetState(BUTTON_USER1) == 0)
     {
     __NOP();
     }
     /* USER CODE END 1 */

     

    ERROR_0-1749360279856.png

    ERROR_1-1749360331215.png

     

    Explorer
    August 10, 2025

    Hi,

    Sorry I replied too fast, AUTH_HDPL needs to be <= Level 1, so 0xB4 should be OK.

    I've tried it on the eval board and I can attach the debugger using 0xB4B4B400 for BSEC_DBGCR.

     

    You may have found already what is wrong, but I can successfully attach the debugger to the FSBL or application while booting from FLASH using this:

    • Open the debug access port to the Cortex-M55 by writing 0xB4 to BSEC_AP_UNLOCK
    • Enable the non-secure/secure debug by writing 0xB451B400 to BSEC_DBGCR

    So maybe try BSEC->DBGCR = 0xB451B400; instead.

     

    On my STM32N6570-DK eval board, the FSBL is booted with HDPL level 1.

    This means AUTH_HDPL needs to be >= Level 1 (so not 0xB4).

    I didn't found your post at first, and also posted about attaching to an application booted from FLASH here https://community.st.com/t5/stm32-mcus-products/how-to-allow-debugger-to-attach-on-stm32n6-when-booting-from/m-p/829924/highlight/true#M284046.