Embedded programming
Development Process
Do you want to use hardware or software to implement a certain function (hardware is fast, but consumes resources)? BSP? Bare metal or OS?
Hardware design and implementation-"Device driver software design and implementation-"OS selection, transplantation, API interface function design-"Support software design and debugging-"Application program design and debugging-"System joint debugging, prototype deliver.
Program download process
Many program files are compiled to generate .obj files, linked to generate binary files, and downloaded to the development board.
Features:
- Cross-compilation, that is, generating code that runs on another platform on one platform (generating programs on the development board on the PC).
- Simulation debugging.
- The development board is the intermediate target machine.
- Limited resources.
Development mode: local machine development (such as the previous computer, binary direct programming), cross-development (host machine development, download to the target machine), simulation development (simulate the target platform on the host machine).
programming language
Low-level language: machine language, asm.
High-level languages: c, c++.
Assembly language includes: instruction statement, pseudo-instruction statement (for the compiler to see), macro instruction statement (multiple instructions that are executed repeatedly are combined into one macro instruction).
expression
Prefix: +ab
Infix: a+b
Suffix: ab-
ab-c5+*
compile
Explanation: Do not generate target files, and analyze and execute while analyzing.
compile: produce
During the compilation process, the relevant symbol information should be stored in the symbol table.
Lexical: Illegal characters, keywords.
Syntax: such as if else
Semantics: such as an infinite loop.
C language
preprocessing
Simple use: can replace functions such as#define square_1(x) x*x
predefined macro
type of data
storage management
Function: push into the stack.
Dynamically applied data: apply in the heap.
Global variables are allocated at the very beginning and released at the end of the program. Global variables declared static are only visible in this file.
object oriented
Object: A real-world entity that encapsulates properties and operations.
Classification: abstract objects into a class.
Communication via messages: Communication between classes.
Inheritance: Expansion.
Three features: polymorphism, overloading, and coverage.
private: It can be accessed in this class.
Default (default): accessible in this package.
protected: Accessible to subclasses in other packages.
public: can be accessed.
example:
The value of *p is the starting address of the string str.
A. The string address cannot be changed.
B, re-point p to the string ABC, yes.
C, assign ABC to the first element of the array, no.
D, same as A.
example:
A is wrong, scripting languages can also be used.
example:
A, The symbol table is used by the compiled language to process symbols.
B, yes.
C, not affected by the machine. It is only affected by the machine when generating the object code.