ARM rookie's growth story - Part 2

Publisher:Huanle666Latest update time:2016-01-12 Source: eefocusKeywords:ARM Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere
This time I will mainly talk about several concepts that you must face when you first use ARM, especially when you jump directly from 51 to ARM: REMAP, Bootloader, and Flashloader.

1. REMAP:
    When it comes to REMAP, we should first think of what MAP is. I am not good at English, so I started with a quote out of context. MAP is a map, and Memory Map is a memory map. However, the reference coordinates of this map are not longitude and latitude, but addresses, which is why it is called memory mapping. In order to adapt to the needs of different memory capacity requirements, the RAM and ROM of the ARM processor itself are not large enough, so it is often necessary to expand some memories, such as Norflash, NANDFlash, SDRAM, SRAM...How can ARM identify these different memories? It can only assign an independent address to each one, which is equivalent to having a different name for each person. The address of the on-chip memory is generally fixed at the factory, and the off-chip memory has different addresses depending on the external bus chip select to which each memory is connected.

    So REMAP, as the name implies, is the remapping of memory, that is, the address of some memory has changed again. I don't understand it very much. This address is not easy to remember, and it changes all the time. Isn't it troublesome? Why didn't I have this thing when I learned 51? Later, I checked some information and understood it a little. 51 is an 8-bit machine. More importantly, the main frequency of 51 is not high. The 8-bit ROM or Flash is enough to match the main frequency of 51. There is no need to insert wait instructions, so the program runs directly in ROM or Flash without affecting the speed of the system. ARM is different. ARM is a 32-bit machine, but Flash is generally 8-bit or 16-bit. There are 32-bit ones, but they seem to be very expensive. Moreover, the product size of ARM is very high, often hundreds of MB, so the process of Flash cannot reach this speed. If the program runs in Flash, too many wait instructions will be inserted, which will affect the performance of ARM. RAM generally has a faster access speed and is easy to form 32 bits, which can match the high-speed ARM. More importantly, ARM must get instructions from address 0x0 after power-on, so ROM or Flash must be mapped to address 0x0 after power-on. At that time, I had a stupid idea that since RAM is so good, why do we need ROM or Flash? Can't we just download the program to RAM? Later, I suddenly realized that RAM is a volatile memory. Nothing will be lost after power failure, and nothing will be at 0x0 after power-on. And there is another point. The interrupt vector table of ARM, which is the place where each interrupt entry address is stored, is generally placed at 0x0, that is, in ROM or Flash. In order to speed up the interrupt response speed, 0x0 should also be mapped to RAM. Therefore, ARM generally starts from ROM or Flash to complete initialization, then copies the application to RAM, and then jumps to RAM for execution.

    I just talked about why we need to REMAP, and now I will talk about how to REMAP. At the beginning, I was confused. They all said REMAP, so how can we complete REMAP? I didn’t read the manual enough. In fact, what is said above is very clear. The at91sam9260 we use is even simpler. There is a special register that can be configured, MATRIX_MRCR—Master Remap Control Register. Just write 1 to the corresponding bit of this register. I also saw on the Internet that some Samsung ARMs can implement REMAP by programming the corresponding bank register to change its starting address.

    Below, I will take our at91sam9260 board as an example to explain my understanding of at91sam9260 REMAP in detail. At the beginning, there is no program in Flash, and of course no REMAP. At this time, connect BMS to high, and then power on. At this time, the address 0X0 is located in the ROM inside the chip. Since the boot program seems to be solidified in the ROM, the serial port will output the words "Rom Boot...>". The starting address of the internal SRAM0 is still at 0x20 0000, and the starting address of the external Norflash is 0x1000 0000. Then we use h-flasher or J-Flash to download the generated Bin file to Norflash, that is, the starting address is 0x1000 0000. Then connect BMS to low, and Norflash is mapped at address 0X0, that is, the starting address of Norflash is 0X0. (You may ask where is the address of ROM now? I don’t know, because the address range of Norflash is 0X0~0X1F FFFF, and the starting address of ROM is 0X10 0000 by default, which is exactly within the range of Norflash, so where is the ROM at this time?) At this time, power on, because there are eight legal interrupt vectors at address 0X0, that is, the starting address of Norflash, the program will start from Norflash, then execute the startup code, initialize SMC and PMC, and then copy the interrupt vector table to the internal SRAM0, and then set the corresponding position of the MATRIX_MRCR register to 1 to implement REMAP. At this time, the starting address of Norflash changes back to 0X1000. 0000, and the starting address of the internal SRAM0 changes back to 0x0. If an exception occurs in the system, the interrupt vector will be taken from the address 0X0, that is, the internal SRAM0. The access speed of the internal SRAM is obviously higher than that of the external Norflash, so the program performance is improved. This is my understanding of at91sam9260 REMAP. Welcome to discuss and advise.

2、Bootloader:

    To be honest, I still don't quite understand this concept. Maybe for a naked system, the concept of Bootloader itself is rather vague. As the name implies, Boot, boots, Load, it is more comfortable to walk with boots on (this metaphor seems to be a bad one). For ARM, it is initialized well and the vector table and data are copied to RAM, so that it can run smoothly. This is the legendary boot loader. So my understanding of Bootloader is to complete the initialization of ARM, establish the interrupt vector table and map it to RAM, copy the data segment and necessary code segment to RAM, complete REMAP, and jump to Main, this series of processes. To put it bluntly, it is the work of the startup code. I feel that this understanding is far-fetched, so please give me more advice.

3. Flashloader:
    This concept is even more vague. It feels similar to Bootloader, except that Flashloader can read, write, and erase Flash, and can work with debugging software to download programs to Flash. There is an option in IAR: Use Flashloader, but it seems to be generally for on-chip Flash. Our board is an external Norflash, so it doesn't seem to be used.

Next, I will talk about my understanding of the startup code based on KEIL MDK.

Keywords:ARM Reference address:ARM rookie's growth story - Part 2

Previous article:ARM rookie's growth story - Part 3
Next article:ARM assembly ADR, LDR and other pseudo instructions

Recommended ReadingLatest update time:2024-11-16 13:32

Linux that greatly simplifies AMP configuration and use
Embedded systems generally fall into two categories: those that require hard real-time performance, and those that don't. In the past, we've had to make the difficult choice between the performance of a real-time operating system or the rich features of our beloved Linux system, and then work hard to make up for the s
[Microcontroller]
Linux that greatly simplifies AMP configuration and use
Installation of arm-linux 4.3.2 cross toolchain
1. Unzip to the root directory first (you can choose any directory). After unzipping, a subdirectory arm will be added to the /usr/local directory. This directory is the installation directory of the toolchain.        Command: tar zxvf arm-linux-gcc-4.3.2.tgz -C /   2. In order to use cross-compilation commands in
[Microcontroller]
Design of data acquisition and transmission instrument system based on ARM and GPRS
0 Introduction     With the development of Internet of Things technology, wired transmission is no longer suitable as a communication medium in dispersed and harsh working points, especially in situations where there is sudden and small data transmission. The development and application of Internet of Things technolo
[Microcontroller]
Design of data acquisition and transmission instrument system based on ARM and GPRS
Design of remote electrical parameter measurement system based on STM32 and Ethernet
  Abstract Aiming at the inconvenience of electricity consumption and charging management in various places, this paper studies the remote electric parameter measurement technology based on ARM and Ethernet. This technology is mainly used for the collection and storage of electric parameters. The main controller adopt
[Test Measurement]
Design of remote electrical parameter measurement system based on STM32 and Ethernet
Implementation of ARM Image Scaler Based on FPGA
ARM is currently the world's largest IP provider of embedded chip technology. Its IP has become a technical standard and development platform adopted by many chip design companies. Therefore, SoC based on ARM core has become the development focus of embedded processors. ARM can be used to implement LCD controller to c
[Microcontroller]
Implementation of ARM Image Scaler Based on FPGA
ARM memory mapping problem
Memory mapping refers to the unified addressing of FLASH, RAM, peripherals, etc. in or outside the chip. That is, using addresses to represent objects. Most of these addresses are specified by the manufacturer, and users can only use them but not change them. Users can only customize them when external RAM or FLASH is
[Microcontroller]
ARM basic learning-register addressing mode and instructions
Addressing mode Data is stored in memory. Addressing is simply to find the address of the stored data or instructions. The memory has many storage units for storing data. In other words, addressing is to read the content stored in the corresponding address number in the storage device where the data is located; the
[Microcontroller]
ARM basic learning-register addressing mode and instructions
ARM and Allwinner Technology Sign Arm Total Access License Agreement, Entering a New Chapter of Technology Cooperation
Recently, ARM Technology (China) Co., Ltd. (hereinafter referred to as "ARM Technology") and Zhuhai Allwinner Technology Co., Ltd. (hereinafter referred to as "Allwinner Technology"), a leading domestic intelligent application processor SoC design manufacturer, jointly announced that the two parties have
[Embedded]
ARM and Allwinner Technology Sign Arm Total Access License Agreement, Entering a New Chapter of Technology Cooperation
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号