-
Notifications
You must be signed in to change notification settings - Fork 0
138 lines (122 loc) · 5.17 KB
/
litex_sim.yml
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
# Licensed under the Apache License, Version 2.0 or the MIT License.
# SPDX-License-Identifier: Apache-2.0 OR MIT
# Copyright Tock Contributors 2023.
# This workflow contains the litex-ci-runner job, which uses the LiteX Verilated
# simulation to run a Tock kernel and perform various tests using libtock-c
# example applications.
name: litex-sim-ci
env:
TERM: xterm # Makes tput work in actions output
# Controls when the action will run. Triggers the workflow on push or pull
# request events but only for the master branch
on:
push: # Run CI for all branches except GitHub merge queue tmp branches
branches-ignore:
- "gh-readonly-queue/**"
pull_request: # Run CI for PRs on any branch
merge_group: # Run CI for the GitHub merge queue
# A workflow run is made up of one or more jobs that can run sequentially or in parallel
# If you add additional jobs, remember to add them to bors.toml
permissions:
contents: read
jobs:
litex-sim-ci:
strategy:
matrix:
os: [ubuntu-latest]
# The type of runner that the job will run on
runs-on: ${{ matrix.os }}
# Steps represent a sequence of tasks that will be executed as part of the job
steps:
# Checkout the Tock repo, needs to happen at the beginning given
# that other steps (such as the Rust toolchain) depend on files
# in this repo.
- name: Checkout the current repository
uses: actions/checkout@v3
# Install basic packages required for the GitHub actions workflow
- name: Update packages and install dependencies
run: |
sudo apt update
sudo apt install python3-pip python3-venv gcc-riscv64-unknown-elf \
verilator libevent-dev libjson-c-dev libz-dev libzmq3-dev
# Install elf2tab to be able to build userspace apps
- name: Install elf2tab
run: |
cargo install [email protected]
# Install tockloader, which is used to prepare binaries with userspace
# applications.
- name: Install tockloader
run: |
pip3 install tockloader==1.11.0
# Clone tock-litex support repository under ./tock-litex, check out the
# targeted release.
- name: Checkout the tock-litex repository
uses: actions/checkout@v3
with:
repository: lschuermann/tock-litex
# The pinned revision is different from the targeted release as
# documented in the LiteX boards, as the CI requires special patches
# to LiteX for interacting with the simulation:
ref: 2024011101-tock-ci-1
path: tock-litex
# Install all of the required Python packages from the tock-litex'
# requirements.txt file
- name: Install Python packages pinned by the tock-litex revision
run: |
pushd tock-litex
# Migen is the DSL which the LiteX ecosystem uses as its
# hardware-description language. It effectively provides a set of
# Python classes and constructs which can be translated into Verilog.
# It is not a package of the LiteX ecosystem, and thus not in the
# requirements.txt, but it is required to be present on the system.
# It should not require any specific or patched version.
pip3 install migen==0.9.2
pip3 install -r requirements.txt
popd
# Build the LiteX simulator Tock kernel. This kernel is never touched, the
# litex-ci-runner will use its own temporary flash files.
- name: Build the LiteX simulator Tock kernel
run: |
pushd boards/litex/sim
make
popd
# Revision to checkout defined in the main tock repository in
# .libtock_c_ci_rev
- name: Checkout libtock-c CI revision
uses: actions/checkout@v3
with:
repository: tock/libtock-c
# Pins a libtock-c revision for LiteX CI tests. In case of
# bugs fixed in libtock-c, backwards-incompatible changes in
# Tock or new tests this might need to be updated.
#
# libtock-c of Feb 9, 2024, 3:08 PM EST
ref: 0e72c922e13cd83a1aaae7a5f587099d45815e6a
path: libtock-c
- name: Build libtock-c apps
run: |
# We only need to build for a single target, but at multiple flash and
# memory addresses such that tockloader can place the non-PIC apps
# into the kernel binary properly.
export TOCK_TARGETS="\
rv32imc|rv32imc.0x00080080.0x40008000|0x00080080|0x40008000
rv32imc|rv32imc.0x00088080.0x40010000|0x00088080|0x40010000"
export LIBTOCK_C_APPS="\
c_hello \
tests/console_timeout \
tests/mpu_walk_region \
tests/printf_long \
rot13_service \
rot13_client \
tests/console_recv_short \
tests/console_recv_long"
pushd libtock-c/examples
for APP in $LIBTOCK_C_APPS; do
make -C "$APP"
done
popd
# Run the LiteX simulation with required options for Tock
- name: Run various tests in the LiteX simulation using the litex-ci-runner
run: |
pushd tools/litex-ci-runner
cargo run