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 booting sequence… WIP:

MCU ⇒ BROM ⇒ SPLU-BootOS target

Next information actual for MCU ver: 0x0002

Hardware buttons

WIP:

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

More detail: hardware-buttons

Bootmode

i2cget -f -y 2 0x18 0x20

bootmode value
spi 0
mmc 1

OOWOW mode

i2cget -f -y 2 0x18 0x92

oowow_mode value
disabled 0
request 1
activated 2
passed 3
rescue 5

Reboot modes by MCU

i2cset -f -y 2 0x18 0x91 value

oowow_mode value
spi 0
mmc 1
default reboot 2

At this moment all modes works same as spi

Boot modes oowow shell usage

WIP:

Set boot mode

~# bootmode
spi
 
~# bootmode mmc
[i] /opt/bootmode spi -> mmc(sd)
 
~# bootmode
mmc
 
~# 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

Forced hardware reboot

~# mcu_reboot
 
~# i2cset -f -y 2 0x18 0x91 2

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

reboot into oowow
i2cset -f -y 2 0x18 0x92 1
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:

u-boot-spl-mmc.log
U-Boot SPL board init
U-Boot SPL 2017.09 (Sep 15 2022 - 14:38:28)
MCU: bootmode: 1, oowow 3
MCU: oowow 0
board_boot_order: /chosen found, using spl_boot_device()
!!! same-as-spl: 
!!! /mmc@fe2c0000: 
!!! /mmc@fe2e0000: 
!!! /spi@fe2b0000/flash@1: 
Trying to boot from MMC2 :: 0
Card did not respond to voltage select!
mmc_init: -95, time 12
spl: mmc init failed with error: -95
Trying to boot from MMC1 :: 1
Trying fit image at 0x4000 sector

Boot mode spi logs

u-boot-spl-spi.log
U-Boot SPL board init
U-Boot SPL 2017.09 (Sep 15 2022 - 14:38:28)
MCU: bootmode: 0, oowow 3
MCU: oowow 0
board_boot_order: /chosen found, using spl_boot_device()
!!! same-as-spl: 
board_spl_was_booted_from: brom_bootdevice_id 6 maps to '/spi@fe2b0000/flash@1'
+++ /spi@fe2b0000/flash@1: 
!!! /mmc@fe2c0000: 
!!! /mmc@fe2e0000: 
!!! /spi@fe2b0000/flash@1: 
Trying to boot from MTD2 :: 0
Trying fit image at 0x300 sector

Boot OOWOW - hold FUNCTION and short press RESET then release FUNCTION

u-boot-spl-oowow-mode.log
U-Boot SPL board init
U-Boot SPL 2017.09 (Sep 15 2022 - 14:38:28)
MCU: bootmode: 0, oowow 1
MCU: oowow 2
board_boot_order: /chosen found, using spl_boot_device()
!!! same-as-spl: 
+++ /spi@fe2b0000/flash@1: 
!!! /mmc@fe2c0000: 
!!! /mmc@fe2e0000: 
!!! /spi@fe2b0000/flash@1: 
Trying to boot from MTD2 :: 0
Trying fit image at 0x300 sector

Boot SPL from eMMC:

u-boot-spl-mmc.log
U-Boot SPL board init
U-Boot SPL 2017.09 (Oct 18 2022 - 20:45:10)
Trying to boot from MMC2
Card did not respond to voltage select!
mmc_init: -95, time 12
spl: mmc init failed with error: -95
Trying to boot from MMC1
spl: partition error
Trying fit image at 0x4000 sector

Boot SPL from eMMC boot oowow u-boot from SD:

u-boot-spl-mmc-sd-oowow.log
U-Boot SPL board init
U-Boot SPL 2017.09 (Oct 18 2022 - 20:45:10)
Trying to boot from MMC2
part_get_info_efi: *** ERROR: Invalid GPT ***
...
spl: partition error
Trying fit image at 0x4000 sector

SPI and eMMC boot loaders cleared. Boot SPL and oowow u-boot from SD

u-boot-spl-sd-oowow.log
U-Boot SPL board init
U-Boot SPL 2017.09 (Jul 25 2022 - 10:32:06)
MCU: bootmode: 1, oowow 3
MCU: oowow 0
board_boot_order: /chosen found, using spl_boot_device()
!!! same-as-spl: 
!!! /mmc@fe2c0000: 
!!! /mmc@fe2e0000: 
!!! /spi@fe2b0000/flash@1: 
Trying to boot from MMC2 :: 0
Trying fit image at 0x4000 sector

Boot SPL android u-boot from eMMC:

u-boot-spl-mmc-android.log
U-Boot SPL board init
U-Boot SPL 2017.09-gc060f28d70-220414 #zyf (Apr 18 2022 - 18:13:34)
Failed to set cpub01
Failed to set cpub23
Trying to boot from MMC2
MMC: no card present
mmc_init: -123, time 0
spl: mmc init failed with error: -123
Trying to boot from MMC1
Trying fit image at 0x4000 sector

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

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/08 23:41 by hyphop