boards: hifive_unleashed: add support for E51 and U54 targets
Add `hifive_unleashed//e51` (earlier selected by default, using
`hifive_unleashed`) and `hifive_unleashed//u54` 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_unleashed/Kconfig.hifive_unleashed b/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed
index 2fc2f15..da445a3 100644
--- a/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed
+++ b/boards/sifive/hifive_unleashed/Kconfig.hifive_unleashed
@@ -2,4 +2,5 @@
# SPDX-License-Identifier: Apache-2.0
config BOARD_HIFIVE_UNLEASHED
- select SOC_SIFIVE_FREEDOM_FU540
+ select SOC_SIFIVE_FREEDOM_FU540_E51 if BOARD_HIFIVE_UNLEASHED_FU540_E51
+ select SOC_SIFIVE_FREEDOM_FU540_U54 if BOARD_HIFIVE_UNLEASHED_FU540_U54
diff --git a/boards/sifive/hifive_unleashed/doc/index.rst b/boards/sifive/hifive_unleashed/doc/index.rst
index 6479117..e6450ac 100644
--- a/boards/sifive/hifive_unleashed/doc/index.rst
+++ b/boards/sifive/hifive_unleashed/doc/index.rst
@@ -15,9 +15,21 @@
Applications for the ``hifive_unleashed`` board configuration can be built as
usual (see :ref:`build_an_application`) using the corresponding board name:
-.. zephyr-app-commands::
- :board: hifive_unleashed
- :goals: build
+.. tabs::
+
+ .. group-tab:: E51
+
+ .. zephyr-app-commands::
+ :zephyr-app: samples/hello_world
+ :board: hifive_unleashed/fu540/e51
+ :goals: build
+
+ .. group-tab:: U54
+
+ .. zephyr-app-commands::
+ :zephyr-app: samples/hello_world
+ :board: hifive_unleashed/fu540/u54
+ :goals: build
Flashing
========
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed.dts b/boards/sifive/hifive_unleashed/hifive_unleashed.dtsi
similarity index 100%
rename from boards/sifive/hifive_unleashed/hifive_unleashed.dts
rename to boards/sifive/hifive_unleashed/hifive_unleashed.dtsi
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts
new file mode 100644
index 0000000..567fb97
--- /dev/null
+++ b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.dts
@@ -0,0 +1,30 @@
+/*
+ * Copyright (c) 2024 Antmicro <www.antmicro.com>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+/dts-v1/;
+
+#include "hifive_unleashed.dtsi"
+
+/ {
+
+ cpus {
+ cpu@1 {
+ status = "disabled";
+ };
+
+ cpu@2 {
+ status = "disabled";
+ };
+
+ cpu@3 {
+ status = "disabled";
+ };
+
+ cpu@4 {
+ status = "disabled";
+ };
+ };
+
+};
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed.yaml b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.yaml
similarity index 76%
rename from boards/sifive/hifive_unleashed/hifive_unleashed.yaml
rename to boards/sifive/hifive_unleashed/hifive_unleashed_e51.yaml
index 1fb91e4..74d0161 100644
--- a/boards/sifive/hifive_unleashed/hifive_unleashed.yaml
+++ b/boards/sifive/hifive_unleashed/hifive_unleashed_e51.yaml
@@ -1,5 +1,5 @@
-identifier: hifive_unleashed
-name: SiFive HiFive Unleashed
+identifier: hifive_unleashed/fu540/e51
+name: SiFive HiFive Unleashed (E51)
type: mcu
arch: riscv
toolchain:
@@ -8,11 +8,11 @@
simulation: renode
simulation_exec: renode
testing:
+ timeout_multiplier: 6
ignore_tags:
- net
- bluetooth
- flash
- - newlib
- crypto
renode:
uart: sysbus.uart0
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_defconfig b/boards/sifive/hifive_unleashed/hifive_unleashed_e51_defconfig
similarity index 100%
rename from boards/sifive/hifive_unleashed/hifive_unleashed_defconfig
rename to boards/sifive/hifive_unleashed/hifive_unleashed_e51_defconfig
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts
new file mode 100644
index 0000000..53af3e2
--- /dev/null
+++ b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.dts
@@ -0,0 +1,17 @@
+/*
+ * Copyright (c) 2024 Antmicro <www.antmicro.com>
+ *
+ * SPDX-License-Identifier: Apache-2.0
+ */
+
+/dts-v1/;
+
+#include "hifive_unleashed.dtsi"
+
+/ {
+ cpus {
+ cpu@0 {
+ status = "disabled";
+ };
+ };
+};
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed.yaml b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml
similarity index 76%
copy from boards/sifive/hifive_unleashed/hifive_unleashed.yaml
copy to boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml
index 1fb91e4..54b15bb 100644
--- a/boards/sifive/hifive_unleashed/hifive_unleashed.yaml
+++ b/boards/sifive/hifive_unleashed/hifive_unleashed_u54.yaml
@@ -1,5 +1,5 @@
-identifier: hifive_unleashed
-name: SiFive HiFive Unleashed
+identifier: hifive_unleashed/fu540/u54
+name: SiFive HiFive Unleashed (U54)
type: mcu
arch: riscv
toolchain:
@@ -8,11 +8,11 @@
simulation: renode
simulation_exec: renode
testing:
+ timeout_multiplier: 6
ignore_tags:
- net
- bluetooth
- flash
- - newlib
- crypto
renode:
uart: sysbus.uart0
diff --git a/boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig b/boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig
new file mode 100644
index 0000000..21f7ae2
--- /dev/null
+++ b/boards/sifive/hifive_unleashed/hifive_unleashed_u54_defconfig
@@ -0,0 +1,10 @@
+# SPDX-License-Identifier: Apache-2.0
+
+CONFIG_CONSOLE=y
+CONFIG_GPIO=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_unleashed/support/openocd_hifive_unleashed.cfg b/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.cfg
index 1620f6c..f809228 100644
--- a/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.cfg
+++ b/boards/sifive/hifive_unleashed/support/openocd_hifive_unleashed.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-fu540.dtsi b/dts/riscv/sifive/riscv64-fu540.dtsi
index bc9c14e..065870f 100644
--- a/dts/riscv/sifive/riscv64-fu540.dtsi
+++ b/dts/riscv/sifive/riscv64-fu540.dtsi
@@ -32,14 +32,80 @@
#address-cells = <1>;
#size-cells = <0>;
- cpu: cpu@0 {
+ cpu@0 {
compatible = "sifive,e51", "riscv";
device_type = "cpu";
- reg = <0>;
+ i-cache-line-size = <0x4000>;
+ reg = <0x0>;
riscv,isa = "rv64imac_zicsr_zifencei";
- status = "okay";
+ hlic0: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
+ #interrupt-cells = <1>;
+ interrupt-controller;
+ };
+ };
- hlic: interrupt-controller {
+ cpu@1 {
+ compatible = "sifive,u54", "riscv";
+ device_type = "cpu";
+ mmu-type = "riscv,sv39";
+ i-cache-line-size = <0x8000>;
+ d-cache-line-size = <0x8000>;
+ reg = <0x1>;
+ riscv,isa = "rv64gc";
+ hlic1: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
+ #interrupt-cells = <1>;
+ interrupt-controller;
+ };
+ };
+
+ cpu@2 {
+ clock-frequency = <0>;
+ compatible = "sifive,u54", "riscv";
+ device_type = "cpu";
+ mmu-type = "riscv,sv39";
+ i-cache-line-size = <0x8000>;
+ d-cache-line-size = <0x8000>;
+ reg = <0x2>;
+ riscv,isa = "rv64gc";
+ hlic2: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
+ #interrupt-cells = <1>;
+ interrupt-controller;
+ };
+ };
+
+ cpu@3 {
+ clock-frequency = <0>;
+ compatible = "sifive,u54", "riscv";
+ device_type = "cpu";
+ mmu-type = "riscv,sv39";
+ i-cache-line-size = <0x8000>;
+ d-cache-line-size = <0x8000>;
+ reg = <0x3>;
+ riscv,isa = "rv64gc";
+ hlic3: interrupt-controller {
+ compatible = "riscv,cpu-intc";
+ #address-cells = <0>;
+ #interrupt-cells = <1>;
+ interrupt-controller;
+ };
+ };
+
+ cpu@4 {
+ clock-frequency = <0>;
+ compatible = "sifive,u54", "riscv";
+ device_type = "cpu";
+ mmu-type = "riscv,sv39";
+ i-cache-line-size = <0x8000>;
+ d-cache-line-size = <0x8000>;
+ reg = <0x4>;
+ riscv,isa = "rv64gc";
+ hlic4: interrupt-controller {
compatible = "riscv,cpu-intc";
#address-cells = <0>;
#interrupt-cells = <1>;
@@ -102,9 +168,17 @@
reg-names = "mem";
};
+
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>;
+ interrupt-names = "soft0", "timer0", "soft1", "timer1",
+ "soft2", "timer2", "soft3", "timer3",
+ "soft4", "timer4";
reg = <0x2000000 0x10000>;
};
@@ -116,10 +190,14 @@
plic: interrupt-controller@c000000 {
compatible = "sifive,plic-1.0.0";
- #address-cells = <0>;
#interrupt-cells = <2>;
+ #address-cells = <1>;
interrupt-controller;
- interrupts-extended = <&hlic 11>;
+ interrupts-extended = <&hlic0 11
+ &hlic1 11 &hlic1 9
+ &hlic2 11 &hlic2 9
+ &hlic3 11 &hlic3 9
+ &hlic4 11 &hlic4 9>;
reg = <0x0c000000 0x04000000>;
riscv,max-priority = <7>;
riscv,ndev = <52>;
diff --git a/samples/drivers/jesd216/sample.yaml b/samples/drivers/jesd216/sample.yaml
index afc3b20..85f6c07 100644
--- a/samples/drivers/jesd216/sample.yaml
+++ b/samples/drivers/jesd216/sample.yaml
@@ -15,7 +15,8 @@
sample.drivers.jesd216:
platform_exclude:
- hifive1
- - hifive_unleashed
+ - hifive_unleashed/fu540/e51
+ - hifive_unleashed/fu540/u54
- hifive_unmatched
- mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk/mimxrt1176/cm4
diff --git a/soc/sifive/sifive_freedom/fu500/Kconfig b/soc/sifive/sifive_freedom/fu500/Kconfig
index 9e39923..fb54b74 100644
--- a/soc/sifive/sifive_freedom/fu500/Kconfig
+++ b/soc/sifive/sifive_freedom/fu500/Kconfig
@@ -23,3 +23,8 @@
select SOC_EARLY_INIT_HOOK
select INCLUDE_RESET_VECTOR
imply XIP
+
+config SOC_SIFIVE_FREEDOM_FU540_U54
+ bool
+ select RISCV_ISA_EXT_G
+ select CPU_HAS_FPU_DOUBLE_PRECISION
diff --git a/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig b/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig
index 4db8701..e7aafaa 100644
--- a/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig
+++ b/soc/sifive/sifive_freedom/fu500/Kconfig.defconfig
@@ -25,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_FU500
diff --git a/soc/sifive/sifive_freedom/fu500/Kconfig.soc b/soc/sifive/sifive_freedom/fu500/Kconfig.soc
index 87a9e6d..08eb6ac 100644
--- a/soc/sifive/sifive_freedom/fu500/Kconfig.soc
+++ b/soc/sifive/sifive_freedom/fu500/Kconfig.soc
@@ -5,12 +5,20 @@
bool
select SOC_FAMILY_SIFIVE_FREEDOM
-config SOC_SERIES
- default "fu500" if SOC_SERIES_SIFIVE_FREEDOM_FU500
-
config SOC_SIFIVE_FREEDOM_FU540
bool
select SOC_SERIES_SIFIVE_FREEDOM_FU500
+config SOC_SIFIVE_FREEDOM_FU540_E51
+ bool
+ select SOC_SIFIVE_FREEDOM_FU540
+
+config SOC_SIFIVE_FREEDOM_FU540_U54
+ bool
+ select SOC_SIFIVE_FREEDOM_FU540
+
+config SOC_SERIES
+ default "fu500" if SOC_SERIES_SIFIVE_FREEDOM_FU500
+
config SOC
- default "fu540" if SOC_SIFIVE_FREEDOM_FU540
+ default "fu540" if SOC_SIFIVE_FREEDOM_FU540_E51 || SOC_SIFIVE_FREEDOM_FU540_U54
diff --git a/soc/sifive/sifive_freedom/soc.yml b/soc/sifive/sifive_freedom/soc.yml
index 1590d49..9f0d3f1 100644
--- a/soc/sifive/sifive_freedom/soc.yml
+++ b/soc/sifive/sifive_freedom/soc.yml
@@ -7,6 +7,9 @@
- name: fu500
socs:
- name: fu540
+ cpuclusters:
+ - name: e51
+ - name: u54
- name: fu700
socs:
- name: fu740
diff --git a/tests/drivers/console/line_splitting/testcase.yaml b/tests/drivers/console/line_splitting/testcase.yaml
index 05567a7..a0c74f3 100644
--- a/tests/drivers/console/line_splitting/testcase.yaml
+++ b/tests/drivers/console/line_splitting/testcase.yaml
@@ -2,7 +2,7 @@
tags:
- drivers
- console
- platform_allow: hifive1 hifive_unleashed
+ platform_allow: hifive1 hifive_unleashed/fu540/e51
harness: robot
tests:
diff --git a/tests/subsys/zbus/integration/testcase.yaml b/tests/subsys/zbus/integration/testcase.yaml
index e856b41..9443c61 100644
--- a/tests/subsys/zbus/integration/testcase.yaml
+++ b/tests/subsys/zbus/integration/testcase.yaml
@@ -3,7 +3,8 @@
platform_exclude:
- m2gl025_miv
- qemu_cortex_a9
- - hifive_unleashed
+ - hifive_unleashed/fu540/e51
+ - hifive_unleashed/fu540/u54
- fvp_base_revc_2xaemv8a/fvp_base_revc_2xaemv8a/smp/ns
tags: zbus
integration_platforms: