Summary of Embedded Basic Knowledge


Preface

       This article is a summary of embedded knowledge points. It took about a day or two to organize it. Now share it with you! ! !


1. Multiple choice questions

1. Which of the following is not a characteristic of embedded systems? ()
A. For specific applications B. High quality and high reliability
C. D. can be cut with the secondary development capacity

analysis: Embedded system itself does not have secondary development, that users often can not function in which the program to be modified after the design is complete, you must have development tools and environment to develop again.

2. Which of the following products are not embedded systems is ()
A. Wireless mouse B. Digital camera
C. Personal notebook D. Tachograph

analysis: common embedded products: digital cameras, cell phones, PDA, router, mouse, keyboard, scanner, printer

3. The stack is a data structure, and the most common operations on it are "push" and "pop", and its entry and exit rules are ().
A. Can protect the scene B.
C. First in last out The most common operations are "push" and "pop" D. Out without

analysis: the stack is a data structure, its most common operation is "push" and "pop", after which advanced out of the rules.

4. ARM is a ___ bit processor based on __ architecture.
A. CISC, 16 B. RISC, 32 C. RISC, 16 D. CISC, 32 

analysis: ARM is based on a 32-bit, RISC processor structure.

5. In the Ubuntu operating system, commenting out a line of programs can be ().
A. // B. * C. / D. ~

Analysis: // is a comment

6. Vi editor, currently in insert mode, if you want to save and exit vi, then ().
A. Use the ":q!" command B. First press the ESC key and use the ":wq!" command
C. Use the ":wq!" command D. First press the ESC key and use the ":q!" command.

Analysis: press the ESC key first and use ":wq!"

7.Under Linux, copy /mnt/hgfs/file.c to the command () under the directory /home/nfs.
A. cp file.c /home/nfs B. cp /file.c /home/nfs
C. cp /mnt/hgfs/file.c /home/nfs D. cp /home/nfs /file.c /mnt/hgfs/

Analysis: cp + current file path + copied file path

8. Regarding the process, the item describing the error is ().
A. The fork() function returns a value once executed
B. Use fork() function to generate child process
C. The parent process "collects corpses" for the child process
D. In parent and child can each perform different tasks

Analysis: perform a return two values.
One of the wonderful things about fork call is that it is only called once, but it can return twice. It may have three different return values:
(1) In the parent process, fork returns the process ID of the newly created child process;
(2) In the child process, fork returns 0;
(3) If an error occurs, fork returns a negative value.

9. The permission of the file filename is 664, and the user owner of the file has the permission to operate on it ().
A. rw- B. rx C. -wx D. -X

analysis: 421 respectively represents read (r) write (w) execution (x)
The first number represents the file owner (Owner), user group (Group), and other users (other Users)

. Compile the file.c file into a program file that can be executed on the development board. The command is ()
A. gcc file.c B. arm-linux-gcc file.c
C. gcc file.c -o file D. arm-linux-gcc file.c -o file

analysis: arm-linux-gcc is a cross-editing tool

2. Fill in the blanks

1. The embedded system is generally composed of hardware and (), and the core of the hardware is ().

Answer: software microprocessor

2. ARM processor has () and ARM two working states.

Answer: Thumb
analysis: Two working states of ARM processor:
1. ARM state: 32-bit, ARM state executes word-aligned 32-bit ARM instructions.
2. Thumb state, 16-bit, 16-bit half-word aligned.

3. In ARM memory, the high byte of data is stored at the low address, which is the () storage mode, and the low byte of data is stored at the low address, which is the () storage mode.

Answer: Big-endian storage Little-endian storage
analysis: Big-endian storage: Big-endian mode means that the high byte of data is stored in the low address of the memory, and the low byte of data is stored in the high address of the memory. This kind of storage The mode is a bit similar to treating the data as a string sequentially: the address increases from small to large, and the data is placed from high to low.
          Small-segment storage: Little-endian mode means that the high byte of data is stored in the high address of the memory, and the low byte of data is stored in the internal low address. This storage mode effectively combines the high and low addresses of the address with the data bit weight Up, the weight of the high address part is high, and the weight of the low address part is low, which is consistent with our logic method;

4. The function to obtain the ID number of the thread itself is ().

Answer: pthread_t pthread_self();
Analysis: Get the current thread ID function under Linux: pthread_t pthread_self();
Return: the ID number of the current thread

5. To bind a socket to an address is to use the () function.

Answer: bind();
Analysis: int bind(int sockfd, const struct sockaddr *myaddr, socklen_t addrlen);

6. In Ubuntu, the () command is generally used to check the network connectivity between hosts.

Answer: ping command

7. The transport layer protocol involved in network programming is () and ().
Answer: TCP UDP

Three, short answer questions

1. List domestic embedded processors and domestic operating systems (3 for each).

Answer: Processor: Feiteng (ARM), HiSilicon (ARM), Spreadtrum (ARM)
Operating system: Unified Operating System (UOS) Deepin Linux (Deepin) Ubuntu Kylin (UbuntuKylin)

2. Write 3 ways of inter-process communication .

Answer: message queue signal socket (socket)
pipe, message queue, shared memory, signal and signal set, etc.

3. Explain the meaning of the following professional terms: (1) ARM (2) CISC (3) SPSR.

Answer: ARM: ARM processor
CISC: Complex instruction set computer
SPSR: Program state save register

4. Explain the meaning of each parameter in ssize_t write (int fd, const void * buf, size_t count);.

Answer: fd: is the file descriptor (write corresponds to write, that is, 1)
buf: usually a string, the string to be written
count: the number of bytes written each time

Four, comprehensive questions

1. Open, write, read, close and other operations on the file.
Please be sure to master the open(), close(), write(), read() and other functions
2. (1) SIGQUIT ----ctrl+\
            SIGINT ------ ctrl+c
   (2) I have get SIGQUIT
            I have get SIGINT

Multithreaded programming

Main functional requirements: create two threads, thread 1, execute function func1, print your own name information; thread 2, execute function func2, print your student ID information; thread execution exits.
code show as below:

#include <stdio.h>
#include <pthread.h>
void *func1(void)
{
    
    
  printf("chenfeifan!!!");
}
void *func2(void)
{
    
    
  printf("201805090213");
}
int main()
{
    
    
  int i=0,ret=0;
  pthread_t id1,id2;
  ret=pthread_create(&id1,NULL,(void*)func1,NULL);
  if(ret) {
    
    printf("Create pthread1 error!\n");return 1;}
  ret=pthread_create(&id2,NULL,(void*)func2,NULL);
  if(ret) {
    
    printf("Create pthread2 error!\n"); return 1;}
  pthread_join(id1,NULL);
  pthread_join(id2,NULL);
  return 0;
}

The results are as follows:
Insert picture description here


to sum up

      Part of the content is only embedded basic content. If you want to study in depth, it is recommended to study systematically.
Do not reprint without my permission!!!

Guess you like

Origin blog.csdn.net/weixin_44935259/article/details/112068212