Skip to content
This repository has been archived by the owner on Jul 3, 2024. It is now read-only.

Commit

Permalink
Merge pull request #374 from sifive/port-1908-to-master
Browse files Browse the repository at this point in the history
Port recent changes to v201908-branch to master
  • Loading branch information
nategraff-sifive authored Sep 19, 2019
2 parents 60eee28 + 01b853e commit 77a6c9c
Show file tree
Hide file tree
Showing 47 changed files with 1,924 additions and 62 deletions.
14 changes: 7 additions & 7 deletions .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,19 +27,19 @@ install:
- docker exec -t host bash -c "yes | apt-get upgrade"
- docker exec -t host bash -c "yes | apt-get install build-essential git wget jq"
# Install QEMU dependencies
- docker exec -t host bash -c "yes | apt-get install libpixman-1-0 libnuma1 libpng12-0 libglib2.0-0"
- docker exec -t host bash -c "yes | apt-get install libpixman-1-0 libnuma1 libpng12-0 libglib2.0-0 libjpeg8"
# Download RISC-V embedded toolchain
- docker exec -t host bash -c "cd /travis && wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14.tar.gz"
- docker exec -t host bash -c "cd /travis && tar xzvf riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14.tar.gz"
- docker exec -t host bash -c "cd /travis && wget https://static.dev.sifive.com/dev-tools/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz"
- docker exec -t host bash -c "cd /travis && tar xzvf riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz"
# Download RISC-V QEMU
- docker exec -t host bash -c "cd /travis && wget https://static.dev.sifive.com/dev-tools/riscv-qemu-3.1.0-2019.05.1-x86_64-linux-ubuntu14.tar.gz"
- docker exec -t host bash -c "cd /travis && tar xzvf riscv-qemu-3.1.0-2019.05.1-x86_64-linux-ubuntu14.tar.gz"
- docker exec -t host bash -c "cd /travis && wget https://static.dev.sifive.com/dev-tools/riscv-qemu-4.1.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz"
- docker exec -t host bash -c "cd /travis && tar xzvf riscv-qemu-4.1.0-2019.08.0-x86_64-linux-ubuntu14.tar.gz"

# Here's where we actually run the test.
script:
# check that submodules match wit-manifest.json
- docker exec -t host bash -c "cd /travis && ./scripts/check-submodules"
# Build all software for all targets
- docker exec -t host bash -c "export RISCV_PATH=/travis/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14 && cd /travis && RISCV_CFLAGS=\"$RISCV_CFLAGS\" ./scripts/all-targets-build"
- docker exec -t host bash -c "export RISCV_PATH=/travis/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14 && cd /travis && RISCV_CFLAGS=\"$RISCV_CFLAGS\" ./scripts/all-targets-build"
# Test by running software on all QEMU targets
- docker exec -t host bash -c "export RISCV_PATH=/travis/riscv64-unknown-elf-gcc-8.2.0-2019.05.3-x86_64-linux-ubuntu14 && export PATH=$PATH:/travis/riscv-qemu-3.1.0-2019.05.1-x86_64-linux-ubuntu14/bin && cd /travis && ./scripts/test-qemu-targets"
- docker exec -t host bash -c "export RISCV_PATH=/travis/riscv64-unknown-elf-gcc-8.3.0-2019.08.0-x86_64-linux-ubuntu14 && export PATH=$PATH:/travis/riscv-qemu-4.1.0-2019.08.0-x86_64-linux-ubuntu14/bin && cd /travis && ./scripts/test-qemu-targets"
24 changes: 21 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -35,12 +35,14 @@ operating systems to RISC-V.
- sifive-hifive-unleashed
- [SiFive Freedom E310 Arty](https://github.com/sifive/freedom)
- freedom-e310-arty
- [QEMU Emulation of the SiFive E31](https://github.com/sifive/riscv-qemu/tree/riscv-qemu-3.1)
- [QEMU Emulation of the SiFive E31](https://github.com/sifive/freedom-tools)
- qemu-sifive-e31
- [QEMU Emulation of the SiFive S51](https://github.com/sifive/riscv-qemu/tree/riscv-qemu-3.1)
- [QEMU Emulation of the SiFive S51](https://github.com/sifive/freedom-tools)
- qemu-sifive-s51
- [QEMU Emulation of the SiFive U54](https://github.com/sifive/riscv-qemu/tree/riscv-qemu-3.1)
- [QEMU Emulation of the SiFive U54](https://github.com/sifive/freedom-tools)
- qemu-sifive-u54
- [QEMU Emulation of the SiFive U54MC](https://github.com/sifive/freedom-tools)
- qemu-sifive-u54mc
- The board support files for the Freedom Metal library are located entirely
within a single target directory in `bsp/<target>/`. For example, the HiFive 1
board support files for Freedom Metal are entirely within `bsp/sifive-hifive1/`
Expand Down Expand Up @@ -125,6 +127,7 @@ To use this SDK, you will need the following software available on your machine:
* GNU Make
* Git
* RISC-V GNU Toolchain
* RISC-V QEMU 4.1.0 (for use with the qemu-sifive-\* simulation targets)
* RISC-V OpenOCD (for use with development board and FPGA targets)
* Segger J-LINK (for use with certain development boards)

Expand All @@ -148,6 +151,21 @@ export RISCV_OPENOCD_PATH=/my/desired/location/openocd
export RISCV_PATH=/my/desired/location/riscv64-unknown-elf-gcc-<date>-<version>
```

##### Install RISC-V QEMU 4.1.0

The RISC-V QEMU Emulator is available from the SiFive Website at

https://www.sifive.com/boards

Download the .tar.gz for your platform and unpack it to your desired location.
Then, add QEMU to your path:

```
cp riscv-qemu-<version>-<date>-<platform>.tar.gz /my/desired/location
tar -xvf riscv-qemu-<version>-<date>-<platform>.tar.gz
export PATH=$PATH:/my/desired/location/riscv-qemu-<version>-<date>-<platform>/bin
```

##### Install Segger J-Link Software

Some targets supported by Freedom E SDK (like the SiFive HiFive1 Rev B) use
Expand Down
6 changes: 4 additions & 2 deletions bsp/qemu-sifive-e31/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SiFive QEMU E31 is a virtual development platform matching the Freedom E310. It’s the best way to start prototyping and developing your RISC‑V applications.
SiFive QEMU E31 is a virtual development platform matching the Freedom E310 (with more memory though).
It’s the best way to start prototyping and developing your RISC‑V applications.

This target is ideal for getting familiarize with RISC-V ISA instructions set and freedom-metal libraries. It supports:

Expand All @@ -10,5 +11,6 @@ This target is ideal for getting familiarize with RISC-V ISA instructions set an
- SPI memory with 1 interrupt line
- Serial port with 1 interrupt line
- 1 RGB LEDS
- DTIM memory with 4M bytes

This BSP matches the QEMU code in https://github.com/sifive/riscv-qemu/tree/riscv-qemu-3.1
This BSP matches the QEMU code in https://git.qemu.org/?p=qemu.git;a=tree;h=refs/tags/v4.1.0;hb=refs/tags/v4.1.0
8 changes: 7 additions & 1 deletion bsp/qemu-sifive-e31/design.dts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
reg-names = "config";
};

test: test@100000 {
compatible = "sifive,test0";
reg = <0x100000 0x1000>;
reg-names = "control";
};

aon: aon@10000000 {
compatible = "sifive,aon0";
reg = <0x10000000 0x8000>;
Expand Down Expand Up @@ -144,7 +150,7 @@

dtim: dtim@80000000 {
compatible = "sifive,dtim0";
reg = <0x80000000 0x4000>;
reg = <0x80000000 0x400000>;
reg-names = "mem";
};

Expand Down
9 changes: 8 additions & 1 deletion bsp/qemu-sifive-e31/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ extern __inline__ unsigned long __metal_driver_sifive_spi0_pinmux_source_selecto


/* --------------------- sifive_test0 ------------ */
extern __inline__ unsigned long __metal_driver_sifive_test0_base(const struct __metal_shutdown *sd);
extern __inline__ unsigned long __metal_driver_sifive_test0_size(const struct __metal_shutdown *sd);


/* --------------------- sifive_trace ------------ */
Expand Down Expand Up @@ -172,7 +174,7 @@ struct __metal_driver_fixed_clock __metal_dt_clock_5 = {

struct metal_memory __metal_dt_mem_dtim_80000000 = {
._base_address = 2147483648UL,
._size = 16384UL,
._size = 4194304UL,
._attrs = {
.R = 1,
.W = 1,
Expand Down Expand Up @@ -251,6 +253,11 @@ struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000 = {
.spi.vtable = &__metal_driver_vtable_sifive_spi0.spi,
};

/* From test@100000 */
struct __metal_driver_sifive_test0 __metal_dt_test_100000 = {
.shutdown.vtable = &__metal_driver_vtable_sifive_test0.shutdown,
};

/* From serial@10013000 */
struct __metal_driver_sifive_uart0 __metal_dt_serial_10013000 = {
.uart.vtable = &__metal_driver_vtable_sifive_uart0.uart,
Expand Down
9 changes: 9 additions & 0 deletions bsp/qemu-sifive-e31/metal-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@
#define METAL_SIFIVE_SPI0_IE 112UL
#define METAL_SIFIVE_SPI0_IP 116UL

/* From test@100000 */
#define METAL_SIFIVE_TEST0_100000_BASE_ADDRESS 1048576UL
#define METAL_SIFIVE_TEST0_0_BASE_ADDRESS 1048576UL
#define METAL_SIFIVE_TEST0_100000_SIZE 4096UL
#define METAL_SIFIVE_TEST0_0_SIZE 4096UL

#define METAL_SIFIVE_TEST0
#define METAL_SIFIVE_TEST0_FINISHER_OFFSET 0UL

/* From serial@10013000 */
#define METAL_SIFIVE_UART0_10013000_BASE_ADDRESS 268513280UL
#define METAL_SIFIVE_UART0_0_BASE_ADDRESS 268513280UL
Expand Down
2 changes: 1 addition & 1 deletion bsp/qemu-sifive-e31/metal.default.lds
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENTRY(_enter)
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x4000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x400000
}

PHDRS
Expand Down
29 changes: 29 additions & 0 deletions bsp/qemu-sifive-e31/metal.h
Original file line number Diff line number Diff line change
Expand Up @@ -81,6 +81,7 @@
#include <metal/drivers/sifive_gpio-leds.h>
#include <metal/drivers/sifive_rtc0.h>
#include <metal/drivers/sifive_spi0.h>
#include <metal/drivers/sifive_test0.h>
#include <metal/drivers/sifive_uart0.h>
#include <metal/drivers/sifive_wdog0.h>
#include <metal/drivers/sifive_fe310-g000_hfrosc.h>
Expand Down Expand Up @@ -134,6 +135,9 @@ struct __metal_driver_sifive_rtc0 __metal_dt_rtc_10000000;
/* From spi@10014000 */
struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000;

/* From test@100000 */
struct __metal_driver_sifive_test0 __metal_dt_test_100000;

/* From serial@10013000 */
struct __metal_driver_sifive_uart0 __metal_dt_serial_10013000;

Expand Down Expand Up @@ -708,6 +712,26 @@ static __inline__ unsigned long __metal_driver_sifive_spi0_pinmux_source_selecto


/* --------------------- sifive_test0 ------------ */
static __inline__ unsigned long __metal_driver_sifive_test0_base(const struct __metal_shutdown *sd)
{
if ((uintptr_t)sd == (uintptr_t)&__metal_dt_test_100000) {
return METAL_SIFIVE_TEST0_100000_BASE_ADDRESS;
}
else {
return 0;
}
}

static __inline__ unsigned long __metal_driver_sifive_test0_size(const struct __metal_shutdown *sd)
{
if ((uintptr_t)sd == (uintptr_t)&__metal_dt_test_100000) {
return METAL_SIFIVE_TEST0_100000_SIZE;
}
else {
return 0;
}
}



/* --------------------- sifive_trace ------------ */
Expand Down Expand Up @@ -1074,6 +1098,11 @@ __asm__ (".weak __metal_spi_table");
struct __metal_driver_sifive_spi0 *__metal_spi_table[] = {
&__metal_dt_spi_10014000};

/* From test@100000 */
#define __METAL_DT_SHUTDOWN_HANDLE (&__metal_dt_test_100000.shutdown)

#define __METAL_DT_TEST_100000_HANDLE (&__metal_dt_test_100000.shutdown)

#define __METAL_DT_MAX_WDOGS 1

__asm__ (".weak __metal_wdog_table");
Expand Down
15 changes: 5 additions & 10 deletions bsp/qemu-sifive-e31/metal.ramrodata.lds
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENTRY(_enter)
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x4000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x400000
}

PHDRS
Expand Down Expand Up @@ -38,15 +38,6 @@ SECTIONS
KEEP (*(SORT_NONE(.fini)))
} >flash AT>flash :flash



.text : {
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
} >flash AT>flash :flash

PROVIDE (__etext = .);
PROVIDE (_etext = .);
PROVIDE (etext = .);
Expand Down Expand Up @@ -102,6 +93,10 @@ SECTIONS


.itim : ALIGN(8) {
*(.text.unlikely .text.unlikely.*)
*(.text.startup .text.startup.*)
*(.text .text.*)
*(.gnu.linkonce.t.*)
*(.itim .itim.*)
} >ram AT>flash :itim_init

Expand Down
2 changes: 1 addition & 1 deletion bsp/qemu-sifive-e31/metal.scratchpad.lds
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ ENTRY(_enter)

MEMORY
{
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x4000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x400000
}

PHDRS
Expand Down
6 changes: 4 additions & 2 deletions bsp/qemu-sifive-s51/README.md
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
SiFive QEMU S51 is a virtual development platform matching the Freedom S510. It’s the best way to start prototyping and developing your RISC‑V applications.
SiFive QEMU S51 is a virtual development platform matching the Freedom S510 (with more memory though).
It’s the best way to start prototyping and developing your RISC‑V applications.

This target is ideal for getting familiarize with RISC-V ISA instructions set and freedom-metal libraries. It supports:

Expand All @@ -10,5 +11,6 @@ This target is ideal for getting familiarize with RISC-V ISA instructions set an
- SPI memory with 1 interrupt line
- Serial port with 1 interrupt line
- 1 RGB LEDS
- DTIM memory with 4M bytes

This BSP matches the QEMU code in https://github.com/sifive/riscv-qemu/tree/riscv-qemu-3.1
This BSP matches the QEMU code in https://git.qemu.org/?p=qemu.git;a=tree;h=refs/tags/v4.1.0;hb=refs/tags/v4.1.0
8 changes: 7 additions & 1 deletion bsp/qemu-sifive-s51/design.dts
Original file line number Diff line number Diff line change
Expand Up @@ -87,6 +87,12 @@
reg-names = "config";
};

test: test@100000 {
compatible = "sifive,test0";
reg = <0x100000 0x1000>;
reg-names = "control";
};

aon: aon@10000000 {
compatible = "sifive,aon0";
reg = <0x10000000 0x8000>;
Expand Down Expand Up @@ -144,7 +150,7 @@

dtim: dtim@80000000 {
compatible = "sifive,dtim0";
reg = <0x80000000 0x4000>;
reg = <0x80000000 0x400000>;
reg-names = "mem";
};

Expand Down
9 changes: 8 additions & 1 deletion bsp/qemu-sifive-s51/metal-inline.h
Original file line number Diff line number Diff line change
Expand Up @@ -92,6 +92,8 @@ extern __inline__ unsigned long __metal_driver_sifive_spi0_pinmux_source_selecto


/* --------------------- sifive_test0 ------------ */
extern __inline__ unsigned long __metal_driver_sifive_test0_base(const struct __metal_shutdown *sd);
extern __inline__ unsigned long __metal_driver_sifive_test0_size(const struct __metal_shutdown *sd);


/* --------------------- sifive_trace ------------ */
Expand Down Expand Up @@ -172,7 +174,7 @@ struct __metal_driver_fixed_clock __metal_dt_clock_5 = {

struct metal_memory __metal_dt_mem_dtim_80000000 = {
._base_address = 2147483648UL,
._size = 16384UL,
._size = 4194304UL,
._attrs = {
.R = 1,
.W = 1,
Expand Down Expand Up @@ -251,6 +253,11 @@ struct __metal_driver_sifive_spi0 __metal_dt_spi_10014000 = {
.spi.vtable = &__metal_driver_vtable_sifive_spi0.spi,
};

/* From test@100000 */
struct __metal_driver_sifive_test0 __metal_dt_test_100000 = {
.shutdown.vtable = &__metal_driver_vtable_sifive_test0.shutdown,
};

/* From serial@10013000 */
struct __metal_driver_sifive_uart0 __metal_dt_serial_10013000 = {
.uart.vtable = &__metal_driver_vtable_sifive_uart0.uart,
Expand Down
9 changes: 9 additions & 0 deletions bsp/qemu-sifive-s51/metal-platform.h
Original file line number Diff line number Diff line change
Expand Up @@ -224,6 +224,15 @@
#define METAL_SIFIVE_SPI0_IE 112UL
#define METAL_SIFIVE_SPI0_IP 116UL

/* From test@100000 */
#define METAL_SIFIVE_TEST0_100000_BASE_ADDRESS 1048576UL
#define METAL_SIFIVE_TEST0_0_BASE_ADDRESS 1048576UL
#define METAL_SIFIVE_TEST0_100000_SIZE 4096UL
#define METAL_SIFIVE_TEST0_0_SIZE 4096UL

#define METAL_SIFIVE_TEST0
#define METAL_SIFIVE_TEST0_FINISHER_OFFSET 0UL

/* From serial@10013000 */
#define METAL_SIFIVE_UART0_10013000_BASE_ADDRESS 268513280UL
#define METAL_SIFIVE_UART0_0_BASE_ADDRESS 268513280UL
Expand Down
2 changes: 1 addition & 1 deletion bsp/qemu-sifive-s51/metal.default.lds
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ ENTRY(_enter)
MEMORY
{
flash (rxai!w) : ORIGIN = 0x20400000, LENGTH = 0x1fc00000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x4000
ram (wxa!ri) : ORIGIN = 0x80000000, LENGTH = 0x400000
}

PHDRS
Expand Down
Loading

0 comments on commit 77a6c9c

Please sign in to comment.