The Silabs Energy Micro EFM32 ARM-Cortex microcontrollers support updating the firmware in the chip via a bootloader. The chips come with the bootloader pre-installed by default.
So far I haven’t had much luck using this bootloader as my quest to get it working usually was quickly suspended by me overwriting the bootloader and then failing to re-install the bootloader.
The problem with re-installing the bootloader is that you need to compile the bootloader for your specific device and Silabs only provides files to do this in the IAR development environment which I have no interest in using.
Luckily I stumbled upon the work of the f-watch team: Bootloader , and after some digging I found the corresponding code here .
They modified the bootloader not to copy itself to RAM, which I don’t need anyway (it is only useful if you want to be able to overwrite the bootloader) and besides that they changed the bootloader triggering procedure from pulling low the SWD pin to pressing two other. That change was quickly reverted.
After installing the bootloader I can now use minicom + xmodem to upload and boot a firmware and it works fine.
The only remaining problem is that I want it to work from within the makefiles I use for building. After some trial and error I found this trick using screen:
# upload via xmodem
# open serial device
screen -d -m -S 'serial' $(SERIAL) 115200
# say we want to Upload
screen -x "serial" -X eval '!!!| echo u'
# execute xmodem transfer
screen -x "serial" -X eval "exec !! sx -vv $<"
# say we want to Boot the installed firmware
screen -x "serial" -X eval '!!!| echo b'
Not the nicest trick but it works fine. To be replaced one day by a python script.