Lecture 4: Intro to Embedded Programming Flashcards
What is step 1 in the C compilation over view?
C preprocessor. This creates a pre processed file by substituting anything like “#include” with its actual value. It then goes on to expand macros.
What is step 2 in the C compilation overview?
The compiler, it will translate the preprocessor file into assembly code for the target architecture.
What is step 3 in the C compiler overview?
The assembler, this will translate the assembly language into machine code.
What is step 4 in the C compiler overview?
Linker. This will combine object files and libraries into a single executable.
What is step 5 in the C compiler Overview?
Object Copy. This will generate a new binary file for the specific device.
Why do we run an infinite loop in our embedded program?
To stop the program doing unpredictable things. Usually we will use it to run background processes.
What is in line assembly?
This allows us to insert hand machine code into the program for better efficiency.
asm(‘NOP’)
What is asm(“NOP”)
This is a no operation instruction that will introduce a 1 cycle delay in a system. We often use in low level programs to help save the state of registers.
What does the size of data types depend on?>
The size of the processor
What is the sizeof operator?
It is an operator that will create a constant value telling the user the size of a data object in bytes.
What does the volatile keyword do?
It will let the compiler know that the value of the variable may change at any time so don’t try optimize it.
What does a switch case statement do?
It lets us test a variable for equality against a range of values. Each value is called a case and there is no limit to how many we can have.
In a switch case statement, what happens if a value is equal to a case?
The statements following that case will execute until a break statement occurs. If there is not a break in that case, then it will continue into the following cases until it hits one.