cancel
Showing results for 
Search instead for 
Did you mean: 

External flash loader for h7

sivaram
Associate III

I am trying to develop external flash loader, which will use the cubeprogrammer utility, I am facing the following error,

1) When I try to use cubeide for the project, If I remove the main and made necessary changes in startup.s and in linker, getting the following linker error "./arm-none-eabi/lib/crt0.o: In function `_start'"

2) When I try to use the atollocstudio, I am able to compile and run in target but the processor resets on executing the following line of HAL Init

 SystemCoreClock = HAL_RCC_GetSysClockFreq() >> ((D1CorePrescTable[(RCC->D1CFGR & RCC_D1CFGR_D1CPRE)>> RCC_D1CFGR_D1CPRE_Pos]) & 0x1FU);

Same code when ran from Flash memory executes without any issues.

3) Also I found that when I moved all the programs to RAM then the ISR's are being hit, the same code executing from flash works without any issues.

12 REPLIES 12

You're basically trying to build a free standing object file, the entry point can be defined as Init

You do not want, and can't have, the vector table, and interrupts. So you'll need to lose SysTick, and implement timing, delay and timeout loops without using it.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I did everything, but in stmcube ide library looks like it is expecting main to be present.

Honestly don't know if the CubeIDE gets in the way here, perhaps you can use the compiler/linker more directly where you control the command line options, add the ones needed, remove the unnecessary ones, etc. You'll need to figure out how to drive your tools. You just need it to do a simple compile/link, and not drag in a lot of library and C run time code.

What QSPI memory are you using? What pins/af settings is that using?

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I was using the startup assembly file which resulted in calling the init, start, main etc... functions in some dependency order , now removed the startup file and removed all the libraries from linking. now the problem is how to initialize the stack pointer without out startup file, just added a test function at the start, the program crashes at the function call if it is called with an argument.

with regards to QSPI memory, I have not come to that level, right now I am just trying to blink led's at different in the respective loader function to make sure if they are executed correctly before venturing in to QSPI stuff.

>>with regards to QSPI memory, I have...

The point more generally was to establish the hardware being used, and if I had constituency..

The code doesn't need to understand what the SP is set too, or the buffers they are passed. The tool loads the .STLDR into RAM and provides the execution context, you just need to provide the function entry points.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

The QSPI we are using is IS25LP128F-JLLE-TR

I am not aware that the STLDR will provide the execution context, also I am trying to execute the code via debugger. I removed the startup file and recompiled and generated the stldr file, now the programmer complains the Error: external loader cannot be loaded, no further information is available. Actually the GUI keeps on crashing with in couple of seconds, this error info is thrown when I try to load via cli executable.

Just figured out the problem, there was an issue with linker section sorted it out and loaded the file, I had just put a while loop and blink a LED inside the Init function to test the correct execution of each functions, I am expecting Init function to execute when the stldr is selected in the external loaders window, Is my expectation correct? cos, the LED function is not working as expected.

Seeing the message "external_loader->sectorstypeNbr = 0 " on selecting external loader.

It calls the Init on-demand, so you'd actually need to touch the memory involved for it to be invoked. The system can support multiple loaders dealing with different memory regions.

Set the debug level in Cube Programmer to "3"

If the naming or geometry is not reflected correctly, review how StorageInfo is being exported. Good tools to examine this would be objcopy or FromELF

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..