Linux System Basics-Embedded WebEx Learning notes for the 4412 Development Board

Source: Internet
Author: User

1. What is Linux system programming

More information: http://topeetboard.com More about: https://arm-board.taobao.com

Linux system programming is divided into three parts: system calls, C libraries, and C compilers.

System call system programming is based on system calls and also ends in system calls. In embedded development with operating system, some service and resources need to be requested from the operating system, some function calls from user space to the kernel. System calls include reading and writing of files, control of processes, and so on.
In Linux, the implementation of the system is less than that of other cores. For example, there are thousands of system calls under Windows, but fewer than 300 in Linux. Linux, as an open source software, implements standard system calls in different architectures (x86,powerpc,arm, etc.). Therefore, there may be some differences in the system calls that are supported in different architectures, but most are generic. The main discussion in this chapter is based on calls on Arm-linux.
In the embedded microcontroller programming, the user can directly write a bare-metal program to implement the call to register.
In Linux, from security and reliability considerations, applications that prohibit user space need to directly perform operations on the hardware and operations on the kernel. However, the application must obtain a way to the underlying operation. On i386 processors, users need to implement user-space calls through interrupts, and then pass parameters to implement the underlying operation. On the ARM processor, the operating mode is switched to achieve the underlying operation, the CPU can be executed in different modes of instruction and access to the register is not the same.
Of course there are differences in different operating systems, for example, in Android, all applications run in the Java Virtual machine provided by the system, and the application is farther away from the bottom.
C Library
C library is the basis of Linux system programming, is the core of all applications, from the previous Linux structure diagram can be seen in the Linux system has been complete contains the C library. Even if you use other languages, such as Java programming in Android, many of the functions are through the C library encapsulation, convenient system calls, many functions just to maintain the consistency of the API, the core of C library is rarely modified.
In Linux, the GNU C library is used. In glibc, in addition to the standard C library, the encapsulation of system calls, threading support, and basic application tools are provided.
C Compiler
In Linux, the standard C compiler is provided with the GNU Editor Tool, and the general operating system will have the GNU compiler.
In embedded development, because of the use of cross-compilation tools, it is best to use a compiler that is consistent with the compiler of the kernel to avoid the eventual application of a call failure.
2. Why learn Linux system programming
Despite the popularity of web development, Java Development, Android development, and so on, these are gradually away from system programming, to advanced development. But these developments do not mean the end of system programming, such as in embedded development, to use the processor to do some algorithmic processing, these algorithms do not require a high-level language, the project does not require a graphical interface, the use of system programming coupled with the minimum Linux system can save a lot of resources. When the kernel is developed, drivers need to be tested, and programmers can use system programming to implement some basic testing work. And like web development, Java Development, Android development, their bottom-up also needs engineers to complete, these work will involve a lot of system programming.
3. The man command for Linux
Linux provides a rich help manual that you do not have to look for when you need to see the parameters of a command, as long as you have a man. The powerful man command is more than just a simple function of finding commands. You can also find a variety of API functions, want to learn Linux programming, this man command must be mastered.
After the man command is familiar, a lot of things can be done without tutorials, without manuals, you can learn by yourself. In the future, when you do the actual project or study independently, you will often use the man command.
Typically, all software on a UNIX system (including each command-line utility, each system call, each callable function in the programming library, and each file format) contains a man page.
Each part is implemented as a separate subdirectory. Each section is routinely named Man1, man2 until man8 contains a manual page for a class of commands.
The standard content of the man manual page.
Man1
General Command. Commands in this section typically do not require superuser (that is, administrator) privileges. LS, cat, and passwd are placed here, as well as the shell. For example, please try man bash.
Man2
A system call or function used to access the services provided by the UNIX kernel. For example, a fork system that generates a new process from an existing process. Enter man fork to display its manual page. Programmers who use system software often refer to this section.
Man3
C Library functions. Many packages offer a feature-rich code base that allows developers to create new software to complement existing features or develop new features. Each library usually has a manual page, and some libraries (such as the system's libc) are too large, so individual functions or a set of related functions have separate documents.
Man4
Special files, such as devices and drivers.
Man5
File format. UNIX uses a text configuration file almost entirely to customize the operation of the system. There are a number of configuration files, including a list of network services (/etc/services) and a list of available shells (/etc/shells), and so on.
Man6
Games and screen saver programs.
Man7
Miscellaneous files. This is an all-encompassing category. On the traditional system, we can understand the information of glob operator, regular expression and so on.
Man8
System administration commands, super users will most likely want to use them.

The above 8 kinds of man commands, usually we use more man1, man2 and man3, and not all have the above eight documents, some only one, or two kinds of documents. In Linux system programming, you can use the man command to see the detailed usage of various API functions and interfaces.


Linux System Basics-Embedded WebEx Learning notes for the 4412 Development Board

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.