(...) F103 does not have a built-in USB bootloader. Bootloader in F105, 107 has the USB option. for example ), i suppose you can update stm32 via usb but the mcu pins are pretty small
Anyway, the built-in uart bootloader works great, almost the same as by usb, you only need a cheap usb-serial ttl converter and the flash loader demonstrator.
Oh my, I started to see Hard faults everywhere... I even think I dreamed with a few!
.
On first try I didn't think it enough, had to revert everything and start again using a different approach. Buuut it's done!
New profile system, now easily expandable, so in the future I can add support for new profiles in a breeze.
Included by default T12, C210 and C245. None gets deleted unless the user erases it.
Also, each stored data uses its own checksum, so in case of error only that slot is erased. Like this:
[SYSTEM SETTINGS][CHECKSUM]
[PROFILE1][CHECKSUM]
[PROFILE2][CHECKSUM]
[PROFILE3][CHECKSUM]
"Iron Type" menu and warnings are gone! Don't blame me if you mess up setting the wrong profile for the tip, be careful!
(I'm still thinking on detection method that doesn't need hardware modding)
The profiles can be changed on the fly from the Settings/SYSTEM entry. (Profile setting)
A new check after the boot splash is added, to detect first booting after a clean flash, that will prompt the user to select the correct profile.
Pretty similar to the old iron tip screen.
I discovered that CubeMX was allocating a lot of heap. Reduced it to almost 0. It freed up additional 1.5KB RAM. As I don't use dynamic allocation, it's ok.
(that was one of the big issues in the original fw, uncontrollled ram usage, hard faults everywhere...)
New settings use 2KB flash. Only the active profile is loaded to ram to save resources.
64KB devices are starting to struggle at 92% but still holding well!
The binaries are updated. As always, force reset at boot.
Also, as the state is stored, when you returned to a menu it would always be in "exit" or "back" modes(last state before exiting the menu), something I always found to be very annoying.
I made some changes in the screen system so there's always a "lastscreen" variable, very useful for taking certain actions depending on the screen you came from.
I use that to reset each menu to initial positions unless coming from a submenu.