Using Arduino STM32 bootloader

mgrunt
Fri Dec 04, 2015 9:36 pm
Hello, I try low cost china board with STM32F103xx with bootloader. Everything works fine, but IDE is very simple and my favorite IDE is emBlocks. Nice is virtual serial port and flash over USB. Most functions I already have in emBlocks and Arduino IDE benefit with own functions are for me almost zero. Is it way how to use Arduino bootloader (flash over USB and virtual serial port) without Arduino IDE for example in emBlocks? Is it necessary edit for example startup code (no overwrite boot loader during flash)? And how to redirect printf to virtual USB serial port?

Thanks for answers
MG


RogerClark
Fri Dec 04, 2015 10:13 pm
The bootloader only provides the ability to upload via DFU and to then execute code from 0x8002000 or 0x8005000 (depending on bootloader version)

The USB serial is compiled into the Arduino sketch by the “core”

@jcw is working on a new bootloader that uses AVRDude to upload rather than DFU-Util, and is jut a serial port (not a DFU device) – see his thread about this.
However his bootloader is only at Alpha stage of development, and I’m not sure whether he has implemented the USB serial within the Sketch yet.

If you want to build using em:blocks, you should consider using files generated by the STM32Cube as it has a virtual serial device, or look at using libopnecm3 as the base of your programs

However neither of these provide a bootloader, so I suggest your best bet is to buy a STLink adaptor and use that for upload, as it does not require you to press any buttons to reset the board etc prior to uploading.


stevech
Sat Dec 05, 2015 3:20 am
What became of em:blocks? Last release was over a year ago.

mgrunt
Sat Dec 05, 2015 3:51 pm
Thank you for answer RogerClark. When I read it, I probably stay with em::blocks (without arduino bootloader) and with STlinkv2+USB serial convertor…

to stevech – I’m using em::blocks because it is very simple make a new project (all is preconfigured). I don’t must make anything (just a few mouse clicks) and I have new project which is ready to using (including SPL too). For example Code Blocks is only IDE and it is hard make first setting. Bud when you advise me how to set it, I will be glad. Thanks


RogerClark
Sat Dec 05, 2015 7:17 pm
CooCox is an alternative to em:blocks which seems to have better comminity support.

Alternatively using the STMCube to generate code then using Eclipse etc as the IDE is also an option.

But if Em:Blocks works for you, then you may as well stick with it, even if its not been updated for a year or more.


stevech
Sun Dec 06, 2015 7:49 am
mgrunt wrote:Thank you for answer RogerClark. When I read it, I probably stay with em::blocks (without arduino bootloader) and with STlinkv2+USB serial convertor…

to stevech – I’m using em::blocks because it is very simple make a new project (all is preconfigured). I don’t must make anything (just a few mouse clicks) and I have new project which is ready to using (including SPL too). For example Code Blocks is only IDE and it is hard make first setting. Bud when you advise me how to set it, I will be glad. Thanks


stevech
Sun Dec 06, 2015 7:50 am
mgrunt wrote:Thank you for answer RogerClark. When I read it, I probably stay with em::blocks (without arduino bootloader) and with STlinkv2+USB serial convertor…

to stevech – I’m using em::blocks because it is very simple make a new project (all is preconfigured). I don’t must make anything (just a few mouse clicks) and I have new project which is ready to using (including SPL too). For example Code Blocks is only IDE and it is hard make first setting. Bud when you advise me how to set it, I will be glad. Thanks


zmemw16
Sun Dec 06, 2015 8:07 am
@stevech wrote
Eclipse+GCC is a hard road but doable

http://gnuarmeclipse.github.io/install/

i setup eclipse both luna & mars with gnuarmeclipse by simply following the instructions.

this was so i could do something with cubemx output files.

i’d rate myself as an only slightly informed linux user, but maybe i’m better at this than i thought :D
currently lenovo i7 laptop with debian jessie

stephen


stevech
Mon Dec 07, 2015 4:53 am
zmemw16 wrote:@stevech wrote
Eclipse+GCC is a hard road but doable

http://gnuarmeclipse.github.io/install/

i setup eclipse both luna & mars with gnuarmeclipse by simply following the instructions.

this was so i could do something with cubemx output files.

i’d rate myself as an only slightly informed linux user, but maybe i’m better at this than i thought :D
currently lenovo i7 laptop with debian jessie

stephen


zmemw16
Mon Dec 07, 2015 6:32 am
i think i’ve done it on a virtualbox xp install as well, i’ll fire it off, check and report….
srp

mgrunt
Tue Dec 08, 2015 12:56 pm
I started with stm32 before years with eclipse. Then I try em::blocks and code blocks. Now I’m back in eclipse… Please, how erase arduino bootloader with stlinkv2? Thanks.

stevech
Tue Dec 08, 2015 7:01 pm
mgrunt wrote:I started with stm32 before years with eclipse. Then I try em::blocks and code blocks. Now I’m back in eclipse… Please, how erase arduino bootloader with stlinkv2? Thanks.

RogerClark
Tue Dec 08, 2015 7:08 pm
As the bootloader is located at the start of flash, like your em:blocks programs, The next time you upload it will be overwritten.

I dont know why you need to completely erase the chip.


stevech
Tue Dec 08, 2015 7:11 pm
RogerClark wrote:I dont know why you need to completely erase the chip.

RogerClark
Tue Dec 08, 2015 7:38 pm
I thought this was in relation to removing the bootloader ( which does not set any protection)

I thought the OP said they already programmed using emBlocks. It seems strange the OP needs to know how to erase.


stevech
Tue Dec 08, 2015 9:10 pm
I’d think the boot loader would be flashed with write protection on those sectors.

RogerClark
Tue Dec 08, 2015 9:28 pm
No.

We don’t flash with write protection.

I’d not noticed an option to flash and write protect sectors, but I’ll look again at the STM tools.

I am pretty sure the bootloader can write protect its self as thats what STM’s STlink code does, but we’ve not put that code into our bootloader

(though I agree it may be worth considering)


stevech
Wed Dec 09, 2015 5:52 am
ST’s ST-Link software for windows has a few options for protecting, sector by sector, with write prohibited. Also read-out protection for no-duplicate.
And a number of others.

Enclosed is a screen grab from one of ST-Link’s menus.

Erase Chip does that then resets the protection option bits for the blank chip.
See other options. Options not available on a given MCU (target) are greyed-out.

2015-12-08_214938.jpg
2015-12-08_214938.jpg (153.5 KiB) Viewed 400 times

Leave a Reply

Your email address will not be published. Required fields are marked *