itop-3568 development board system programming study notes (1) Introduction to system programming and basic program framework

[Beijing Xunwei] Linux System Programming for Embedded Learning https://www.bilibili.com/video/BV1zV411e7Cy/Personal Study Notes

What is Linux System Programming

Linux system programming is also called advanced programming under Linux, which is between the application layer and the driver layer.

System programming mainly involves the following contents:

· Read and write files and other file I/O operations, including how the Linux kernel implements and manages file I/O, memory mapping and optimization techniques
· System calls for process management, including real-time processes
· Files and directories - create, move, copy , deletion, and management
Memory management—a memory allocation interface, managing memory, and optimizing memory access
Signals and their roles in Unix systems, and basic and advanced signal interfaces
Time, sleep, and clock management

—— "Linux System Programming"

System programming basic program framework

Linux system programming is actually C language programming under Linux, so its basic program framework is the C language basic program framework, the following is the framework code (refer to the original video)

#include <stdio.h>
#include <stdlib.h>

int main(int argc, char *argv[])
{
    
    
	// argc:命令行中参数的个数
	// argv:命令行的参数

	int i = 0;
	printf("参数个数为 %d\n", argc);
	for(i = 0; i < argc; i++)
	{
    
    
		printf("第%d个参数为 %s.\n", i + 1, argv[i]);
	}
	return 0;
}

Compile and execute the program on the x86 platform:

insert image description here

Use a cross compiler to compile the test code into an executable program for the ARM platform,

insert image description here
Test in the serial port terminal of the development board:

insert image description here

Guess you like

Origin blog.csdn.net/weixin_43772810/article/details/128871023