ARM development steps: After reading this, the development ideas will be clearer

Publisher:SereneWandererLatest update time:2019-10-30 Source: 51heiKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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. 

[1] [2]
Keywords:ARM Reference address:ARM development steps: After reading this, the development ideas will be clearer

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

Arm launches Neoverse V2, a new generation of data center chip technology
Beijing time, September 15th morning news, it was reported that 5G data and connected devices have seen explosive growth. In order to meet the demand, Arm announced the launch of the next-generation data center chip technology called Neoverse V2.    Arm develops technology, forms intellectual property, and then licens
[Semiconductor design/manufacturing]
About ARM's PC pointer exception return processing
To understand the PC pointer, you must first understand the LR pointer. Link register LR (r14): used to save and restore the contents of the PC register, it has two special functions. (1) Save the subroutine return address. When using BL or BLX, the jump instruction automatically puts the return address into r14;
[Microcontroller]
ARM Study Notes 11——GNU ARM Assembly Programming
  In GNU ARM assembly programming, the syntax format of each line is as follows:    @comment    If the statement is too long, you can write it in several lines, and use "" at the end of the line to indicate a line break. There cannot be any characters after "", including spaces and tabs.   Parameter description:
[Microcontroller]
ARM SVC mode source code
The svc mode can separate SDK (API) and Application, and can also omit a lot of repeated code. For example, if USB is used in bootload and you want to reuse it in application, you can use svc Principle: Similar to software interrupt, a software interrupt source is added to indicate the function interface to be called
[Microcontroller]
ARM Basic Knowledge
In addition to normal saving, after compiling correctly, choose to save as a .h file with the same name, and change the main function name in the h file to other names, such as xmain, or main1, etc., then the new project can call the function in the original project! 1. Project 1 first write LCD1602, and after compili
[Microcontroller]
[Embedded] arm-linux-gcc/ld/objcopy/objdump parameter overview
arm-linux-gcc   -o only activates preprocessing, compilation, and assembly, that is, it only makes the program into an obj file     -Wall specifies to generate all warning messages     -O2 The compiler provides a compilation optimization option for the program. Using this option during compilation can improve the exec
[Microcontroller]
ARM Software Programming
1. Interrupt handling process The interrupt processing flow of the ARM system is shown in Figure 1. There are five main interrupts in the system: timer interrupt, serial port input interrupt, serial port output interrupt, interface interrupt, and link interrupt. Figure 1: Flowchart of application processi
[Microcontroller]
ARM Software Programming
Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components
Guess you like

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号