In this update, automatic identification of NAND, MMC, and SD startup is realized (environment variables are stored in nandflash). The nandflash drivers in SD and NAND startup modes are all 8bit hw ecc verification, and adjust the structure of some source code files. You can obtain the source code from the following link, download the previous version, and obtain ver3.1 by referring to the subsequent steps. The principle of this modification is simple and not detailed.
Download the latest source code:
Download ver4.0 source code: U-boot for tiny210 ver4.0
Ver3.1 download:
Ver3.1 source code download: U-boot for tiny210 ver3.1
The following link provides the source code of a previous version.
Download ver3.0 source code: U-boot for tiny 210 ver3.0
Ver2.2 source code download: U-boot for tiny210 ver2.2
Download ver2.1 source code: U-boot for tiny210 ver2.2
Download ver2.1 source code: U-boot for tiny210 ver2.1
Download ver2.0 source code: U-boot for tiny210 ver2.0
Link for modifying and analyzing versions: ver2.0
Ver2.1 ver2.2 ver2.2.1 ver2.2.2 ver
3.0 ver3.1
Ver4.0
Basic functions of ver3.1:
1. SD boot, based on the SPL function of linaro U-boot
2. Load the file from the FAT partition of the SD card to the SDRAM
3. Save the environment variables to the SD card
4. Add the dm9000 NIC Driver and enable the network function (such as TFTP and NFS)
5. Add the tab key command auto-completion Function
6. Fixed the bug:
Fixed bug 1: writing to MMC (0)... mmc_send_cmd: error during transfer: 0x00208001 MMC write failed occurs when the environment variable is saved on the SD card.
Bug 2: Only one environment variable can be saved at a startup.
7. Add the nandflash driver to enable all NAND cmd.
8. Added support for burning and writing the yaffs file system.
9. Modify the nandflash burned to 8-bit hardware ECC verification when the SD card is started and the NAND is started.
10. Add nandflash to start.
+ 11. Add Automatic Identification for NAND or MMC/SD startup. For how to adjust the source code structure, see the source code package of ver3.1. The following describes the modification process and provides a brief analysis: 1. modify ARCH/ARM/CPU/armv7/start. s file. Add "+" to this file: @-32, 7 + 32, 9 @@
# Include <asm-offsets.h>
# Include <config. h>
# Include <version. h>
-
+ # Include <common. h>
+ # Include <configs/tiny210.h>
+ # Include <s5pc110. h>
. Globl _ start
_ Start: B Reset
Ldr pc, _ undefined_instruction
@-176, 8 + 178, 61 @ call_board_init_f:
LDR sp, = (config_sys_init_sp_addr)
Bic sp, SP, #7/* 8-byte alignment for Abi compliance */
LDR r0, = 0x00000000
+ # If defined (config_tiny210) | defined (config_mini210)
+ ADR R4, _ start
+ LDR R5, _ text_base
+ CMP R5 and r4
+ Beq board_init_in_ram
+
+ LDR r0, = pro_id_base
+ LDR R1, [r0, # omr_offset]
+ Bic R2, R1, #0xffffffc1
+
+/* NAND boot */
+ CMP R2, #0x0 @ 512b 4-cycle
+ Moveq R3, # boot_nand
+
+ CMP R2, #0x2 @ 2kb 5-cycle
+ Moveq R3, # boot_nand
+
+ CMP R2, #0x4 @ 4kb 5-cycle 8-bit ECC
+ Moveq R3, # boot_nand
+
+ CMP R2, #0x6 @ 4kb 5-cycle 16-bit ECC
+ Moveq R3, # boot_nand
+
+ CMP R2, #0x8 @ onenand MUX
+ Moveq R3, # boot_onenand
+
+/* SD/MMC boot */
+ CMP R2, # 0xc
+ Moveq R3, # boot_mmcsd
+
+/* Nor boot */
+ CMP R2, #0x14
+ Moveq R3, # boot_nor
+
+/* UART bootong failed */
+ CMP R2, #(0x1 <4)
+ Moveq R3, # boot_sec_dev
+
+ LDR r0, = inf_reg_base
+ STR R3, [r0, # inf_reg3_offset]
+
+ LDR R1, [r0, # inf_reg3_offset]
+ CMP R1, # boot_nand/* 0x0 => boot device is NAND */
+ Beq nand_boot_210
+ CMP R1, # boot_mmcsd
+ Beq mmcsd_boot_210
+
+ Nand_boot_210:
+ BL board_init_f_nand
+
+ Mmcsd_boot_210:
+ BL board_init_f
+ Board_init_in_ram:
+ # Endif
BL board_init_f
-
Functions implemented by the blue code: Read the startup information at the address of pro_id_base + omr_offset (which is a Startup Mode register from which the startup status can be obtained during power-on), with the value 0x0 ~ 0x6 corresponds to several different nandflash boot methods, and 0xc corresponds to MMC/SD boot. When a startup method is determined, the corresponding hex system is stored in the inform3 register. Functions implemented by the red code: Read the inform3 content and jump to the pre-defined boot_nand boot_mmcsd CMP to jump to the Code handler function in the corresponding startup mode. 2. move the Board/Samsung/tiny210/nand_cp.c to the --> ARCH/ARM/CPU/armv7/s5pc1xx/directory and move the Board/Samsung/tiny210/mmc_boot.c to the --> ARCH/ARM/CPU/ the movement of nand_cp.cmmc_boot.c in the armv7/s5pc1xx/directory is mainly to make the directory level clearer and reduce code duplication. Add the red code to arch/ARM/CPU/armv7/s5pc1xx/makefile: @-32, 6 + 32, 10 @ sobjs = cache. o
Sobjs + = reset. o
Cobjs + = clock. o
+ Ifdef config_spl_build
+ Cobjs + = mmc_boot.o
+ Cobjs + = nand_cp.o
+ Endif
SRCS: =$ (sobjs:. O =. s) $ (cobjs:. O =. c)
Objs: =$ (addprefix $ (OBJ), $ (cobjs) $ (sobjs ))
Modify board/Samsung/tiny210/makefile to delete the following red code:-ifdef CONFIG_SPL_BUILD-ifdef config_tiny210_nand_boot
-Cobjs + = mmc_boot.o-endif-ifdef config_tiny210_nand_boot
-Cobjs + = nand_cp.o-endif
-Endif 3. Modify ARCH/ARM/CPU/armv7/s5pc1xx/nand_cp.c and void board_init_f (unsigned long bootflag) --> void board_init_f_nand (unsigned long bootflag)
134 void board_init_f_nand (unsigned long bootflag)
135 {
136 _ attribute _ (noreturn) void (* uboot) (void );
137 copy_uboot_to_ram_nand ();
Delete the following code:-void board_init_r (gd_t * ID, ulong dest_addr) -{-/* function attribute is no-return */-/* This function never executes */-while (1 )-;-}
-Void save_boot_params (u32 r0, u32 R1, u32 R2, u32 R3) {} 4. modify include/Common. h, add the following red code: 243/* ARCH/$ (ARCH)/lib/board. C */
244 void board_init_f (ulong) _ attribute _ (noreturn ));
245 # If defined (config_tiny210) | defined (config_mini210)
246 void board_init_f_nand (ulong) _ attribute _ (noreturn ));
247 # endif
248 void board_init_r (gd_t *, ulong) _ attribute _ (noreturn ));
249 int checkboard (void); 5. Modify ARCH/ARM/lib/board. c261 void board_init_f_nand (ulong bootflag)
262 {
263 while (1 );
264}
265
266 void board_init_f (ulong bootflag)
267 {
268 bd_t * BD;
269 init_fnc_t ** init_fnc_ptr;
270 gd_t * ID; 6. Modify SPL/makefile in make process merge tiny210-spl.bin u-boot.bin104 $ (topdir)/board/$ (boarddir)/tools/mk1_(board+spl.exe \
105 $ (OBJ) u-boot-spl.bin $ (OBJ) $ (board)-SPL. Bin
+ 106 cat $ (OBJ) $ (board)-SPL. Bin $ (topdir)/u-boot.bin> $ (topdir)/$ (board)-uboot. Bin
7. Modify include/configs/tiny210.h to replace the content after 427 rows with/* flash and Environment Organization */
429 # define config_sys_no_flash 1
430 # UNDEF config_assist_imls
431 # define config_ident_string "for FriendlyLEG-TINY210"
432 # define config_dos_partition 1
433
434/* nand_boot & mmcsd_boot by LK */
435 # define config_s5pc11x
436 # define config_env_is_in_nand 1
437 # define config_env_size 0X4000/* 16 KB */
438 # define reserve_block_size (2048)
439 # define bl1_size (8 <10)/* 8 K reserved for BL1 */
440 # define config_env_offset 0x40000
441 # define pai_nand_hwecc
442 # define config_nand_bl1_8bit_ecc
443 # define config_8bit_hw_ecc_slc 1
So far, ver3.0 --> ver3.1 has been modified.
Compile U-boot
$ Make arch = arm cross_compile =/opt/friendlyarm/toolschain/4.5.1/bin/ARM-None-Linux-gnueabi-tiny210_config
$ Make arch = arm cross_compile =/opt/friendlyarm/toolschain/4.5.1/bin/ARM-None-Linux-gnueabi-All SPL my system has two sets of cross tool chains, therefore, you have not added/opt/friendlyarm/toolschain/4.5.1/bin/to the environment variable. You must specify the path when using the toolchain.
1. Start SD to write the U-boot image to the SD card
Connect the SD card to your computer through a card reader (or directly insert it into the laptop card slot) and find the device corresponding to the SD card through "cat/proc/Partitions". My device node is/dev/sdb.
Run the following command:
$ Sudo dd iflag = dsync Oflag = dsync if = tiny210-uboot.bin of =/dev/SDB seek = 1
2. Enable NAND boot to write the U-boot image to the nandflash Development Board using the U-boot for tiny210 enabled on the SD card. Run the following command:
[FriendlyLEG-TINY210] # TFTP 21000000 tiny210-uboot.bin [FriendlyLEG-TINY210] # NAND erase. Chip [FriendlyLEG-TINY210] # NAND write 21000000 0
3c1f4