Skip to content

Commit 192104b

Browse files
committed
riscv32: enable JIT for pico2, add it to CI
Signed-off-by: Paul Guyot <pguyot@kallisys.net>
1 parent f3c67db commit 192104b

File tree

2 files changed

+33
-8
lines changed

2 files changed

+33
-8
lines changed

.github/workflows/pico-build.yaml

Lines changed: 27 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,17 @@ jobs:
4141
strategy:
4242
matrix:
4343
board: ["pico", "pico_w", "pico2"]
44+
platform: [""]
4445
language: ["cpp"]
46+
jit: ["", "-DAVM_DISABLE_JIT=OFF"]
47+
include:
48+
- board: "pico2"
49+
platform: "-DPICO_PLATFORM=rp2350-riscv"
50+
jit: ""
51+
52+
- board: "pico2"
53+
platform: "-DPICO_PLATFORM=rp2350-riscv"
54+
jit: "-DAVM_DISABLE_JIT=OFF"
4555

4656
steps:
4757
- name: Checkout repo
@@ -57,6 +67,16 @@ jobs:
5767
libnewlib-arm-none-eabi libstdc++-arm-none-eabi-newlib \
5868
erlang-base erlang-dev erlang-dialyzer erlang-eunit rebar3
5969
70+
- name: Install riscv32 toolchain
71+
if: matrix.platform == '-DPICO_PLATFORM=rp2350-riscv'
72+
run: |
73+
sudo mkdir -p /opt
74+
cd /opt
75+
sudo wget https://github.com/raspberrypi/pico-sdk-tools/releases/download/v2.2.0-3/riscv-toolchain-15-x86_64-lin.tar.gz
76+
sudo tar xzf riscv-toolchain-15-x86_64-lin.tar.gz
77+
ls /opt
78+
echo "/opt/riscv-toolchain-15-x86_64-lin/bin" >> $GITHUB_PATH
79+
6080
- name: "Git config safe.directory for codeql"
6181
run: git config --global --add safe.directory /__w/AtomVM/AtomVM
6282

@@ -74,7 +94,7 @@ jobs:
7494
set -euo pipefail
7595
mkdir build
7696
cd build
77-
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }}
97+
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.platform }} ${{ matrix.jit }}
7898
ninja
7999
80100
- name: "Perform CodeQL Analysis"
@@ -97,7 +117,7 @@ jobs:
97117
mkdir build.nosmp
98118
cd build.nosmp
99119
# TODO: fix all warnings and enable -DAVM_WARNINGS_ARE_ERRORS=ON
100-
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} -DAVM_DISABLE_SMP=1
120+
cmake .. -G Ninja -DPICO_BOARD=${{ matrix.board }} ${{ matrix.jit }} -DAVM_DISABLE_SMP=1
101121
cmake --build . --target=rp2_tests
102122
103123
- name: Run tests with rp2040js
@@ -112,7 +132,7 @@ jobs:
112132
npx tsx run-tests.ts ../build.nosmp/tests/rp2_tests.uf2 ../build.nosmp/tests/test_erl_sources/rp2_test_modules.uf2
113133
114134
- name: Build atomvmlib.uf2
115-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
135+
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
116136
shell: bash
117137
run: |
118138
set -euo pipefail
@@ -122,7 +142,7 @@ jobs:
122142
make atomvmlib-${{ matrix.board }}.uf2
123143
124144
- name: Rename AtomVM and write sha256sum
125-
if: startsWith(github.ref, 'refs/tags/')
145+
if: startsWith(github.ref, 'refs/tags/') && matrix.platform == '' && matrix.jit == ''
126146
shell: bash
127147
run: |
128148
pushd src/platforms/rp2/build
@@ -137,7 +157,7 @@ jobs:
137157
popd
138158
139159
- name: Rename atomvmlib and write sha256sum
140-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
160+
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
141161
shell: bash
142162
run: |
143163
pushd build/libs
@@ -148,7 +168,7 @@ jobs:
148168
149169
- name: Release (Pico & Pico2)
150170
uses: softprops/action-gh-release@v1
151-
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w'
171+
if: startsWith(github.ref, 'refs/tags/') && matrix.board != 'pico_w' && matrix.platform == '' && matrix.jit == ''
152172
with:
153173
draft: true
154174
fail_on_unmatched_files: true
@@ -160,7 +180,7 @@ jobs:
160180
161181
- name: Release (PicoW)
162182
uses: softprops/action-gh-release@v1
163-
if: startsWith(github.ref, 'refs/tags/') && matrix.board == 'pico_w'
183+
if: startsWith(github.ref, 'refs/tags/') && matrix.board == 'pico_w' && matrix.platform == '' && matrix.jit == ''
164184
with:
165185
draft: true
166186
fail_on_unmatched_files: true

src/platforms/rp2/CMakeLists.txt

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -69,8 +69,13 @@ if(CMAKE_SYSTEM_PROCESSOR MATCHES "^cortex-m.+$")
6969
if (NOT AVM_DISABLE_JIT)
7070
set(AVM_JIT_TARGET_ARCH "armv6m")
7171
endif()
72+
elseif(CMAKE_SYSTEM_PROCESSOR MATCHES "^hazard3$")
73+
# Pico2 RISC-V processor (Hazard3)
74+
if (NOT AVM_DISABLE_JIT)
75+
set(AVM_JIT_TARGET_ARCH "riscv32")
76+
endif()
7277
else()
73-
# Typically riscv is not supported yet
78+
# Other processors not supported yet
7479
if (NOT AVM_DISABLE_JIT)
7580
message("JIT is not supported on ${CMAKE_SYSTEM_PROCESSOR}")
7681
set(AVM_DISABLE_JIT ON CACHE BOOL "Disable just in time compilation." FORCE)

0 commit comments

Comments
 (0)