cancel
Showing results for 
Search instead for 
Did you mean: 

External loader : SectorErase function is missing

Pedro3
Senior

Hello there!

I'm trying to build an external loader for STM32H7, so I can use a NOR FLASH in XiP mode, but following the AN and the examples in CubeProgrammer folder, I'm getting the message:

STM32CubeProgrammer API v1.4.0

External loader : SectorErase function is missing!

Error: External loader cannot be loaded.

The .ELF file was generated by SW4STM32, coded using HAL and linker modified to DTCMRAM.

Do you have any idea what's going on?

Thanks!

6 REPLIES 6

In Keil and IAR you need to use "KeepInCompilation" or similar so the linker doesn't discard what it thinks is dead code, or unused portions.

Watch also for C++ name mangling.

Generally I've found the linkers to generate very noisy .ELF files, and I've had to clean and sanitize them to get them to a reasonable size instead of multi-megabyte.

Inspect the .ELF with FromELF or objdump to confirm location and presence of symbols.

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

Hi Clive, thanks for your tips!

I added "__attribute__((used))" to the functions and "#ifdef __cplusplus" to the headers, with no luck. So I decided to port the code to TrueStudio (just like the examples) and the missing function error is gone! But the my loader isn't working, not erasing and not reading the mapped memory... Do you know any other secret for that?

Thanks again!

I work on these platforms commercially. Writing and debugging these types of loaders is complex and involved. There are many secrets and tricks, and ST's implementation isn't well documented or robust, the example code is frequently buggy and poorly/incorrectly commented.

I would recommend you code your own working routines first, and use them within your app to upload and test functionality of the NOR FLASH you are using. Provide a means to upload .HEX, or X-MODEM in .BIN data directly.

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

Hi Clive, thanks for your help again!

Yes, I've noticed that the codes for EL are a mess, but I was counting on CubeProgrammer to "burn" the QSPI Flash at this "starting point". But it's ok.

So now I'm trying to write the .bin file directly to Flash (using an external programmer). STM32H7 is accessing the Flash in memory mapped mode (QSPI) and I also can read it by QSPI_BASE address. But "JumpToApplication" routine isn't working, giving me a "Hard Fault" right after calling the function. What am I missing?

Thanks!

Not sufficiently familiar with your code.

Thumb instructions expect an odd address. The data in the Vector Table is not executable.

Dump the data at the memory location you are jumping too, and review, and perhaps look at via disassembly view in debugger. Data would need to be mapped, and perhaps have MPU settings.

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

Hi Clive, thanks about your help. I've followed your suggestion and used a USB flash drive to get the bin and "burn" to QSPI. Much better than CubeProgrammer!

Thanks again!