[COMPLETED] Combining Blink & Count to the bootloader

STM32duino bootloader aka Maple bootloader
victor_pv
Posts: 1747
Joined: Mon Apr 27, 2015 12:12 pm

Re: Combining Blink & Count to the bootloader

Post by victor_pv » Sat Jun 24, 2017 9:15 pm

I am thinking it may be easier to:
1.- Take maple mini and wipe it clean.
2.-Load bootloader.
3.-Load blink or whatever example sketch.
4.-Download the flash until the end of actual code with st-link and there you have a merged bin that can be uploaded.

If the question is how to do this for every variant, then that's a different problem. I dont think it's worth it. May be better to make the bins available only from a page with a big red banner warning the board will only show as DFU device until a sketch is loaded.

User avatar
RogerClark
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Combining Blink & Count to the bootloader

Post by RogerClark » Sat Jun 24, 2017 10:54 pm

Hi Victor

I agree its too much efforft to download to the device and then read it back to make the combined bootloader.

But I already made an exe to merge the binaries.

As long as I only use Serial.print in the shetch it would work on all boards.

I will try to write some text that the sketch part will display on a 1 second loop

ag123
Posts: 806
Joined: Thu Jul 21, 2016 4:24 pm

Re: Combining Blink & Count to the bootloader

Post by ag123 » Sun Jun 25, 2017 7:58 am

thus far i'm quite happy with just the 'raw' bootloader, in fact after i installed the bootloader i deliberately zero out blocks of flash after 0x8002000
if i remember correctly, this leaves it in 'perpetual' boot loader mode waiting for sketch install
either way the 'perpetual mode' keeps the led blinking
then what's needed is to install the sketch say from arduino ide or via dfu-util
for new users this should probably be the 1st thing they'd need to learn - to compile and install the blinky sketch
which would give them usb-serial as well
just 2 cents

User avatar
RogerClark
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Combining Blink & Count to the bootloader

Post by RogerClark » Sun Jun 25, 2017 10:43 am

ag123 wrote:
Sun Jun 25, 2017 7:58 am
thus far i'm quite happy with just the 'raw' bootloader, in fact after i installed the bootloader i deliberately zero out blocks of flash after 0x8002000
if i remember correctly, this leaves it in 'perpetual' boot loader mode waiting for sketch install
either way the 'perpetual mode' keeps the led blinking
then what's needed is to install the sketch say from arduino ide or via dfu-util
for new users this should probably be the 1st thing they'd need to learn - to compile and install the blinky sketch
which would give them usb-serial as well
just 2 cents
Depends on how people install it, its possible that the BP has a binary already in it.

The Bootloader just looks for a magic number (I think it looks for the stack address or part of it in the start of the sketch code segment).
Its unlikely but not impossible that it would detect something else as a valid sketch and jump to it, then crash

User avatar
RogerClark
Posts: 7481
Joined: Mon Apr 27, 2015 10:36 am
Location: Melbourne, Australia
Contact:

Re: Combining Blink & Count to the bootloader

Post by RogerClark » Sat Jul 22, 2017 4:36 am

Guys.

I've finally got around to doing a version of this.

See

https://github.com/rogerclarkmelbourne/ ... erged_bins

I made a simple sketch that prints out the message
Congratulations, you have installed the STM32duino bootloader
For more information about Arduino on STM32
See https://github.com/rogerclarkmelbourne/ ... bootloader
and http://www.stm32duino.com
I have tested this on the Blue Pill and it works fine.

I have not tested on the Maple mini, but it should work as I use a different sketch for the maple binaries

If this seems to work for everyone, I'll put these combined binaries into the binaries folder, to replace the files that contain just the bootloader.



BTW. I can't recall if the other larger maple boards have different disconnect hardware from the Maple mini, in which case I'd need a different sketch for them, which is not what I've done at the moment.

But its taken me long enough getting this far, so if the larger Maple boards have an issue I'll simply delete the combined binary and those users can use the bootloader without sketch

User avatar
mrburnette
Posts: 1885
Joined: Mon Apr 27, 2015 12:50 pm
Location: Greater Atlanta
Contact:

Re: Combining Blink & Count to the bootloader

Post by mrburnette » Sun Jul 23, 2017 3:00 pm

RogerClark wrote:
Mon Jun 19, 2017 1:52 am
Guys

A problem that we get over and over again, is people expecting to get the Serial device when they first load the bootloader
<...>

History


Long ago, a forum was spun-off from a massively long Arduino.cc thread by a group of advanced Arduino users; said purpose of that new site was to give knowledgeable uC users a core compatible with IDE 1.5x to support the STM32F103xx Maple Mini inexpensive Chinese boards from Baite. Said core was a hack from the abandoned LeafLabs core effort.

The idea is that the STM32F103 board would give previous AVR Arduino users a cheap solution to extending performance and headroom while maintaining as-much Arduino'ish look 'n feel as possible. At the time, members agreed that the forum would address advanced users as the 8-bit AVR official Arduino forum was staffed and moderated for newbies.

IMO:

Newbies should start with the 8-bit Arduino UNO and learn the basic terminologies and procedures and capabilities and limitations. When they have acquainted themselves with the fundamentals of the Arduino language, bootloaders, serial, I2C, SPI, and basic electronics then they have a foundation for moving up the ecosystem and being productive with the STM32F1xx boards.

The time to move from 8-bit Arduino to 32-bit STM32 will depend on the individual; but, with so much Internet material available for Arduino atmega328P, the timeframe could be as short as a few weeks of vacation. Couple in some darn-good YouTube videos on Arduino and C/C++ as implemented in the Arduino ecosystem and many people can shed the novice handle in a few months. (Students at the 300-400 or advanced classes likely have formal classes that provide the required foundational prerequisites.)

I do not think if we provide a true-valued service by making things foolproof and novice friendly. Roger has a few YouTube videos that are excellent and there is the WiKi that addresses far more than the commercial Maple Mini product of Leaf Labs.

A lots of effort can be wasted for little value gain when we get off-course and start looking to improve that which is working correctly. ... not to mention making the simple core complex.

Opinion by Ray

ag123
Posts: 806
Joined: Thu Jul 21, 2016 4:24 pm

Re: Combining Blink & Count to the bootloader

Post by ag123 » Mon Jul 24, 2017 7:56 am

i didn't actually have an avr, i started messing with mcu's in stm32 & is quite happy that way, :lol:
i'd think stm32f1 is actually a good mcu to get started feature rich but an initial rather steep learning curve. the initial goofs as it seemed tend to be messing with those 'perpetual bootloader' buttons with maple mini and possibly installing the bootloader itself for the bluepill

for those who are truly 'newbies' in the mcu or even stm32 world, they should probably start with maple mini that has the bootloader pre-installed by the vendor. this is apparently the case for boards maple mini from baite & olimex. https://www.olimex.com/Products/Duino/S ... e-hardware. i actually started off with the olimex's board which is at a somewhat premium vs the cheap chinese MM and BP. the olimex's board is still good value as it is a stm32f103RB and that it conform to the arduino uno headers which makes it usable with shields and is packed in addition with a uSD card slot on board, separate LDO for analog & digital, on board lipo charger

but the pre-installed boot loader means that i actually started without st-link, ft232 usb-serial etc, i started straight installing a blinky sketch via usb with the original maple bootloader installed by olimex. i'd guess that pretty much shortened the initial learning curve.
& of all things i actually used the 'ancient' *maple IDE*, simple no-nonsense, small footprint, works straight out of box on maple mini & olimex's board
:lol:

Post Reply