Original address: http://blog.csdn.net/yanghao23/article/details/7689534
Note: When Bootloader is destroyed, the J-link tool can be used to write NAND flash as follows.
(Connect the serial line and J-link line)
In the J-link Commander:
1. Adjust the Jlink transfer speed:
J-link>r//reset
J-link>speed 12000//speed 12M
2. Download the SDRAM initialization tool to the CPU memory 0 address and execute it to initialize the SDRAM:
J-link>loadbin d:\init-sdram.bin 0//load the file to the 0 address of the CPU for initializing SDRAM
J-LINK>SETPC 0//pointing program
J-link>g//go Execution
3. Download the Download-tools.bin file that is running directly in memory to the 0x33f80000 address in SDRAM and execute:
J-link>h//halt Stop (can see CPU information)
J-link>loadbin d:\download-tools.bin 0x33f80000//file uploaded to SDRAM
J-link>setpc 0x33f80000
J-LINK>G//serial port with information display
4. Pause the execution of the download-tools, download the u-boot-hw.bin that will be written to the NAND into the SDRAM 0x30000000, and then restore the Download-tools to run:
J-link>h
J-link>loadbin d:\u-boot-hw.bin 0x30000000//download U-boot to SDRAM start location
J-link>g
In the serial assistant:
5. Use the Download-tools NAND Operation command in SECURECRT to erase the bootloader region of the NAND flash, Then write the u-boot-hw.bin in the 0x30000000 that you just downloaded to the SDRAM into the bootloader area in NAND flash:
Openjtag> NAND Erase 0 40000//erase NAND data 0-40000
openjtag> NAND Write 30000000 0 40000//write the contents of SDRAM 40000 bytes to NAND flash
6. Restart the Development Board
openjtag> Reset
"Paste"-use Jlink Burn write Uboot