@@ -560,6 +560,8 @@ endmenu
source "package/memtester/Config.in"
source "package/memtool/Config.in"
source "package/mhz/Config.in"
+ source "package/milkv-duo-libraries/Config.in"
+ source "package/milkv-duo-smallcore-freertos/Config.in"
source "package/minicom/Config.in"
source "package/msr-tools/Config.in"
source "package/nanocom/Config.in"
new file mode 100644
@@ -0,0 +1,65 @@
+config BR2_PACKAGE_MILKV_DUO_LIBRARIES
+ bool "milk-v duo libraries"
+ depends on BR2_riscv
+ help
+ Those packages provide board-specific hardware tools and
+ firmware for the Milk-V Duo platform.
+
+if BR2_PACKAGE_MILKV_DUO_LIBRARIES
+
+config BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL
+ bool "milkv-duo-firmware-fsbl"
+ select BR2_PACKAGE_HOST_MTOOLS
+ help
+ This package is obtained from
+ https://github.com/milkv-duo/duo-buildroot-sdk,
+ from which we download the first stage bootloader source and
+ compile it, generating the atf bl2.bin. At the mean time, we
+ will use the fiptool.py in this package to create the binary
+ file fip.bin to pack the opensbi, u-boot and so on.
+
+ If you are using Buildroot to generate the whole SD card
+ Image or the fip.bin, you must say Y to this package!
+
+ https://github.com/gtxzsxxk/milkv-duo-firmware-fsbl
+
+config BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL_64MB
+ bool "64 MiB free ram"
+ default n
+ depends on BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL
+ help
+ Say Y to this will disable the ION in order to
+ have the all 64MiB Free memory.
+
+config BR2_PACKAGE_MILKV_DUO_PINMUX
+ bool "duo-pinmux tool"
+ default n
+ help
+ Say Y to this will compile the duo-pinmux, which can
+ get or set function of any Milk-V Duo GPIO Pin. More info at
+
+ https://milkv.io/docs/duo/application-development/pinmux
+
+ https://github.com/shodan8192/milkv-duo-pinmux
+
+config BR2_PACKAGE_MILKV_DUO_FEATURES
+ bool "duo usb features"
+ default n
+ select BR2_PACKAGE_DHCPCD
+ select BR2_PACKAGE_DNSMASQ
+ select BR2_PACKAGE_DROPBEAR
+ select BR2_PACKAGE_LRZSZ
+ select BR2_PACKAGE_HTOP
+ help
+ Say Y to this will copy the cvitek usb shell scripts to have
+ the USB features. The role could be configured at
+
+ /etc/milkv-duo.conf
+
+ Supported usb functions are rndis, host and mass-storage.
+ By default Duo has the LED blinking. It could be configured
+ in that conf file as well. Say Y to this will also select
+ some packages automatically, to have the same experience
+ with the official release.
+
+endif
new file mode 100644
@@ -0,0 +1,51 @@
+################################################################################
+#
+# milkv-duo-libraries
+#
+################################################################################
+
+MILKV_DUO_LIBRARIES_VERSION = f359994bd497f942bb67734280d81f6640c7c168
+MILKV_DUO_LIBRARIES_SITE = $(call github,milkv-duo,milkv-duo-buildroot-libraries,$(MILKV_DUO_LIBRARIES_VERSION))
+MILKV_DUO_LIBRARIES_INSTALL_STAGING = YES
+MILKV_DUO_LIBRARIES_DEPENDENCIES = host-python3 host-mtools
+MILKV_DUO_LIBRARIES_FSBL_64MB = ION
+
+ifeq ($(BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL_64MB),y)
+MILKV_DUO_LIBRARIES_FSBL_64MB = 64MB
+endif
+
+define MILKV_DUO_LIBRARIES_BUILD_CMDS
+ if [ $(BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL) = y ]; then \
+ $(MAKE) -C $(@D)/firmware \
+ ARCH=riscv BOOT_CPU=riscv CHIP_ARCH=cv180x \
+ PROJECT_FULLNAME=cv1800b_milkv_duo_sd \
+ CROSS_COMPILE=$(TARGET_CROSS) \
+ FREE_RAM_SIZE=$(MILKV_DUO_LIBRARIES_FSBL_64MB) \
+ bl2; \
+ fi
+
+ if [ $(BR2_PACKAGE_MILKV_DUO_PINMUX) = y ]; then \
+ $(TARGET_MAKE_ENV) $(TARGET_CC) $(TARGET_CFLAGS) $(TARGET_LDFLAGS) \
+ -I $(@D)/pinmux/include $(@D)/pinmux/src/*.c -o $(@D)/pinmux/duo-pinmux; \
+ fi
+endef
+
+define MILKV_DUO_LIBRARIES_INSTALL_STAGING_CMDS
+ if [ $(BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL) = y ]; then \
+ $(INSTALL) -D -m 0755 $(@D)/firmware/build/cv180x/bl2.bin $(BINARIES_DIR)/bl2.bin; \
+ $(INSTALL) -D -m 0755 $(@D)/firmware/plat/cv180x/chip_conf.bin $(BINARIES_DIR)/chip_conf.bin; \
+ $(INSTALL) -D -m 0755 $(@D)/firmware/plat/cv180x/fiptool.py $(BINARIES_DIR)/fiptool.py; \
+ $(INSTALL) -D -m 0644 $(@D)/firmware/plat/cv180x/multi.its $(BINARIES_DIR)/multi.its; \
+ $(INSTALL) -D -m 0755 $(@D)/firmware/test/cv181x/ddr_param.bin $(BINARIES_DIR)/ddr_param.bin; \
+ fi
+
+ if [ $(BR2_PACKAGE_MILKV_DUO_PINMUX) = y ]; then \
+ $(INSTALL) -D -m 0755 $(@D)/pinmux/duo-pinmux $(TARGET_DIR)/usr/bin/; \
+ fi
+
+ if [ $(BR2_PACKAGE_MILKV_DUO_FEATURES) = y ]; then \
+ cp $(@D)/overlay/* -r $(TARGET_DIR); \
+ fi
+endef
+
+$(eval $(generic-package))
new file mode 100644
@@ -0,0 +1,21 @@
+config BR2_PACKAGE_MILKV_DUO_SMALLCORE_FREERTOS
+ bool "milkv-duo-smallcore-freertos"
+ depends on BR2_PACKAGE_MILKV_DUO_FIRMWARE_FSBL
+ select BR2_PACKAGE_HOST_CMAKE
+ help
+ This package is obtained from
+ https://github.com/milkv-duo/duo-buildroot-sdk,
+ from which we download the FreeRTOS ported to Milk-V Duo
+ into the Buildroot. This FreeRTOS will run in the small core
+ and will not do anything because it is simply a template
+ with some basic UART demos. You can realize your own ideas
+ by adding code to
+
+ output/build/milkv-duo-smallcore-freertos-hash/cvitek/task
+ /comm/src/riscv64/comm_main.c
+
+ If you say Y, then every time you make Buildroot, it will
+ automatically compile and include the FreeRTOS into the
+ fip.bin, which will then be packed into sdcard.img
+
+ https://github.com/gtxzsxxk/milkv-duo-smallcore-freertos
new file mode 100644
@@ -0,0 +1,108 @@
+################################################################################
+#
+# milkv-duo-smallcore-freertos
+#
+################################################################################
+
+MILKV_DUO_SMALLCORE_FREERTOS_VERSION = 1dac21ade58b0f9a0a531cfe93ee319337a88d80
+MILKV_DUO_SMALLCORE_FREERTOS_SITE = $(call github,milkv-duo,milkv-duo-smallcore-freertos,$(MILKV_DUO_SMALLCORE_FREERTOS_VERSION))
+MILKV_DUO_SMALLCORE_FREERTOS_INSTALL_STAGING = YES
+MILKV_DUO_SMALLCORE_FREERTOS_DEPENDENCIES = host-cmake host-ninja
+MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV = CROSS_COMPILE=$(TARGET_CROSS)
+
+define MILKV_DUO_SMALLCORE_FREERTOS_BUILD_CMDS
+ if [ ! -d $(@D)/cvitek/build/arch ]; then \
+ mkdir -p $(@D)/cvitek/build/arch; \
+ fi
+
+ cd $(@D)/cvitek/build/arch && \
+ $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) -G Ninja -DCHIP=cv180x \
+ -DTOP_DIR=$(@D)/cvitek \
+ -DRUN_TYPE=CVIRTOS \
+ -DRUN_ARCH=riscv64 \
+ -DBUILD_ENV_PATH=$(@D)/cvitek/build \
+ -DCMAKE_TOOLCHAIN_FILE=$(@D)/cvitek/scripts/toolchain-riscv64-elf.cmake \
+ $(@D)/cvitek/arch
+ cd $(@D)/cvitek/build/arch && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target install -- -v
+
+ if [ ! -d $(@D)/cvitek/build/kernel ]; then \
+ mkdir -p $(@D)/cvitek/build/kernel; \
+ fi
+
+ cd $(@D)/cvitek/build/kernel && \
+ $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) -G Ninja -DCHIP=cv180x \
+ -DRUN_ARCH=riscv64 \
+ -DTOP_DIR=$(@D)/cvitek \
+ -DBUILD_ENV_PATH=$(@D)/cvitek/build \
+ -DCMAKE_TOOLCHAIN_FILE=$(@D)/cvitek/scripts/toolchain-riscv64-elf.cmake \
+ $(@D)/cvitek/kernel
+ cd $(@D)/cvitek/build/kernel && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target install -- -v
+
+ if [ ! -d $(@D)/cvitek/build/common ]; then \
+ mkdir -p $(@D)/cvitek/build/common; \
+ fi
+
+ cd $(@D)/cvitek/build/common && \
+ $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) -G Ninja -DCHIP=cv180x \
+ -DRUN_ARCH=riscv64 \
+ -DTOP_DIR=$(@D)/cvitek \
+ -DBUILD_ENV_PATH=$(@D)/cvitek/build \
+ -DCMAKE_TOOLCHAIN_FILE=$(@D)/cvitek/scripts/toolchain-riscv64-elf.cmake \
+ $(@D)/cvitek/common
+ cd $(@D)/cvitek/build/common && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target install -- -v
+
+ if [ ! -d $(@D)/cvitek/build/hal ]; then \
+ mkdir -p $(@D)/cvitek/build/hal; \
+ fi
+
+ cd $(@D)/cvitek/build/hal && \
+ $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) -G Ninja -DCHIP=cv180x \
+ -DRUN_ARCH=riscv64 \
+ -DTOP_DIR=$(@D)/cvitek \
+ -DRUN_TYPE=CVIRTOS \
+ -DBUILD_ENV_PATH=$(@D)/cvitek/build \
+ -DCMAKE_TOOLCHAIN_FILE=$(@D)/cvitek/scripts/toolchain-riscv64-elf.cmake \
+ -DBOARD_FPGA=n \
+ $(@D)/cvitek/hal/cv180x
+ cd $(@D)/cvitek/build/hal && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target install -- -v
+
+ if [ ! -d $(@D)/cvitek/build/driver ]; then \
+ mkdir -p $(@D)/cvitek/build/driver; \
+ fi
+
+ cd $(@D)/cvitek/build/driver && \
+ $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) -G Ninja -DCHIP=cv180x \
+ -DRUN_ARCH=riscv64 \
+ -DTOP_DIR=$(@D)/cvitek \
+ -DRUN_TYPE=CVIRTOS \
+ -DBUILD_ENV_PATH=$(@D)/cvitek/build \
+ -DBOARD_FPGA=n \
+ -DCMAKE_TOOLCHAIN_FILE=$(@D)/cvitek/scripts/toolchain-riscv64-elf.cmake \
+ $(@D)/cvitek/driver
+ cd $(@D)/cvitek/build/driver && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target install -- -v
+
+ if [ ! -d $(@D)/cvitek/build/task ]; then \
+ mkdir -p $(@D)/cvitek/build/task; \
+ fi
+
+ cd $(@D)/cvitek/build/task && \
+ $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) -G Ninja -DCHIP=cv180x \
+ -DRUN_ARCH=riscv64 \
+ -DRUN_TYPE=CVIRTOS \
+ -DTOP_DIR=$(@D)/cvitek \
+ -DBUILD_ENV_PATH=$(@D)/cvitek/build \
+ -DBOARD_FPGA=n \
+ -DCMAKE_TOOLCHAIN_FILE=$(@D)/cvitek/scripts/toolchain-riscv64-elf.cmake \
+ $(@D)/cvitek/task
+ cd $(@D)/cvitek/build/task && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target install -- -v
+ cd $(@D)/cvitek/build/task && $(TARGET_MAKE_ENV) $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV) $(BR2_CMAKE) --build . --target cvirtos.bin -- -v
+endef
+
+define MILKV_DUO_SMALLCORE_FREERTOS_INSTALL_STAGING_CMDS
+ $(INSTALL) -D -m 0755 $(@D)/cvitek/install/bin/cvirtos.bin $(BINARIES_DIR)/cvirtos.bin
+ if [ ! -e $(BINARIES_DIR)/empty.bin ]; then \
+ touch $(BINARIES_DIR)/empty.bin; \
+ fi
+endef
+
+$(eval $(generic-package))
This commit adds the packages that are necessary for milkv-duo image's generating and configurations. Co-authored-by: Emil S <emil.soltys@outlook.com> Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com> --- package/Config.in | 2 + package/milkv-duo-libraries/Config.in | 65 +++++++++++ .../milkv-duo-libraries.mk | 51 +++++++++ .../milkv-duo-smallcore-freertos/Config.in | 21 ++++ .../milkv-duo-smallcore-freertos.mk | 108 ++++++++++++++++++ 5 files changed, 247 insertions(+) create mode 100644 package/milkv-duo-libraries/Config.in create mode 100644 package/milkv-duo-libraries/milkv-duo-libraries.mk create mode 100644 package/milkv-duo-smallcore-freertos/Config.in create mode 100644 package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk