boards: hifive_unmatched: add support for S7 and U74 targets
Add `hifive_unmatched//s7` (earlier selected by default, using
`hifive_unmatched`) and `hifive_unmatched//u74` targets.
Define work-area for other 4 cores in openocd.cfg
Update twister platform white/black lists, to support new targets
Signed-off-by: Jakub Wasilewski <jwasilewski@internships.antmicro.com>
Signed-off-by: Filip Kokosinski <fkokosinski@antmicro.com>
diff --git a/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched b/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched
index 87911f3..77ea79e 100644
--- a/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched
+++ b/boards/sifive/hifive_unmatched/Kconfig.hifive_unmatched
@@ -2,4 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
config BOARD_HIFIVE_UNMATCHED
- select SOC_SIFIVE_FREEDOM_FU740
+ select SOC_SIFIVE_FREEDOM_FU740_S7 if BOARD_HIFIVE_UNMATCHED_FU740_S7
+ select SOC_SIFIVE_FREEDOM_FU740_U74 if BOARD_HIFIVE_UNMATCHED_FU740_U74
diff --git a/boards/sifive/hifive_unmatched/doc/index.rst b/boards/sifive/hifive_unmatched/doc/index.rst
index 2ff4d5d..bc24471 100644
--- a/boards/sifive/hifive_unmatched/doc/index.rst
+++ b/boards/sifive/hifive_unmatched/doc/index.rst
@@ -15,9 +15,21 @@
Applications for the ``hifive_unmatched`` board configuration can be built as
usual (see :ref:`build_an_application`) using the corresponding board name:
-.. zephyr-app-commands::
- :board: hifive_unmatched
- :goals: build
+.. tabs::
+
+ .. group-tab:: S7
+
+ .. zephyr-app-commands::
+ :zephyr-app: samples/hello_world
+ :board: hifive_unmatched/fu740/s7
+ :goals: build
+
+ .. group-tab:: U74
+
+ .. zephyr-app-commands::
+ :zephyr-app: samples/hello_world
+ :board: hifive_unmatched/fu740/u74
+ :goals: build
Flashing
========
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched.dts b/boards/sifive/hifive_unmatched/hifive_unmatched.dtsi
similarity index 100%
rename from boards/sifive/hifive_unmatched/hifive_unmatched.dts
rename to boards/sifive/hifive_unmatched/hifive_unmatched.dtsi
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts
new file mode 100644
index 0000000..a850910
--- /dev/null
+++ b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.dts
@@ -0,0 +1,29 @@
+/*
+ * Copyright (c) 2024 Antmicro <www.antmicro.com>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/dts-v1/;
+
+#include "hifive_unmatched.dtsi"
+
+/ {
+ cpus {
+ cpu@1 {
+ status = "disabled";
+ };
+
+ cpu@2 {
+ status = "disabled";
+ };
+
+ cpu@3 {
+ status = "disabled";
+ };
+
+ cpu@4 {
+ status = "disabled";
+ };
+ };
+};
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched.yaml b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.yaml
similarity index 75%
rename from boards/sifive/hifive_unmatched/hifive_unmatched.yaml
rename to boards/sifive/hifive_unmatched/hifive_unmatched_s7.yaml
index 6fbfb69..171d857 100644
--- a/boards/sifive/hifive_unmatched/hifive_unmatched.yaml
+++ b/boards/sifive/hifive_unmatched/hifive_unmatched_s7.yaml
@@ -1,5 +1,5 @@
-identifier: hifive_unmatched
-name: SiFive HiFive Unmatched
+identifier: hifive_unmatched/fu740/s7
+name: SiFive HiFive Unmatched (S7)
type: mcu
arch: riscv
toolchain:
@@ -8,6 +8,7 @@
simulation: renode
simulation_exec: renode
testing:
+ timeout_multiplier: 6
ignore_tags:
- net
- bluetooth
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_defconfig b/boards/sifive/hifive_unmatched/hifive_unmatched_s7_defconfig
similarity index 100%
rename from boards/sifive/hifive_unmatched/hifive_unmatched_defconfig
rename to boards/sifive/hifive_unmatched/hifive_unmatched_s7_defconfig
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts
new file mode 100644
index 0000000..e8adf2b
--- /dev/null
+++ b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.dts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2024 Antmicro <www.antmicro.com>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/dts-v1/;
+
+#include "hifive_unmatched.dtsi"
+
+/ {
+ cpus {
+ cpu@0 {
+ status = "disabled";
+ };
+ };
+};
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched.yaml b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml
similarity index 74%
copy from boards/sifive/hifive_unmatched/hifive_unmatched.yaml
copy to boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml
index 6fbfb69..09dd76d 100644
--- a/boards/sifive/hifive_unmatched/hifive_unmatched.yaml
+++ b/boards/sifive/hifive_unmatched/hifive_unmatched_u74.yaml
@@ -1,5 +1,5 @@
-identifier: hifive_unmatched
-name: SiFive HiFive Unmatched
+identifier: hifive_unmatched/fu740/u74
+name: SiFive HiFive Unmatched (U74)
type: mcu
arch: riscv
toolchain:
@@ -8,6 +8,7 @@
simulation: renode
simulation_exec: renode
testing:
+ timeout_multiplier: 6
ignore_tags:
- net
- bluetooth
diff --git a/boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig b/boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig
new file mode 100644
index 0000000..b634332
--- /dev/null
+++ b/boards/sifive/hifive_unmatched/hifive_unmatched_u74_defconfig
@@ -0,0 +1,9 @@
+# SPDX-License-Identifier: Apache-2.0
+
+CONFIG_CONSOLE=y
+CONFIG_SERIAL=y
+CONFIG_UART_SIFIVE_PORT_0=y
+CONFIG_UART_CONSOLE=y
+CONFIG_XIP=n
+CONFIG_RV_BOOT_HART=1
+CONFIG_FLOAT_HARD=y
diff --git a/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg b/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg
index 1620f6c..f809228 100644
--- a/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg
+++ b/boards/sifive/hifive_unmatched/support/openocd_hifive_unmatched.cfg
@@ -18,5 +18,9 @@
target create $_TARGETNAME.4 riscv -chain-position $_TARGETNAME -coreid 4
target smp $_TARGETNAME.0 $_TARGETNAME.1 $_TARGETNAME.2 $_TARGETNAME.3 $_TARGETNAME.4
$_TARGETNAME.0 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1
+$_TARGETNAME.1 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1
+$_TARGETNAME.2 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1
+$_TARGETNAME.3 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1
+$_TARGETNAME.4 configure -work-area-phys 0x80000000 -work-area-size 0x4000 -work-area-backup 1
flash bank onboard_spi_flash0 fespi 0x20000000 0 0 0 $_TARGETNAME.0 0x10040000
diff --git a/dts/riscv/sifive/riscv64-fu740.dtsi b/dts/riscv/sifive/riscv64-fu740.dtsi
index 314cc17..4b82d63 100644
--- a/dts/riscv/sifive/riscv64-fu740.dtsi
+++ b/dts/riscv/sifive/riscv64-fu740.dtsi
@@ -38,7 +38,7 @@
riscv,isa = "rv64imac_zicsr_zifencei";
status = "okay";
- hlic: interrupt-controller {
+ hlic0: interrupt-controller {
compatible = "riscv,cpu-intc";
#address-cells = <0>;
#interrupt-cells = <1>;
@@ -52,8 +52,9 @@
reg = <0x1>;
riscv,isa = "rv64gc";
- cpu1_intc: interrupt-controller {
+ hlic1: interrupt-controller {
compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
#interrupt-cells = <1>;
interrupt-controller;
};
@@ -65,8 +66,9 @@
reg = <0x2>;
riscv,isa = "rv64gc";
- cpu2_intc: interrupt-controller {
+ hlic2: interrupt-controller {
compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
#interrupt-cells = <1>;
interrupt-controller;
};
@@ -78,8 +80,9 @@
reg = <0x3>;
riscv,isa = "rv64gc";
- cpu3_intc: interrupt-controller {
+ hlic3: interrupt-controller {
compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
#interrupt-cells = <1>;
interrupt-controller;
};
@@ -91,8 +94,9 @@
reg = <0x4>;
riscv,isa = "rv64gc";
- cpu4_intc: interrupt-controller {
+ hlic4: interrupt-controller {
compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
#interrupt-cells = <1>;
interrupt-controller;
};
@@ -125,7 +129,11 @@
clint: clint@2000000 {
compatible = "sifive,clint0";
- interrupts-extended = <&hlic 3 &hlic 7>;
+ interrupts-extended = <&hlic0 3 &hlic0 7
+ &hlic1 3 &hlic1 7
+ &hlic2 3 &hlic2 7
+ &hlic3 3 &hlic3 7
+ &hlic4 3 &hlic4 7>;
reg = <0x0 0x2000000 0x0 0x10000>;
};
@@ -141,7 +149,11 @@
#address-cells = <0>;
#interrupt-cells = <2>;
interrupt-controller;
- interrupts-extended = <&hlic 11>;
+ interrupts-extended = <&hlic0 11
+ &hlic1 11
+ &hlic2 11
+ &hlic3 11
+ &hlic4 11>;
reg = <0x0 0x0c000000 0x0 0x04000000>;
riscv,max-priority = <7>;
riscv,ndev = <52>;
diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml
index 85f6c07..5dcdc66 100644
--- a/samples/drivers/jesd216/sample.yaml
+++ b/samples/drivers/jesd216/sample.yaml
@@ -17,7 +17,8 @@
- hifive1
- hifive_unleashed/fu540/e51
- hifive_unleashed/fu540/u54
- - hifive_unmatched
+ - hifive_unmatched/fu740/s7
+ - hifive_unmatched/fu740/u74
- mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk/mimxrt1176/cm4
filter: dt_compat_enabled("jedec,spi-nor")
diff --git a/samples/drivers/mspi/mspi_async/sample.yaml b/samples/drivers/mspi/mspi_async/sample.yaml
index 73b5985..3510408 100644
--- a/samples/drivers/mspi/mspi_async/sample.yaml
+++ b/samples/drivers/mspi/mspi_async/sample.yaml
@@ -5,7 +5,7 @@
tags:
- mspi
filter: dt_compat_enabled("mspi-aps6404l")
- platform_exclude: hifive_unmatched
+ platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74
harness: console
harness_config:
type: multi_line
diff --git a/samples/drivers/mspi/mspi_flash/sample.yaml b/samples/drivers/mspi/mspi_flash/sample.yaml
index 3364536..6f71269 100644
--- a/samples/drivers/mspi/mspi_flash/sample.yaml
+++ b/samples/drivers/mspi/mspi_flash/sample.yaml
@@ -6,7 +6,7 @@
- mspi
- flash
filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("mspi-atxp032")
- platform_exclude: hifive_unmatched
+ platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74
harness: console
harness_config:
type: multi_line
diff --git a/samples/drivers/spi_flash/sample.yaml b/samples/drivers/spi_flash/sample.yaml
index 377c5cc..3e9bffa 100644
--- a/samples/drivers/spi_flash/sample.yaml
+++ b/samples/drivers/spi_flash/sample.yaml
@@ -8,7 +8,7 @@
filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("st,stm32-qspi-nor")
or dt_compat_enabled("st,stm32-ospi-nor") or dt_compat_enabled("st,stm32-xspi-nor")
or (dt_compat_enabled("nordic,qspi-nor") and CONFIG_NORDIC_QSPI_NOR)
- platform_exclude: hifive_unmatched
+ platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74
harness: console
harness_config:
type: multi_line
diff --git a/samples/subsys/fs/fs_sample/README.rst b/samples/subsys/fs/fs_sample/README.rst
index d4da8d8..963172b 100644
--- a/samples/subsys/fs/fs_sample/README.rst
+++ b/samples/subsys/fs/fs_sample/README.rst
@@ -73,13 +73,13 @@
Building and Running EXT2 samples
*********************************
-Ext2 sample can be built for ``hifive_unmatched`` or ``bl5340_dvk/nrf5340/cpuapp``. Because
+Ext2 sample can be built for ``hifive_unmatched/fu740/s7`` or ``bl5340_dvk/nrf5340/cpuapp``. Because
FAT is default file system for this sample, additional flags must be passed to build
the sample.
.. zephyr-app-commands::
:zephyr-app: samples/subsys/fs/fs_sample
- :board: hifive_unmatched
+ :board: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74
:gen-args: -DCONF_FILE=prj_ext.conf
:goals: build
:compact:
diff --git a/samples/subsys/fs/fs_sample/sample.yaml b/samples/subsys/fs/fs_sample/sample.yaml
index 91c0fe1..3b670ba 100644
--- a/samples/subsys/fs/fs_sample/sample.yaml
+++ b/samples/subsys/fs/fs_sample/sample.yaml
@@ -73,7 +73,7 @@
simulation_exclude:
- renode
extra_args: CONF_FILE="prj_ext.conf"
- platform_allow: hifive_unmatched bl5340_dvk/nrf5340/cpuapp
+ platform_allow: hifive_unmatched/fu740/s7 bl5340_dvk/nrf5340/cpuapp
sample.filesystem.fat_fs.stm32h747i_disco_m7_sdmmc:
build_only: true
platform_allow: stm32h747i_disco/stm32h747xx/m7
diff --git a/soc/sifive/sifive_freedom/fu700/Kconfig b/soc/sifive/sifive_freedom/fu700/Kconfig
index 7179342..5644ea3 100644
--- a/soc/sifive/sifive_freedom/fu700/Kconfig
+++ b/soc/sifive/sifive_freedom/fu700/Kconfig
@@ -22,3 +22,8 @@
select SOC_EARLY_INIT_HOOK
select INCLUDE_RESET_VECTOR
imply XIP
+
+config SOC_SIFIVE_FREEDOM_FU740_U74
+ bool
+ select RISCV_ISA_EXT_G
+ select CPU_HAS_FPU_DOUBLE_PRECISION
diff --git a/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig b/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig
index 56aab7e..c990500 100644
--- a/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig
+++ b/soc/sifive/sifive_freedom/fu700/Kconfig.defconfig
@@ -1,4 +1,5 @@
# Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com>
+# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0
if SOC_SERIES_SIFIVE_FREEDOM_FU700
@@ -24,4 +25,10 @@
config NUM_IRQS
default 64
+config FPU
+ default y if CPU_HAS_FPU
+
+config RISCV_IMPRECISE_FPU_STATE_TRACKING
+ default y if FPU
+
endif # SOC_SERIES_SIFIVE_FREEDOM_FU700
diff --git a/soc/sifive/sifive_freedom/fu700/Kconfig.soc b/soc/sifive/sifive_freedom/fu700/Kconfig.soc
index db58d77..a46673c 100644
--- a/soc/sifive/sifive_freedom/fu700/Kconfig.soc
+++ b/soc/sifive/sifive_freedom/fu700/Kconfig.soc
@@ -5,12 +5,20 @@
bool
select SOC_FAMILY_SIFIVE_FREEDOM
-config SOC_SERIES
- default "fu700" if SOC_SERIES_SIFIVE_FREEDOM_FU700
-
config SOC_SIFIVE_FREEDOM_FU740
bool
select SOC_SERIES_SIFIVE_FREEDOM_FU700
+config SOC_SIFIVE_FREEDOM_FU740_S7
+ bool
+ select SOC_SIFIVE_FREEDOM_FU740
+
+config SOC_SIFIVE_FREEDOM_FU740_U74
+ bool
+ select SOC_SIFIVE_FREEDOM_FU740
+
+config SOC_SERIES
+ default "fu700" if SOC_SERIES_SIFIVE_FREEDOM_FU700
+
config SOC
- default "fu740" if SOC_SIFIVE_FREEDOM_FU740
+ default "fu740" if SOC_SIFIVE_FREEDOM_FU740_S7 || SOC_SIFIVE_FREEDOM_FU740_U74
diff --git a/soc/sifive/sifive_freedom/soc.yml b/soc/sifive/sifive_freedom/soc.yml
index 9f0d3f1..2f5ebd1 100644
--- a/soc/sifive/sifive_freedom/soc.yml
+++ b/soc/sifive/sifive_freedom/soc.yml
@@ -13,3 +13,6 @@
- name: fu700
socs:
- name: fu740
+ cpuclusters:
+ - name: s7
+ - name: u74
diff --git a/tests/drivers/charger/sbs_charger/testcase.yaml b/tests/drivers/charger/sbs_charger/testcase.yaml
index 18d5d30..c497729 100644
--- a/tests/drivers/charger/sbs_charger/testcase.yaml
+++ b/tests/drivers/charger/sbs_charger/testcase.yaml
@@ -18,7 +18,8 @@
- qemu_kvm_arm64
- xenvm
- xenvm/xenvm/gicv3
- - hifive_unmatched
+ - hifive_unmatched/fu740/s7
+ - hifive_unmatched/fu740/u74
- rcar_h3ulcb/r8a77951/a57
- rcar_salvator_xs
- numaker_pfm_m467
diff --git a/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml b/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml
index 4c295cd..3081e8b 100644
--- a/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml
+++ b/tests/drivers/fuel_gauge/sbs_gauge/testcase.yaml
@@ -11,7 +11,8 @@
- CONF_FILE="prj.conf;boards/emulated_board.conf"
- DTC_OVERLAY_FILE="boards/emulated_board.overlay"
platform_exclude:
- - hifive_unmatched
+ - hifive_unmatched/fu740/s7
+ - hifive_unmatched/fu740/u74
- qemu_cortex_a53
- qemu_cortex_a53/qemu_cortex_a53/smp
- qemu_kvm_arm64
@@ -30,7 +31,7 @@
- simulation
filter: dt_compat_enabled("sbs,sbs-gauge-new-api")
platform_allow:
- - hifive_unmatched
+ - hifive_unmatched/fu740/s7
- qemu_cortex_a53
- qemu_cortex_a53/qemu_cortex_a53/smp
- qemu_kvm_arm64
diff --git a/tests/drivers/memc/ram/testcase.yaml b/tests/drivers/memc/ram/testcase.yaml
index 5d9f768..7af8417 100644
--- a/tests/drivers/memc/ram/testcase.yaml
+++ b/tests/drivers/memc/ram/testcase.yaml
@@ -26,4 +26,4 @@
tags:
- drivers
- memc
- platform_allow: hifive_unmatched
+ platform_allow: hifive_unmatched/fu740/s7
diff --git a/tests/kernel/device/boards/hifive_unmatched.overlay b/tests/kernel/device/boards/hifive_unmatched_fu740_s7.overlay
similarity index 100%
rename from tests/kernel/device/boards/hifive_unmatched.overlay
rename to tests/kernel/device/boards/hifive_unmatched_fu740_s7.overlay
diff --git a/tests/kernel/device/boards/hifive_unmatched.overlay b/tests/kernel/device/boards/hifive_unmatched_fu740_u74.overlay
similarity index 100%
copy from tests/kernel/device/boards/hifive_unmatched.overlay
copy to tests/kernel/device/boards/hifive_unmatched_fu740_u74.overlay
diff --git a/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay b/tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_s7.overlay
similarity index 100%
rename from tests/subsys/fs/ext2/boards/hifive_unmatched.overlay
rename to tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_s7.overlay
diff --git a/tests/subsys/fs/ext2/boards/hifive_unmatched.overlay b/tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_u74.overlay
similarity index 100%
copy from tests/subsys/fs/ext2/boards/hifive_unmatched.overlay
copy to tests/subsys/fs/ext2/boards/hifive_unmatched_fu740_u74.overlay
diff --git a/tests/subsys/fs/ext2/testcase.yaml b/tests/subsys/fs/ext2/testcase.yaml
index bfe58c9..5c6c6df 100644
--- a/tests/subsys/fs/ext2/testcase.yaml
+++ b/tests/subsys/fs/ext2/testcase.yaml
@@ -5,7 +5,8 @@
platform_allow:
- native_sim
- native_sim/native/64
- - hifive_unmatched
+ - hifive_unmatched/fu740/s7
+ - hifive_unmatched/fu740/u74
- bl5340_dvk/nrf5340/cpuapp
extra_args:
- EXTRA_DTC_OVERLAY_FILE="ramdisk_small.overlay"
@@ -22,7 +23,8 @@
simulation_exclude:
- renode
platform_allow:
- - hifive_unmatched
+ - hifive_unmatched/fu740/s7
+ - hifive_unmatched/fu740/u74
- bl5340_dvk/nrf5340/cpuapp
extra_args: CONF_FILE=prj_sdcard.conf