How to put u-boot into SD card
s3c6410 startup process
bl0 in irom loads the bin file from the sd card to iRAM
u-boot.bin has 202KB, how to put it into iRAM which has only 8KB
View CHxx_IROM_ApplicationNote_Rev1.00_080801.pdf reference book
Reference book requirements
If u-boot.bin is larger than 8KB, it must be divided into two parts
The first part is less than or equal to 8KB and is placed in a specified location in the non-volatile memory (there are 6 types) (the specified location is determined by the reference book (actually the program in the iROM))
The second part is to be loaded by the first part, and the location of the second part is determined by the loading function of the first part.
How to split u-boot.bin of u-boot-1.1.6 into two parts, and where to put the second part
Divide into two parts
Part 1: dd if=u-boot.bin of=./bl1.bin bs=512 count=16
Part 2: cp u-boot.bin ./bl2.bin
The two parts are placed in the SD card address
The first part is placed at the address determined by the reference book
The placement address of the second part is determined by the code of the first part: bl1 544 sectors before
# |________________|________|________|______________|______________|(END)
# BL2(512个sector) ENV(32) BL1(16) signature(1) Reserved(1025)
// (u-boot-1.1.6 uses 793KB, u-boot-2018.09 uses 1049KB)
Notice:
The size of BL2 and the size of ENV are defined in the u-boot code
In the new code (2021.01), the size of ENV remains unchanged, but the size of BL2 becomes 1024, which means that BL2 can be 512KB
How to determine the location of the second part and how to move the second part
How the code in the SD card is moved determines where the second part is
How to port the code
#ifdef CONFIG_BOOT_MOVINAND // u-boot-1.1.6/cpu/s3c64xx/start.S
ldr sp, _TEXT_PHY_BASE
bl movi_bl2_copy
b after_copy
#endif
Porting code core
CopyMovitoMem(HSMMC_CHANNEL, MOVI_BL2_POS, MOVI_BL2_BLKCNT, (uint *)BL2_BASE, MOVI_INIT_REQUIRED);
#define CopyMovitoMem(a,b,c,d,e) (((int(*)(int, uint, ushort, uint *, int))(*((uint *)(TCM_BASE + 0x8))))(a,b,c,d,e)) // This code is defined in iTCM
HSMMC_CHANNEL
0
Which channel to use: 0
MOVI_BL2_POS
#define MOVI_BL2_POS (MOVI_LAST_BLKPOS - MOVI_BL1_BLKCNT - MOVI_BL2_BLKCNT - MOVI_ENV_BLKCNT)
Where to move from: Total block size (calculated by the code in iROM, located at the signature) - BL size (16 sectors, determined by the manual) - BL2 size (512, determined by u-boot, so the second part is up to 256KB) - Environment size (32, determined by u-boot)
MOVI_BL2_BLKCNT
#define MOVI_BL2_BLKCNT (PART_SIZE_BL / MOVI_BLKSIZE)
How many blocks to move: 512 blocks, 256KB
BL2_BASE
#define BL2_BASE (CFG_PHY_UBOOT_BASE)
Where to move to: 0x5FE00000, located in sdram
MOVI_INIT_REQUIRED
0
Reinitialize: No
BL1 loads BL2
#ifdef CONFIG_BOOT_ONENAND_IROM
ldr sp, _TEXT_PHY_BASE
bl onenand_bl2_copy
b after_copy
#endif
skip_hw_init:
/* Set up the stack */
stack_setup:
#ifdef CONFIG_MEMORY_UPPER_CODE
ldr sp, =(CFG_UBOOT_BASE + CFG_UBOOT_SIZE - 0xc)
#else
ldr r0, _TEXT_BASE /* upper 128 KiB: relocated uboot */
sub r0, r0, #CFG_MALLOC_LEN /* malloc area */
sub r0, r0, #CFG_GBL_DATA_SIZE /* bdinfo */
#ifdef CONFIG_USE_IRQ
sub r0, r0, #(CONFIG_STACKSIZE_IRQ+CONFIG_STACKSIZE_FIQ)
#endif
sub sp, r0, #12 /* leave 3 words for abort-stack */
#endif
clear_bss:
ldr r0, _bss_start /* find start of bss segment */
ldr r1, _bss_end /* stop here */
mov r2, #0x00000000 /* clear */
clbss_l:
str r2, [r0] /* clear loop... */
add r0, r0, #4
cmp r0, r1
ble clbss_l
// After this sentence, jump to BL2
ldr pc, _start_armboot
_start_armboot:
.word start_armboot
_start_armboot and start_armboot are located in sdram
System.map:23:5fe000e4 t _start_armboot
System.map:148:5fe02b18 T start_armboot
other
bl2 analysis
bl2 starts from start_armboot
start_armboot lib_arm/board.c
main_loop common/main.c
if (bootdelay >= 0 && s && !abortboot (bootdelay)) parse_string_outer // CFG_HUSH_PARSER common/hush.c
parse_stream_outer common/hush.c
run_list common/hush.c
run_list_real common/hush.c
run_pipe_real common/hush.c
LOG
K // This character is the only character printed by bl1
U-Boot 1.1.6-ga513a9d6-dirty (Mar 1 2021 - 16:06:00) for SMDK6410 // This sentence is the first sentence printed by bl2
****************************************
** u-boot 1.1.6 **
** Updated for OK6410 TE6410 Board **
** Version (2012-09-23) **
** OEM: Forlinx Embedded **
** Web: http://www.witech.com.cn **
****************************************
CPU: S3C6410 @532MHz
Fclk = 532MHz, Hclk = 133MHz, Pclk = 66MHz, Serial = CLKUART (SYNC Mode)
Board: SMDK6410
DRAM: 256 MB
Flash: 0 kB
NandFlash Information:
Nandflash:ChipType= SLC ChipName=MT29F16G08ABACAWP
No No Calc pagesize, blocksize, erasesize, use ids table .............
NandFlash:name=NAND 2GiB 1,8V 8-bit,id=38, pagesize=4096 ,chipsize=1024 MB,erasesize=524288 oobsize=128
NandFlash Size is 1024 MB
SD/MMC: SD 2.0 SDHC / Manufacturer: 0xFE,OEM: "42/SD16G",REV: 2.0,S/N: 573,DATE: 2020/8
SDHC size: 30474 MiB
Freq = 50MHz
In: serial
Out: lcd
Err: lcd
Hit any key to stop autoboot: 0
###################### User Menu for OK6410#####################
[1] Format the nand flash
[2] Burn image from SD card
[3] Burn image from USB
[4] Reboot the u-boot
[5] Exit to command line
-----------------------------Select---------------------------------
Enter your Selection:
Previous article:OK6410A Development Board (IV) OK6410A Bare Metal Code
Next article:OK6410A Development Board (Part 2) Environment Familiarization
- Popular Resources
- Popular amplifiers
Professor at Beihang University, dedicated to promoting microcontrollers and embedded systems for over 20 years.
- LED chemical incompatibility test to see which chemicals LEDs can be used with
- Application of ARM9 hardware coprocessor on WinCE embedded motherboard
- What are the key points for selecting rotor flowmeter?
- LM317 high power charger circuit
- A brief analysis of Embest's application and development of embedded medical devices
- Single-phase RC protection circuit
- stm32 PVD programmable voltage monitor
- Introduction and measurement of edge trigger and level trigger of 51 single chip microcomputer
- Improved design of Linux system software shell protection technology
- What to do if the ABB robot protection device stops
- Ford patents pre-charge alarm to help save costs and respond to emergencies
- New real-time microcontroller system from Texas Instruments enables smarter processing in automotive and industrial applications
- Sandia Labs develops battery failure early warning technology to detect battery failures faster
- Ranking of installed capacity of smart driving suppliers from January to September 2024: Rise of independent manufacturers and strong growth of LiDAR market
- Industry first! Xiaopeng announces P7 car chip crowdfunding is completed: upgraded to Snapdragon 8295, fluency doubled
- P22-009_Butterfly E3106 Cord Board Solution
- Keysight Technologies Helps Samsung Electronics Successfully Validate FiRa® 2.0 Safe Distance Measurement Test Case
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Innovation is not limited to Meizhi, Welling will appear at the 2024 China Home Appliance Technology Conference
- Huawei's Strategic Department Director Gai Gang: The cumulative installed base of open source Euler operating system exceeds 10 million sets
- Problems encountered with diode step-down
- DK_MINI_GW1N-LV4LQ144C6I5_V1.1 User Manual
- Confused question about inductor
- Programming with Ada on the Adafruit STM32 Feather Development Board
- Free download in the last day | Example: How IoT technology integrates isolated industrial automation islands
- Make DSP C++ programs as simple and clear as ARM/MCU
- Sharing of power management solutions, please take a look if you are interested.
- The meaning of each section of the TMS320F2812 CMD file
- I really want to participate! Learn!!
- How to protect smart sockets in smart homes?