sábado, 21 de setembro de 2024

MILK-V DUOS (SG2000) - RESUMO (SEM eMMC)


  

DUO S

O SoC Sophgo SG2000 tem uma mistura fascinante de núcleos RISC-V de 64 bits (Arm também)…

  • Processador principal: núcleo RISC-V de 64 bits

    T-Head C906 (1,0 GHz)

    (Para  Linux)

  • Coprocessador: Núcleo RISC-V de 64 bits

    T-Head C906 (700 MHz)

    (Sem cache)

  • Processador Alt-Main: Núcleo Arm de 64 bits

    Cortex-A53 (1,0 GHz)

Além de um MCU 8051 de baixo consumo (para tarefas de ativação) e uma unidade de processamento de tensor (para reconhecimento de imagem , não LLM)

Uau, CPUs RISC-V e Arm em um único SoC?

Na verdade, há um interruptor físico que seleciona a CPU principal: RISC-V OU Arm .


Inicialização sem MicroSD

O que acontece se inicializarmos o Milk-V Duo S?

Conecte nosso Dongle USB UART de acordo com as instruções (foto acima)…

Duo SUART USB
GND (pino 6)Terra
TX (Pino 8)RX
RX (Pino 10)TX


Gire o interruptor para que fique em “ RV” (RISC-V) em vez de “ Arm”. (Foto acima)

Ligue a placa via porta USB-C . Conecte-se ao USB UART a 115,2 kbps …

screen /dev/ttyUSB0 115200

O Milk-V Duo S não inicializa porque não vem com o U-Boot Bootloader na memória Flash…

C.SCS/0/0.WD.URPL.USBI.USBEF.BS/EMMC.EMI/25000000/12000000. 
E:eMMC initializing failed
E:Boot failed
E:RESET:plat/mars/platform.c:114

Precisaremos do U-Boot no MicroSD na próxima seção.

Se vemos “ B.SCS em vez de “ C.SCS”…

B.SCS/0/0.WD.URPL.USBI.USBEF.BS/EMMC.EMI/25000000/12000000.

Não, estamos no Modo ARM… Volte para o RISC-V!


Baixe o Linux MicroSD

Milk-V Duo S não inicializa sem MicroSD. E agora?

Inicializamos o Linux no MicroSD , graças ao trabalho incrível de Justin Hammond (Fishwaldo)…

Baixamos a versão mais recente do Milk-V Duo S (SG2000)…

Descompacte a imagem Debian…

## For Linux:
$ sudo apt install lz4

## For macOS:
$ brew install lz4

## Uncompress the download to get `duos_sd.img`
$ lz4 duos_sd.img.lz4

E escreva duos_sd.img para um cartão MicroSD. Use Balena Etcher , GNOME Disks ou dd.

Veremos esses arquivos MicroSD …

## MicroSD Root Folder
$ ls -l /Volumes/boot
-rwx 3494900 System.map-5.10.4-20240329-1+
-rwx  125534 config-5.10.4-20240329-1+
drwx    2048 extlinux
drwx    2048 fdt
-rwx  388608 fip.bin
-rwx 4937389 vmlinuz-5.10.4-20240329-1+

## U-Boot Bootloader Config
$ ls -l /Volumes/boot/extlinux
-rwx 749 extlinux.conf

## Linux Device Tree for SG2000
$ ls -l /Volumes/boot/fdt/linux-image-duos-5.10.4-20240329-1+
-rwx 21575 cv181x_milkv_duos_sd.dtb

Damos uma olhada na configuração do U-Boot Bootloader (que inicializará o NuttX com um pequeno ajuste)

$ cat /Volumes/boot/extlinux/extlinux.conf
...
menu label Debian GNU/Linux trixie/sid 5.10.4-20240329-1+
linux  /vmlinuz-5.10.4-20240329-1+
fdtdir /fdt/linux-image-duos-5.10.4-20240329-1+/
append root=/dev/root console=ttyS0,115200 earlycon=sbi root=/dev/mmcblk0p2 rootwait rw

Veja o que acontece quando inicializamos o MicroSD…



Inicialize o Linux MicroSD

Linux no MicroSD: ele inicializa no Milk-V Duo S?

Sim, o Linux inicializa OK. Primeiro vemos OpenSBI (Supervisor Binary Interface) …

OpenSBI v0.9
Platform Name       : Milk-V DuoS
Platform Features   : mfdeleg
Platform HART Count : 1
Platform Console Device : uart8250
Firmware Base       : 0x8000_0000
Firmware Size       : 132 KB
Runtime SBI Version : 0.3

Domain0 Region00 : 0x7400_0000-0x7400_ffff (I)
Domain0 Region01 : 0x8000_0000-0x8003_ffff ()
Domain0 Region02 : 0x0-0xffff_ffff_ffff_ffff (R,W,X)
Boot HART ISA      : rv64imafdcvsux
Boot HART Features : scounteren,mcounteren,time
Boot HART MIDELEG  : 0x0222
Boot HART MEDELEG  : 0xb109

## OpenSBI boots at 0x8000_0000.
## 0x7400_0000 looks interesting! We'll come back to this

(Veja o Log Completo )

Seguido pelo U-Boot Bootloader …

## U-Boot Boots
U-Boot 2021.10-ga57aa1f2-dirty (Apr 24 2024 - 11:24:46 +0000) cvitek_cv181x
Hit any key to stop autoboot:  0 
Scanning mmc 0:1...
Found /extlinux/extlinux.conf

## U-Boot Menu
1:.Debian GNU/Linux trixie/sid 5.10.4-20240329-1+
2:.Debian GNU/Linux trixie/sid 5.10.4-20240329-1+ (rescue target)
Enter choice: 1

## U-Boot boots Debian Linux
Retrieving file: /vmlinuz-5.10.4-20240329-1+
Retrieving file: /fdt/linux-image-duos-5.10.4-20240329-1+/cv181x_milkv_duos_sd.dtb
Booting using the fdt blob at 0x81200000

Finalmente vemos o Debian Linux …

Starting kernel ...
Linux version 5.10.4-20240329-1+ (root@3abcc283c6ba) (riscv64-unknown-linux-musl-gcc (Xuantie-900 linux-5.10.4 musl gcc Toolchain V2.6.1 B-20220906) 10.2.0, GNU ld (GNU Binutils) 2.35)
...
Debian GNU/Linux trixie/sid duos ttyS0
duos login: 

O Linux funciona muito bem.

Questões: suporte@smartcore.com.br

A SMARTCORE FORNECE CHIPS E MÓDULOS PARA IOT, COMUNICAÇÃO WIRELESS, BIOMETRIA, CONECTIVIDADE, RASTREAMENTO E AUTOMAÇÃO. NOSSO PORTFÓLIO INCLUI MODEM 2G/3G/4G/NB-IOT, SATELITAL, MÓDULOS WIFI, BLUETOOTH, GPS, SIGFOX, LORA, LEITOR DE CARTÃO, LEITOR QR CCODE, MECANISMO DE IMPRESSÃO, MINI-BOARD PC, ANTENA, PIGTAIL, BATERIA, REPETIDOR GPS E SENSORES.



Nenhum comentário:

Postar um comentário