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
2024-12-24 12:49 PM
For now, the external loader does not support any memory only flashes an LED on PD2. Please see the attached files.
The target memory is W25Q series connected via QSPI.
I have done Erase, Read, Write, MemoryMappedMode tests and everything works fine. The tests were done normally from the main loop without using external loader.
For now, the main problem is to run the external loader.
When the external loader functions will be started correctly I will insert W25Q support code into them.
Current config and versions:
STM32G491RE (FLASH=512k, RAM=112k)
STM32CubeIDE Version: 1.14.0 Build: 19471_20231121_1200
I am using the debugger included in STM32CubeIDE. In the debugger configuration -> add external loader (the path to the loader is set).
I also made tests with STM32CubeProgrammer v.2.18.0 - external loader also does not work.
I also tried to use this loader: https://github.com/cturvey/stm32extldr/tree/main/g4_w25q128
This is the exact hardware configuration as mine, but also does not start.
I think it is also because the wrong sequence of programming.