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>
This commit is contained in:
Jakub Wasilewski 2024-05-28 10:51:38 +02:00 committed by Fabio Baltieri
commit 8e881959a4
29 changed files with 270 additions and 30 deletions

View file

@ -2,4 +2,5 @@
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
config BOARD_HIFIVE_UNMATCHED 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

View file

@ -15,9 +15,21 @@ Building
Applications for the ``hifive_unmatched`` board configuration can be built as Applications for the ``hifive_unmatched`` board configuration can be built as
usual (see :ref:`build_an_application`) using the corresponding board name: usual (see :ref:`build_an_application`) using the corresponding board name:
.. zephyr-app-commands:: .. tabs::
:board: hifive_unmatched
:goals: build .. 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 Flashing
======== ========

View file

@ -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";
};
};
};

View file

@ -1,5 +1,5 @@
identifier: hifive_unmatched identifier: hifive_unmatched/fu740/s7
name: SiFive HiFive Unmatched name: SiFive HiFive Unmatched (S7)
type: mcu type: mcu
arch: riscv arch: riscv
toolchain: toolchain:
@ -8,6 +8,7 @@ ram: 3840
simulation: renode simulation: renode
simulation_exec: renode simulation_exec: renode
testing: testing:
timeout_multiplier: 6
ignore_tags: ignore_tags:
- net - net
- bluetooth - bluetooth

View file

@ -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";
};
};
};

View file

@ -0,0 +1,21 @@
identifier: hifive_unmatched/fu740/u74
name: SiFive HiFive Unmatched (U74)
type: mcu
arch: riscv
toolchain:
- zephyr
ram: 3840
simulation: renode
simulation_exec: renode
testing:
timeout_multiplier: 6
ignore_tags:
- net
- bluetooth
renode:
uart: sysbus.uart0
resc: boards/sifive/hifive_unmatched/support/hifive_unmatched.resc
supported:
- spi
- memc
vendor: sifive

View file

@ -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

View file

@ -18,5 +18,9 @@ target create $_TARGETNAME.3 riscv -chain-position $_TARGETNAME -coreid 3
target create $_TARGETNAME.4 riscv -chain-position $_TARGETNAME -coreid 4 target create $_TARGETNAME.4 riscv -chain-position $_TARGETNAME -coreid 4
target smp $_TARGETNAME.0 $_TARGETNAME.1 $_TARGETNAME.2 $_TARGETNAME.3 $_TARGETNAME.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.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 flash bank onboard_spi_flash0 fespi 0x20000000 0 0 0 $_TARGETNAME.0 0x10040000

View file

@ -38,7 +38,7 @@
riscv,isa = "rv64imac_zicsr_zifencei"; riscv,isa = "rv64imac_zicsr_zifencei";
status = "okay"; status = "okay";
hlic: interrupt-controller { hlic0: interrupt-controller {
compatible = "riscv,cpu-intc"; compatible = "riscv,cpu-intc";
#address-cells = <0>; #address-cells = <0>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
@ -52,8 +52,9 @@
reg = <0x1>; reg = <0x1>;
riscv,isa = "rv64gc"; riscv,isa = "rv64gc";
cpu1_intc: interrupt-controller { hlic1: interrupt-controller {
compatible = "riscv,cpu-intc"; compatible = "riscv,cpu-intc";
#address-cells = <0>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-controller; interrupt-controller;
}; };
@ -65,8 +66,9 @@
reg = <0x2>; reg = <0x2>;
riscv,isa = "rv64gc"; riscv,isa = "rv64gc";
cpu2_intc: interrupt-controller { hlic2: interrupt-controller {
compatible = "riscv,cpu-intc"; compatible = "riscv,cpu-intc";
#address-cells = <0>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-controller; interrupt-controller;
}; };
@ -78,8 +80,9 @@
reg = <0x3>; reg = <0x3>;
riscv,isa = "rv64gc"; riscv,isa = "rv64gc";
cpu3_intc: interrupt-controller { hlic3: interrupt-controller {
compatible = "riscv,cpu-intc"; compatible = "riscv,cpu-intc";
#address-cells = <0>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-controller; interrupt-controller;
}; };
@ -91,8 +94,9 @@
reg = <0x4>; reg = <0x4>;
riscv,isa = "rv64gc"; riscv,isa = "rv64gc";
cpu4_intc: interrupt-controller { hlic4: interrupt-controller {
compatible = "riscv,cpu-intc"; compatible = "riscv,cpu-intc";
#address-cells = <0>;
#interrupt-cells = <1>; #interrupt-cells = <1>;
interrupt-controller; interrupt-controller;
}; };
@ -125,7 +129,11 @@
clint: clint@2000000 { clint: clint@2000000 {
compatible = "sifive,clint0"; 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>; reg = <0x0 0x2000000 0x0 0x10000>;
}; };
@ -141,7 +149,11 @@
#address-cells = <0>; #address-cells = <0>;
#interrupt-cells = <2>; #interrupt-cells = <2>;
interrupt-controller; interrupt-controller;
interrupts-extended = <&hlic 11>; interrupts-extended = <&hlic0 11
&hlic1 11
&hlic2 11
&hlic3 11
&hlic4 11>;
reg = <0x0 0x0c000000 0x0 0x04000000>; reg = <0x0 0x0c000000 0x0 0x04000000>;
riscv,max-priority = <7>; riscv,max-priority = <7>;
riscv,ndev = <52>; riscv,ndev = <52>;

View file

@ -17,7 +17,8 @@ tests:
- hifive1 - hifive1
- hifive_unleashed/fu540/e51 - hifive_unleashed/fu540/e51
- hifive_unleashed/fu540/u54 - hifive_unleashed/fu540/u54
- hifive_unmatched - hifive_unmatched/fu740/s7
- hifive_unmatched/fu740/u74
- mimxrt1170_evk/mimxrt1176/cm7 - mimxrt1170_evk/mimxrt1176/cm7
- mimxrt1170_evk/mimxrt1176/cm4 - mimxrt1170_evk/mimxrt1176/cm4
filter: dt_compat_enabled("jedec,spi-nor") filter: dt_compat_enabled("jedec,spi-nor")

View file

@ -5,7 +5,7 @@ tests:
tags: tags:
- mspi - mspi
filter: dt_compat_enabled("mspi-aps6404l") filter: dt_compat_enabled("mspi-aps6404l")
platform_exclude: hifive_unmatched platform_exclude: hifive_unmatched/fu740/s7 hifive_unmatched/fu740/u74
harness: console harness: console
harness_config: harness_config:
type: multi_line type: multi_line

View file

@ -6,7 +6,7 @@ tests:
- mspi - mspi
- flash - flash
filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("mspi-atxp032") 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: console
harness_config: harness_config:
type: multi_line type: multi_line

View file

@ -8,7 +8,7 @@ tests:
filter: dt_compat_enabled("jedec,spi-nor") or dt_compat_enabled("st,stm32-qspi-nor") 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("st,stm32-ospi-nor") or dt_compat_enabled("st,stm32-xspi-nor")
or (dt_compat_enabled("nordic,qspi-nor") and CONFIG_NORDIC_QSPI_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: console
harness_config: harness_config:
type: multi_line type: multi_line

View file

@ -73,13 +73,13 @@ sample lists them out on the debug serial output.
Building and Running EXT2 samples 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 FAT is default file system for this sample, additional flags must be passed to build
the sample. the sample.
.. zephyr-app-commands:: .. zephyr-app-commands::
:zephyr-app: samples/subsys/fs/fs_sample :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 :gen-args: -DCONF_FILE=prj_ext.conf
:goals: build :goals: build
:compact: :compact:

View file

@ -73,7 +73,7 @@ tests:
simulation_exclude: simulation_exclude:
- renode - renode
extra_args: CONF_FILE="prj_ext.conf" 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: sample.filesystem.fat_fs.stm32h747i_disco_m7_sdmmc:
build_only: true build_only: true
platform_allow: stm32h747i_disco/stm32h747xx/m7 platform_allow: stm32h747i_disco/stm32h747xx/m7

View file

@ -22,3 +22,8 @@ config SOC_SERIES_SIFIVE_FREEDOM_FU700
select SOC_EARLY_INIT_HOOK select SOC_EARLY_INIT_HOOK
select INCLUDE_RESET_VECTOR select INCLUDE_RESET_VECTOR
imply XIP imply XIP
config SOC_SIFIVE_FREEDOM_FU740_U74
bool
select RISCV_ISA_EXT_G
select CPU_HAS_FPU_DOUBLE_PRECISION

View file

@ -1,4 +1,5 @@
# Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com> # Copyright (c) 2017 Jean-Paul Etienne <fractalclone@gmail.com>
# Copyright (c) 2024 Antmicro <www.antmicro.com>
# SPDX-License-Identifier: Apache-2.0 # SPDX-License-Identifier: Apache-2.0
if SOC_SERIES_SIFIVE_FREEDOM_FU700 if SOC_SERIES_SIFIVE_FREEDOM_FU700
@ -24,4 +25,10 @@ config MAX_IRQ_PER_AGGREGATOR
config NUM_IRQS config NUM_IRQS
default 64 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 endif # SOC_SERIES_SIFIVE_FREEDOM_FU700

View file

@ -5,12 +5,20 @@ config SOC_SERIES_SIFIVE_FREEDOM_FU700
bool bool
select SOC_FAMILY_SIFIVE_FREEDOM select SOC_FAMILY_SIFIVE_FREEDOM
config SOC_SERIES
default "fu700" if SOC_SERIES_SIFIVE_FREEDOM_FU700
config SOC_SIFIVE_FREEDOM_FU740 config SOC_SIFIVE_FREEDOM_FU740
bool bool
select SOC_SERIES_SIFIVE_FREEDOM_FU700 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 config SOC
default "fu740" if SOC_SIFIVE_FREEDOM_FU740 default "fu740" if SOC_SIFIVE_FREEDOM_FU740_S7 || SOC_SIFIVE_FREEDOM_FU740_U74

View file

@ -13,3 +13,6 @@ family:
- name: fu700 - name: fu700
socs: socs:
- name: fu740 - name: fu740
cpuclusters:
- name: s7
- name: u74

View file

@ -18,7 +18,8 @@ tests:
- qemu_kvm_arm64 - qemu_kvm_arm64
- xenvm - xenvm
- xenvm/xenvm/gicv3 - xenvm/xenvm/gicv3
- hifive_unmatched - hifive_unmatched/fu740/s7
- hifive_unmatched/fu740/u74
- rcar_h3ulcb/r8a77951/a57 - rcar_h3ulcb/r8a77951/a57
- rcar_salvator_xs - rcar_salvator_xs
- numaker_pfm_m467 - numaker_pfm_m467

View file

@ -11,7 +11,8 @@ tests:
- CONF_FILE="prj.conf;boards/emulated_board.conf" - CONF_FILE="prj.conf;boards/emulated_board.conf"
- DTC_OVERLAY_FILE="boards/emulated_board.overlay" - DTC_OVERLAY_FILE="boards/emulated_board.overlay"
platform_exclude: platform_exclude:
- hifive_unmatched - hifive_unmatched/fu740/s7
- hifive_unmatched/fu740/u74
- qemu_cortex_a53 - qemu_cortex_a53
- qemu_cortex_a53/qemu_cortex_a53/smp - qemu_cortex_a53/qemu_cortex_a53/smp
- qemu_kvm_arm64 - qemu_kvm_arm64
@ -30,7 +31,7 @@ tests:
- simulation - simulation
filter: dt_compat_enabled("sbs,sbs-gauge-new-api") filter: dt_compat_enabled("sbs,sbs-gauge-new-api")
platform_allow: platform_allow:
- hifive_unmatched - hifive_unmatched/fu740/s7
- qemu_cortex_a53 - qemu_cortex_a53
- qemu_cortex_a53/qemu_cortex_a53/smp - qemu_cortex_a53/qemu_cortex_a53/smp
- qemu_kvm_arm64 - qemu_kvm_arm64

View file

@ -26,4 +26,4 @@ tests:
tags: tags:
- drivers - drivers
- memc - memc
platform_allow: hifive_unmatched platform_allow: hifive_unmatched/fu740/s7

View file

@ -0,0 +1,85 @@
/*
* Copyright (c) 2020 Nordic Semiconductor ASA
* Copyright (c) 2020 Intel Corporation
*
* SPDX-License-Identifier: Apache-2.0
*
* Application overlay for creating a fake device instance we
* can use to test DEVICE_MMIO APIs, which get raw data about
* memory ranges from DTS instances.
*
* Names in this file should be chosen in a way that won't conflict
* with real-world devicetree nodes, to allow these tests to run on
* (and be extended to test) real hardware.
*/
/ {
fakedriver@E0000000 {
compatible = "fakedriver";
reg = <0x0 0xE0000000 0x0 0x2000>;
status = "okay";
};
fakedriver@E1000000 {
compatible = "fakedriver";
reg = <0x0 0xE1000000 0x0 0x2000>;
status = "okay";
};
fakedriver@E2000000 {
compatible = "fakedriver";
reg = <0x0 0xE2000000 0x0 0x2000>;
status = "okay";
};
fakedriver@E3000000 {
compatible = "fakedriver";
reg = <0x0 0xE3000000 0x0 0x2000>;
status = "okay";
};
fakedriver@E4000000 {
compatible = "fakedriver";
reg = <0x0 0xE4000000 0x0 0x2000>;
status = "okay";
};
fakedriver_multireg@E5000000 {
compatible = "fakedriver_multireg";
reg = <0x0 0xE5000000 0x0 0x1000>,
<0x0 0xE6000000 0x0 0x1000>;
reg-names = "chip",
"dale";
status = "okay";
};
fakedeferdriver@E7000000 {
compatible = "fakedeferdriver";
reg = <0x0 0xE7000000 0x0 0x2000>;
status = "okay";
zephyr,deferred-init;
};
fakedeferdriver@E8000000 {
compatible = "fakedeferdriver";
reg = <0x0 0xE8000000 0x0 0x2000>;
status = "okay";
zephyr,deferred-init;
};
fakedomain_0: fakedomain_0 {
compatible = "fakedomain";
status = "okay";
#power-domain-cells = <0>;
power-domains = <&fakedomain_2>;
};
fakedomain_1: fakedomain_1 {
compatible = "fakedomain";
status = "okay";
#power-domain-cells = <0>;
power-domains = <&fakedomain_0>;
};
fakedomain_2: fakedomain_2 {
compatible = "fakedomain";
status = "okay";
#power-domain-cells = <0>;
};
};

View file

@ -0,0 +1,21 @@
/*
* Copyright (c) 2023 Antmicro
*
* SPDX-License-Identifier: Apache-2.0
*/
&spi2 {
status = "okay";
sdhc0: sdhc@0 {
compatible = "zephyr,sdhc-spi-slot";
reg = <0>;
status = "okay";
mmc {
compatible = "zephyr,sdmmc-disk";
disk-name = "SD";
status = "okay";
};
spi-max-frequency = <20000000>;
};
};

View file

@ -5,7 +5,8 @@ tests:
platform_allow: platform_allow:
- native_sim - native_sim
- native_sim/native/64 - native_sim/native/64
- hifive_unmatched - hifive_unmatched/fu740/s7
- hifive_unmatched/fu740/u74
- bl5340_dvk/nrf5340/cpuapp - bl5340_dvk/nrf5340/cpuapp
extra_args: extra_args:
- EXTRA_DTC_OVERLAY_FILE="ramdisk_small.overlay" - EXTRA_DTC_OVERLAY_FILE="ramdisk_small.overlay"
@ -22,7 +23,8 @@ tests:
simulation_exclude: simulation_exclude:
- renode - renode
platform_allow: platform_allow:
- hifive_unmatched - hifive_unmatched/fu740/s7
- hifive_unmatched/fu740/u74
- bl5340_dvk/nrf5340/cpuapp - bl5340_dvk/nrf5340/cpuapp
extra_args: CONF_FILE=prj_sdcard.conf extra_args: CONF_FILE=prj_sdcard.conf