Okay, so I essentially fixed the initialization issue.
The Problem
In my case, I added the JPEG code to an existing application that made use of the NPU via. generated files from STM32Cube AI Studio. To make use of that generated code, I had to expand my linker script with the provided one by the AI Studio; so I basically expanded my MEMORY region, to match that of the generated .ld file:
/* Memories definition */
MEMORY
{
RAM (xrw) : ORIGIN = 0x34000000, LENGTH = 0x100000
AXISRAM3_4_5_6 (xrw) : ORIGIN = 0x34270000, LENGTH = 0x0
ROM (xrw) : ORIGIN = 0x70100400, LENGTH = 0x6ffc00
EXTFLASH (rx) : ORIGIN = 0x70180000, LENGTH = 0x7e80000
}
/* Sections */
SECTIONS
{
/* Add Memory Area for AXIFLEXMEM */
.AI_AXIFLEXMEM (NOLOAD):
{
. = ALIGN(4);
KEEP(*(.AI_AXIFLEXMEM))
. = ALIGN(4);
} >RAM
/* Add Memory Area for AXISRAM1 */
.AI_AXISRAM1 (NOLOAD):
{
. = ALIGN(4);
KEEP(*(.AI_AXISRAM1))
. = ALIGN(4);
} >RAM
/* Add Memory Area for xSPI2 */
.AI_XSPI2 :
{
. = ALIGN(4);
KEEP(*(.AI_XSPI2))
. = ALIGN(4);
} >EXTFLASH
/* Add Memory Area for EXTFLASH */
.AI_EXTFLASH :
{
. = ALIGN(4);
KEEP(*(.AI_EXTFLASH))
. = ALIGN(4);
} >EXTFLASH
/* ... the rest of the ld file ... */
The Fix
I didn’t see that the generated .ld file also increased the _Min_Heap_Size and _Min_Stack_Size, so I additionally updated those:
_Min_Heap_Size = 2048; /* required amount of heap */
_Min_Stack_Size = 8192; /* required amount of stack */