diff mbox series

[v4,2/3] package/milkv-duo-smallcore-freertos: new package

Message ID tencent_09FFA925CC1CAC0076C6605FE496419B1308@qq.com
State New
Headers show
Series [v4,1/3] package/milkv-duo-libraries: new package | expand

Commit Message

Hanyuan Zhao Feb. 7, 2024, 7:49 a.m. UTC
This commit adds the freertos support for the
RISC-V dev board milk-v duo.

https://github.com/milkv-duo/milkv-duo-smallcore-freertos

Co-authored-by: Emil S <emil.soltys@outlook.com>
Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com>

---
Changes v3 -> v4:
  - Move the make recipes to the repo
  - Bump the version to latest

Changes v2 -> v3:
  - No Changes

Changes v1 -> v2:
  - Set the depends and select logic
  - Add host tools
---
 package/Config.in                             |  1 +
 .../milkv-duo-smallcore-freertos/Config.in    | 21 ++++++++++++++++++
 .../milkv-duo-smallcore-freertos.mk           | 22 +++++++++++++++++++
 3 files changed, 44 insertions(+)
 create mode 100644 package/milkv-duo-smallcore-freertos/Config.in
 create mode 100644 package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk

Comments

Giulio Benetti Feb. 7, 2024, 11:39 a.m. UTC | #1
Hi Hanyuan,

On 07/02/24 08:49, Hanyuan Zhao wrote:
> This commit adds the freertos support for the
> RISC-V dev board milk-v duo.
> 
> https://github.com/milkv-duo/milkv-duo-smallcore-freertos
> 
> Co-authored-by: Emil S <emil.soltys@outlook.com>
> Signed-off-by: Hanyuan Zhao <hanyuan-z@qq.com>
> 
> ---
> Changes v3 -> v4:
>    - Move the make recipes to the repo
>    - Bump the version to latest
> 
> Changes v2 -> v3:
>    - No Changes
> 
> Changes v1 -> v2:
>    - Set the depends and select logic
>    - Add host tools
> ---
>   package/Config.in                             |  1 +
>   .../milkv-duo-smallcore-freertos/Config.in    | 21 ++++++++++++++++++
>   .../milkv-duo-smallcore-freertos.mk           | 22 +++++++++++++++++++
>   3 files changed, 44 insertions(+)
>   create mode 100644 package/milkv-duo-smallcore-freertos/Config.in
>   create mode 100644 package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk
> 
> diff --git a/package/Config.in b/package/Config.in
> index 322aba90b8..7be3316f71 100644
> --- a/package/Config.in
> +++ b/package/Config.in
> @@ -565,6 +565,7 @@ endmenu
>   	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"
> diff --git a/package/milkv-duo-smallcore-freertos/Config.in b/package/milkv-duo-smallcore-freertos/Config.in
> new file mode 100644
> index 0000000000..8503932461
> --- /dev/null
> +++ b/package/milkv-duo-smallcore-freertos/Config.in
> @@ -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/milkv-duo/milkv-duo-smallcore-freertos
> diff --git a/package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk b/package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk
> new file mode 100644
> index 0000000000..1d8d4fcf12
> --- /dev/null
> +++ b/package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk
> @@ -0,0 +1,22 @@
> +################################################################################
> +#
> +# milkv-duo-smallcore-freertos
> +#
> +################################################################################
> +
> +MILKV_DUO_SMALLCORE_FREERTOS_VERSION = 10b86e308ca2305a464ae2bb3eb868a72295f7ab
> +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) MK_ENV=$(TARGET_MAKE_ENV) TARGET_CMAKE=$(BR2_CMAKE) BUILD_PATH=$(@D)
> +
> +define MILKV_DUO_SMALLCORE_FREERTOS_BUILD_CMDS
> +	$(MAKE) -C $(@D) all $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV)
> +endef
> +
> +define MILKV_DUO_SMALLCORE_FREERTOS_INSTALL_STAGING_CMDS
> +	$(INSTALL) -D -m 0755 $(@D)/cvitek/install/bin/cvirtos.bin $(BINARIES_DIR)/cvirtos.bin
> +	touch $(BINARIES_DIR)/empty.bin
> +endef
> +
> +$(eval $(generic-package))

It looks good to me, moving build system to repository made it really
easier, so:
Reviewed-by: Giulio Benetti <giulio.benetti@benettiengineering.com>

Just FYI, buildroot also deal with cmake package using:
$(eval $(cmake-package))
so in the future you can use that or other infrastructure that it
provides that you can find under buildroot/package/pkg-*.mk

Best regards
diff mbox series

Patch

diff --git a/package/Config.in b/package/Config.in
index 322aba90b8..7be3316f71 100644
--- a/package/Config.in
+++ b/package/Config.in
@@ -565,6 +565,7 @@  endmenu
 	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"
diff --git a/package/milkv-duo-smallcore-freertos/Config.in b/package/milkv-duo-smallcore-freertos/Config.in
new file mode 100644
index 0000000000..8503932461
--- /dev/null
+++ b/package/milkv-duo-smallcore-freertos/Config.in
@@ -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/milkv-duo/milkv-duo-smallcore-freertos
diff --git a/package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk b/package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk
new file mode 100644
index 0000000000..1d8d4fcf12
--- /dev/null
+++ b/package/milkv-duo-smallcore-freertos/milkv-duo-smallcore-freertos.mk
@@ -0,0 +1,22 @@ 
+################################################################################
+#
+# milkv-duo-smallcore-freertos
+#
+################################################################################
+
+MILKV_DUO_SMALLCORE_FREERTOS_VERSION = 10b86e308ca2305a464ae2bb3eb868a72295f7ab
+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) MK_ENV=$(TARGET_MAKE_ENV) TARGET_CMAKE=$(BR2_CMAKE) BUILD_PATH=$(@D)
+
+define MILKV_DUO_SMALLCORE_FREERTOS_BUILD_CMDS
+	$(MAKE) -C $(@D) all $(MILKV_DUO_SMALLCORE_FREERTOS_CONF_ENV)
+endef
+
+define MILKV_DUO_SMALLCORE_FREERTOS_INSTALL_STAGING_CMDS
+	$(INSTALL) -D -m 0755 $(@D)/cvitek/install/bin/cvirtos.bin $(BINARIES_DIR)/cvirtos.bin
+	touch $(BINARIES_DIR)/empty.bin
+endef
+
+$(eval $(generic-package))