Write bootloader to the ARM Development Board NAND Flash with J-link

Source: Internet
Author: User
Tags jlink

I. Causes and principles

Cause: In the past computer burning write bootloader to NAND is using JTAG and Jflash,jtag is connected with the port, the current computer is generally not the same mouth, now generally used cheaper to start the J-link, using USB, you can no longer use the previous Jflash burned write. It is therefore necessary to find a way to J-link write NAND.

The following instructions j-link the principle of burning nand.

With the realarm2410 Development Board as an example, the Development Board to set the jumper to NAND flash boot mode to operate NAND, at this time the memory map such as:

Figure 1

1, in memory, there is no mapping of NAND, but only through the NAND Flash controller in S3C2410A access NAND, and access to the NAND of this section of the program size, will certainly exceed 4KB, so can only be placed in SDRAM execution. Assuming the board is completely empty from the factory, there is no program in NAND, in the case of power loss, SDRAM and SRAM are more unlikely to store the program. Then, you can follow the following ideas, combined with figure 2 memory allocation diagram to illustrate.

Fig. 2:sram and SDRAM distribution diagram

The SRAM is used to perform initialization of the program Init.bin, the program is less than 4KB, the bootloader.bin to be burned in the first 1MB space SDRAM, usually bootloader only dozens of KB, set aside 1MB of space is sufficient; from 0x33df3000-0x33 The ef3000 1MB space is used to store the burned-out execution code ro segments, the 1MB heap and the 20K stack are also allocated as 2, and the remaining SDRAM is used as the RW segment.

Therefore, the burn-write steps are:

    1. Ready to init.bin,bootloader.bin,program.bin three files;
    2. Load the init.bin into the SRAM and run;
    3. Loading the bootloader.bin into the 0x30000000-0x30100000 of the SDRAM;
    4. Load the program.bin into the 0x33df3000-0x33ef3000 of the SDRAM and run;

Specific instructions are given below.

Second, prepare the Init.bin,bootloader.bin,program.bin file.

Init.bin is a small section in the SRAM run, initialize the SDRAM program, how to set the program loading section by the distributed loading file, refer to my other blog post Keil MDK use J-link respectively in Sram,nor The principle and method of debugging code in Flash and SDRAM, this paper introduces the principle and method of setting up the loading position of RO, RW, Stack, Heap and so on. The implementation of the program is also very simple, no longer repeat. Init.bin MDK Engineering downloads are available here. Target needs to select Runfromsram_norflash_boot, and the resulting bin file will be renamed Init.bin.

Bootloader.bin This article uses the Vivi, because different development Board bootloader not the same, therefore please according to the actual choice.

Program.bin related to NAND flash controller to NAND operation, as well as bad block recognition, ECC error correction, etc., can refer to S3C2410A and NAND flash data sheet, this article is not mainly about NAND drive, not in this article To set the program to load execution at the 0x33df3000 start of SDRAM, also refer to my other blog post Keil MDK the principles and methods of debugging code in Sram,nor Flash and SDRAM, respectively, using J-link. Program.bin MDK Engineering downloads are available here.

Third, load init.bin to SRAM execution

Loading bin files can be done using j-link, to facilitate narration, put the prepared init.bin,vivi (that is, bootloader.bin), program.bin into the JLink.exe directory, execute JLink.exe, enter the console. Connect the Development Board serial port 0 to the computer serial port, and open the computer serial terminal (recommended use SECURECRT). On the Jlink console, proceed as follows:

J-link Reset:

J-link> R

Load the Init.bin to the 0x0 location (that is, the start address of the SRAM), set the PC to 0x0, and execute:

J-link> loadbin Initsdram.bin 0
J-link> SETPC 0
J-link> Go

So the SDRAM is initialized.

Iv. loading Bootloader.bin to 0x30000000-0x30100000

Here Bootloader.bin is the Vivi file. Follow these steps:

To pause the Init.bin operation:

J-link> h

Loading Vivi to 0x30000000 start location:

j-link> Loadbin Vivi 0x30000000

V. Load program to 0x33df3000 and execute

Load Program.bin to 0x33df3000 and execute:

j-link> Loadbin Program.bin 0x33df3000
J-link> Setpc 0x33df3000
J-link> Go

In the computer serial terminal can see the printing of the burning NAND flash process information, as well as the verification results. After the burn is completed, restart the Development Board to see the start-up interface and the serial port printing information.

After modifying or porting a new bootloader, you can still burn it in this way. With the bootloader, the kernel and the file system are naturally burned.

Write bootloader to the ARM Development Board NAND Flash with J-link

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.