Skip to main content
Associate II
June 11, 2026
Question

Cannot start debugging when variable is placed in custom section

  • June 11, 2026
  • 1 reply
  • 8 views

Good morning everyone,

If I explicitly set an array to a custom memory section, STM32CubeIDE for VSCode is unable to start a debug session, showing a an error popup with text: “bound doStepLoadImages Failed: Load failed”. I am using a NUCLEO-N657X0-Q board.

This happens even if the section is linked to to the same memory region (and physical bank) where the the array would end up if left unspecified (linker script attached below).

Example code:

uint8_t img_buff[PICTURE_BUFFER_SIZE] __ALIGNED(16) __section(".image1");

Examining the .map file, img_buff ends up at address 0x34006940, which is, correctly, in AXISRAM1. In this condition, debug doesn’t work.

If I remove the __section(".image1")  part, the array is assigned (as expected) to section .bss.img_buff, ending up at address 0x340026b0, which is still in AXISRAM1, similarly to the other condition. Debug works as normal.

The same issue arises if I place the array in AXISRAM2 (by assigning it to section .axisram2, cfr. linker script below).

 

I would greatly appreciate any kind of support with this problem. Please let me know if there’s any additional information required for troubleshooting the issue.

Thank you for your time


Best,
Walter

 

My configuration in .vscode/launch.json is:

{
"version": "0.2.0",
"configurations": [
{
"type": "stlinkgdbtarget",
"request": "launch",
"name": "STM32N6 Debug",
"origin": "snippet",
"cwd": "${workspaceFolder}",
"preBuild": "${command:st-stm32-ide-debug-launch.build}",
//"runEntry": "BOOT_Application", // Set in BOOT_Application
"deviceCore": "Cortex-M55",
"svdPath": "${env:STM32CLT_PATH}/STMicroelectronics_CMSIS_SVD/STM32N657.svd",
"imagesAndSymbols": [
{
"symbolFileName": "${workspaceFolder}/Appli/build/${workspaceFolderBasename}_Appli.elf",
"imageFileName": "${workspaceFolder}/Appli/build/${workspaceFolderBasename}_Appli-trusted.elf",
},

{
"symbolFileName": "${workspaceFolder}/FSBL/build/${workspaceFolderBasename}_FSBL.elf",
"imageFileName": "${workspaceFolder}/FSBL/build/${workspaceFolderBasename}_FSBL.elf",
}
],
"serverExtLoader": [
{
"loader": "${env:STM32CubeProg_PATH}/ExternalLoader/MX25UM51245G_STM32N6570-NUCLEO.stldr",
"initialize": false
}
]
}
]
}

 

Log from the debug terminal:


STMicroelectronics ST-LINK GDB server. Version 7.13.0
Copyright (c) 2026, 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

Waiting for debugger connection...
GNU gdb (GNU Tools for STM32 14.3.rel1.20251027-0700) 15.2.90.20241229-git
Copyright (C) 2024 Free Software Foundation, Inc.
License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html>
This is free software: you are free to change and redistribute it.
There is NO WARRANTY, to the extent permitted by law.
Type "show copying" and "show warranty" for details.
This GDB was configured as "--host=x86_64-w64-mingw32 --target=arm-none-eabi".
Type "show configuration" for configuration details.
For bug reporting instructions, please see:
<https://www.gnu.org/software/gdb/bugs/>.
Find the GDB manual and other documentation resources online at:
<http://www.gnu.org/software/gdb/documentation/>.

For help, type "help".
Type "apropos word" to search for commands related to "word".
add-symbol-file "[...]/Appli/build/FW_Theia_Appli.elf"
add symbol table from file "[...]/Appli/build/FW_Theia_Appli.elf"
(y or n) [answered Y; input not from terminal]
Reading symbols from [...]/Appli/build/FW_Theia_Appli.elf...
add-symbol-file "[...]/FSBL/build/FW_Theia_FSBL.elf"
add symbol table from file "[...]/FSBL/build/FW_Theia_FSBL.elf"
(y or n) [answered Y; input not from terminal]
Reading symbols from [...]/FSBL/build/FW_Theia_FSBL.elf...
Debugger connected
Waiting for debugger connection...
0x18003a1a in ?? ()
connected to remote target localhost:61234
load "[...]/Appli/build/FW_Theia_Appli-trusted.elf"
Loading section .data, size 0x3c1301e0 lma 0x70100000
Load failed
cube is killed by signal SIGTERM

 

My linker script, as you can see it is almost the same as the one auto-generated by STM32CubeMX, except for the more detailed definition of memory regions, and the addition of the .image1 and .axisram2 output sections:

/* Entry Point */
ENTRY(Reset_Handler)
_Min_Heap_Size = 0x200; /* required amount of heap */
_Min_Stack_Size = 0x800; /* required amount of stack */


/* MARK: REGIONS
/* Memories definition */
MEMORY
{
ITCM (xr ) : ORIGIN = 0x10000000, LENGTH = 64K
DTCM ( rw) : ORIGIN = 0x30000000, LENGTH = 128K

AXISRAM1 ( rw) : ORIGIN = 0x34000000, LENGTH = 1M
AXISRAM2 ( rw) : ORIGIN = 0x34100000, LENGTH = 1M

AXISRAM3 ( rw) : ORIGIN = 0x34200000, LENGTH = 448K
AXISRAM4 ( rw) : ORIGIN = 0x34270000, LENGTH = 448K
AXISRAM5 ( rw) : ORIGIN = 0x342E0000, LENGTH = 448K
AXISRAM6 ( rw) : ORIGIN = 0x34350000, LENGTH = 448K
CACHEAXI ( rw) : ORIGIN = 0x343C0000, LENGTH = 256K
VENCRAM ( r ) : ORIGIN = 0x34400000, LENGTH = 128K

AHBSRAM1 ( rw) : ORIGIN = 0x38000000, LENGTH = 16K
AHBSRAM2 ( rw) : ORIGIN = 0x38004000, LENGTH = 16K

BACKUP_SRAM ( rw) : ORIGIN = 0x3C000000, LENGTH = 8K

XSPI2_FSBL_HEADR ( r ) : ORIGIN = 0x70000000, LENGTH = 1K
XSPI2_FSBL ( r ) : ORIGIN = 0x70000400, LENGTH = 255K

XSPI2_APPLI_HEADR ( r ) : ORIGIN = 0x70100000, LENGTH = 1K
XSPI2_APPLI (xr ) : ORIGIN = 0x70100400, LENGTH = 511K
}
/* Highest address of the user mode stack */
_estack = ORIGIN(AXISRAM1) + LENGTH(AXISRAM1); /* end of "AXISRAM1" Ram type memory */
_sstack = _estack - _Min_Stack_Size;

/* Sections */
SECTIONS
{
/* MARK: ISR Vector */
/* Startup code and ISR vector into RAM type memory */
.isr_vector : {
. = ALIGN(4);
KEEP(*(.isr_vector)) /* Startup code */
. = ALIGN(4);
} > XSPI2_APPLI /* ITCM would be nicer */

/* MARK: ITCM */
/* The code defined in .RamFunc section will be copied to RAM at startup and used for quick execution */
.RamFunc : {
. = ALIGN(4);
*(.RamFunc) /* .RamFunc sections */
*(.RamFunc*) /* .RamFunc* sections */
. = ALIGN(4);
_eRamFunc = .; /* define a global symbol at end of RamFunc code */
} > ITCM

/* MARK: XSPI2_APPLI */
/* The program code and other data into FLASH memory */
.text : {
. = ALIGN(4);
*(.text) /* .text sections (code) */
*(.text*) /* .text* sections (code) */
*(.glue_7) /* glue arm to thumb code */
*(.glue_7t) /* glue thumb to arm code */
*(.eh_frame)

KEEP (*(.init))
KEEP (*(.fini))

. = ALIGN(4);
_etext = .; /* define a global symbols at end of code */
} > XSPI2_APPLI

/* Constant data into FLASH memory */
.rodata : {
. = ALIGN(4);
*(.rodata) /* .rodata sections (constants, strings, etc.) */
*(.rodata*) /* .rodata* sections (constants, strings, etc.) */
. = ALIGN(4);
} > XSPI2_APPLI

.ARM.extab : {
. = ALIGN(4);
*(.ARM.extab* .gnu.linkonce.armextab.*)
. = ALIGN(4);
} > XSPI2_APPLI

.ARM : {
. = ALIGN(4);
__exidx_start = .;
*(.ARM.exidx*)
__exidx_end = .;
. = ALIGN(4);
} > XSPI2_APPLI

.preinit_array (READONLY) : {
. = ALIGN(4);
PROVIDE_HIDDEN (__preinit_array_start = .);
KEEP (*(.preinit_array*))
PROVIDE_HIDDEN (__preinit_array_end = .);
. = ALIGN(4);
} > XSPI2_APPLI

.init_array (READONLY) : {
. = ALIGN(4);
PROVIDE_HIDDEN (__init_array_start = .);
KEEP (*(SORT(.init_array.*)))
KEEP (*(.init_array*))
PROVIDE_HIDDEN (__init_array_end = .);
. = ALIGN(4);
} > XSPI2_APPLI

.fini_array (READONLY) : {
. = ALIGN(4);
PROVIDE_HIDDEN (__fini_array_start = .);
KEEP (*(SORT(.fini_array.*)))
KEEP (*(.fini_array*))
PROVIDE_HIDDEN (__fini_array_end = .);
. = ALIGN(4);
} > XSPI2_APPLI

/* Used by the startup to initialize data */
_sidata = LOADADDR(.data);

/* Initialized data sections into RAM memory */
.data : {
. = ALIGN(4);
_sdata = .; /* create a global symbol at data start */
*(.data) /* .data sections */
*(.data*) /* .data* sections */

. = ALIGN(4);
_edata = .; /* define a global symbol at data end */

} > AXISRAM1 AT> XSPI2_APPLI

.noncacheable : {
. = ALIGN(8);
__snoncacheable = .;/* create symbol for start of section */
KEEP(*(noncacheable_buffer))
. = ALIGN(8);
__enoncacheable = .; /* create symbol for end of section */
} > AXISRAM1

.gnu.sgstubs : {
. = ALIGN(4);
*(.gnu.sgstubs*) /* Secure Gateway stubs */
. = ALIGN(4);
} > XSPI2_APPLI

/* Uninitialized data section into "RAM" Ram type memory */
. = ALIGN(4);
.bss : {
/* This is used by the startup in order to initialize the .bss section */
_sbss = .; /* define a global symbol at bss start */
__bss_start__ = _sbss;
*(.bss)
*(.bss*)
*(COMMON)

. = ALIGN(4);
_ebss = .; /* define a global symbol at bss end */
__bss_end__ = _ebss;
} > AXISRAM1

/* MARK: Heap */
/* User_heap section, used to check that there is enough RAM memory left, considering the minimum required heap size */
._user_heap : {
. = ALIGN(8);
PROVIDE ( end = . );
PROVIDE ( _end = . );
. = . + _Min_Heap_Size;
. = ALIGN(8);
} > AXISRAM1

/* MARK: Stack */
/* stack section, used to check that there is enough RAM memory left, considering the minimum required stack size */
._stack_section_faux : {
. = ALIGN(8);
. = . + _Min_Stack_Size;
. = ALIGN(8);
} > AXISRAM1

/* MARK: AXISRAM1 explicit */
.image1 : {
. = ALIGN(32);
_simage1 = .; /* create a global symbol at start of section */
*(.image1) /* .image1 section */
. = ALIGN(4);
_eimage1 = .; /* create a global symbol at end of section */
} >AXISRAM1

/* MARK: AXISRAM2 explicit */
/* AXISRAM2 section, used for data explicitly placed in AXISRAM2 memory */
.axisram2 : {
. = ALIGN(8);
_saxisram2 = .; /* create a global symbol at start of section */
*(.axisram2) /* .axisram2 sections */
*(.axisram2*) /* .axisram2* sections */
. = ALIGN(4);
_eaxisram2 = .; /* create a global symbol at end of section */
} >AXISRAM2

/* Remove information from the compiler libraries */
/DISCARD/ :
{
libc.a ( * )
libm.a ( * )
libgcc.a ( * )
}

.ARM.attributes 0 : { *(.ARM.attributes) }
}

 

1 reply

Pavel A.
June 13, 2026

> Loading section .data, size 0x3c1301e0 lma 0x70100000

Oh…  size 0x3c1301e0 ??