Use stm32loader for hFramework firmware

Hi!
Is it possible to use stm32loader to flash firmware written in hFramework using GPIO pins in Raspberry Pi?

I try to use:

stm32loader -c rpi -e -w myproject.bin

and I get:

Bootloader version: 0x31                                                                                              │
Chip id: 0x413 (STM32F405xx/07xx and STM32F415xx/17xx)                                                                │
Device UID: 0053-0045-30355113-30373633                                                                               │
Flash size: 1024 KiB                                                                                                  │
Extended erase (0x44), this can take ten seconds or more                                                              │
Write 571 chunks at address 0x8000000...                                                                              │
[====================] 100.0% address:0x8023a00                                                                       │
Writing finished!

but the firmware does not seem to run.

Hi Blazej,

Using code based on hFramework you have to flash bootloader in the first place and protect some sectors in memory before overwrite. Next you can flash your compiled code. Unfortunately stm32loader don’t know where it should start write for example .hex or .bin file. This functionality is available in core2-flasher. So answering your question, it’s not possible to flash code based on hFramework usingstm32loader for now. We also do not plan to add such functionality because hFramework is already deprecated.

Best regards,
Hubert

Thanks for the helpful tips!
By analyzing resulted .hex files and core2-flasher source code, I figured out how to use stm32loader to flash hFramework firmware.

The main problem is that stm32loader does not erase flash memory at all when there are protected pages (or I’m doing something wrong). So I start by performing a write unprotect:

stm32loader -c rpi -W

Then, I erase memory and flash the bootloader:

stm32loader -c rpi -e -w -v bootloader_1_0_0_core2.bin

And now I write the firmware starting at the 0x08010000 address:

stm32loader -c rpi -w -v -a 0x08010000 myproject.bin 

Flashing the bootloader each time is kind of a hassle but I can live with that.

The thing I’m concerned right now is this line in core2-flasher source code:

res = writeMemory(0x08008000, "\x00\x00\xff\xff", 4);

which writes 4 bytes at 0x08008000 address.
Is this some necessary step? I haven’t noticed any problems without it.

Hi Blazej,

As I said before this script is quite old and we do not remember all details. Please review STM32 boot process manual to investigate that if this is important for you for some reason.

Best regards,
Hubert