2024-12-21 01:52 PM
Hi,
I am working on an external loader for STM32G491.
For STM32F4 series microcontroller, everything works fine, but STM32G491 does not work.
I observed that the external loader program is loaded into RAM, but does not execute.
I did some tests with running the program from RAM in debug mode.
I observed that if the FLASH memory is erased then the program loaded into RAM does not want to start (see image below).
If there is any previous running program in FLASH memory, then loading the test program into RAM and running it with the debugger works fine.
For STM32F4 series microcontroller, I can always run the program from RAM ( also for deleted FLASH memory - which seems to be normal).
The problem with the external loader is that the debugger initially deletes the processor's FLASH memory, then using the external loader to erase the external memory, but the external loader no longer works, because the FLASH memory is deleted.
I use CubeIDE Version: 1.14.0 & HAL library
Start of the linker file:
/* Entry Point */
ENTRY(Init)
/* Generate 2 segment for Loader code and device info */
PHDRS {Loader PT_LOAD ; SgInfo PT_LOAD ; }
/* Highest address of the user mode stack */
_estack = ORIGIN(RAM) + LENGTH(RAM); /* end of RAM */
/* Generate a link error if heap and stack don't fit into RAM */
_Min_Heap_Size = 0x200 ; /* required amount of heap */
_Min_Stack_Size = 0x400 ; /* required amount of stack */
/* Specify the memory areas */
MEMORY
{
RAM (xrw) : ORIGIN = 0x20000004, LENGTH = 112K
}
What did I miss?
Any ideas?
Best regards,
Lehu