Embedded software test preparation_5 Embedded programming

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.

image-20230506151305907

Features:

  1. Cross-compilation, that is, generating code that runs on another platform on one platform (generating programs on the development board on the PC).
  2. Simulation debugging.
  3. The development board is the intermediate target machine.
  4. 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).

image-20230506151916875

expression

Prefix: +ab

Infix: a+b

Suffix: ab-

image-20230506152732178

ab-c5+*

compile

Explanation: Do not generate target files, and analyze and execute while analyzing.

compile: produce

image-20230506153539941

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

image-20230506154114102

Simple use: can replace functions such as#define square_1(x) x*x

predefined macro

image-20230506154451014

type of data

image-20230506154611913

storage management

image-20230506155458931

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:

image-20230506165443051

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:

image-20230506165732453

A is wrong, scripting languages ​​can also be used.

example:

image-20230506165911869

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.

Guess you like

Origin blog.csdn.net/jtwqwq/article/details/130532090