Skip to content
0:00 / 0:00

#startupcode#armcortex-m#linkermap

#13 Startup Code Part-1: What is startup code and how the CPU gets from reset to main?

Quantum Leaps, LLC

74K subscribers • 20 videos on Hallway

YouTube

Intermediate. Assumes working knowledge.

122K views12 years ago3 recommendations

Systems programmingHardwareEmbedded systemsCPUs and computer architecture

Miro Samek explains how standard startup code initializes data sections and how the CPU transitions from reset to the main function.

In this lesson, you will learn about the standard startup code that gets linked with your application from the IAR library. You will see how the startup code initializes the various data sections and you will see these sections in the linker map file. Finally, you'll go back all the way to the beginning of the reset sequence, where you will encounter the vector table. ------ Resources: Companion web page for this video course: state-machine.com/quickstart GitHub repository for projects for this video course: github.com/QuantumLeaps/modern-embedded-programming-course YouTube playlist of the course: youtube.com/playlist?list=PLPW8O6W-1chwyTzI3BHwBLbGQoPFxPAPM

Why it's here

3 people recommend this

What people say. Recommended as an excellent explanation of the ARM Cortex-M startup code, vector tables, and the reset sequence.

Moments people linked to

u/Ivanovitch_kin r/embedded • Recommends

On “arm assembly programming interrupt vector”

I suggest looking at this timestamp of this video, it explains it all, including the +1 ( related to Arm Thumb instruction mode) [video
3View on Reddit

u/Svimesenin r/embedded • Recommends

On “Resources about creating cortex-m7 project from scratch?”

Here is part 1 of a video series explaining the startup code if you've not seen it yet: link to this video

u/Ivanovitch_kin r/embedded • Recommends

On “Function doesn't work when i change it's name”

As others have said, the APÏ name is hardcoded in the Interrupt Vector Table, that is located (if not relocated using VTOR register) at address 0. If you want to learn more about how it works, this video explains it very well

u/active-objectin r/embedded • Recommends

On “Is C startup code bad practice?”

As most commentators already mentioned, the statrup code for ARM Cortex-M can a probably should be mostly in C. You might need some assembly to code the Cortex-M **exception handlers**, and this would be so that they correctly work even in the case of stack overflow. And speaking of exception handlers, the standard startup code from most silicon vendors (ST, TI, etc.) implements exception handlers as endless loops. This is perhaps good for debugging (because the CPU is tied inside an offending exception). But it is a horrible idea for production code, exactly because the CPU is hang in the exception (denial of service). Here, I would recommend the following resources: * [YouTube videos ab…