×

We are still shipping! When you place an order, we will ship as quickly as possible. We are actively monitoring the COVID-19 situation; please see all updates here. Thank you for your continued support.

Enginursday: Exploring the Embedded Startup Process

Let's take a look at what makes 'main()' feel so cozy and welcoming - what has to happen to have variables initialized, objects constructed and stacks a-stackin?

Favorited Favorite 2

Artemis, my close friend, has urged me to learn much more about the bare-metal details of getting code running and supporting the familiar features that we often take for granted in C++. It is actually a very interesting topic and a beneficial thing to understand when working on embedded systems. Sadly, however, it is a fairly challenging topic to find information about on the internet - and what you can find is daunting, to say the least.

Since we are not fans of reinventing the wheel we've developed some examples you can follow along with using an Artemis board. After doing so you will know:

  1. How the linker organizes compiled code
  2. How startup code initializes variables
  3. How the stack and heap are managed
  4. How global/static object constructors are conveniently called before you get to main()

Check out the examples, explanation and instructions on the embedded-startup exploration repo!

Here are some useful tools to have along the way:

Artemis Boards

SparkFun RedBoard Artemis ATP

SparkFun RedBoard Artemis ATP

DEV-15442
$24.95
1
SparkFun RedBoard Artemis

SparkFun RedBoard Artemis

DEV-15444
$19.95
1
SparkFun Artemis Module - Low Power Machine Learning BLE Cortex-M4F

SparkFun Artemis Module - Low Power Machine Learning BLE Cortex-M4F

WRL-15484
$8.95
SparkFun Thing Plus - Artemis

SparkFun Thing Plus - Artemis

WRL-15574
$20.95

Debuggers

J-Link EDU Mini Programmer

J-Link EDU Mini Programmer

PGM-15345
$18.00
1
J-Link EDU Base Programmer

J-Link EDU Base Programmer

PGM-15346
$60.00
J-Link BASE Compact Programmer

J-Link BASE Compact Programmer

PGM-15347
$378.00

Accessories

SparkFun Serial Basic Breakout - CH340C and USB-C

SparkFun Serial Basic Breakout - CH340C and USB-C

DEV-15096
$8.95
4
USB 2.0 Cable A to C - 3 Foot

USB 2.0 Cable A to C - 3 Foot

CAB-15092
$3.95


Comments 2 comments

  • I don't have time at the moment to go through it in great detail, but it looks pretty good! BTW, it's sort of a "walk down memory lane" (hmm... there's an unintended pun there) as it takes me back to the days when we had to use a computer's "front panel" switches to "toggle" the initial program into it, e.g., to get it to load the assembler, linker, or one's object code off either mag tape or paper tape! Back in those days we had to allocate stack space, heap, program space, arrange the interrupt vectors, etc., by hand for every program.

    One very minor nit to pick (one letter!): Under "How Computers Work (quickly)", in a point numbered 3, it says "volatile memory pace" -- I think it should be "space", not "pace" (don't have time at the moment to do a correction in the Git stuff...

    • Wow! As you can probably tell my perspective is very different - coming from the side where I've never had to think about such things until just recently. The barrier to entry today is so wonderfully low - I can get my brother to learn the basics as long as he has a web browser! Thanks for the story. (And thanks for the typo catch - I'll go ahead and fix it)

Related Posts

Recent Posts

Tags


All Tags