StM32F4xx-Discovery Bootloader
Keywords: Embedded systems, ARM, STM32F4, Bootloader
Bootloader…..!!!! Bootloader is a tiny piece of embedded code, active a boot time, that loads (Loader) program into RAM for execution (if required) AND/OR has the capability to Update firmware by Programming/ Reprogramming internal flash.

Imagine a device in field (say IoT) with a possible bug in its firmware but there is no direct physical access to the device after its deployment. In such scenario an embedded bootloader enables adds functionality to update firmware remotely. e.g. cell phone firmware update.
STM32F4xx devices come preprogrammed with embedded bootloader that provides the facility of downloading program to internal flash via:USARTCANUSB OTG
NOTE:
1): The embedded bootloader of STM32F4xx devices only provides the facility of flash programming. It doesn’t have any “Debug Stub” as part of bootloader to provide debug facility.
2): Updating/Programming internal flash via USART, the peripheral clock is provided from internal RC oscillator of 16MHz, while in case of USB OTG and CAN an external HSE clock is required that should be multiple of 1Mhz (4Mhz-26Mhz).
So where is this bootloader code and how it can be accessed? Lets look at the memory map of STM32F4xx microcontrollers:
As can be seen from Memory Map, the memory space between 0x1FFF,0000 and 0x1FFF,740F is assigned to System memory + OTP. Out of this space 30Kbytes are assigned to System memory while the remaining 528-bytes are reserved for OTP memory. This 30Kbytes of System memory is the space where STM32 bootloader resides. It comes pre-configured, all you have to do is to boot from this region and it will take care of the rest by listening to data traffic on above mentioned ports and programming internal flash memory on code block.
Lets see how STM43F4-Discovery board can be configured to boot from System Memory and subsequently from preprogrammed bootloader.
Boot Configuration:
By default ARM Cortex-M processors upon reset starts executing code from Code Space in memory map i.e. 0x0000,0000 – 0x1FFF,FFFF. This is fixed but STM32F4xx implementation provides the flexibility of booting from other memory regions by aliasing/mapping different memory spaces at Code Space/region. The following table shows how to boot STM32Fxx devices from different memory spaces [1].
Boot mode selection pins | Boot Mode | Aliased/Mapped Memory | |
---|---|---|---|
BOOT1 | BOOT0 | ||
x | 0 | Main Flash memory | Main Flash memory is selected as the boot space |
0 | 1 | System memory | System memory is selected as the boot space |
1 | 1 | Embedded SRAM | Embedded SRAM is selected as the boot space |
So in order to boot STM32Fxx devices from System memory, BOOT1 = must be at Logic-0 and BOOT0 = must be at logic-1 at the time of RESET. Lets have some fun with STM32F4xx-Discovery board and program it via its embedded bootloader.
Hardware Requirements:
- USB-to-Serial Cable
- STM32F4xx device (STM32F407-Discovery in my case)
- Flash Loader Demonstrator
Software Pre-Requisites:
1): Make sure that appropriate driver for USB-to-Serial Cable is installed on host PC. This can be verified via Device Manager. Remember there shouldn’t be any yellow warning sign on Driver as shown below figure.

2): Make sure Flash Loader Demonstrator as mentioned in above Hardware Requirements, is installed on host PC.
3): A test program in .hex/.bin format. For test purpose simple Blinky .hex for STM32F407 can be downloaded from here.
Steps:
Lets do some real work. Following are the steps to program STM32F4xx devices through their embedded bootloader via one of USART.
1) – Connect on-board Boot0 pin to on-board Vdd. Similarly connect Boot1 pin to on-board GND. On STM32F4xx boards Boot1 is multiplexed with PB2 pin. If you don’t see any Boot1, connect PB2 to GND. On STM32F4-Discovery both Vdd and GND pins are next to Boot0, and Boot1 respectively and can be connected via jumpers.
2) – Connect USB to Serial Tx, Rx and GND pins to one of the following STM32F4xx USART pins. On STM32F4-Discovery, U(S)ART-1 is hardware configured for USB OTG using some capacitor so it may not work as expected. Following are the U(S)ART pins on STM32F4-Discovery board.USART1 (PA9/PA10)USART3 (PB10/11 and PC10/11)
Possible Connection (Excluding USART1) between Serial Cable and USART3 is as follow.TXD –> PB10, RXD –> PB11TXD –> PC10, RXD –> PC11
3) – Connect USB-to-Serial Cable TXD pin to Rx of STM32F4xx USART, and USB-to-Serial RXD pin to Tx of STM32F4xx USART. Also connect GND pin of the board to USB-to-Serial cable ground wire.
4) – Connect USB-to-Serial cable to host PC and Power up Discovery board.
5) – Open Flash Loader Software and select USB-to-Serial port (shown in Device Manager Figure-1). In my case its COM9. Leave rest of the settings as it is. Click Next. If you see any error stating “No response from the target…..”, Press the on-board Reset button (black) and click next.

If everything is configured as described above, you should see the following message. Click Next.

6) – Select the target board/Microcontroller which will most probably be set automatically. As shown in Figure-4, the flash loader is connected to STM43F4 board having 1024k OR 1Mbytes of flash memory. Click Next.

7) – In this step you have to Select what you want to do with internal Flash. Either you can Erase it or Program it. As we are programming device so we will select “Download to device”. Select program file (.hex/.bin) and check Verify after download. Click Next.

8) – Wait for the Flash Loader software to program and verify STM32F4xx internal flash and give success message as shown in bellow figure.

9) – Remove Jumbers (Boot0,1) and Serial Cable, Press Reset button on board. You will see the LED blinking.

[1] – Reference manual-RM0090
My relatives all the time say that I am wasting my time here at
net, except I know I am getting know-how everyday by
reading such fastidious articles or reviews. 0mniartist asmr
This is my first time visit at here and i am actually
impressed to read all at single place. asmr 0mniartist
Thanks for sharing your thoughts on 0mniartist.
Regards 0mniartist asmr
Do you have a spam issue on this site; I also am
a blogger, and I was wondering your situation; we have created some
nice practices and we are looking to swap strategies with
others, be sure to shoot me an e-mail if interested. asmr 0mniartist
I don’t know if it’s just me or if everybody else encountering issues with your blog.
It appears like some of the text within your content are running off the screen. Can someone
else please comment and let me know if this is
happening to them too? This could be a issue with my browser because I’ve had this
happen previously. Thank you 0mniartist asmr
Howdy! I’m at work surfing around your blog from my new iphone 3gs!
Just wanted to say I love reading through your blog and look forward to all your posts!
Carry on the excellent work!
We are a group of volunteers and starting a new
scheme in our community. Your website offered us with valuable information to work on. You have done a formidable job and
our whole community will be grateful to you.
I couldn’t refrain from commenting. Perfectly written!
I will immediately clutch your rss as I can’t
in finding your e-mail subscription hyperlink or newsletter service.
Do you’ve any? Please permit me recognize so that I could subscribe.
Thanks.
You need to be a part of a contest for one of the best websites online.
I’m going to recommend this website!
Excellent web site you’ve got here.. It’s hard to
find quality writing like yours these days. I truly appreciate people like you!
Take care!!
Today, while I was at work, my cousin stole my iPad and tested to see if it can survive a 30 foot drop, just so
she can be a youtube sensation. My iPad is now destroyed and she has 83 views.
I know this is totally off topic but I had to share it
with someone!
It’s very trouble-free to find out any topic on web as compared to
books, as I found this article at this website.
For most recent information you have to pay a quick visit world wide web and
on world-wide-web I found this web site as a most excellent
site for latest updates.
scoliosis
Does your blog have a contact page? I’m having trouble locating it but,
I’d like to shoot you an e-mail. I’ve got some recommendations for your blog you might be interested in hearing.
Either way, great site and I look forward to seeing it grow over time.
scoliosis
scoliosis
Hey there! This is my first visit to your blog!
We are a collection of volunteers and starting a new initiative in a community in the same
niche. Your blog provided us beneficial information to work on. You have done a extraordinary job!
scoliosis
dating sites
Very rapidly this web site will be famous amid all blogging people, due to
it’s fastidious articles or reviews dating sites
scoliosis
Wonderful beat ! I wish to apprentice while you amend your site, how can i subscribe for a blog web site?
The account helped me a acceptable deal. I have been tiny bit familiar of
this your broadcast provided bright clear concept scoliosis
dating sites
Whoa! This blog looks just like my old one! It’s on a completely different topic but it has pretty much the same layout and design.
Wonderful choice of colors! free dating sites https://785days.tumblr.com/
I’m gone to inform my little brother, that he should also pay a quick visit this blog on regular basis to get
updated from most up-to-date gossip.
Thanks for sharing your thoughts about dating sites.
Regards
Hi there, the whole thing is going sound here and ofcourse every one
is sharing facts, that’s actually fine, keep up writing.
I used to be able to find good advice from your blog articles.
Great work! This is the type of info that are supposed to be shared
around the net. Shame on the search engines for not positioning this publish upper!
Come on over and discuss with my web site . Thanks =)
Hello to every body, it’s my first pay a quick visit of
this blog; this website contains remarkable
and genuinely good stuff in support of readers.
I know this if off topic but I’m looking into starting my own weblog and was wondering what all is needed to get set up?
I’m assuming having a blog like yours would cost a pretty penny?
I’m not very internet savvy so I’m not 100% sure. Any
recommendations or advice would be greatly appreciated.
Many thanks
Your method of describing the whole thing in this paragraph is really good,
every one be able to effortlessly know it, Thanks a lot.
Hey there excellent blog! Does running a blog such as this take a large amount of
work? I’ve absolutely no expertise in programming however I was hoping
to start my own blog in the near future. Anyways, should you have any ideas or tips for new blog owners please share.
I know this is off subject nevertheless I simply needed to ask.
Many thanks!
Good post. I learn something totally new and challenging on websites
I stumbleupon on a daily basis. It will always be interesting to read content
from other authors and use a little something from their sites.
Pretty! This was a really wonderful article. Thanks for supplying these details.
Wow! At last I got a blog from where I be able to truly obtain helpful data regarding my study and knowledge.
This is really interesting, You’re a very skilled
blogger. I have joined your feed and look forward to seeking more of
your magnificent post. Also, I’ve shared your site in my social networks!
I’d like to find out more? I’d like to find out more details.
What’s up, after reading this remarkable post i am too cheerful to share
my knowledge here with mates.
Your method of describing the whole thing in this post is genuinely fastidious, all be capable of without difficulty be aware of it, Thanks a lot.
Thanks for any other excellent article. The place
else could anyone get that type of information in such
a perfect means of writing? I have a presentation subsequent week, and I’m at
the look for such information.
Hi there to every body, it’s my first go to see of this web site; this
website contains amazing and in fact fine information in favor of readers.
This piece of writing will assist the internet viewers for creating new blog or even a weblog from
start to end.
Hey! This is my first visit to your blog! We are a collection of volunteers and starting a
new initiative in a community in the same niche. Your blog provided us useful information to
work on. You have done a wonderful job!
My developer is trying to persuade me to move to .net from PHP.
I have always disliked the idea because of the expenses.
But he’s tryiong none the less. I’ve been using WordPress on a variety of websites
for about a year and am worried about switching to another platform.
I have heard excellent things about blogengine.net. Is there a way
I can transfer all my wordpress posts into it? Any kind of help would be greatly
appreciated!
Wow that was odd. I just wrote an very long comment but after I clicked submit
my comment didn’t appear. Grrrr… well I’m not writing all that over again. Regardless, just wanted to say great blog!
At this time I am going away to do my breakfast, after having my breakfast coming
again to read further news.
whoah this blog is wonderful i like studying your posts.
Keep up the great work! You know, a lot of persons are hunting around for this info, you can help them greatly.
Thanks for a marvelous posting! I truly enjoyed reading it, you happen to be a great author.I will be
sure to bookmark your blog and definitely will come back down the road.
I want to encourage one to continue your great work, have a nice
morning!
What i don’t realize is if truth be told how you’re no longer really a lot more neatly-appreciated than you might be now.
You are so intelligent. You know thus considerably on the subject of this
subject, made me personally consider it from numerous various angles.
Its like men and women don’t seem to be involved until it is something to do
with Lady gaga! Your own stuffs nice. All the time care for it up!
Hi, i think that i noticed you visited my web site so i came to return the prefer?.I am trying to to find issues to enhance my web site!I suppose its ok to
use some of your concepts!! asmr https://app.gumroad.com/asmr2021/p/best-asmr-online asmr
Link exchange is nothing else however it is just placing the other person’s web site link on your page at
suitable place and other person will also do similar
for you. cheap flights http://1704milesapart.tumblr.com/ cheap flights
Piece of writing writing is also a fun, if you know afterward you can write
otherwise it is complicated to write. quest bars http://j.mp/3C2tkMR quest bars
Wonderful work! That is the type of information that should
be shared across the net. Disgrace on Google for no longer positioning this submit higher!
Come on over and visit my web site . Thanks =) scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery
Wonderful beat ! I would like to apprentice whilst you amend
your website, how could i subscribe for a weblog website?
The account aided me a acceptable deal. I were a little
bit acquainted of this your broadcast provided bright transparent concept quest bars https://www.iherb.com/search?kw=quest%20bars quest bars
I have not checked in here for a while as I thought it was getting boring, but the last few posts are good quality so I guess I will add you back to my everyday bloglist. You deserve it my friend 🙂
I think this is among the most significant information for me.
And i am glad reading your article. But want to remark on few
general things, The website style is perfect, the articles
is really excellent : D. Good job, cheers scoliosis surgery https://coub.com/stories/962966-scoliosis-surgery scoliosis surgery
Just want to say your article is as amazing. The clearness on your submit is simply nice and
that i can assume you are an expert on this subject. Well with your permission allow me to snatch your RSS feed to stay up to
date with impending post. Thank you one million and please carry on the rewarding work.
ps4 https://bit.ly/3z5HwTp ps4 games
Thanks for sharing excellent informations. Your site is so cool. I am impressed by the details that you have on this site. It reveals how nicely you understand this subject. Bookmarked this web page, will come back for extra articles. You, my friend, ROCK! I found simply the info I already searched all over the place and just could not come across. What a great website.
Excellent beat ! I wish to apprentice while you amend your site, how could i subscribe for a blog site?
The account helped me a acceptable deal. I had been a little bit acquainted of this your broadcast offered bright clear concept
Hi Dear, are you truly visiting this web site on a regular basis, if so afterward you will without doubt
obtain good experience.
I believe this is among the most vital information for me.
And i am glad reading your article. However want to
commentary on few normal issues, The web site taste is wonderful, the articles is
really great : D. Excellent process, cheers
I enjoy what you guys are usually up too. Such clever work and reporting!
Keep up the awesome works guys I’ve added you guys to my personal blogroll.
Definitely imagine that which you said. Your favourite justification seemed to be on the net
the simplest factor to consider of. I say to you, I
definitely get irked at the same time as people think about worries that they
plainly don’t recognise about. You managed to hit the nail upon the highest and also outlined out the whole thing with no need
side-effects , people can take a signal. Will likely be again to get more.
Thanks
Good day! I simply wish to offer you a big thumbs up for your great information you’ve
got here on this post. I am coming back to your web site
for more soon.
This blog was… how do I say it? Relevant!! Finally I
have found something which helped me. Kudos!
Also visit my web blog: tracfone 2022