Notice that shiny new button on the opposite side of the maple from the reset button? It's fun for the whole family (on GPIO pin 38), but also moonlights as a BOOT control pin: when the button is pushed when the STM32 is reset or powered on, the microprocessor enters a hardware bootloader mode which listens on USART1 for upload data. This is a hardcoded, low level bootloader, not to be confused with maple-bootloader which listens on the USB port and accepts uploads over DFU from the IDE or dfu-util. What this method is most useful for is upgrading or replacing maple-bootloader itself!
To flash a new bootloader over serial, you'll need a means of serial communication (we usually use a USB-Serial FTDI chip), a .bin file of the bootloader you want to upload (you can compile the latest version of ours using the source from http://github.com/leaflabs/maple-bootloader ), python (including the PySerial library), and the modified version stm32loader.py script from the micromouse project (the original was written by Ivan A-R: http://tuxotronic.org/wiki/projects/stm32loader ):
http://www.micromouseonline.com/blog/2009/05/07/stm32-arm-cortex-bootloader
The procedure I use on linux is to first connect both the FTDI chip and the Maple to my laptop via USB, power them on, and connect the GND, RX, and TX pins to the Maple on USART port #1 (pins 7 and 8, not 0 and 1). I make sure that the FTDI chip shows up as a device on my system, usually as /dev/ttyUSB0
. Then I hold down the BUT button and press RESET on the Maple; after a second or two I release the BUT. The LED should not power up when in the serial bootloadermode. Then I go to the root of my Maple bootloader (where I have stm32loader.py extracted) and run:
./stm32loader.py -p /dev/ttyUSB0 -evw build/maple_boot.bin
You may have to replace /dev/ttyUSB0
with your platform's serial device and build/maple_boot.bin
with the path to the actual .bin youwant to upload.
If it works you'll see a bunch of upload/verify memory addresses scroll by. If it doesn't work, make sure you entered the serial bootloader mode correctly, that your RX/TX lines aren't swapped, that all the devices are powered on, and that you have appropriate permissions for your serial port.
Happy hacking!