Jlink burn nor/NAND Flash

Source: Internet
Author: User
Tags jlink

1. Brief Description
The debugging and flash burning functions of jlink are powerful, but it is difficult to perform flash operations on S3C2410 and S3C2440: You need to set SDRAM when burning or flash; otherwise, the speed is very slow; burning and writing NAND flash can only be achieved theoretically, but no one has implemented it directly.
In this article, an indirect method is used to burn or write non-NAND flash on the S3C2410 and S3C2440 development boards. The principle is: jlink can easily read and write the memory and start the program, so you can download a special program to the SDRAM on the Development Board and run it, then use this program to burn and write.

2. Procedure
2.1 connect hardware
Most of the S3C2410 and S3C2440 development boards use three JTAG interfaces.

However, most of the jlinks on the market only support the JTAG interface with a 54mm-spacing of 20 PIN, so the adapter Board is required. You can also directly use the jlink variants, as shown in the following two types of simplified jlink:
Http://item.taobao.com/auction/item_detail-db1-757658496f103f39f75c9c1a97a0333d.htm
Http://item.taobao.com/auction/item_detail-0db1-23f1c5b6f377845658eeb8e092859552.htm

Take mini2440 as an example, such as connecting the JTAG line.
Http://bbs.21ic.com/upfiles/img/20093/20093416117925.jpg

2.2 run J-link commander
After J-link commander is started, it automatically detects the CPU. If no CPU is detected, execute the USB command in it to connect to jlink, and then execute the R command to identify the processor.

2.3 download and run a special program
For the S3C2410 and S3C2440 processors, they have 4 k sram internally. When nor flash is used for startup, the address is 0x40000000; When NAND Flash is used for startup, the address is 0.
For the S3C2410 and S3C2440 development boards, 64 m sdram is usually added. Before the SDRAM can be used, it must be initialized.
Therefore, first put an init. bin is downloaded to the internal SRAM to run. It executes the initialization of the SDRAM, and then downloads a large program, such as U-boot to the SDRAM, it implements the nor and NAND Flash operations.
Here is the command in J-link commander, assuming init. Bin and u-boot.bin are under E: disk.
1. Speed 12000 // set the TCK to 12 Mb, and the program will be downloaded soon.
2. download and run init. Bin, which is used to initialize the SDRAM
2.1 For NAND boot:
Loadbin E:/init. Bin 0
Setpc 0
G
2.2 If nor is Enabled:
Loadbine:/init. Bin 0x40000000
Setpc 0x40000000
G

3. Download The Special uboot:
H
Loadbin E:/u-boot.bin 0x33f80000
Setpc 0x33f80000
G

Now, U-boot has been started. You can see the uboot startup information on the serial port tool. Then you can download files through the network or serial port, then run the commands in U-boot to write the data.

Of course, if there is no network and you do not want to endure the serial speed, you can also download it through jlink commander, for example:
H
Loadbin your_file.bin 0x30000000
G

At this time, your file has been downloaded to the SDRAM 0x30000000.
The subsequent operation is the U-boot command.

2.4 use U-boot to burn flash
For example, if you want to burn a program named LEDs. bin to nor or NAND Flash, refer:
(1). Download through jlink:
Run the following command in J-link Commander:
H
Loadbin E:/LEDs. Bin 0x30000000
G

Note the LEDs. bin size.

(2). Write to nor flash through U-boot:
Run the following command in U-boot:
Protect off all // unlock
Erase 0 2 FFFF // erase the nor flash sector whose size starts from 0 and ranges from 0 to (the size can be an integer multiple of the erased block, and you can run the flash info command to view it)
CP. B 0x30000000 0 30000 // burn the program downloaded to 0x30000000 and write it to nor.

(3). Write to NAND flash through U-boot:
Run the following command in U-boot:
Nand erase 0 30000 // erase the nnad flash sector whose size starts from 0 to 0x30000
Nand write. jffs2 30000000 0 30000 // burn the program downloaded to 0x30000000 and write it to NAND.

Note that the numbers 2 FFFF and 30000 used above are 192 KB. If your program is small, set it by yourself.

Init. Bin is written in assembly. It is location independent and can be executed anywhere.
U-boot.bin is also after my a lot of modifications, can be applied to the friendly arm, youlong, yangchuang Development Board, with the following features:
1. Nor flash supporting CFI and JEDEC Interfaces
2. Support for various NAND Flash
3. Support for CS8900 and dm9000 Networks
4. Support for USB download
5. Support burning the yaffs File System Image

For (the file is too big, this site can not upload): http://ouravr.com/bbs/bbs_upload34876/files_12/ourdev_422781.rar

I wrote and modified these two programs for openjtag Based on ft2232d. Later I thought they could be used on jlink.
In fact, for the ft2232d-based usb jtag tool, I have compiled a nor and NAND FLASH WRITER. Currently, the jlink tool for writing and writing NAND is still under research.
This is an indirect and troublesome Method for writing nor and NAND through U-boot. However, the speed is very fast and no one seems to be able to write or burn NAND for jlink.

Source: http://www.rosoo.net/a/embedded_o/201006/9696.html

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.