Phillip Stanley-Marbell
Foundations of Embedded Systems
Department of Engineering, University of Cambridge
http://physcomp.eng.cam.ac.uk
Topic 04: Low-Level C Programming and Tools for Embedded Systems
(~30 minutes)
Version 0.2020
(Video)
38
Intended Learning Outcomes for Today
2
Design your own linker script files and use map files generated by the linker
By the end of this topic, you should be able to:
Apply binary utilities (such as objdump and objcopy) to deconstruct binaries
Design C programs comprising a mixture of C and assembly language
Enumerate steps in compiling a C program to machine instructions
37
3
Next:
We will look at four dierent variants of a simple 4-line
C program to introduce the compilation and linking process
38
Anatomy of Four C Programs: Program 1
4
More on linker script files (an input) later
More on map files (an output) later
38
Anatomy of Four C Programs: Disassembling Program 1
5
Disassembled binary is 160 lines
38
Anatomy of Four C Programs: Program 2
6
Exactly the same compilation flags and steps