Bootloader and ISP

Discussion about the Maple and other bootloaders
abba
Posts: 3
Joined: Mon Oct 24, 2016 9:01 am

Bootloader and ISP

Postby abba » Mon Oct 24, 2016 9:35 am

Hi folks,

great project here, started looking into the STM32 a few weeks ago because I needed USB-Midi.
I'm reading Brown's Discovering the STM and have tons of documentation, but please forgive me for asking
before perusing it all - this isn't stackoverflow after all, is it?

I'm a bit confused how the bootloader, isr vector table and manual flashing (SWD...) interact/coexist.

Example: Arduino with usb-bootloader examples work fine. I then tried to flash the Keil blinky example via Keil - board went dead.
After flashing maple_mini_boot20.bin with the ST-Link utility, suddenly the blinky example came to life.

If you want to keep both the usb-bootloader and flash via ST-Link, is it just a matter of specifying an offset?
The bootloader at 0x8000000 has the isr-table at its start. But so does the .bin/hex.
Do you have to edit the linker script to put your main into a custom section? Details, details, details...

User avatar
martinayotte
Posts: 1170
Joined: Mon Apr 27, 2015 1:45 pm

Re: Bootloader and ISP

Postby martinayotte » Mon Oct 24, 2016 3:39 pm

Yes, it is the LD script that manage that.

For example, for the bootloader_20.ld script of maple-mini variant, you have :

Code: Select all

MEMORY
{
  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
  rom (rx)  : ORIGIN = 0x08002000, LENGTH = 120K
}


And for the bare metal mem-jtag.ld script of maple-mini variant, you have :

Code: Select all

MEMORY
{
  ram (rwx) : ORIGIN = 0x20000000, LENGTH = 20K
  rom (rx)  : ORIGIN = 0x08000000, LENGTH = 128K
}

abba
Posts: 3
Joined: Mon Oct 24, 2016 9:01 am

Re: Bootloader and ISP

Postby abba » Tue Oct 25, 2016 10:57 pm

Thanks.
I understand for this scenario with some debuggers you can simply specify an offset and flash (with the isr-table probably omitted), whereas with e.g. VisualGdb you have to edit the linker script - you can't even flash separate memory regions and always have to copy in the bootloader. Why is that (assuming a flash block size of 1 KB you could still write with this granularity)?

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

Re: Bootloader and ISP

Postby RogerClark » Wed Oct 26, 2016 7:02 am

Why would you want to flash via STLink and keep the bootloader

The bootloader only provided a USB DFU device for uploading, and once the upload is complete the bootloader just transfers control (jumps) to the start of the sketch (application ) code

The sketch code provides USB Serial, and with STlink upload, the USB Serial is still compiled in as part of the sketch code.
Hence you can upload with STLink and still have USB Serial.

abba
Posts: 3
Joined: Mon Oct 24, 2016 9:01 am

Re: Bootloader and ISP

Postby abba » Thu Oct 27, 2016 12:07 pm

Hi Roger, thanks for the info, even if that wasn't the question. Sooner or later, if you go beyond basic stuff, you have to know how things work.


Return to “Maple Bootloader”

Who is online

Users browsing this forum: No registered users and 1 guest