The definition of embedded systems should be application-oriented, computer-based, software and hardware can be tailored to the functional, reliability, cost, volume, and power consumption requirements of application systems.
The definition of an embedded system should be a dedicated computer system centered on applications, based on computer technology, where software and hardware can be tailored to the functional, reliability, cost, volume, and power consumption requirements of the application system.. For example, an ATM is a typical RTOS. embedded OS consists of two parts: a processor, such as ARM, POWERPC, and MIPC, and an OS, such as linux, wince, and vxworks, us/OS, etc.
I am studying arm + linux mainly because arm technology is mature. linux is an open-source and free-of-charge tool, in addition, if you have learned how to develop an embedded system for linux in the future, you can also focus on linux servers.
To learn about embedded linux, we mainly focus on four points,
The first point is to write bootloader and port it to nand flash;
Second, compile the kernel and download it to nand flash through bootloader;
Third, establish a file system based on nand flash;
Fourth, download the written application to the target.
The basic process is like this, but it may be different when it comes to the development board. below we will take the fs2410 of Shenzhen Youlong company as the target board for the specific development process described above, and issues that should be paid attention to during development.
Step 1: Create a cross-compilation environment
A:The application development environment based on the linux operating system is generally composed of the target system hardware (Development Board) and the host PC. The target hardware development board is used to run the operating system and system application software. The kernel compilation and application development and debugging of the operating system used by the target board need to be completed through the host PC (therefore called cross-compilation ). Generally, the two parties establish a connection through a serial port, a parallel port, or an Ethernet interface. Install linux OS, such as redhao linux 9.0, which can be installed by default (but must contain the ftp service) to connect the linux server to the LAN. other PCs can use windows, software tools are required.
(1) ftp client program (2) telnet tool (3) linux operating system kernel source code transplanted to a specific arm platform (4) gnu compilation tool, which can be downloaded by related websites
Install the ftp client program and telnet tool on a pc of a workstation. the compiling of linux OS kernel is usually fixed and varies slightly according to the Makefiel file, refer to the relevant documentation. after the kernel is compiled in fixed steps, executable binary files will be generated in the corresponding directory and uploaded to the PC through ftp, download to the development board through the serial port or network.
B:
(1) create a compilation environment. in this process, some environment variables will be set, the installation directory will be created, and the kernel source code and header files will be installed.
(2) create binutils. after this process is completed, tools such as arm-linux-ld will be created.
(3) Create a cross-compiled version of gcc. note: In this process, only c programs can be compiled, rather than c ++ programs.
(4) create a cross-compiled version of glibc, which is the most likely to cause problems.
(5) create a cross-compiled version of gdb. After this process ends, a arm-linux_gdb is created
(6) recreate gcc. The c ++ compiler was not compiled during the previous gcc creation process. now glibc is ready, so this step will improve the cross-compilation of gcc.
(7) recreate glibc.
If an error occurs during the cross-compilation process, check the following:
Check whether the version is correct and whether the patch is installed;
Whether the library file path is set correctly;
Whether the system environment variables are set correctly.
Step 2: write bootloader and port it to the Development Board
A: bootloader is the first code to run after the system is powered on. The bootloader in the embedded system is equivalent to the bios in the PC. Most bootloaders have two different operation modes. one is the bootloading mode. In this mode, bootloader loads the operating system to RAM from a solid state storage device on the target machine, and the whole process is not involved by the user. This mode is the normal working mode of bootloader and the downloading mode. In this mode, the bootloader on the target machine downloads the kernel image and the root file system image from the development host (host) through serial port or network communication means and waits in RAM. Then, bootloader can be written to the solid-state storage media on the target machine.
B: most bootloader starts in two stages.
(1): Basic hardware initialization (blocking all interruptions, disabling internal processor commands/data cache, etc ).
Prepare the RAM space for the second stage. if it is from a solid-state storage medium, copy the second-stage code of bootlodaer to RAM.
Set the stack.
Jump to the C program entry point in the second stage.
(2): initialize the hardware devices to be used in this phase.
Check the system memory ING.
Read the kernel image and root file system image from flash to RAM.
Set startup parameters for the kernel to call the kernel.