Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
21 changes: 18 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -87,7 +87,7 @@ The images, by default, do not allocate any memory for the ION heap, as they are
The images also include the remoteproc and mailbox drivers so you can load up ardunio/freertos images on the small C906 core.

### Additional Packages
This image also adds the debian repository for https://github.com/Fishwaldo/sophgo-sg200x-packages so you can install additional repositories. The debian repository is hosted at
This image can add the debian repository for https://github.com/Fishwaldo/sophgo-sg200x-packages so you can install additional repositories. The debian repository is hosted at
https://sophgo.my-ho.st:8443/ which pulls down the compiled debian packages from the above github repository occasionally.


Expand Down Expand Up @@ -126,9 +126,24 @@ Patches for the kernel, opensbi, u-boot or fsbl can be placed in configs/common/

To assist with developing the image, you can get a shell in the docker container by running:
```
docker run --privileged -it --rm -v ./configs/:/configs -v ./image:/output -v ./scripts/:/builder builder /bin/bash
sudo ./build_docker.sh
sudo docker run --privileged --rm tonistiigi/binfmt --install all
sudo docker run --privileged -it --rm -v ./configs/:/configs -v ./image:/output -v ./scripts/:/builder -v builder /bin/bash
```
or
```
sudo docker run --privileged -it --rm -v ./configs/:/configs -v ./image:/output -v ./scripts/:/builder -v ./keydir/:/keydir builder /bin/bash
```
to enable secure boot.

Inside the container, packages are build in the /builder/ directory, and the rootfs is placed at /rootfs/ directory
```
make BOARD=duos image
```
or to sign the bootloader
```
make BOARD=duos SIGN_FIP=1 image
```
inside the container, packages are build in the /builder/ directory, and the rootfs is placed at /rootfs/ directory

# TODO
- DeviceTree Overlay Support
Expand Down
14 changes: 10 additions & 4 deletions configs/duos/dts/cv181x_milkv_duos_sd.dts
Original file line number Diff line number Diff line change
Expand Up @@ -25,10 +25,12 @@

&spi3 {
status = "okay";

spidev@0 {
status = "okay";
};
spidev0: spidev@0 {
compatible = "spidev";
reg = <0>; /* CS 0 */
spi-max-frequency = <10000000>; /* e.g. 1 MHz */
status = "okay";
};
};

&usb {
Expand All @@ -55,6 +57,10 @@
status = "okay";
};

&uart2 {
status = "okay";
};

&soc_thermal_0 {
cooling-maps {
map0 {
Expand Down
4 changes: 4 additions & 0 deletions configs/duos/linux/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -479,6 +479,10 @@ CONFIG_I2C=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_MUX=y
CONFIG_I2C_DESIGNWARE_PLATFORM=y
CONFIG_SPI=y
CONFIG_SPI_DESIGNWARE=y
CONFIG_SPI_DW_MMIO=y
CONFIG_SPI_SPIDEV=y
# CONFIG_PTP_1588_CLOCK is not set
CONFIG_PINCTRL=y
CONFIG_CVITEK_PINCTRL_CV1835=y
Expand Down
4 changes: 2 additions & 2 deletions configs/duos/settings.mk
Original file line number Diff line number Diff line change
Expand Up @@ -7,9 +7,9 @@ ARCH=riscv
DDR_CFG=ddr3_1866_x16
PARTITION_FILE=partition_$(STORAGE_TYPE).xml

PACKAGES += " duo-pinmux wireless-regdb wpasupplicant cvi-pinmux-cv181x bluez"
PACKAGES += "wireless-regdb wpasupplicant cvi-pinmux-cv181x bluez git zip unzip curl musl-tools"

IMAGE_ADDITIONS += "aic8800-firmware"
IMAGE_ADDITIONS += "ethernet-leds"
IMAGE_ADDITIONS += "usb-switch"
IMAGE_ADDITIONS += "hciattach-service"
IMAGE_ADDITIONS += "hciattach-service"
1 change: 1 addition & 0 deletions configs/duos/u-boot/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -46,6 +46,7 @@ CONFIG_DM_ETH=y
CONFIG_ETH_DESIGNWARE=y
CONFIG_SYS_NS16550=y
CONFIG_SPI=y
CONFIG_SPI_SPIDEV=y
CONFIG_LZ4=y
CONFIG_LZMA=y
# CONFIG_TOOLS_LIBCRYPTO is not set
137 changes: 137 additions & 0 deletions configs/licheervnano/dts/cv181x_licheervnano_sd.dts
Original file line number Diff line number Diff line change
@@ -0,0 +1,137 @@
/dts-v1/;
#include "cv181x_base_riscv.dtsi"
#include "cv181x_asic_qfn.dtsi"
#include "cv181x_asic_sd.dtsi"
#include "cv181x_default_memmap.dtsi"

#include <dt-bindings/input/linux-event-codes.h>
#include <dt-bindings/gpio/gpio.h>
#include <dt-bindings/leds/common.h>
#ifndef __UBOOT__
#include <dt-bindings/mailbox/cvitek-mailbox.h>
#endif

&sd {
min-frequency = <400000>; // 400Khz
//max-frequency = <50000000>; // 50Mhz
max-frequency = <25000000>; // 25Mhz
//max-frequency = <10000000>; // 10Mhz
//max-frequency = <5000000>; // 5Mhz
};


&uart1 {
status = "okay";
};


&i2c4 {
statuc = "okay";
gt9xx: gt9xx@14 {
compatible = "goodix,gt911";
reg = <0x14>;
interrupts = <3 0 IRQ_TYPE_EDGE_FALLING>;
interrupt-parent = <&porte>;
irq-gpios= <&porte 3 0>;
reset-gpios = <&porte 4 0>;
status = "okay";
};
};

&dac {
status = "okay";
/delete-property/ mute-gpio-r;
};

&soc_thermal_0 {
cooling-maps {
map0 {
trip = <&soc_thermal_trip_0>;
cooling-device = <&cv181x_cooling THERMAL_NO_LIMIT 1>;
};
map1 {
trip = <&soc_thermal_trip_1>;
cooling-device = <&cv181x_cooling THERMAL_NO_LIMIT THERMAL_NO_LIMIT>;
};
};
};

/ {
model = "LicheeRv Nano";

/delete-node/ wifi_pin;
/delete-node/ bt_pin;

gpio-keys {
compatible = "gpio-keys";
key-user {
label = "User Key";
linux,code = <KEY_DISPLAYTOGGLE>;
debounce-interval = <1>;
gpios = <&porta 30 1>;
};
};

wifisd:wifi-sd@4320000 {
compatible = "cvitek,cv181x-sdio";
bus-width = <4>;
reg = <0x0 0x4320000 0x0 0x1000>;
reg_names = "core_mem";
src-frequency = <375000000>;
min-frequency = <400000>; // 400Khz
//max-frequency = <50000000>; // 50Mhz
//max-frequency = <45000000>; // 45Mhz
//max-frequency = <40000000>; // 40Mhz
//max-frequency = <35000000>; // 35Mhz
//max-frequency = <30000000>; // 30Mhz
max-frequency = <25000000>; // 25Mhz
//max-frequency = <20000000>; // 20Mhz
//max-frequency = <15000000>; // 15Mhz
//max-frequency = <10000000>; // 10Mhz
//max-frequency = <5000000>; // 5Mhz
64_addressing;
reset_tx_rx_phy;
non-removable;
pll_index = <0x7>;
pll_reg = <0x300207C>;
no-mmc;
no-sd;
status = "okay";
interrupts = <38 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&plic0>;
};

leds {
compatible = "gpio-leds";
led0 {
gpios = <&porta 14 GPIO_ACTIVE_LOW>;
linux,default-trigger = "heartbeat";
function = LED_FUNCTION_HEARTBEAT;
};
};
#ifndef __UBOOT__
mbox: mbox@0x01900000 {
compatible = "cvitek,sg200x-mailbox";
reg = <0x0 0x01900000 0x0 0x1000>;
reg-names = "mailbox";
interrupts = <101 IRQ_TYPE_LEVEL_HIGH>;
interrupt-parent = <&plic0>;
status = "okay";
#mbox-cells = <4>;
};

cv181x-c906_1 {
compatible = "cvitek,cv181x-c906_1";
memory-region = <&fast_image &vdev0vring0 &vdev0vring1 &vdev0buffer>;
firmware = "c906-mcu.elf";
resets = <&rst RST_C906_1>;
reset-names = "sw_reset";
clocks = <&clk CV181X_CLK_C906_1>;
clock-names = "clk_c906_1";
mboxes = <&mbox 0 CVITEK_MBOX_DIRECTION_TX CVITEK_MBOX_C906_1 1>, <&mbox 1 CVITEK_MBOX_DIRECTION_RX CVITEK_MBOX_C906_1 1>;
mbox-names = "vq_tx", "vq_rx";
status = "okay";
};
#endif
};

38 changes: 38 additions & 0 deletions configs/licheervnano/patches/fsbl/0002-add-debug-mode.patch.old
Original file line number Diff line number Diff line change
@@ -0,0 +1,38 @@
From 0e02a58c09c8f520838e372578b14d979a737d18 Mon Sep 17 00:00:00 2001
From: Justin Hammond <[email protected]>
Date: Thu, 18 Apr 2024 13:38:27 +0000
Subject: [PATCH] add debug mode

---
plat/cv180x/bl2/bl2_opt.c | 15 +++++++++++++++
1 file changed, 15 insertions(+)

diff --git a/plat/cv180x/bl2/bl2_opt.c b/plat/cv180x/bl2/bl2_opt.c
index c73fa55..013d5de 100644
--- a/plat/cv180x/bl2/bl2_opt.c
+++ b/plat/cv180x/bl2/bl2_opt.c
@@ -419,6 +419,21 @@ retry_from_flash:

switch_rtc_mode_2nd_stage();

+ if (!(mmio_read_32(GPIO_BASE + 0x050) & (1 << 30))) {
+ NOTICE("=========================================\n");
+ NOTICE("|| Debug Mode ||\n");
+ NOTICE("|| ||\n");
+ NOTICE("=========================================\n");
+
+ mmio_setbits_32(0x3003024, 1 << 6); /* reset the small core */
+
+ /* pinmux was set for jtag by default */
+
+ while(1)
+ ;
+ }
+
+
if (monitor_entry) {
NOTICE("Jump to monitor at 0x%lx.\n", monitor_entry);
jump_to_monitor(monitor_entry, loader_2nd_entry);
--
2.43.0

4 changes: 2 additions & 2 deletions configs/licheervnano/settings.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
CHIP=sg200x
UBOOT_CHIP=sg2002
CHIP=cv181x
UBOOT_CHIP=cv181x
UBOOT_BOARD=licheervnano_sd
BOOT_CPU=riscv
ARCH=riscv
Expand Down
1 change: 1 addition & 0 deletions configs/licheervnano/u-boot/defconfig
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,5 @@ CONFIG_CVI_SOUND_DRIVERS=y
CONFIG_SPI=y
CONFIG_LZ4=y
CONFIG_LZMA=y
CONFIG_TARGET_CVITEK_CV181X=y
# CONFIG_TOOLS_LIBCRYPTO is not set
4 changes: 2 additions & 2 deletions configs/settings.mk
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
KERNELREV="2"
FSBLVERSION=1.0.0
KERNELREV="3"
FSBLVERSION=1.1.0
PACKAGES="ca-certificates debian-archive-keyring dosfstools binutils file tree sudo bash-completion u-boot-menu openssh-server network-manager dnsmasq-base libpam-systemd ppp libengine-pkcs11-openssl iptables systemd-timesyncd vim usbutils parted exfatprogs systemd-sysv i2c-tools net-tools ethtool avahi-utils sudo gnupg rsync gpiod u-boot-tools libubootenv-tool"

IMAGE_ADDITIONS="usb-gadget"
3 changes: 2 additions & 1 deletion scripts/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -14,12 +14,13 @@ RUN apt-get update \
git gperf kmod libexpat-dev \
libgmp-dev libmpc-dev libmpfr-dev libssl-dev \
libtool mmdebstrap openssl parted \
patchutils python3 python3-dev python3-distutils \
patchutils python3 python3-dev python3-pip \
python3-setuptools swig gnupg \
systemd-container texinfo zlib1g-dev wget arch-test \
linux-image-generic genimage joe mc zip \
fakeroot git kernel-wedge quilt ccache flex bison \
libssl-dev dh-exec rsync libelf-dev bc gcc-riscv64-unknown-elf \
&& pip3 install --no-cache-dir --break-system-packages pycryptodome \
&& git clone --depth 1 https://github.com/milkv-duo/host-tools.git /host-tools \
&& rm -rf /host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-elf \
&& rm -rf /host-tools/gcc/gcc-linaro-6.3.1-2017.05-x86_64_aarch64-linux-gnu \
Expand Down
Loading