6410 uboot supports SD/sdhccard boot FAT32 File System yaffs2 burning picture display burning status

Source: Internet
Author: User
Tags bmp image

From: http://blog.csdn.net/lxj_com2006/article/details/6732943

Development Board: Feiling 6410 256 m DDR 2g nand (4 K pagesize)



Transplanted uboot: http://download.csdn.net/source/3561490

Samsung irom boot documentation: http://download.csdn.net/source/3561602

Burning tool download: http://download.csdn.net/source/3561492

Raw data BMP Conversion Tool (pic2raw): http://www.mculee.cn/post/%E5%9B%BE%E7%89%87,bmp,raw,%E8%BD%AC%E6%8D%A2.html

Port description:

1. Support for SD/sdhc startup. Related Files:

Include/confisg/smdk6410.h definition # define config_boot_movinand disable // # define config_boot_nand

For other reference, the main function of CPU/cloud64xx/movi. C is to copy bl2 to DDR memory by using the copymmctomem (z, A, B, C, E) function of Samsung irom code,

The first 8 K (BL1) is manually copied when the CPU is powered on. You need to set the CPU startup jumper;

The memory has been configured to 128 MB, and the MMC. bin provided by alicloud only supports 128 MB (MB wasted). It is almost difficult to burn files larger than MB.

Generally, when more and more applications are added, the file system will become larger and larger,

The maximum file size is 253 m, and uboot 2 m (address 0x5fe00000) framebuffer 1 m (0x5fd00000 ),

If this parameter is exceeded, you may need to change the program to multipart burn (currently uboot fat does not support multipart read files ).

2. Burn bin to SD card:

Record;

You can also use the irom_fusing_tool provided by Samsung (the source code can be downloaded from the Internet and can be modified by yourself;

If no tool is available, you can use the winhex tool to directly write the SD card. Note that the offsets written by SD and sdhc are different and they are all written at the end of the SD,

The block size of the card can be obtained through the global variable globalblocksizehide of irom code,

For details, refer to the Samsung irom boot documentation. These uboot codes have been written;

At this point, the SD uboot should be ready to run. Note that the include/configs/smdk6410.h file is in the uboot with MB of memory of Feiling.

The size of cmd_env_size needs to be changed back to 0X4000. This value will be involved in bl2 address calculation in include/movi. h;

3. SD card driver:

The driver file is old, and the sdhccard and sd2.0 protocols are not supported. SD/MMC (2g or below) can;

You need to modify the initialization function hsmmc_init (),

Card initialization sequence for sd2.0

SD rest defaults 0-> sd_send_if_cond defaults 8-> select SD... For more information, see the transplanted code,

For more information, see sd2.0 protocol.

Sdma also has a problem. It is a big part of the system. I tested that when the file is larger than 16 MB, the data read is incorrect. You need to modify the movi_read () function,

Change to read by Bytes each time until block num is read. Why? I have read datasheet carefully,

There should be no problem with the original program. It is estimated that Samsung's sdma is not doing well or there are bugs. It can also be found online, but not much.

4. uboot1.1.6 FAT file system support:

FS/fat. c This file also has a bug. If there is a problem reading the file directory, go to the uboot official website to download the latest code,

Replace fs/fat. C should be replaced directly. I replaced it with a comparison tool;

After supporting the FAT file system, you can copy the compiled u-boot.bin, zimage, rootfs. yaffs2 file directly to the SD card (format the SD card as FAT32 ),

You can use fatload MMC 0x50008000 u-boot.bin; first put the file in the memory, and then run the NAND. Write command to burn the write.

5. Support for yaffs2 burning:

When the NAND write. yaffs command is added, you must note that the yaffs file is directly burned into the NAND, and the kernel is not aware (no file data is detected ),

Because yaffs files are stored in the format of pagesize + OOB, OOB is used to identify file information and cannot be found because it is directly burned.

Note that the pagesize and OOB generated by the mkyaffs2image tool must be matched with uboot. Otherwise, it is useless to burn it in.

Feiling uses the NAND k9gag08u0d_2g 4 K pagesize,

You need to modify kernel/fs/yaffs2/utils/mkyaffs2image. c

# Define chunksize 4096 // 2048
# Define sparesize 128 // 64

If you use other mkyaffs2image. c versions, note the OOB format.

Turn Off kernel NAND drive ECC Hardware Detection

6. Install uboot:

When Samsung 6410 is started from NAND, the Controller only supports 2 k pagesize. Therefore, after switching to 4 K pagesize nand,

As a result, the uboot cannot run. You can split the uboot into 4 K page size pages each 2 K,

Can refer to this cool way: http://bbs.witech.com.cn/archiver? Tid-3743.html

I wanted to use irom boot to start NAND (4 K pagesize is supported directly ),

However, the BIND file requires ECC verification (in fact, it is not required at all, and the NAND 1st blocks are guaranteed). Otherwise, the ECC cannot be enabled and the ECC cannot be canceled,

You have not found the information for writing ECC;

Later, the NAND write. uboot command was added, with a 2 k hop and 4 K hop;

Modify the commom/mongo_nand.c do_nand () function

7. LCD display support:

In actual production, it is impossible for each staff member to access a computer and view the burning status through a serial port,

Added the LCD display burning status (6410 supports layer-5 windows framebuffer, I used layer-2, layer-0 background, layer-1 OSD simultaneously displays serial port printing information, the color is 565 ),

The images displayed in the burning status are stored in the SD card (burnicon. Bin 565 raw data BMP), because uboot is hard to store 480*272*2 byte images, and NAND cannot store images before burning,

It is best to have an SD card.

The Beecher starts to sound 10 times.

Common/LCD. c

Include/confisg/smdk6410.h definition # define config_ LCD

Modify the time sequence of the void LCD _ctrl_init (void * lcdbase) LCD Controller

NOTE: For the byte sequence of the image, 565 is used for small-end (low-byte front), and 6410 LCD controller is used for large-end (high-byte front) by default ), otherwise, the image is not displayed properly in reverse order:

Cloud_wincon0 = cloud_winconx_bppmode_f_16bpp_565 |Initi_winconx_hawswp_enable;


8. Modify the white screen for boot. The default backlight is disabled. After framebuffer is written, enable the backlight;

We modified the LCD circuit board (with a transistor and gpio controlled lt1937 shdn (pin4), which automatically lowers the power and turns off the backlight)

Enable the backlight (gpio height) after the image is displayed, mainly to prevent flash and smooth transition

9. U-boot automatically runs the burning command:

Modify the config_bootcommand macro in include/configs/smdk6410.h to enable U-boot to automatically execute commands.

# Define config_bootcommand "fatload MMC 0:1 0x5fd00000 burnicon. Bin ;"\
"NAND scrub 0x00000000 0x00100000;"/* U-boot */\
"NAND erase 0x00000000 0x00100000 ;"\
"Fatload MMC 0x50008000 u-boot.bin ;"\
"NAND write. uboot 0x50008000 0x00000000 $ filesize ;"\
"NAND scrub 0x00100000 0x00300000 ;"\
"NAND erase 0x00100000 0x00300000 ;"\
"Fatload MMC 0: 1 0x50008000 zimage;"/* kernel zimage */\
"NAND write. E 0x50008000 0x00100000 $ filesize ;"\
"NAND scrub 0x00400000 ;"\
"NAND erase 0x00400000 ;"\
"Fatload MMC 0-1 0x50008000 rootfs. yaffs2;"/* root filesystem yaffs2 */\
"NAND write. yaffs 0x50008000 0x00400000 $ filesize ;"\
"Nand OK"/* beep sound OK */

0x5fd00000 is the address of the Windows framebuffer on the background layer, and burnicon. Bin is a 565 raw data BMP image. You can directly drop it to framebuffer to display the image.

Note:$ FilesizeIndicates the file size. Therefore, the file size must not exceed the size of the kernel NAND Partition Table. Otherwise, an error occurs.

When cramfs is burned, the write size is directly 32 MB. Therefore, errors are prone when the data size is greater than 32 MB. In addition, the system runs the kernel to burn yaffs2, which is not practical.

Supplement: the previous version reads each part in 512 bytes, but now it is changed to 100 k for each read. The speed of reading a M file is increased from seconds to 20 seconds, and the speed is increased by 5 times, however, if I set it to K for each read, data loss may occur. Update code: CPU/89c64xx/hs_mmc.c void movi_read (uint ADDR, uint start_blk, uint blknum) {uint DMA = 0, CMD, multi_blk, I, Count, spare; /* enable interrupt */initi_hsmmc_writew (initi_hsmmc_readw (hm_norintstsen )&~ (Dma_sts_int_en | blockgap_event_sts_int_en), hm_norintstsen); initi_hsmmc_writew (hm_norintsigen &~ (0 xFFFF) | transfercomplete_sig_int_en, hm_norintsigen);/* clear interrupt */clearcommandcompletestatus (); cleardmastatus (); cleartransfercompletestatus (); spare = blknum; count = (blknum * card_oneblocksize_ver1)-1)/(card_oneblocksize_ver1 * 512) + 1; for (I = 0; I <count; I ++) {While (! Check_card_status (); setsystemaddressreg (ADDR); // AHB system address for write ADDR + = card_oneblocksize_ver1 * 512; // 256 K + + notify (6, card_oneblocksize_ver1 ); // maximum DMA buffer size, block size set_blkcnt_register (spare> 512 )? 512: Spare); // block numbers to read/* card start block address to read */If (movi_hc) {set_arg_register (start_blk );} else {set_arg_register (start_blk * card_oneblocksize_ver1);} start_blk + = 512; DMA = 1; multi_blk = (spare> 1); cmd = multi_blk? 18: 17; If (spare> 512) {spare-= 512;}/* Listen 17 signle block, limit 18 mutil block read */set_transfer_mode_register (multi_blk, multi_blk, DMA ); set_register (CMD, 1, mmc_rsp_r1); If (wait_for_assist_done () {printf ("error: Command not complete \ n"); goto error ;} /* Wait for transfer complete */check_dma_int (); error: clearcommandcompletestatus (); cleardmastatus (); cleartransfercompletestatus ();} return ;}

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.