How to use JLink to indirectly burn Nor and Nand Flash of S3C2410 and S3C2440 development boards

Publisher:吾道明亮Latest update time:2020-05-12 Source: eefocusKeywords:JLink Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

1. Brief description

JLink's debugging and Flash burning functions are very powerful, but the Flash operations of S3C2410 and S3C2440 are a bit troublesome: SDRAM needs to be set when burning Nor Flash, otherwise the speed is very slow; burning Nand Flash is only theoretically possible, but no one has directly implemented this yet.


This article uses an indirect method to implement the programming of the Nor and Nand Flash of the S3C2410 and S3C2440 development boards. The principle is: JLink can easily read and write memory and start programs, so a special program can be downloaded to the SDRAM on the development board, run it, and then use this program to program.


2. Operation steps

2.1 Connecting the Hardware

For most S3C2410 and S3C2440 development boards, there are generally three types of JTAG interfaces they use (as shown in Figure 1), of which the first two are more commonly used.

However, most JLinks on the market only support the third JTAG interface, so an adapter board is needed. Or you can directly use a variant of JLink, such as the two improved versions of JLink shown in Figure 2:

Take mini2440 as an example, connect the JTAG line as shown in Figure 3.

2.2 Run J-Link commander

The J-Link commander startup interface is shown in Figure 4. (If no CPU is detected, execute the usb command to connect to JLink, and then execute the r command to identify the processor).

2.3 Download and run a specially crafted program

For S3C2410 and S3C2440 processors, they have 4K SRAM inside. When booting with Nor Flash, the address is 0x40000000; when booting with Nand Flash, the address is 0.

For S3C2410 and S3C2440 development boards, 64M SDRAM is usually connected externally. Before SDRAM can be used, it needs to be initialized.

Therefore, first download an init.bin to the internal SRAM to run, which performs the initialization of SDRAM; then download a larger program, such as u-boot to SDRAM to run, which will implement the operation of Nor and Nand Flash.

The following are the commands in J-Link commander, assuming that init.bin and u-boot.bin are in the e: drive.


1. speed 12000 //Set TCK to 12M, the download speed will be very fast


2. Download and run init.bin, which is used to initialize SDRAM

2.1 If it is NAND boot:

loadbin e:init.bin 0      

setpc 0

g

2.2 If it is Nor startup:

loadbin e:init.bin 0x40000000      

setpc 0x40000000

g


3. Download the special uboot:

h

loadbin e:u-boot.bin 0x33f80000

setpc 0x33f80000

g


The above operation commands can refer to Figure 5.

Now, u-boot has been started, and you can see the interface shown in Figure 6 on the serial port tool. You can then download files through the network or serial port, and then use the commands in u-boot to burn them.

Of course, if there is no network and you don't want to endure the serial port rate, you can also download it through jlink commander, for example:

h

loadbin your_file.bin 0x30000000

g


At this point, your file has been downloaded to SDRAM 0x30000000.

The subsequent operations are u-boot commands.


2.4 Use u-boot to burn Flash

For example, suppose you need to burn a program named leds.bin to Nor and Nand Flash, then please refer to:

(1) Download via Jlink:

Execute in J-Link commander:

h

loadbin e:leds.bin 0x30000000

g


Note the size of leds.bin


(2) Burn to Nor Flash via u-boot:

Execute in u-boot:

protect off all // unlock

erase 0 2ffff // Erase the NOR Flash sector with a size of 0x30000 starting from address 0 (the size is an integer multiple of the erasable block, which can be viewed by running the flash info command)

cp.b 0x30000000 0 30000 // Burn the program downloaded to 0x30000000 to NOR


(3) Burn to Nand Flash via u-boot:

Execute in u-boot:

nand erase 0 30000 // Erase the Nnad Flash sector with size 0x30000 starting from address 0

nand write.jffs2 30000000 0 30000 // Burn the program downloaded to 0x30000000 to Nand


Note that the numbers 2ffff, 30000, etc. used above are 192K. If your program is smaller, please set it yourself.

Keywords:JLink Reference address:How to use JLink to indirectly burn Nor and Nand Flash of S3C2410 and S3C2440 development boards

Previous article:S3C2440 startup process and assembly code knowledge
Next article:Detailed analysis of the s3c2440 startup process

Latest Microcontroller Articles
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号