Detailed analysis of arm2440 Startup Process

Source: Internet
Author: User

To analyze the Startup Process of arm2440, you must first understand the hardware configuration of arm2440. There is no storage chip in the CPU of arm2440, except for a 4 kb SRAM (static memory can run programs, but the most important thing is to lose all the data when the power is down. Note that the 4 kb is the CPU itself, not the peripherals. Now let's talk about the starting process. (Start from nand flash)

1. First, the machine is powered on, and the external NAND Flash 0x0000-0x01000, that is, the first 4 kb of content, is copied to the 4 kb SRAM inside our CPU through hardware, in addition, this address is mapped to the starting address, that is, the cpu sp pointer is directed to the internal 4 kb SRAM 0x0000 address and starts running.

Note: (how to copy the data to the SRAM inside the CPU on the hardware may be explained in the following section)

During reset, NAND Flash Controller will get information about the connected NAND flash through pin status
(Ncon (Adv flash), gpg13 (page size), gpg14 (address cycle), gpg15 (bus width)-refer to pin
Configuration), after power-on or system reset is occurred, the NAND Flash Controller load automatically
4-kbytes Boot Loader codes. After loading the boot loader codes, the boot loader code in steppingstone is
Executed. (2440 Technical Manual)

2. well, now the program is running in your internal 4 kb SRAM, but the space for this 4 kb SRAM is too small. Maybe you think that the program I wrote is very large, at least m-level, what should you do? You have to expand a large piece of SRAM, 64 MB, right? If you think it is still 256 MB, but whatever the case, your most important question: how can I put my program in my external SRAM, so you thought why I don't jump to the command like the interrupt in the MCU, I have a copy command in my 4 kb file, so that all my external Nan flash programs can be tested in our external SRAM, so the role of this SRAM is reflected.

3. the first problem is that the idea of copying commands is okay, but suppose you copy the command to external memory, well, you have to put your SP pointer, that is, the address of the program pointer, to the starting address of the external memory, so that you can start your entire program completely. So you need to remap your address and map the external memory address to the address of our program pointer, of course, there is no ing concept in the single chip microcomputer (maybe but rarely used). If it is a single chip microcomputer extension, then you just need to point the SP pointer address to the first address of our external memory.

Note:

1. During the entire process, if you use Linux to start your system, bootloader is generally used, then you can put your bootloader to the first address of your NAND Flash. Put your program on the subsequent address, so that during power-on, your bootloader will copy your program to your external memory.

2. Keep up with the problem. What is the size of the bootloader? What is the copy address from the address segment to the address segment?

First consider the first question: Size

If your bootloader is larger than 4 kb, it is easy to solve the problem. You have to modify the bootloader. Of course, you can also modify the size of the loader to make it smaller than 4 kb, however, if you want your bootloader to have powerful functions, what should you do? It is also very simple. Then you should initialize the address of the bootloader smaller than 4 kb, then copy all the things you want to your external memory. Remember the analogy in the actual Bootloader:

0x00000000-0x00060000 // U-boot
0x00060000-0x00080000 // start parameter, that is, the saveenv command, to save the set parameter address.

The details are detailed here, and the program and startup parameters are carefully divided.

Okay, the second question: copy the address segment.

If your bootloader is small and runs in the internal SRAM of the CPU, you can copy your program after 4 kb, but if it is larger than 4 kb, refer to the previous statement. Of course, if you copy your kernel 0x00080000-0x00280000 first, the file system is stored in the area after kernel 0x00280000 -.

4. Well, you have your kernel and some bootloaders in your external memory. This is not very important, but now you just want to see if you can start your Linux kernel, you can consider letting your program's address pointer point to the first address of the kernel to see if it can start. But to be honest, many articles are testing whether or not their kernel is started. It is hard to understand the starting address 0x3000000.

5. Content of the English Technical Manual:

In recent times, nor flash memory gets high in price while an SDRAM and a nand flash memory is
Comparatively economical mical, motivating some users to execute the boot code on a NAND Flash and execute
Main code on an SDRAM.
S3c2440a boot code can be executed on an external nand flash memory. In order to support nand flash Boot
Loader, The s3c2440a is equipped with an internal SRAM buffer called 'steppingstone '. When booting, the first 4
Kbytes of the nand flash memory will be loaded into steppingstone and the boot code loaded into steppingstone
Will be executed.
Generally, the boot code will copy NAND Flash content to SDRAM. using hardware ECC, the NAND Flash data
Validity will be checked. Upon the completion of the copy, the main program will be executed on the SDRAM

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.