Tiny210 (s5pv210) Port U-boot (based on version 2014.4) -- Port NAND Flash

Source: Internet
Author: User
Tags spl

In this section, we start to transplant nand flash: To support nand, We need to configure config_0000_nand by viewing the help documentation DOC/readme. NAND. We need to modify tiny210.h to block config_0000_onenand, and add config_0000_nand:


Compilation error. config_sys_max_nand_device is not defined. The maximum number of NAND devices is defined. Our board has only one nand
Defined as 1


Re-compile. Error: The base address of NAND is not defined. View s5pv210 Manual. The base address of NAND is 0xb0e00000, which is defined in tiny210.h:



Re-compile, or error: env_onenand.c and onenand related, we do not need to compile, view u-boot-2014.04/common/makefile:


With env_nand.o and env_onenand.o, we need to save the environment variables to nand, so we need to define
Config_env_is_in_nand and disable config_env_is_in_onenand.


Re-compile, no board_nand_init is defined, and you can see the name as a board-related NAND initialization function. Search U-boot source code
We found that this function is defined in u-boot-2014.04/Drivers/MTD/NAND/s3c2410_nand.c, we write s5pv210_nand.c, copy s3c2410_nand.c as s5pv210_nand.c:

At the same time view u-boot-2014.04drivers/MTD/NAND/makefile, see how to s5pv210_nand.c compiled into U-boot:


Only when config_nand_s3c2410 is defined will the s3c2410_nand.c be compiled. We will add a line like below:


And define config_nand_s5pv210 in tiny210.h:


Replace all the S3C2410 instances in s5pv210_nand.c with s5pv210, and then modify s5pv210_nand.c. first we need to use the NAND-related register operation in arch/ARM/include/ASM/arch-s5pc1xx/CPU. h:


Then add the macro below:


Then create the file nand_reg.h under ARCH/ARM/include/ASM/arch-s5pc1xx/and define the register structure of NAND:


Then add the header file # include <ASM/ARCH/nand_reg.h> to s5pv210_nand.c.
Initialize board_nand_init and add the s5pv210_nand_select_chip function. This function will call s5pv210_hwcontrol and modify s5pv210_hwcontrol. This function mainly performs hardware-related operations, for example, sending commands, sending addresses, and selecting slices. For details, see the code.
Compiled successfully, the u-boot.bin size has changed to 225172b due to the addition of the NAND driver


We need to modify the copy size in copy_bl2_to_ram in the u-boot-spl.bin 225172/512 = 439
We will change the copy size to 500, and copy KB:


Re-compile, Will tiny210-spl.bin and u-boot.bin burn SD card, from SD card start Development Board:



Print warning: Warning-bad CRC, using default environment
This is because we have specified in smdkv210.h to save the environment variable to NAND. When U-boot starts, it will read the environment variable from the specified address.
If the read fails, the default environment variable is used. The default environment variable is defined in the single board configuration file through a macro such as config. For example, config_ipaddr defined earlier. Run saveenv to save the environment variables to NAND. the following warning will not be reported at next startup:



Execute reset Reset


Now let's test whether the read and write operations of NAND are correct. We will first download an object to the memory through TFTP:

First configure the network to test whether the network is connected:



Download an object to the memory:


Then erase the block starting with the 0x80000 address of NAND.


Then, the data of 0x20000000 bytes starting with 0x800 in the memory is written to the 0x80000 address of the NAND.


Then read 0x80000 bytes of data from the 0x800 address of the NAND to the 0x20002000 address of the memory.


Then, use the CMP command to compare whether the 0x20000000 bytes starting with 0x20002000 are the same.



Total of 2048 byte (s) were the same
We read and write 0x800 bytes, that is, 2048 bytes, all of which are correct.

The transplantation of NAND Flash is successful. Next time we add partitions to the NAND Flash



Tiny210 (s5pv210) Port U-boot (based on version 2014.4) -- Port NAND Flash

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.