Make a minimal system board:
If you have never done ARM development, it is recommended that you do not try to do all the applications well at the beginning, because the startup method of ARM is different from that of DSP or MCU, and you will often encounter various problems. Therefore, it is recommended to first build a small system board with only Flash, SRAM or SDRAM, CPU, JTAG, and reset signal, leaving an expansion interface. If the minimum system can run normally, your task is half done. Fortunately, the peripheral interfaces of ARM are basically standard interfaces. If you have experience in wiring these hardware, it is a very easy thing for you.
2. Write the boot code. Write a small boot code based on the hardware address, including the following parts: Initialize the port, shield the interrupt, copy the program to SRAM; complete the code remapping; configure the interrupt handle and connect it to the C language entry. You may see that the bootloader has a lot of things in some sample programs given to you, but don't be bothered by these complicated programs, because you are not making a development board, your task is to make a small program to keep your application running.
3. Carefully study the information of the chip you are using. Although ARM is compatible in terms of core, each chip has its own characteristics, and these issues must be considered when writing programs. Especially for girls, don't be dependent here. You always want to modify other people's sample programs, but the more you modify them, the more messy they become.
4. Read more operating system programs. There are many open source programs for ARM applications. If you want to improve yourself, you should read more programs from others. Linux, uc/os-II, etc. are all very good source codes.
5. If you are working on hardware, each manufacturer basically has a DEMO board schematic for the chip. Digest the schematic first. This way, when you design in the future, you will have a clear idea of how to allocate resources. You must digest the device's DATSHEET well.
6. If you are working on software, it is best to have some understanding of the operating system mechanism. Of course, this is a piece of cake for software engineers. But if you are a hardware engineer, it will be a bit difficult.
Q: Is it better to make a minimum system board with 2 layers or 4 layers? A: Only AT91 can use a two-layer board, and the others can use at least 4 layers; 44b0 ground and power are handled well and can also use a two-layer board; Talking about four-layer boards and 33 ohm resistors: The selection of a four-layer board is not only a matter of power and ground, but also the high-speed digital circuit has requirements for the impedance of the routing, and it is difficult to control the impedance of a two-layer board.
The 33 ohm resistor is usually added to the driver end, which also plays the role of impedance matching. When wiring, the data address line and the high-speed line that needs to be guaranteed should be laid first. At high frequencies, the traces on the PCB board should be regarded as transmission lines. Transmission lines have their characteristic impedance. Those who have studied transmission line theory know that when there is a sudden change in impedance (mismatch) somewhere on the transmission line, the signal will be reflected when it passes through, and the reflection will interfere with the original signal, which will seriously affect the normal operation of the circuit.
When using a four-layer board, the outer layer usually has signal lines, and the middle two layers are power and ground planes respectively. This isolates the two signal layers on the one hand, and more importantly, the outer layer's lines and the planes they are close to form a transmission line called a "microstrip", whose impedance is relatively fixed and can be calculated. This is more difficult to do for a two-layer board. The impedance of this transmission line is mainly related to the width of the line, the distance to the reference plane, the thickness of the copper plating, and the characteristics of the dielectric material. There are many ready-made formulas and programs for calculation. The 33-ohm resistor is usually connected in series at one end of the driver (not necessarily 33 ohms, ranging from a few ohms to fifty or sixty ohms, depending on the specific situation of the circuit). Its function is to match the impedance of the line after being connected in series with the output impedance of the transmitter, so that the reflected signal (assuming that the impedance of the receiving end is not matched) will not be reflected back again (absorbed), so that the signal at the receiving end will not be affected. The receiving end can also be matched, such as using resistors in parallel, but it is rarely used in digital systems because it is more troublesome, and many times it is a single send and multiple receive, such as the address bus, which is not as easy to do as the source end matching. The high frequency mentioned here does not necessarily refer to a circuit with a very high clock frequency. Whether it is high frequency depends not only on the frequency, but more importantly on the rise and fall time of the signal. Usually, the frequency of the circuit can be estimated by the rise (or fall) time, generally taking half of the reciprocal of the rise time. For example, if the rise time is 1ns, then its reciprocal is 1000MHz, which means that the circuit should be designed based on a frequency band of 500MHz. Sometimes it is necessary to deliberately slow down the edge time. The output slope of the driver of many high-speed ICs is adjustable. Constructing Embedded Linux Linux itself has a complete set of tool chains, which makes it easy to establish the development environment and cross-operation environment of embedded systems by itself, and can overcome the barriers of the simulation tool (ICE) in embedded system development.
The complete openness of the kernel allows people to design and develop real hard real-time systems by themselves, and soft real-time systems are also easy to implement in Linux. The powerful network support makes it possible to use the Linux network protocol stack to develop it into an embedded TCP/IP network protocol stack. Linux provides the basic kernel to complete embedded functions and all the required user interfaces. It is multifaceted. It can handle embedded tasks and user interfaces.
A small embedded Linux system only needs the following three basic elements: * Boot tools * Linux microkernel, which consists of memory management, process management and transaction processing * Initialization process If you want it to do something and keep it small, you have to add: * Hardware driver * One or more applications that provide the required functions. To add more functions, you may need these: * A file system (perhaps in ROM or RAM) * TCP/IP network stack Below we will introduce the actual development of embedded Linux from the four steps of streamlining the kernel, system startup, driver program, and changing X-Window to MicroWindows. Streamlining the kernel Common commands for constructing the kernel include: make config, dep, clean, mrproper, zImage, bzImage, modules, modules_install. Command descriptions are omitted. Now let's give an example to illustrate: I use 2.2.15 included in Mandrake. I did not modify any line of program code, and I only obtained these data by modifying the configuration file. First, use make config to remove all the options that can be removed. No floppy; no SMP, MTRR; no Networking, SCSI; remove all block devices, leaving only old IDE devices; remove all character devices; remove all filesystems, leaving only minix; no sound support. Believe me, I have removed all options. After doing this, I got a 188K core. Is it not small enough? OK, one more trick, please replace -O3, -O2 in the following two files with -Os. ./Makefile ./arch/i386/kernel/ Makefile In this way, the whole core becomes 9K smaller, becoming 179K. However, this core may be difficult to play the function of Linux, so I decided to add the network back. Add network support in General back, recompile, and the core becomes 189K. 10K to add a TCP/IP stack, it seems to be a good deal. It is useless to have a stack without a driver, so I added the RTL8139 driver commonly used in embedded boards, 195K. If you need the DOS file system, the size becomes 213K. If minix is replaced with ext2, the size grows to 222K.
The memory required by Linux is about 600K to 800K. 1MB of memory may be enough to boot the system, but it is not very useful because it is difficult to even load the C library. 2MB of memory should be enough to do something, but it takes more than 4MB to run a relatively complete system. Because the filesystem of Linux is quite large, about 230K, accounting for 1/3 of the volume. Memory management takes up 80K, which is about the same as the sum of other parts of the kernel. TCP/IP stack takes up 65K, and drivers take up 120K. SysV IPC takes up 21K, which can be removed if necessary, and the kernel file should be about 10K smaller. If you want to trim the kernel size, where should you move? The answer is obvious, of course, the file system.
Linux's VFS simplifies the design of the file system, and buffer cache and directory cache increase the efficiency of the system. But these embedded systems are not very useful. If they can be removed, the kernel can be reduced by about 20K immediately. If the entire VFS is skipped and the file system is directly written as a driver, it should be possible to reduce 230K to about 50K. The entire kernel is reduced to about 100K. System startup The system startup sequence and related files are still in the core source directory. See the following files: ./arch/$ARCH/boot/ bootsect.s ./arch/$ARCH/boot/setup.s ./init/main.c bootsect.S and setup.S This program is the first program of the Linux kernel, including Linux's own bootstrap program. However, before explaining this program, we must first explain the actions of a general IBM PC when it is turned on (here, the boot means "turning on the power of the PC"). When the power of a PC is turned on, it starts to execute from the address FFFF:0000 in the memory (this address must be in the ROM BIOS, which is usually between FEOOOh and FFFFFh). The content here is a jump instruction, which jumps to another location in the ROM BIOS and starts to execute a series of actions. Immediately after the system test code, the control will be transferred to the boot program in the ROM (ROM bootstrap routine). This program will read the zeroth track and the zeroth sector on the disk into the memory. As for where in the memory it is read? --Absolute position 07C0:0000 (that is, 07C00h), which is a feature of the IBM series PC. And the Linux bootsect program is located in the boot sector of the Linux boot disk.
Previous article:ARM 2440 naked implementation of electronic clock
Next article:Difference between MOV MVN LDR in ARM assembly language
Recommended ReadingLatest update time:2024-11-16 12:59
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- Innolux's intelligent steer-by-wire solution makes cars smarter and safer
- 8051 MCU - Parity Check
- How to efficiently balance the sensitivity of tactile sensing interfaces
- What should I do if the servo motor shakes? What causes the servo motor to shake quickly?
- 【Brushless Motor】Analysis of three-phase BLDC motor and sharing of two popular development boards
- Midea Industrial Technology's subsidiaries Clou Electronics and Hekang New Energy jointly appeared at the Munich Battery Energy Storage Exhibition and Solar Energy Exhibition
- Guoxin Sichen | Application of ferroelectric memory PB85RS2MC in power battery management, with a capacity of 2M
- Analysis of common faults of frequency converter
- In a head-on competition with Qualcomm, what kind of cockpit products has Intel come up with?
- Dalian Rongke's all-vanadium liquid flow battery energy storage equipment industrialization project has entered the sprint stage before production
- Allegro MicroSystems Introduces Advanced Magnetic and Inductive Position Sensing Solutions at Electronica 2024
- Car key in the left hand, liveness detection radar in the right hand, UWB is imperative for cars!
- After a decade of rapid development, domestic CIS has entered the market
- Aegis Dagger Battery + Thor EM-i Super Hybrid, Geely New Energy has thrown out two "king bombs"
- A brief discussion on functional safety - fault, error, and failure
- In the smart car 2.0 cycle, these core industry chains are facing major opportunities!
- The United States and Japan are developing new batteries. CATL faces challenges? How should China's new energy battery industry respond?
- Murata launches high-precision 6-axis inertial sensor for automobiles
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications