Khadas Docs

Amazing Khadas, always amazes you!

User Tools

Site Tools


Sidebar

products:sbc:edge2:hardware:edge2-boot-flow

This is an old revision of the document!


Edge2 Boot flow

Edge2 have advanced and flexible boot flow … see also Edge2 boot sequence

MCU ⇒ BROM ⇒ SPLU-BootOS target

Next information actual for MCU ver: 0x0002

Hardware buttons

  • FUNCTION + RESET - oowow mode
  • POWER + RESET - force boot from SD/eMMC.
  • FUNCTION x3 times - flash mode

More detail: hardware-buttons

MCU features

Boot mode

Common boot mode configuration 0x20

boot mode value
spi 0
mmc 1
boot-mode read
i2cget -f -y 2 0x18 0x20

Boot flag

This flag 0x92 will be used one time on next reboot!

boot flag value
disabled 0
OOWOW request 1
boot from SPI 2
boot from eMMC 3
boot-flag read
i2cget -f -y 2 0x18 0x92

Reboot mode

We can reboot device by non standard way via MCU 0x91 register with special options.

reboot mode value
SPI 0
normal reboot 1
eMMC 2
reboot-mode read
i2cset -f -y  2 0x18 0x91 value

Device will be rebooted immediately after successful writing to 0x91 MCU register

Only normal reboot == 1 dos not change boot-flag on next reboot!
SPI == 0 will change boot-flag to 2 on next reboot
eMMC == 2 will change boot-flag to 3 on next reboot

See too: mcu-registers-annotation

Boot modes oowow shell usage

WIP:

Boot mode setup examples

## read current boot-mode
 
~# bootmode
spi
 
## setup to MMC
 
~# bootmode mmc
[i] /opt/bootmode spi -> mmc(sd)
 
~# bootmode
mmc
 
## setup to SPI
 
~# bootmode spi
[i] /opt/bootmode mmc -> spi

Set oowow mode

~# mcu_oowow_mode set 1
[i] set with 1
 
~# mcu_oowow_mode clean
[i] set with 0
 
~# mcu_oowow_mode && echo activated
0x01
activated
 
~# mcu_oowow_mode clean
[i] set with 0
 
~# mcu_oowow_mode || echo disabled
disabled
 
~# i2cset -f -y 2 0x18 0x92 1
 
~# i2cget -f -y 2 0x18 0x92
0x01

Reboot by MCU examples

Forced hardware reboot

## oowow shell
~# mcu_reboot
 
## common system
~# i2cset -f -y 2 0x18 0x91 1

Reboot into OOWOW via i2c command

reboot into oowow
i2cset -f -y 2 0x18 0x92 1
i2cset -f -y 2 0x18 0x91 1

Reboot from SPI flash U-Boot via i2c command

WIP: not works as need

reboot into oowow
i2cset -f -y 2 0x18 0x92 0
i2cset -f -y 2 0x18 0x91 0

SPL stage

SPL boot loader priority: spiemmcsd - hard-coded by MCU and BROM

SPL boot loader priority not same as mcu bootmode. MCU boot mode works only after SPL boot stage passed.

Boot mode mmc logs: WIP:

U-Boot stage

Current u-boot can start OS from USBSDeMMC ⇒ …

oowow spi uboot

boot_targets
kedge2# printenv boot_targets 
boot_targets=usb0 mmc1 mmc0 pxe dhcp fail

mmc uboot

default eMMC u-boot log for Ubuntu images

boot_targets
kedge2# printenv boot_targets 
boot_targets=usb0 mmc1 mmc0 pxe dhcp

Advanced

MCU registers annotation

MCU version: 02 & 03

0x91 REBOOT_MODE
    0 - reset and boot from SPI
    1 - reset normal
    2 - reset and boot from eMMC

0x92 BOOT_FLAG
    0 - normal
    1 - press FUNC boot-up
    2 - reset from SPI boot-up
    3 - reset from eMMC boot-up

See too: mcu-features

U-boot spl

SPI Flash partitions table

MTD parts
0x000000000000-0x000000080000 : "bootloader" # 0x03f800 bytes x 2 > 0x000000 0x040000 < 0
0x000000080000-0x0000000a6000 : "bl2e"       # 0x013000 bytes x 2 > 0x080000 0x093000 < 0x00040000
0x0000000a6000-0x0000000c8000 : "bl2x"       # 0x011000 bytes x 2 > 0x0a6000 0x0b7000 < 0x00053000
0x0000000c8000-0x000000148000 : "ddrfip"     # 0x040000 bytes x 2 > 0x0c8000 0x108000 < 0x00064000
0x000000148000-0x000000448000 : "devfip"     # 0x275000 bytes     > 0x148000          < 0x000a4000
0x000000448000-0x000000488000 : "env"        # zero
0x000000488000-0x0000004c8000 : "dtb"        # zero
0x0000004c8000-0x0000006c8000 : "boot"       # zero
0x0000006c8000-0x000002000000 : "user"       # zero
Last modified: 2023/05/16 00:00 by hyphop