OK6410A development board (Part 3) u-boot-1.1.6 boot analysis

Publisher:qazwsx007Latest update time:2022-09-27 Source: csdnKeywords:OK6410A Reading articles on mobile phones Scan QR code
Read articles on your mobile phone anytime, anywhere

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

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:


Keywords:OK6410A Reference address:OK6410A development board (Part 3) u-boot-1.1.6 boot analysis

Previous article:OK6410A Development Board (IV) OK6410A Bare Metal Code
Next article:OK6410A Development Board (Part 2) Environment Familiarization

Latest Microcontroller Articles
  • Download from the Internet--ARM Getting Started Notes
    A brief introduction: From today on, the ARM notebook of the rookie is open, and it can be regarded as a place to store these notes. Why publish it? Maybe you are interested in it. In fact, the reason for these notes is ...
  • Learn ARM development(22)
    Turning off and on interrupts Interrupts are an efficient dialogue mechanism, but sometimes you don't want to interrupt the program while it is running. For example, when you are printing something, the program suddenly interrupts and another ...
  • Learn ARM development(21)
    First, declare the task pointer, because it will be used later. Task pointer volatile TASK_TCB* volatile g_pCurrentTask = NULL;volatile TASK_TCB* vol ...
  • Learn ARM development(20)
    With the previous Tick interrupt, the basic task switching conditions are ready. However, this "easterly" is also difficult to understand. Only through continuous practice can we understand it. ...
  • Learn ARM development(19)
    After many days of hard work, I finally got the interrupt working. But in order to allow RTOS to use timer interrupts, what kind of interrupts can be implemented in S3C44B0? There are two methods in S3C44B0. ...
  • Learn ARM development(14)
  • Learn ARM development(15)
  • Learn ARM development(16)
  • Learn ARM development(17)
Change More Related Popular Components

EEWorld
subscription
account

EEWorld
service
account

Automotive
development
circle

About Us Customer Service Contact Information Datasheet Sitemap LatestNews


Room 1530, 15th Floor, Building B, No.18 Zhongguancun Street, Haidian District, Beijing, Postal Code: 100190 China Telephone: 008610 8235 0740

Copyright © 2005-2024 EEWORLD.com.cn, Inc. All rights reserved 京ICP证060456号 京ICP备10001474号-1 电信业务审批[2006]字第258号函 京公网安备 11010802033920号