Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Subsequently, x-boot loads the images of TF-A (BL31), OP-TEE (BL32), and U-Boot (BL33) from a storage device into DRAM. The CPU (core 0) then switches itself from 32-bit mode to 64-bit by triggering a software reset. It proceeds to awaken other cores (core 1, 2, 3) and transitions them to 64-bit mode. Finally, all cores execute TF-A.

Table of Contents

Table of Contents

Features

...

The flow chart below illustrates the process from i-boot's reset vector to the jump to TF-A for all cores

...

...

x-boot supports many device drivers for accessing devices. The following table shows the locations of drivers in project diretory boot/xboot/ and features of each driver.

...

Drivers

...

Folders

...

Features

...

8-bit NAND

...

nand/

...

Source Files

The source files for x-boot are located in the "boot/xobot/" directory under the project's top folder. The entry point for x-boot is the label "_start" in the assembly file "arch/arm/sp7350/start.S". Notably, "_start" is situated at an offset of 32 bytes within the x-boot module, with the initial 32-byte space reserved for a header. The "_start" subroutine initializes the C execution environment and subsequently jumps to the C main function, the "xboot_main()" subroutine in the "xboot.c" file. The "xboot.c" file serves as the top-level control file for x-boot, governing the entire flow of operations.

The table below lists and explains the main files and folders in x-boot:

Files or folders

Descriptions

adc/

Contains subroutines for ADC.

arch/arm/sp7350/

Houses CPU-relevant codes, including:

  • a64up module

  • CPU and cache-related codes

  • MMU table page creating codes

  • Linker script file: boot.ld

  • Start-up file: start.S

bin/

Output folder

common/

Contains common code, such as verifying images.

configs/

Contains defconfig files for boards.

cpio/

Contains CPIO codes.

draminit/

Contains DRAM-related codes.

fat/

Contains codes for FAT file-system operations.

i2c/

Contains subroutines for I2C interface.

include/

Contains many constant definitions used in x-boot.

lib/

Contains images CRC verification codes.

nand/

Contains SPI-NAND and 8-bit NAND drivers.

otp/

Contains subroutines for accessing OTP.

romshare/

Contains the entry table for accessing secure functions in i-boot.

sdmmc/

Contains SD card and eMMC drivers.

tools/

Contains some utilities used by x-boot.

usb/

Contains USB2.0 and USB3.0 drivers.

warmboot/

Contains a concise version of x-boot for running during warm-boot.

Kconfig

Menu config file of x-boot.

Makefile

Make file of x-boot

xboot.c

Main C file of x-boot.

Driver Specifications and Features

x-boot incorporates a range of device drivers, each offering specific features to facilitate various operations. The following table outlines the detailed specifications and features of these drivers.

Drivers

Specification and features

8-bit NAND

  1. Supports loading U-Boot image from 8-bit NAND flash.

  2. First Requires the first block of 8-bit NAND flash should to contain the Sunplus Boot Profile Header.

  3. Support Supports reading 1K60 ECC sectors.

  4. U-Boot image should be stored in 1K60 sectors.

ADC

adc/

eMMC

sdmmc/

  1. Support Supports loading U-Boot image from the eMMC device.

  2. U-Boot image should be stored at in the User Data Area.

  3. Requires eMMC should to contain the GUID Partition Table (GPT).

I2C driver

i2c/

  1. Support Supports I2C master mode.

  2. Support Supports 100kHz and 400kHz speeds.

NVMEN (OTP)

otp/

  1. Support Supports read and write OTP.

SD card

sdmmc/

  1. Support Supports loading U-Boot image from an SD card.

  2. U-Boot image should be stored at the root directory of the first partition of the SD card.

  3. File-name of the U-Boot image should be u“u-boot.img.

  4. First Requires the first partition of the SD card should to be in FAT32 or FAT16 format.

SPI-NAND

nand/

  1. Support Supports loading U-Boot image from SPI-NAND flash.

  2. First Requires the first block of SPI-NAND flash should to contain the Sunplus Boot Profile Header.

  3. Support Supports reading 1K60 ECC sectors.

  4. U-Boot image should be stored in 1K60 ECC sectors.

  5. Support Supports SPI-NAND flash mounted in X1 or X2 position.

USB2.0 Host

usb/

  1. Support Supports loading U-Boot image from an a USB flash drive in the USB2.0 port.

  2. U-Boot image should be stored at the root directory of the first partition of the USB flash drive.

  3. File-name of the U-Boot image should be u“u-boot.img.

  4. First Requires the first partition of the USB flash drive should to be in FAT32 or FAT16 format.

  5. Support Supports high-speed read operation only

USB3.0 Host

usb/

  1. Support Supports loading U-Boot image from an a USB flash drive in the USB3.0 port.

  2. U-Boot image should be stored at the root directory of the first partition of the USB flash drive.

  3. File-name of the U-Boot image should be u“u-boot.img.

  4. First Requires the first partition of the USB flash drive should to be in FAT32 or FAT16 format.

  5. Support Supports high-speed read operation only

Other files

The following table shows the locations of important forlders or files of x-boot in project diretory boot/xboot/.

...

Type

...

Folders

...

Files

...

machine

...

arch/arm/sp7350/

...

a64up/

...

aboot.S

...

boot.ld

...

cache.c

...

cpu/

...

include/

...

page_table/

...

start.S

...

default config files

...

configs/

...

sp7350_emmc_ev_defconfig

...

sp7350_sdcard_ev_defconfig

All defconfig files are placed at configs/. Normally, the file name proceed with sp7350- and followed by defconfig, like sp7350_emmc_ev_defconfig, sp7350_sdcard_ev_defconfig, and etc.

SRAM Space Allocation

To facilitate program maintenance and data sharing, x-boot and i-boot utilize the same SRAM segment division and structure. Figure 4.2 The figure below illustrates the segmentation of SRAM into 9 segments, ranging ordered from low to high addresses: xboot_buf, bootinfo, boothead, a64up, cdata, storage_buf, stack, bootcompat, and spacc_ram.

...

Below are explanations Let's delve into the purpose of each segment's purpose:

  • xboot_buf: This segment houses the x-boot program segment, where the x-boot program it is loaded and executed.

  • bootinfo: Contains the bootinfo segment containing with the g_bootinfo structure, which records recording essential boot-related information.

  • boothead: The boothead segment holding stores the g_boothead array, used to store for GPT data for in eMMC or header data for in NAND flashflashes.

  • a64up: a64up segment where Dedicated to the a64up program resides module, responsible for transitioning the CPU from 32-bit mode to 64-bit mode.

  • cdata: This is the C data segment containing , hosting global variables or and static variables in C.

  • storage_buf: Device Reserved for device driver data segment for related to boot devices such as like eMMC and NAND flash. Different Multiple boot device drivers share the same this space here during a single boot, as with only one boot device driver is utilized per boot.

  • mmu_pgtbl: Page The page table of MMU.

  • stack: Stack The stack segment where the stack for C is located.

  • bootcomp: CPU run control datafields.

  • reserved: This segment is designated for warm-boot reteion retention data.

During system boot, i-boot reads boot-related information from the boot switch and the OTP (One-Time Programmable) memory within the C chip. This information is then stored in the C structure g_bootinfo structure. Consequently, . x-boot directly utilizes the data in the g_bootinfo structure determines the i-boot boot mode and the subsequent boot process. x-boot directly utilizes the data in the g_bootinfo structure to determine the boot mode and process.to determine the boot mode and process.

x-boot Log and Explanation

Line 1: Banner (version) of x-boot

Line 5: PLLC (CPU frequency) is set to 1.5GHz.

Line 6: PLLL3 (L3 cache frequency) is configured to 1.2GHz.

Line 7: PLLD (DRAM clock) is set to 800MHz, with a data-rate of DDR SDRAM is 3200 Mbps.

Line 14: “{{emmc_boot}}” indicates that x-boot is executing the 'emmc boot' flow.

Line 19: Boot-device is 0x1F (MX[6..2]), indicating eMMC boot.

Line 20: Banner (version) of DDR training firmware

Line 23: DDR SDRAM part number is MT53E1G32D2 version B, with FBGA code ‘D8CJG’.

LIne 24: DDR SDRAM clock is at 1600MHz.

Line 28: The length of the x-boot image is 0xAEA0 (44,704 bytes), excluding DDR training firmware.

Line 29-30: 1D training firmware has benn successfully loaded, with the checksum verified.

Line 42: 1D training has successfully completed.

Line 44-45: 2D training firmware has been successfully loaded, with the checksum verified.

Line 52: 2D training has successfully completed.

LIne 57: Testing DRAM (only 1kB range)

Line 61: The bus clock of eMMC is configured to 200kHz (divisor = 1789) for the IdentifyStorage command.

Line 69: The bus clock of eMMC is adjusted to 25MHz (divisor = 14) for subsequent Read and other commands.

Line 70: Read GPT of eMMC.

LIne 71-73: Loading header of uboot1 image (factory default)

Line 74-78: Loading uboot2 image (the latest update). Size of uboot2 image is 858,952 bytes. The checksum of uboot2 image is successfully verified.

Line 79-81: Loading fip image (including TF-A and OP-TEE images). Size of fip image is 408,462 bytes. The checksum of fip image is successfully verified.

Line 82: uboot image is loaded at 0x00500040.

Line 83: fip image is loaded at 0x01000000.

Line 84: Initializing Cortex M4 hardware. Reset of CM4 is asserted here.

Line 85-86: CPU core is preparing to switch to 64-bit mode, and a64up module is located at 0xFA218400.

Line 87: CPU core 0 is at secure EL3 mode and proceeds to execute TF-A (BL31), which is located at 0x00200000.

Code Block
+++xBoot Feb 14 2024 18:41:41
Remap DRAM for 4GB
ID1 of STI8070X = 0x88
ID2 of STI8070X = 0x01
Set PLLC to 1.5GHz
Set PLLL3 to 1.2GHz
PLLD: 800MHz, DATARATE:3200
0x00001008
0x0000C0BE
0x00000107
[d] xboot.c :397
..mode=0x0000001F

{{emmc_boot}}
[d] common/bootmain.c :76
dev=2
pin=1
.Run draiminit@0xFA208351
bootdevice=0x0000001F
Built at Feb 14 2024 18:41:37
dram_init
dwc_umctl2_lpddr4_1600_SP7350_for_realchip
MT53E1G32D2_B, 2rank, FBGA=D8CJG
SDRAM_SPEED_1600
dwc_ddrphy_phyinit_main 20231212
dwc_ddrphy_phyinit_out_lpddr4_train1d2d_3200_SP7350
bootdevice:0x0000001F
XBOOT_len=0x0000AEA0
1D IMEM checksum ok
1D DMEM checksum ok
Start to wait for the training firmware to complete v.00 !!!
End of CA training.
End of initialization.
End of read enable training.
End of fine write leveling.
End of read dq deskew training.
End of MPR read delay center optimization.
End of Wrtie leveling coarse delay.
End of write delay center optimization.
End of read delay center optimization.
End of max read latency training.
Training has run successfully.(firmware complete)
bootdevice:0x0000001F
2D IMEM checksum ok
2D DMEM checksum ok
Start to wait for the training firmware to complete v.00 !!!
End of initialization.
End of 2D write delay/voltage center optimization.
End of 2D write delay/voltage center optimization.
End of 2D read delay/voltage center optimization.
End of 2D read delay/voltage center optimization.
Training has run successfully.(firmware complete)
Register programming done!!!
Register programming done!!!
dram_init_end
Done draiminit
dram test 0x00800000 - 0x00800400
Set WL_REG_ON (GPIO56) to HI.
[d] sdmmc/drv_sd_mmc.c :21
InitChipCtrl
busclk=200000
div=1789
[d] sdmmc/drv_sd_mmc.c :23
IdentifyStorage
[d] sdmmc/hal_sd_mmc.c :507
busclk=25000000
div=14
[d] sdmmc/hal_sd_mmc.c :1729
[d] sdmmc/drv_sd_mmc.c :33
Read GPT
part1 LBA=0x00000022
emmc load uboot@blk=0x00000022
uboot1 hdr good
part2 LBA=0x00000822
emmc load uboot@blk=0x00000822
data size=858952
verify img...
uboot2 good
emmc load fip@blk=0x00001022
data size=408462
verify img...
uboot @0x00500040
fip @0x01000000
M4 init
32->64
a64up@0xFA218400
core0 S-EL3 @0x00200000