Skip to content

Commit 0842344

Browse files
authored
Merge pull request #2191 from ucb-bar/zephyr-integration
Add Chipyard port of Zephyr RTOS
2 parents 9d1c6eb + a3bd834 commit 0842344

File tree

12 files changed

+1363
-787
lines changed

12 files changed

+1363
-787
lines changed

.github/scripts/build-zephyr.sh

Lines changed: 24 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,24 @@
1+
#!/bin/bash
2+
3+
# turn echo on and error on earliest command
4+
set -ex
5+
6+
# get shared variables
7+
SCRIPT_DIR="$( cd "$( dirname "$0" )" && pwd )"
8+
source $SCRIPT_DIR/defaults.sh
9+
10+
# install Zephyr dependencies
11+
git submodule update --init $LOCAL_CHIPYARD_DIR/software/zephyrproject/zephyr
12+
cd $LOCAL_CHIPYARD_DIR/software/zephyrproject/zephyr/
13+
west init -l .
14+
west config manifest.file west-riscv.yml
15+
west update
16+
17+
# set environment variables for Zephyr
18+
export ZEPHYR_BASE=$LOCAL_CHIPYARD_DIR/software/zephyrproject/zephyr
19+
export ZEPHYR_TOOLCHAIN_VARIANT=cross-compile
20+
export CROSS_COMPILE=$RISCV/bin/riscv64-unknown-elf-
21+
22+
23+
# Build hello world
24+
west build -p -b chipyard_riscv64 samples/chipyard/hello_world/

.github/scripts/check-commit.sh

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -78,7 +78,7 @@ branches=("main")
7878
search
7979

8080

81-
submodules=("coremark" "firemarshal" "nvdla-workload" "spec2017")
81+
submodules=("coremark" "firemarshal" "nvdla-workload" "spec2017" "zephyrproject/zephyr")
8282
dir="software"
8383
branches=("master" "dev")
8484
search

.github/scripts/run-tests.sh

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -173,6 +173,9 @@ case $1 in
173173
chipyard-tacit-rocket)
174174
run_binary LOADMEM=1 BINARY=$RISCV/riscv64-unknown-elf/share/riscv-tests/benchmarks/dhrystone.riscv
175175
;;
176+
chipyard-zephyr)
177+
run_binary LOADMEM=1 BINARY=$LOCAL_CHIPYARD_DIR/software/zephyrproject/zephyr/build/zephyr/zephyr.elf
178+
;;
176179
chipyard-radiance)
177180
# Verilator fails to build sim binary, just generate verilog
178181
;;

.github/workflows/chipyard-run-tests.yml

Lines changed: 29 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -581,6 +581,34 @@ jobs:
581581
group-key: "group-cores"
582582
project-key: "chipyard-tacit-rocket"
583583

584+
chipyard-rocket-zephyr-run-tests:
585+
name: chipyard-rocket-zephyr-run-tests
586+
needs: prepare-chipyard-cores
587+
runs-on: as4
588+
steps:
589+
- name: Delete old checkout
590+
run: |
591+
ls -alh .
592+
rm -rf ${{ github.workspace }}/* || true
593+
rm -rf ${{ github.workspace }}/.* || true
594+
ls -alh .
595+
- name: Checkout
596+
uses: actions/checkout@v4
597+
- name: Git workaround
598+
uses: ./.github/actions/git-workaround
599+
- name: Create conda env
600+
uses: ./.github/actions/create-conda-env
601+
- name: Build zephyr hello world
602+
run: |
603+
conda activate ${{ env.conda-env-name-no-time }}-$(date --date "${{ env.workflow-timestamp }}" +%Y%m%d)
604+
.github/scripts/build-zephyr.sh
605+
- name: Run tests
606+
uses: ./.github/actions/run-tests
607+
with:
608+
group-key: "group-cores"
609+
project-key: "chipyard-zephyr"
610+
611+
584612
chipyard-cva6-run-tests:
585613
name: chipyard-cva6-run-tests
586614
needs: prepare-chipyard-cores
@@ -1280,6 +1308,7 @@ jobs:
12801308
chipyard-shuttle-run-tests,
12811309
chipyard-shuttle3-run-tests,
12821310
chipyard-tacit-rocket-run-tests,
1311+
chipyard-rocket-zephyr-run-tests,
12831312
chipyard-cva6-run-tests,
12841313
chipyard-ibex-run-tests,
12851314
chipyard-vexiiriscv-run-tests,

.gitmodules

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@
151151
[submodule "generators/vexiiriscv"]
152152
path = generators/vexiiriscv
153153
url = https://github.com/ucb-bar/vexiiriscv-tile.git
154+
[submodule "software/zephyrproject/zephyr"]
155+
path = software/zephyrproject/zephyr
156+
url = https://github.com/ucb-bar/zephyr.git
154157
[submodule "software/tacit_decoder"]
155158
path = software/tacit_decoder
156159
url = https://github.com/ucb-bar/tacit_decoder.git

conda-reqs/chipyard-extended.yaml

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -63,6 +63,14 @@ dependencies:
6363
- graphviz
6464
- expect
6565

66+
# zephyr deps
67+
- ninja
68+
- gperf
69+
- ccache
70+
- dtc
71+
- west
72+
- pyelftools
73+
6674
# clang-format for driver coding style enforcement.
6775
- clang-format
6876
- clang-tools

0 commit comments

Comments
 (0)