How to build the bootloader?

Bootloader for boards that don't have the addition hardware found on the Maple mini, which resets the USB
navintiwari08
Posts: 16
Joined: Sat Aug 22, 2015 3:54 pm

How to build the bootloader?

Postby navintiwari08 » Sat Aug 22, 2015 4:34 pm

Hi!! this is Navin. I've worked with 8 bit micro controllers including PIC, 8051 and AVRs(with Arduino). I really wanted to start something with arm cortex m3. So I got a generic stm32f103x board and was looking for a way to use it with Arduino. In the description it says that stm32duino bootloader makes use of pin PC14(used for DFU if this pin goes high at boot time). The board that I have uses stm32f103c8t6 mcu and pin PC14 is the OSC i/p for 32768Hz resonator. Now, I know this can be changed in the bootloader so that the "button" can be made to use some other pin. I'm new to understanding bootloaders and their structure and if its not too much, could anybody please tell me how do I rebuild(compile) this bootloader with small changes in pin definitions and where to get the required files and tools. Basically, I want to know the steps to build the bootloader myself from its C and header files and where to get them. Thanks for your time!

keep it burning
-Navin

zmemw16
Posts: 983
Joined: Wed Jul 08, 2015 2:09 pm
Location: St Annes, Lancs,UK

Re: How to build the bootloader?

Postby zmemw16 » Sat Aug 22, 2015 6:06 pm

need to pull and install Arduino_STM32 first? nope it builds standalone, good idea though
https://github.com/rogerclarkmelbourne/Arduino_STM32

expand the zip under ~/sketchbook_stm32/hardware
i have separate sketchbook directories for avr and stm32; ./.arduino15 is another matter....

https://github.com/rogerclarkmelbourne/STM32duino-bootloader

pull the zip & expand at the ~/sketchbook_stm32/hardware/Arduino_STM32/STM32duino-bootloader/ level
should give you a README.md file and a STM32F1 directory

cd ~/sketchbook/hardware/Arduino_STM32/STM32duino-bootloader/STM32F1
add a section into config.h as/if required, following the template in config.h

add a target into the Makefile again following the template in there

make clean && make generic-pz4 :-)

or for all on a linux platform
for i in a1 a9 b9 c13 d1 d2 e2 e5 g15;do make clean && make generic-p$i;done

no doubt this will corrected as required:-)

wiki?? has more details??

stephen

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

Re: How to build the bootloader?

Postby RogerClark » Sat Aug 22, 2015 9:42 pm

I tried to put a lot of detail in the readme of the stm32duino-bootloader, please take a look at that first.

On windows you need to install Make? I have WinAVR installed, which installed Make. This may be the easiest way to get Make.

For new targets you need to change the Makefile, there is a line you need to add for your new target and you also need a new rules section to tell Make how to build the new target.
But if you look at the Makefile, its pretty simple to see what you need to add, i.e just copy and change one line for the target and copy and change the last block of runs for another target.

Then you just need to add another ifdef block in config.

Note. Button is optional, and also note you ca configure if the button pressed state is Logic High or Low

navintiwari08
Posts: 16
Joined: Sat Aug 22, 2015 3:54 pm

Re: How to build the bootloader?

Postby navintiwari08 » Sun Aug 23, 2015 3:07 pm

I'll try it out as suggested by you guys. Will revert back in case I get stuck. Meanwhile, this is the generic board that I have. I also have stm nucleo L152RE board that I'm using with Keil to learn more about cortex m3 programming. Here is the generic board I mentioned.

Image

It has only one LED "D1" which is connected between Vcc and GND through a resistor. Just wanted to put it out. Any info regarding this is welcomed.

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

Re: How to build the bootloader?

Postby RogerClark » Sun Aug 23, 2015 8:52 pm

I have the same board, but it has many problems.

I think it does not have the 1.5k pullup resistor on USB D+, also it seems to have some startup issues.
Most of these boards, you can upload via serial and run the sketch, but if you change to boot link and try to run straight after powerup, it doesnt work.

Well, some boards run the code straight after booting, but most dont.

I suspect faulty manufacturing or bad hardware design

navintiwari08
Posts: 16
Joined: Sat Aug 22, 2015 3:54 pm

Re: How to build the bootloader?

Postby navintiwari08 » Mon Aug 24, 2015 5:22 pm

I found a .pdf file containing the schematic of the stm32 mini board. Also checked with a multi-meter, the USB D+ has a 1.5k pull up. Look for jumper P2 and resistor R13. Here's how USB D+ is pulled up.. Usbd+>R11>P2>R13>3.3V. Resistor R11 is around 22 ohms. I think its to limit the current from usb port on board. Here is the file. Hope it helps in some way. http://www.sunspot.co.uk/Projects/Arduino/STM32/MINI-STM32-Schematic-Diagram.pdf

User avatar
ahull
Posts: 1404
Joined: Mon Apr 27, 2015 11:04 pm
Location: Sunny Scotland
Contact:

Re: How to build the bootloader?

Postby ahull » Mon Aug 24, 2015 8:28 pm

navintiwari08 wrote:I found a .pdf file containing the schematic of the stm32 mini board. Also checked with a multi-meter, the USB D+ has a 1.5k pull up. Look for jumper P2 and resistor R13. Here's how USB D+ is pulled up.. Usbd+>R11>P2>R13>3.3V. Resistor R11 is around 22 ohms. I think its to limit the current from usb port on board. Here is the file. Hope it helps in some way. http://www.sunspot.co.uk/Projects/Arduino/STM32/MINI-STM32-Schematic-Diagram.pdf


Thanks navintiwari08, that's very useful. We now have a schematic for the "Ugly board". It even shows the zero ohm resistor between VBat and 3v3. If only I had found that *before* I fitted the battery to that board, I could have saved myself some pyrotechnics. :oops:
- Andy Hull -

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

Re: How to build the bootloader?

Postby RogerClark » Mon Aug 24, 2015 9:34 pm

22 ohms on USB lines is normal.

Looking at the schematic, I cant see any obvious reasons why these boards dont seem to work.

Perhaps the crystals or the oscillator caps are defective.

All I know is that several people have these boards, but quite often they dont work correctly and seem to have startup problems, even after pressing reset


Return to “Generic bootloader”

Who is online

Users browsing this forum: No registered users and 1 guest