Understanding and Decoding Keil startup code for ARM Cortex-M Processors

Keywords: Embedded systems, ARM, Keil, Startup code, Boot sequence


While turning on your PC, you must have seen few splash screen, that company logo and OS logo. Its takes few seconds to boot up and bring desktop on screen. There are bunch of things happen in the background that load your OS while booting up your PC.

In embedded systems the ultimate controlling unit i.e. MCU/Processor usually is tightly coupled with the memory and hardware. Like desktop PC, MCUs also passes certain stages before jumping to user code. The steps followed is a combination of both hardware defined and software defined. We have a dedicated tutorial for Boot process in embedded system that will guide you to understand how boot sequence in embedded systems. The link to the tutorial is given bellow.

One piece of code that has critical significance both at boot time and at run is the startup code. The startup code is usually provided by vendors as a part of toolchain and is usually automatically added while creating new project. You can write your own startup code if you have fair grip over Assembly and underlying hardware architecture.

In this tutorial we will try to explain the startup file e.g. startup_tm4c123.s, startup_stm32f4xx.s etc. added to keil projects for ARM cortex-M processor based MCUS e.g. STM32F4xx, TM4C123 etc. etc. The startup file code is written in ARM Assembly (for ARM Compiler like Keil) and is usually provided by the SoC vendor. The startup file provides low level interface between various exception and the underlying hardware. The code also provides entry point for the application linking the Power on Reset event to the main application.

Before moving forward, let’s explain the ARM assembly instructions and directives used in the startup code. It’s not complete list of ARM assembly instruction rather these are the ones used in startup file.

1. ARM Assembly:

Following are the selective ARM Cortex-M instructions used in Startup code.

NOTE: If you are already familiar with ARM assembly, you can skip this section.

EQU: The EQU is not really an Instruction rather its an Assembler directive called the EQUATE directive. Its much similar to #define directive in C and assigns a Label to a numeric number. e.g.

PI    EQU    3.14



77 thoughts on “Understanding and Decoding Keil startup code for ARM Cortex-M Processors”

  • Hey! I understand this is kind of off-topic but I had to ask.
    Does managing a well-established website like yours require a massive amount work?
    I’m completely new to running a blog but I do write in my journal daily.

    I’d like to start a blog so I can share my own experience and views
    online. Please let me know if you have any ideas or tips for new aspiring blog owners.
    Thankyou! 0mniartist asmr

  • Admiring the persistence you put into your site and detailed information you provide.
    It’s great to come across a blog every once in a while that isn’t the same out of
    date rehashed material. Excellent read! I’ve saved your
    site and I’m adding your RSS feeds to my Google account.

    0mniartist asmr

  • Hey there are using WordPress for your blog platform? I’m new to the
    blog world but I’m trying to get started and set up
    my own. Do you need any html coding knowledge to make your own blog?
    Any help would be greatly appreciated!

  • Howdy! This blog post couldn’t be written much better!
    Going through this post reminds me of my previous roommate!
    He constantly kept talking about this. I am going to
    send this post to him. Fairly certain he will have a very good read.
    I appreciate you for sharing!

  • After I initially commented I appear to have
    clicked the -Notify me when new comments are added- checkbox
    and from now on each time a comment is added I receive four emails with the same comment.

    There has to be a means you are able to remove me from that service?
    Thank you!

  • It is in point of fact a great and helpful piece of information. I am
    satisfied that you just shared this useful info with us.
    Please keep us up to date like this. Thanks for sharing.

  • Hi, i read your blog from time to time and i own a similar one and i
    was just wondering if you get a lot of spam comments? If so how do you prevent it, any plugin or anything you can recommend?
    I get so much lately it’s driving me mad so any assistance is very much appreciated.

  • I know this if off topic but I’m looking into starting my own weblog and was wondering
    what all is needed to get setup? I’m assuming having a blog like yours would cost
    a pretty penny? I’m not very internet savvy so I’m not 100% positive.
    Any tips or advice would be greatly appreciated.
    Many thanks

  • you’re in reality a excellent webmaster. The website loading velocity
    is amazing. It sort of feels that you are doing any distinctive trick.

    Moreover, The contents are masterpiece. you’ve done a fantastic process in this subject!

  • After exploring a handful of the blog posts on your site, I seriously like your way
    of writing a blog. I book-marked it to my bookmark site list and
    will be checking back in the near future. Please visit my website too and let me know your opinion.

  • Normally I do not learn post on blogs, however I would like to
    say that this write-up very pressured me to check out and do so!
    Your writing taste has been surprised me. Thank you,
    quite great article.

  • First off I want to say fantastic blog! I had a quick question which I’d like to ask if you
    don’t mind. I was interested to find out how you center yourself and clear your head
    prior to writing. I have had difficulty clearing my thoughts in getting my thoughts out there.
    I truly do enjoy writing but it just seems like the first 10 to 15 minutes are generally lost just trying to figure
    out how to begin. Any ideas or hints? Appreciate it!

  • Hey I know this is off topic but I was wondering if you knew of any
    widgets I could add to my blog that automatically tweet my newest twitter updates.
    I’ve been looking for a plug-in like this for quite some time and was hoping maybe you would have some experience with
    something like this. Please let me know if you run into anything.
    I truly enjoy reading your blog and I look forward to your new updates.

  • I was extremely pleased to discover this site. I want to to thank
    you for ones time for this wonderful read!! I definitely liked every part of it and i
    also have you saved to fav to check out new things on your website.

  • Howdy! I’m at work surfing around your blog from my new iphone 4!
    Just wanted to say I love reading your blog and look forward to all your posts!

    Carry on the fantastic work!

  • May I simply just say what a comfort to find somebody that genuinely knows
    what they are discussing on the net. You definitely know how to bring a problem to light and make it important.
    More and more people should check this out and understand this side of the
    story. I was surprised you aren’t more popular since you surely have
    the gift.

  • Do you have a spam problem on this blog; I also am a blogger, and I was wanting to know your situation;
    we have created some nice practices and we are looking to trade strategies with
    other folks, why not shoot me an e-mail if interested.

  • I know this if off topic but I’m looking into starting my own blog and was wondering what all is required
    to get setup? I’m assuming having a blog like yours would cost a pretty penny?

    I’m not very web smart so I’m not 100% sure.

    Any tips or advice would be greatly appreciated. Cheers

  • My relatives all the time say that I am wasting my time here at net,
    but I know I am getting experience all the time
    by reading thes good articles or reviews.

  • Wow, amazing blog structure! How lengthy have you ever been running a blog for? you made running a blog glance easy. The total glance of your site is magnificent, as well as the content material!

  • Hello there! I know this is kinda off topic but I’d
    figured I’d ask. Would you be interested
    in exchanging links or maybe guest writing a blog post or vice-versa?
    My site addresses a lot of the same subjects as yours and
    I think we could greatly benefit from each other. If you happen to be interested feel free to shoot me an email.
    I look forward to hearing from you! Great blog by the way!

  • Incredible! This blog looks just like my old one! It’s on a entirely different topic but it has pretty much the same page layout and design. Wonderful choice of colors!

  • After checking out a handful of the blog articles on your web page,
    I really like your way of writing a blog. I saved as a favorite it to
    my bookmark website list and will be checking back in the near future.
    Take a look at my website as well and tell me
    what you think.

  • This design is spectacular! You most certainly know how to keep a reader entertained.
    Between your wit and your videos, I was almost moved to start my own blog (well, almost…HaHa!) Excellent job.

    I really loved what you had to say, and more than that,
    how you presented it. Too cool! scoliosis surgery https://0401mm.tumblr.com/ scoliosis surgery

  • We’re a gaggle of volunteers and opening a new scheme in our community. Your site offered us with useful information to work on. You’ve done a formidable activity and our entire community can be grateful to you.

  • Unquestionably believe that that you said. Your favourite justification appeared to be at the web the simplest thing to bear in mind of. I say to you, I definitely get annoyed whilst folks consider worries that they just don’t understand about. You controlled to hit the nail upon the top as well as outlined out the whole thing with no need side-effects , other folks could take a signal. Will likely be back to get more. Thank you

  • I blog very often and also I genuinely respect your content. This terrific piece has definitely actually peaked my passion. I am mosting likely to book mark your online site and keep looking for new facts relating to once a week. I opted in for your RSS feed as well.

  • Hi there, i read your blog occasionally and i own a similar one and i was just wondering if you get a lot of spam remarks? If so how do you stop it, any plugin or anything you can recommend? I get so much lately it’s driving me crazy so any support is very much appreciated.

  • I love your blog.. very nice colors & theme. Did you make this website yourself or did you hire someone to do it for you? Plz respond as I’m looking to create my own blog and would like to know where u got this from. kudos

  • Simply desire to say your article is as astounding. The clarity in your post is just excellent and i could assume you are an expert on this subject. Fine with your permission let me to grab your RSS feed to keep up to date with forthcoming post. Thanks a million and please keep up the gratifying work.

  • Write more, thats all I have to say. Literally, it seems as though you relied on the video to make your point. You clearly know what youre talking about, why waste your intelligence on just posting videos to your site when you could be giving us something informative to read?

  • Hi, i read your blog from time to time and i own a similar one and i was just wondering if you get a lot of spam feedback? If so how do you prevent it, any plugin or anything you can suggest? I get so much lately it’s driving me insane so any support is very much appreciated.

  • Hi there this is somewhat of off topic but I was wondering if blogs use WYSIWYG editors or if you have to manually code with HTML. I’m starting a blog soon but have no coding expertise so I wanted to get advice from someone with experience. Any help would be greatly appreciated!

  • Hello There. I found your blog using msn. This is a very well written article. I will be sure to bookmark it and come back to read more of your useful info. Thanks for the post. Ill definitely return.

  • Hello there! This is my first visit to your blog! We are a team of volunteers and starting a new project in a community in the same niche. Your blog provided us beneficial information to work on. You have done a outstanding job!

  • Please let me know if you’re looking for a author for your weblog. You have some really good posts and I believe I would be a good asset. If you ever want to take some of the load off, I’d love to write some material for your blog in exchange for a link back to mine. Please send me an e-mail if interested. Kudos!

  • Do you have a spam problem on this blog; I also am a blogger, and I was wondering your situation; we have developed some nice methods and we are looking to trade techniques with other folks, why not shoot me an e-mail if interested.

  • Its like you read my mind! You appear to know a lot about this, like you wrote the book in it or something. I think that you can do with some pics to drive the message home a bit, but other than that, this is great blog. An excellent read. I will definitely be back.

Leave a Reply

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