Hello,
I have a hex file. I don't know whether it was created with the Arduino software, C, or another programming language. I would like to load it into an STM32 BluePill. Is this possible with the Arduino software?
There are AVR-Dude, WinAvr, and similar programs, but they apparently require a programming adapter. There should be something that allows you to load the hex file into the BluePill via USB, like with the Arduino software, without an additional adapter.
Regards,
Hans
In theory and maybe it can work.
Your Bluepill would have to have a bootloader installed that allows for upload via its USB connector.
The STM32 core for the Arduino IDE supports the Maple DFU bootloader and a HID bootloader.
e.g. for the Maple bootloader this is the upload command the IDE generates on my PC after compiling Blink for the Bluepill
F:Arduino\arduino-1.8.19\portable\packages\STMicroelectronics\tools\STM32Tools\2.2.1/win/busybox.exe sh F:\Arduino\arduino-1.8.19\portable\packages\STMicroelectronics\tools\STM32Tools\2.2.1/maple_upload.sh COM5 2 1EAF:0003 C:\Users\hmeij\AppData\Local\Temp\arduino_build_800861/Blink.ino.bin
The "Blink.inp.bin" is the binary file that gets uploaded. You would have to convert your hexfile in a binfile first.
Personally I find these bootloaders a pain in the neck and strongly recommend to buy a STLINK-V2 USB programmer. They cost about €5,- and will also allow you to upload via the "STM32CubeProgrammer (SWD)" option or even better use the STM32CubeProgrammer software that makes uploading a bin or hexfile easy.
Hi @Holzwurm56.
Was the file compiled specifically for the STM32F103Cx microcontroller that is on the "Blue Pill" board?
I ask because, unlike Arduino sketch code which is often compatible with many or all different boards, the compiled binary file can only be used with the specific microcontroller (and configuration of that microcontroller) it was compiled for.
The Hex-File is for the stm32 on the BluePill.
Why not get the original source file and compile it?
I’ll take a SWAG and say you could write a user program to convert the HEX file to binary and figure out how to program it into memory. You might look into OTA (Over-The-Air) updates for hints on how to approach that. However, it’s a lot of work, and I’m not sure that processor will even allow it.
STM32CubeProgrammer can do the Hex to Binary conversion for you as it is able to read and write Binary, Hexfile and SREC format.