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.
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
- Popular Resources
- Popular amplifiers
- Practical Deep Neural Networks on Mobile Platforms: Principles, Architecture, and Optimization
- ARM Embedded System Principles and Applications (Wang Xiaofeng)
- ARM Cortex-M4+Wi-Fi MCU Application Guide (Embedded Technology and Application Series) (Guo Shujun)
- An ARM7-based automotive gateway solution
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!
- Rambus Launches Industry's First HBM 4 Controller IP: What Are the Technical Details Behind It?
- 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
- V853 Replace the startup LOGO
- The problem of the servo not rotating when the nodemcu esp8266 development board drives it
- Mentor Usage Problems
- Ethernet Problems
- If you want to know whether the signal generated by the signal generator or function generator is ready or whether it is input according to the set value standard...
- MicroPython precompiled firmware for TB-01 (W600)
- Is it necessary to attend Altium's offline training?
- How to prevent audio equipment from aging and make the sound better
- Find TPS929120 library files
- [Atria Development Board AT32F421 Review] SPI Usage