Analysis of technical difficulties in starting program in embedded applications using ARM7

Publisher:as233632621Latest update time:2012-03-17 Source: 21ic Keywords:ARM7 Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

Analysis of technical difficulties

⑴.Use of MMU

MMU is the abbreviation of memory management unit, which is a device used to manage the virtual memory system. MMU is usually part of the CPU and has a small amount of storage space to store the matching table from virtual address to physical address. This table is called TLB (Translation Lookaside Buffer). All data requests are sent to the MMU, which determines whether the data is in RAM or in a large-capacity storage device. If the data is not in the storage space, the MMU will generate a page fault interrupt.

The two main functions of the MMU are:

Convert a virtual address to a physical address.

Control memory access permissions. When the MMU is turned off, the virtual address is directly output to the physical address bus.

In practice, using MMU solves the following problems:

① When using DRAM as a large-capacity memory, if the rows and columns of DRAM are non-square, the physical address of the DRAM will be discontinuous, which will cause great inconvenience to program writing and debugging. Proper configuration of the MMU can convert it into a continuous virtual address space.

②The interrupt vector table of the ARM core is required to be placed at address 0. When the ROM is at address 0, the interrupt service program cannot be debugged, so it is necessary to map the readable and writable memory space to address 0 during the debugging phase.

③ Certain address segments of the system are not allowed to be accessed, otherwise unpredictable consequences will occur. In order to avoid such errors, these address segments can be set to user-inaccessible types through the settings of the MMU matching table.

The matching table generated by the boot program contains information such as address mapping, storage page size (1M, 64K, or 4K), and whether access is allowed.

For example: the physical address range of the 16M DRAM on the target board is 0xc000, 0000~0xc07f, ffff; 0xc100, 0000~0xc17f, ffff; the virtual address range of the 16M ROM is: 0x0000, 0000~0x00ff, ffff. The matching table is configured as follows:

It can be seen that the left side is a continuous virtual address space, the right side is a discontinuous physical address space, and DRAM is mapped to the address interval 0. The MMU obtains the corresponding physical address according to the conversion logic based on the virtual address and page table location information, and outputs it to the address bus.

It should be noted that after enabling the MMU, the program continues to run, but for the programmer, the pointer of the program counter has changed to point to the virtual address corresponding to the ROM.

⑵Distribution loading analysis of target files

First, create a text file, called a distribution load description file, which specifies the loading range and execution range for each part of the application.

Here are some examples:

FLASH 0x01000000 0x011fffff; 2M FLASH

{

FLASH 0x01000000

{

boot.o(BOOT,+FIRst)

* (+RO)

}

DRAM 0x00000000

{

vector.0(VECTOR, +First)

int_handler.o (+RO)

* (+RW, +ZI)

}

}

Add “-scov description-file –scf” or “-scatter description-file” to the command line of the ARM linker. After compilation and linking, a distribution loading file will be generated.

The linker also generates a set of symbols that give the length, load address, and execution address of each interval named in the distribution description file. Since neither the linker nor the C library has the function of copying code from its load interval to the execution interval, or creating a zero-initialized area, it is up to the application programmer to use the information generated by this set of symbols to complete this work. This must be done before calling the C program, as shown below:

LDR r0, = |Load$$DRAM$$Base|

LDR r1, = |Image$$DRAM$$Base|

CMP r0, r1 ; Check if the load address and execution address are the same

BEQ do_zi_init ; If the interval is the same, the interval will not be copied and the zero data area will be initialized

MOV r2, r1 ; different, copy the load area to the execution area

LDR r4, = |Image$$DRAM$$length|

ADD r2, r2, r4

BL copy

do_zi_init

LDR r1, = |Image$$DRAM$$ZI$$Base|

MOV r2, r1

LDR r4, = |Image$$DRAM$$ZI$$length|

ADD r2, r2, r4

MOV r3, #0

BL zi_init ; Call zero initialization subroutine

Conclusion:

The startup program introduced in this article has been run and tested on systems developed with Cirrus Logic's EP7211 and Ateml's AT91M40400. In the future, we can add serial communication modules and FLASH operation modules to develop system monitoring programs, thereby realizing online upgrades of application programs.

Keywords:ARM7 Reference address:Analysis of technical difficulties in starting program in embedded applications using ARM7

Previous article:Design of integrated wireless data acquisition instrument based on ARM11
Next article:How to implement the upper control algorithm analysis solution of ARM9 microcontroller

Recommended ReadingLatest update time:2024-11-17 03:46

Design of vehicle detection system control unit based on ARM development board
introduction Due to the increasing demand for traffic, more and more circular induction coil detectors are used for traffic detection. These coils buried under the road surface can detect electromagnetic changes when vehicles pass by and accurately calculate traffic flow. Traffic flow is the basic data for traf
[Microcontroller]
Design of vehicle detection system control unit based on ARM development board
Signal Acquisition System Designed with ARM7 and UC/OS-II
In some industrial sites, equipment is prone to failure after long-term operation. In order to monitor these devices, data acquisition devices are usually used to collect data from them during operation and send them to the PC. The data is analyzed by specific software running on the PC to determine the status of the
[Microcontroller]
Signal Acquisition System Designed with ARM7 and UC/OS-II
What are the classifications of a5 a8 a9, v6 v7, arm7 arm9 arm11 in arm processors?
ARM processors have been developed for many years, with many architectures and many different cores. The architectures are armv1 v2 v3 v4 v5 v6 v7 There are too many cores, for example, armv1 corresponds to arm1, armv5 corresponds to arm9, armv6 corresponds to arm11, and armv7 corresponds to cortex (for ex
[Microcontroller]
Design and Application of Bluetooth Access Point Based on ARM7
1 Introduction In industrial sites, due to some harsh environments and inconvenient wiring, Bluetooth wireless communication technology can be used to achieve data communication. At the same time, there are many devices in industrial sites that are interconnected in different ways, including non-intelligent
[Microcontroller]
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

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号