Is there a way to use this bootloader out of the arduino IDE

STM32duino bootloader aka Maple bootloader
Post Reply
synths_with_stm
Posts: 3
Joined: Sun Dec 22, 2019 2:05 am

Is there a way to use this bootloader out of the arduino IDE

Post by synths_with_stm »

Hi, so as the humongous title of this topic says I´m trying to get to work the stm32duino usb bootloader out of the arduino environment (in this case I´ll just upload a bin file).
So as far as I´m aware you can use the "maple_upload.bat" file to, well upload files using this bootloader.
When I use it for uploading bin files compiled on the Arduino IDE it has no problems, but when I try to upload a simple blink program made in Coocox it refuses to complete the upload. Is there a workaround for this issue?
I leave a link to my bin file https://drive.google.com/file/d/1Ig3oeK ... WnThe/view
mrburnette
Posts: 633
Joined: Thu Dec 19, 2019 1:23 am
Answers: 7

Re: Is there a way to use this bootloader out of the arduino IDE

Post by mrburnette »

The batch uploader is here: https://github.com/rogerclarkmelbourne/ ... upload.bat

Roger's bootloader, an evolution from the LeafLabs bootloader, is located here:
https://github.com/rogerclarkmelbourne/ ... bootloader

A write-up about the bootloader:
https://github.com/rogerclarkmelbourne/ ... Bootloader


If you want to know more, this article may be useful:

http://kevincuzner.com/2018/06/28/build ... -an-stm32/
synths_with_stm
Posts: 3
Joined: Sun Dec 22, 2019 2:05 am

Re: Is there a way to use this bootloader out of the arduino IDE

Post by synths_with_stm »

Thanks for the reply, I'm not trying to be mean but it hasn't solve my issue completely.
Maybe I wasn't clear enough so all i'm want to do is to use this bootloader to update the firmware of one of my projects (just like the main purpose of a bootloader).
As you have pointed out I can use that batch file to upload the bin file, but that only works when I use bin files that were compiled in the arduino IDE using the stm32 addon, but any other file simply won't work.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Is there a way to use this bootloader out of the arduino IDE

Post by ag123 »

this is for the stm32f103 based boards (e.g. the various 'pill' boards etc)
technically stm32f103 (and most of other variants i'd guess. jumps to 0x8000000) start of flash memory and start running from there after a reset.
so if you can find a means to place your sketch.bin at that location 0x8000000, it would start running from there.

one of those ways to place a sketch.bin at 0x8000000 is to use a usb-uart dongle e.g.
https://medium.com/@paramaggarwal/progr ... 3cec0dbc86

or you could use a st-link v2 dongle
https://github.com/stm32duino/wiki/wiki/Upload-methods
^^ read this from the official core - covers lots of ground including (usb-uart, st-link, Roger's stm32duino bootloader and hid bootloader)

the usb (dfu) bootloader on the maple mini (and blue pill) has its origins from leaflab (the maple mini) - this is literally user firmware not built-in on chip
and Roger made much improvements on it nicknamed the stm32duino-bootloader
https://github.com/rogerclarkmelbourne/ ... bootloader
after installing Roger's bootloader, that make it possible to install a sketch using the command

Code: Select all

dfu-util -a 2 -RD sketch.bin
for libmaple based (and official core) sketches with a usb cable (no dongles required). select the appropriate upload method
checkout also the hid boot loader
viewtopic.php?f=58&t=19

this is convenient as otherwise the normal means to install a sketch or firmware on stm32f103 is either uart (using a usb-uart dongle) or a jtag-swd dongle (e.g. st-link v2)

to run a sketch directly at 0x8000000, among the things one need to check is to look in the ld scripts to select ld scripts that start at 0x8000000 and that the vector table table entry point is at 0x8000000 (this normally is a define e.g. VECT_TAB_OFFSET=0x0 official core, VECT_TAB_ADDR=0x8000000 libmaple core). if you build using an external tool and your sketch doesn't 'work', take a look at how the ld scripts are defined and the vector tab address define is defined e.g. in boards.txt

these are normally pre-defined in boards.txt in the core and one would only need to select the appropriate entries e.g. upload method.from the menu in the Arduino IDE

if one use the Roger's 'stm32duino (dfu) boot loader' the flash start address of the sketch would normally be 0x8002000. again it is more a matter of selecting the appropriate upload method in Arduino IDE. and Roger's 'stm32duino (dfu) boot loader' should be installed at 0x8000000 using a usb-uart dongle or an st-link v2 dongle e.g.
https://medium.com/@paramaggarwal/progr ... 3cec0dbc86
https://github.com/rogerclarkmelbourne/ ... ill-Boards

there is also this HID bootloader which probably works better for windows users
viewtopic.php?f=58&t=19
Last edited by ag123 on Sun Dec 22, 2019 2:51 pm, edited 14 times in total.
ag123
Posts: 1655
Joined: Thu Dec 19, 2019 5:30 am
Answers: 24

Re: Is there a way to use this bootloader out of the arduino IDE

Post by ag123 »

for the m4 based e.g. stm32f4xx boards and i think the stm32f303 etc
they have a built-in (on chip) USB DFU boot loader. no additional firmware/software (for the bootloader itself) is required

for this details, one should review ST's reference docs:
STM32 microcontroller system memory boot mode ...
https://www.st.com/resource/en/applicat ... 167594.pdf

get an updated version of dfu-util
http://dfu-util.sourceforge.net/
or use apps like like STM32CubeProgrammer
https://www.st.com/en/development-tools ... eprog.html

https://github.com/stm32duino/wiki/wiki/Upload-methods
^^ read this from the official core - covers lots of ground including (usb-uart, st-link, Roger's stm32duino bootloader and hid bootloader and including this DFU boot / flash method

set boot0, connect usb (if it is already connected, unplug and re-plug the cable, pressing reset may not do it, the host may not detect the change)
if you use dfu-util,

Code: Select all

dfu-util -l
would likely list that board as being available for flashing

flashing with dfu-util is something like

Code: Select all

dfu-util -s 0x8000000 -D sketch.bin
Bingo600
Posts: 86
Joined: Sat Dec 21, 2019 3:56 pm

Re: Is there a way to use this bootloader out of the arduino IDE

Post by Bingo600 »

Just thoughts about BMP & dfu bootloader

What about flashing more than 64K on a Bluepill that only reports 64K available ?
I had issues w. dfu-util when trying to flash a BlackMagic Probe (BMP) (90K code) to a Bluepill.

I built dfu-util from latest source, but still had issues (well dfu-util is prob just honouring the reported specs) , but it would make dfu-loading quite unusable for me.

BMP actually comes w. an "own" dfu-loader that will flash > 64k , so solvable for BMP ...

/Bingo
Post Reply

Return to “USB bootloader”