

















Study with the several resources on Docsity
Earn points by helping other students or get them with a premium plan
Prepare for your exams
Study with the several resources on Docsity
Earn points to download
Earn points by helping other students or get them with a premium plan
This course introduces the fundamental concepts of embedded software development, focusing on how software interacts directly with hardware in embedded systems. Students learn basic programming techniques, memory management, timing, and control for microcontroller- and microprocessor-based applications.
Typology: Lecture notes
1 / 25
This page cannot be seen from the preview
Don't miss anything!


















Name: Neil Robert Membreve, M.Eng. Date:
Department of Electrical Engineering
[~]$ [1/25]
[1. Motivation]$ [2/25]
■ The software is organized in layers ■ Each layer assumes specific functionality ■ Modules are described in C-files (.c) ■ Definitions are described in header files (.h) ■ Functions interact with other modules ■ Eventually interact with Hardware Figure: Layers of an embedded system software
[3. Embedded Software Modules]$ [4/25]
■ Device Drivers ■ Interface to hardware layers ■ Hardware Abstraction Layer (HAL) ■ Code Booting ■ Real-time operation system (RTOS) ■ Abstracts High from Low levels ■ Scheduling ■ Resource management ■ Libraries for shared code
[4. Embedded System Software Layers]$ [5/25]
Figure: Top embedded programming languages
ASPENCORE. (2017). 2017 Embedded Markets Study Integrating IoT and Advanced Technology Designs, Application Development & Processing Environments. April, 1-
[6. Embedded Programming Languages]$ [7/25]
■ Availability of compilers for almost any MCU ■ Small executable ■ Deterministic resource use (e.g., no dynamic memory allocation) ■ Efficient Memory Management ■ Timing-centric operations ■ Direction Hardware/IO Control ■ Optimized execution
Figure: C can be used even on very small micro-controllers
[7. Why C?]$ [8/25]
Figure: Computer and target processor
[9. Embedded Software Development Processes]$ [10/25]
Figure: Software tools
The software tools include compiler toolchain (e.g., AVR GCC, gdb make files), linker, emulators, simulators, SDK, text editors/IDE, version control, etc
[10. Embedded Software Development Processes]$ [11/25]
Figure: The role of a preprocessor
The C preprocessor is the macro preprocessor for the C compiler. The preprocessor provides the ability for the inclusion of header files, macro expansions, conditional compilation, and line control.
[12. Embedded Software Development Processes]$ [13/25]
Figure: The role of a linker
The linker combines all of the object files into a single executable object code, which uses symbols to reference other functions/variables
[13. Embedded Software Development Processes]$ [14/25]
■ A computer only understand a set of instructions in a numeric format, typically called machine code
1 # include < stdio .h > 2 3 int main () { 4 printf ( " Hello , World! " ) ; 5 return 0; 6 } Listing 1: Source code
Figure: Machine code
■ The GCC compiler - The GNU Compiler Collection^1 - is often used for compilating embedded system. (^1) https://www3.ntu.edu.sg/home/ehchua/programming/cpp/gcc_make.html
[15. Code Compilation using GNU Toolsets]$ [16/25]
■ First stage of the compilation process ■ Removes all the comments ■ Include any #include files (typical the .h header file) ■ Expands all the macros
1 gcc -E hello. c > hello. i
[16. Code Compilation using GNU Toolsets]$ [17/25]
[18. Translation of C code into machine code]$ [19/25]
1 Pre-processing - via the AVR GNU C Preprocessor (avr-cpp), which includes the headers (#include) and expands the macros (#define). avr-cpp -mmcu=attiny13 blink.c > blink.i The resultant intermediate file blink.i contains the expanded source code. 2 Compilation - the compiler compiles the pre-processed source code into assembly code for a specific processor. avr-gcc -S blink.i >blink.s The -S option specifies to produce assembly code, instead of object code. The resultant assembly file is "blink.s". 3 Assembly - the assembler (avr-as) converts the assembly code into machine code in the object file "hello.o" avr-as -o blink.o blink.s
[19. Translation of C code into machine code]$ [20/25]