Skip to content

C-example on risc-v architecture #423

C-example on risc-v architecture

C-example on risc-v architecture #423

Workflow file for this run

name: Martos ci workflow
on:
push:
branches: [ "main" ]
pull_request:
branches: [ "main" ]
env:
CARGO_TERM_COLOR: always
DOCKERHUB_USERNAME: sevenbunu
jobs:
build:
# TODO: all should be on self-hosted runners
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Build
run: cargo build --lib --verbose
test:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Run tests
run: cargo test --verbose
fmt:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Fmt
run: cargo fmt --all -- --check
clippy:
runs-on: ubuntu-latest
steps:
- uses: actions/checkout@v3
- name: Clippy
run: cargo clippy -- -D clippy::all
prepare-image:
runs-on: ubuntu-latest
steps:
- run: echo "null"
outputs:
username: ${{ env.DOCKERHUB_USERNAME }}
xtensa-esp32-rust-example-hello-world:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/xtensa-esp32/hello-world && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/xtensa-esp32/hello-world && cargo fmt --all -- --check
xtensa-esp32-rust-example-dynamic-memory:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/xtensa-esp32/dynamic-memory && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/xtensa-esp32/dynamic-memory && cargo fmt --all -- --check
xtensa-esp32-rust-example-timer:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/xtensa-esp32/timer && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/xtensa-esp32/timer && cargo fmt --all -- --check
xtensa-esp32-rust-example-wifi:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/xtensa-esp32/wifi && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/xtensa-esp32/wifi && cargo fmt --all -- --check
xtensa-esp32-static-library:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./c-library/xtensa-esp32 && . /root/export-esp.sh && cargo build --release
- name: Fmt
run: cd ./c-library/xtensa-esp32 && cargo fmt --all -- --check
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: xtensa-esp32-static-library
path: c-library/xtensa-esp32/target/xtensa-esp32-none-elf/release/libxtensa_esp32_static_lib.a
retention-days: 7
outputs:
username: ${{ needs.prepare-image.outputs.username }}
xtensa-esp32-c-example:
needs: xtensa-esp32-static-library
runs-on: ubuntu-latest
env:
IDF_PATH: /root/esp/esp-idf
IDF_TOOLS_PATH: /root/.espressif
container:
image: ${{ needs.xtensa-esp32-static-library.outputs.username }}/xtensa-esp32-c:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Download static library
uses: actions/download-artifact@v4
with:
name: xtensa-esp32-static-library
path: c-library/xtensa-esp32/target/xtensa-esp32-none-elf/release
- name: Build
run: cd ./examples/c-examples/xtensa-esp32 && . /root/esp/esp-idf/export.sh && make && esptool.py --chip esp32 elf2image --flash_mode="dio" --flash_freq "40m" --flash_size "4MB" -o main.bin main.elf
risc-v-esp32c6-rust-example-hello-world:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/risc-v-esp32-c6/hello-world && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/risc-v-esp32-c6/hello-world && cargo fmt --all -- --check
risc-v-esp32c6-rust-example-dynamic-memory:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/risc-v-esp32-c6/dynamic-memory && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/risc-v-esp32-c6/dynamic-memory && cargo fmt --all -- --check
risc-v-esp32c6-rust-example-timer:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/risc-v-esp32-c6/timer && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/risc-v-esp32-c6/timer && cargo fmt --all -- --check
risc-v-esp32c6-rust-example-wifi:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./examples/rust-examples/risc-v-esp32-c6/wifi && . /root/export-esp.sh && cargo build
- name: Fmt
run: cd ./examples/rust-examples/risc-v-esp32-c6/wifi && cargo fmt --all -- --check
risc-v-esp32c6-static-library:
runs-on: ubuntu-latest
needs: [prepare-image]
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ${{ needs.prepare-image.outputs.username }}/xtensa-esp32-rust:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Build
run: cd ./c-library/risc-v-esp32-c6 && . /root/export-esp.sh && cargo build --release
- name: Fmt
run: cd ./c-library/risc-v-esp32-c6 && cargo fmt --all -- --check
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: risc-v-esp32c6-static-library
path: c-library/risc-v-esp32-c6/target/riscv32imac-unknown-none-elf/release/librisc_v_esp32c6_static_lib.a
retention-days: 7
outputs:
username: ${{ needs.prepare-image.outputs.username }}
risc-v-esp32c6-c-example:
needs: risc-v-esp32c6-static-library
runs-on: ubuntu-latest
env:
IDF_PATH: /root/esp/esp-idf
IDF_TOOLS_PATH: /root/.espressif
container:
image: ${{ needs.risc-v-esp32c6-static-library.outputs.username }}/risc-v-esp32c6-c:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Download static library
uses: actions/download-artifact@v4
with:
name: risc-v-esp32c6-static-library
path: c-library/risc-v-esp32-c6/target/riscv32imac-unknown-none-elf/release
- name: Build
run: cd ./examples/c-examples/risc-v-esp32c6 && . /root/esp/esp-idf/export.sh && make && esptool.py --chip esp32c6 elf2image --flash_mode="dio" --flash_freq "40m" --flash_size "4MB" -o main.bin main.elf
mips64-rust-example-hello-world:
runs-on: ubuntu-latest
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ubuntu:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Dependencies
run: apt update && apt install curl build-essential lld -y && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo 'PATH="${PATH}:/root/.cargo/bin"' >> $GITHUB_PATH && . "/root/.cargo/env" && rustup toolchain install nightly && rustup default 1.71 && rustup target add mips64el-unknown-linux-gnuabi64 && rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Build
run: cd ./examples/rust-examples/mips64/hello-world && cargo +nightly build --release
- name: Fmt
run: cd ./examples/rust-examples/mips64/hello-world && cargo +nightly fmt --all -- --check
mips64-rust-example-dynamic-memory:
runs-on: ubuntu-latest
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ubuntu:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Dependencies
run: apt update && apt install curl build-essential lld -y && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo 'PATH="${PATH}:/root/.cargo/bin"' >> $GITHUB_PATH && . "/root/.cargo/env" && rustup toolchain install nightly && rustup default 1.71 && rustup target add mips64el-unknown-linux-gnuabi64 && rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Build
run: cd ./examples/rust-examples/mips64/dynamic-memory && cargo +nightly build --release
- name: Fmt
run: cd ./examples/rust-examples/mips64/dynamic-memory && cargo +nightly fmt --all -- --check
mips64-rust-example-timer:
runs-on: ubuntu-latest
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ubuntu:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Dependencies
run: apt update && apt install curl build-essential lld -y && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo 'PATH="${PATH}:/root/.cargo/bin"' >> $GITHUB_PATH && . "/root/.cargo/env" && rustup toolchain install nightly && rustup default 1.71 && rustup target add mips64el-unknown-linux-gnuabi64 && rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Build
run: cd ./examples/rust-examples/mips64/timer && cargo +nightly build --release
- name: Fmt
run: cd ./examples/rust-examples/mips64/timer && cargo +nightly fmt --all -- --check
mips64-static-library:
runs-on: ubuntu-latest
env:
CARGO_HOME: /root/.cargo
RUSTUP_HOME: /root/.rustup
container:
image: ubuntu:latest
options: --user root
steps:
- uses: actions/checkout@v3
- name: Dependencies
run: apt update && apt install curl build-essential lld -y && curl --proto '=https' --tlsv1.2 -sSf https://sh.rustup.rs | sh -s -- -y && echo 'PATH="${PATH}:/root/.cargo/bin"' >> $GITHUB_PATH && . "/root/.cargo/env" && rustup toolchain install nightly && rustup default 1.71 && rustup target add mips64el-unknown-linux-gnuabi64 && rustup component add rust-src --toolchain nightly-x86_64-unknown-linux-gnu
- name: Build
run: cd ./c-library/mips64 && cargo +nightly build --release
- name: Fmt
run: cd ./c-library/mips64 && cargo +nightly fmt --all -- --check
- name: Archive production artifacts
uses: actions/upload-artifact@v4
with:
name: mips64-static-library
path: c-library/mips64/target/mips64el-unknown-linux-gnuabi64/release/libmips64_static_lib.a
retention-days: 7