Embedded System Diploma Sameh Afifi
Embedded System Diploma Sameh Afifi
Sameh Afifi
Difference between embedded C and C
Important Macros
Super loop
Programming process
Preprocessor
Compiler
Assembler
Linker
Linker script
Makefile
Cross development
Simulator vs Emulator
Polling vs Interrupts
Layered architecture
© 2019 Embedded system Sameh Afifi 2
Difference between embedded C and C
• Embedded C language is most frequently used to program the microcontroller.
• Earlier, many embedded applications were developed using assembly level programming.
However, they did not provide portability. This disadvantage was overcome by the advent of
various high level languages like C.
• Embedded C is an extension to the C language with some additional header files. These
header files may change from controller to controller.
• C is used for desktop computers, while embedded C is for microcontroller based applications.
Accordingly, C has the luxury to use resources of a desktop PC like memory, OS, etc. While
programming on desktop systems, we need not bother about memory.
• However, embedded C has to use with the limited resources (RAM, ROM, I/Os) on an
embedded processor. Thus, program code must fit into the available program memory. If
code exceeds the limit, the system is likely to crash.
• Compilers for C (ANSI C) typically generate OS dependent executables. Embedded C requires
compilers to create files to be downloaded to the microcontrollers/microprocessors where it
needs to run.
© 2019 Embedded system Sameh Afifi 3
Important Macros
#define SETBIT(REG,BIT) (REG |= 1 << BIT)
.lib files
file1.C .obj1
file2.C File1.s .obj2 .HEX
File1.i .obj3 .elf
main.C Pre-
Compiler Assembler Linker
main.h processor
File2.i File2.s
file2.h
Main.i Main.s
file1.h
Emulator
Real
hardware
An emulator or in-circuit emulator is a hardware device which behaves like a target machine.
It is often called a real time tool because it can react to events as the target microcontroller
would.
https://www.facebook.com/groups/EmbeddedSystem.SA/
https://www.linkedin.com/in/sameh-afifi-8389173a/
We can't solve problems by using the same kind of thinking we used when we created them.
And Warnings is the silent Killer.