-
Notifications
You must be signed in to change notification settings - Fork 63
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #2262 from magnmaeh/add-flexpret-support
Support for FlexPRET platform
- Loading branch information
Showing
20 changed files
with
645 additions
and
79 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,43 @@ | ||
name: Install FlexPRET and dependencies (Linux only) | ||
description: Install FlexPRET and dependencies (Linux only) | ||
runs: | ||
using: "composite" | ||
steps: | ||
- name: Setup | ||
run: | | ||
# Clone the FlexPRET repository | ||
git clone --recurse-submodules https://github.com/pretis/flexpret | ||
# This rest is copied directly from FlexPRET's `azure-pipelines.yml` | ||
# Ubuntu 20.04 only has Verilator 4.028 but we neeed a more modern version | ||
# so we do not use 'sudo apt-get install -y -qq verilator' here. | ||
wget -q https://github.com/sifive/verilator/releases/download/4.036-0sifive2/verilator_4.036-0sifive2_amd64.deb -O verilator.deb | ||
sudo dpkg -i verilator.deb | ||
# Install riscv compiler | ||
wget https://github.com/stnolting/riscv-gcc-prebuilt/releases/download/rv32i-4.0.0/riscv32-unknown-elf.gcc-12.1.0.tar.gz | ||
sudo mkdir /opt/riscv | ||
sudo tar -xzf riscv32-unknown-elf.gcc-12.1.0.tar.gz -C /opt/riscv/ | ||
rm riscv32-unknown-elf.gcc-12.1.0.tar.gz | ||
# Update submodules | ||
git submodule update --init --recursive | ||
# Save location of RISC-V compiler to reuse later | ||
echo "FP_RISCV_COMPILER=/opt/riscv" >> "$GITHUB_ENV" | ||
shell: bash | ||
- name: Build FlexPRET and install to SDK | ||
run: | | ||
# Step into cloned directory | ||
cd flexpret | ||
# Save pwd to environment variable so we can find `env.bash` in later steps | ||
echo "FP_DIR=$(pwd)" >> "$GITHUB_ENV" | ||
# Source environment | ||
source env.bash | ||
# Build FlexPRET's high memory configuration and install it to SDK | ||
cd $FP_PATH && cmake -DFP_CONFIG=highmem -B build && cd build && make all install | ||
shell: bash |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
# Tests for embedded platforms | ||
name: CI (embedded platforms) | ||
|
||
on: | ||
workflow_dispatch: | ||
push: | ||
branches: | ||
- master | ||
pull_request: | ||
types: [synchronize, opened, reopened, ready_for_review, converted_to_draft] | ||
merge_group: | ||
|
||
env: | ||
# 2020.11 | ||
vcpkgGitRef: 0bf3923f9fab4001c00f0f429682a0853b5749e0 | ||
|
||
concurrency: | ||
group: all-embedded-${{ github.ref }}-${{ github.event_path }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | ||
|
||
jobs: | ||
check-diff: | ||
uses: ./.github/workflows/check-diff.yml | ||
|
||
c-embedded: | ||
uses: ./.github/workflows/c-embedded.yml | ||
needs: check-diff | ||
if: ${{ needs.check-diff.outputs.run_c == 'true' }} | ||
|
||
# Add more languages if supported |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
name: C embedded | ||
|
||
on: | ||
workflow_dispatch: | ||
workflow_call: | ||
|
||
|
||
concurrency: | ||
group: c-embedded-${{ github.ref }}-${{ github.event_path }} | ||
cancel-in-progress: ${{ github.ref != 'refs/heads/master' }} | ||
|
||
jobs: | ||
# Run the C Arduino integration tests. | ||
arduino: | ||
uses: ./.github/workflows/c-arduino-tests.yml | ||
with: | ||
all-platforms: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} | ||
|
||
# Run the C Zephyr integration tests. | ||
zephyr: | ||
uses: ./.github/workflows/c-zephyr-tests.yml | ||
|
||
# Run the C FlexPRET integration tests. | ||
flexpret: | ||
uses: ./.github/workflows/c-flexpret-tests.yml |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,58 @@ | ||
name: C FlexPRET tests | ||
|
||
on: | ||
workflow_call: | ||
inputs: | ||
compiler-ref: | ||
required: false | ||
type: string | ||
runtime-ref: | ||
required: false | ||
type: string | ||
use-cpp: | ||
required: false | ||
type: boolean | ||
default: false | ||
scheduler: | ||
required: false | ||
type: string | ||
all-platforms: | ||
required: false | ||
default: true | ||
type: boolean | ||
|
||
jobs: | ||
flexpret-tests: | ||
runs-on: ubuntu-latest | ||
steps: | ||
- name: Check out lingua-franca repository | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: lf-lang/lingua-franca | ||
submodules: true | ||
ref: ${{ inputs.compiler-ref }} | ||
fetch-depth: 0 | ||
- name: Prepare build environment | ||
uses: ./.github/actions/prepare-build-env | ||
- name: Setup and build FlexPRET | ||
uses: ./.github/actions/setup-flexpret | ||
- name: Check out specific ref of reactor-c | ||
uses: actions/checkout@v3 | ||
with: | ||
repository: lf-lang/reactor-c | ||
path: core/src/main/resources/lib/c/reactor-c | ||
ref: ${{ inputs.runtime-ref }} | ||
if: ${{ inputs.runtime-ref }} | ||
- name: Run FlexPRET smoke tests | ||
run: | | ||
cd "$FP_DIR" && source env.bash && cd - | ||
export RISCV_TOOL_PATH_PREFIX=$FP_RISCV_COMPILER | ||
./gradlew core:integrationTest \ | ||
--tests org.lflang.tests.runtime.CFlexPRETTest.* \ | ||
core:integrationTestCodeCoverageReport | ||
rm -rf test/C/src-gen | ||
- name: Report to CodeCov | ||
uses: ./.github/actions/report-code-coverage | ||
with: | ||
files: core/build/reports/jacoco/integrationTestCodeCoverageReport/integrationTestCodeCoverageReport.xml | ||
if: ${{ github.repository == 'lf-lang/lingua-franca' }} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
80 changes: 80 additions & 0 deletions
80
core/src/integrationTest/java/org/lflang/tests/runtime/CFlexPRETTest.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/************* | ||
* Copyright (c) 2023, The University of California at Berkeley. | ||
* | ||
* Redistribution and use in source and binary forms, with or without modification, | ||
* are permitted provided that the following conditions are met: | ||
* | ||
* 1. Redistributions of source code must retain the above copyright notice, | ||
* this list of conditions and the following disclaimer. | ||
* | ||
* 2. Redistributions in binary form must reproduce the above copyright notice, | ||
* this list of conditions and the following disclaimer in the documentation | ||
* and/or other materials provided with the distribution. | ||
* | ||
* THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND | ||
* ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED | ||
* WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE | ||
* DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE LIABLE FOR | ||
* ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES | ||
* (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; | ||
* LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON | ||
* ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT | ||
* (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS | ||
* SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. | ||
***************/ | ||
package org.lflang.tests.runtime; | ||
|
||
import java.util.List; | ||
import org.junit.jupiter.api.Assumptions; | ||
import org.junit.jupiter.api.Test; | ||
import org.lflang.target.Target; | ||
import org.lflang.tests.Configurators; | ||
import org.lflang.tests.TestBase; | ||
import org.lflang.tests.TestRegistry.TestCategory; | ||
import org.lflang.tests.Transformers; | ||
|
||
public class CFlexPRETTest extends TestBase { | ||
|
||
public CFlexPRETTest() { | ||
super(Target.C); | ||
} | ||
|
||
@Test | ||
public void buildFlexPRETConcurrent() { | ||
Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); | ||
super.runTestsFor( | ||
List.of(Target.C), | ||
"Build concurrent tests for FlexPRET.", | ||
TestCategory.CONCURRENT::equals, | ||
Transformers::noChanges, | ||
Configurators::makeFlexPRETCompatible, | ||
TestLevel.BUILD, | ||
false); | ||
} | ||
|
||
@Test | ||
public void buildFlexPRETBasicTestsUnthreaded() { | ||
Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); | ||
super.runTestsFor( | ||
List.of(Target.C), | ||
"Build basic tests for FlexPRET in single threaded mode.", | ||
TestCategory.BASIC::equals, | ||
Transformers::noChanges, | ||
Configurators::makeFlexPRETCompatibleUnthreaded, | ||
TestLevel.BUILD, | ||
false); | ||
} | ||
|
||
@Test | ||
public void buildFlexPRETBasicTests() { | ||
Assumptions.assumeTrue(isLinux(), "FlexPRET tests only supported on Linux"); | ||
super.runTestsFor( | ||
List.of(Target.C), | ||
"Build basic tests for FlexPRET.", | ||
TestCategory.BASIC::equals, | ||
Transformers::noChanges, | ||
Configurators::makeFlexPRETCompatible, | ||
TestLevel.BUILD, | ||
false); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.