Skip to content

Commit

Permalink
Merge remote-tracking branch 'upstream/master'
Browse files Browse the repository at this point in the history
  • Loading branch information
EhsanKhodadad committed Oct 1, 2024
2 parents f8d1e83 + b00aafe commit 06be510
Show file tree
Hide file tree
Showing 24 changed files with 347 additions and 142 deletions.
19 changes: 4 additions & 15 deletions .github/actions/setup-flexpret/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,12 @@ runs:
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
sudo apt install verilator
# 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"
wget -q --show-progress https://github.com/xpack-dev-tools/riscv-none-elf-gcc-xpack/releases/download/v14.2.0-2/xpack-riscv-none-elf-gcc-14.2.0-2-linux-x64.tar.gz -O gcc.tar.gz
tar xvf gcc.tar.gz --directory=/opt
echo "RISCV_TOOL_PATH_PREFIX=/opt/xpack-riscv-none-elf-gcc-14.2.0-2" >> $GITHUB_ENV
shell: bash
- name: Build FlexPRET and install to SDK
run: |
Expand Down
2 changes: 1 addition & 1 deletion .github/actions/setup-zephyr/action.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ runs:
steps:
- name: Setup environment variables
run: |
echo "SDK_VERSION=0.16.3" >> $GITHUB_ENV
echo "SDK_VERSION=0.16.8" >> $GITHUB_ENV
shell: bash
- name: Dependencies
run: |
Expand Down
4 changes: 2 additions & 2 deletions .github/scripts/run-zephyr-tests.sh
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/bin/bash

# Skip
skip=("FileReader" "FilePkgReader")
skip=("FileReader" "FilePkgReader" "AsyncCallback" "AsyncCallbackDrop" "AsyncCallbackReplace")

find_kconfig_folders() {
if [ -f "$folder/CMakeLists.txt" ]; then
Expand Down Expand Up @@ -45,7 +45,7 @@ run_qemu_zephyr_test() {
pid=$!
return_val=2
wait_count=0
timeout=60
timeout=120
# Parse the file and match on known outputs. With timeout.
while [ "$wait_count" -le "$timeout" ]; do
sleep 1
Expand Down
7 changes: 0 additions & 7 deletions .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,3 @@ jobs:
uses: ./.github/actions/report-code-coverage
with:
files: core/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/base/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfc/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lfd/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml,cli/lff/build/reports/jacoco/testCodeCoverageReport/testCodeCoverageReport.xml

epoch:
uses: lf-lang/epoch/.github/workflows/build.yml@main
with:
lingua-franca-ref: ${{ github.head_ref || github.ref_name }}
lingua-franca-repo: ${{ github.event.pull_request.head.repo.full_name }}
upload-artifacts: false
6 changes: 3 additions & 3 deletions .github/workflows/c-embedded.yml
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ jobs:
zephyr:
uses: ./.github/workflows/c-zephyr-tests.yml

# Run the C FlexPRET integration tests.
flexpret:
uses: ./.github/workflows/c-flexpret-tests.yml
# # Run the C FlexPRET integration tests.
# flexpret:
# uses: ./.github/workflows/c-flexpret-tests.yml

# Run the C Patmos integration tests.
patmos:
Expand Down
1 change: 0 additions & 1 deletion .github/workflows/c-flexpret-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,6 @@ jobs:
- 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
Expand Down
52 changes: 26 additions & 26 deletions .github/workflows/c-zephyr-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -39,27 +39,27 @@ jobs:
path: core/src/main/resources/lib/c/reactor-c
ref: ${{ inputs.runtime-ref }}
if: ${{ inputs.runtime-ref }}
# - name: Run Zephyr smoke tests
# run: |
# ./gradlew core:integrationTest \
# --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrUnthreaded* \
# --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrThreaded* core:integrationTestCodeCoverageReport
# ./.github/scripts/run-zephyr-tests.sh test/C/src-gen
# rm -rf test/C/src-gen
# - name: Run basic tests
# run: |
# ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildBasic* core:integrationTestCodeCoverageReport
# ./.github/scripts/run-zephyr-tests.sh test/C/src-gen
# rm -rf test/C/src-gen
# - name: Run concurrent tests
# run: |
# ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildConcurrent* core:integrationTestCodeCoverageReport
# ./.github/scripts/run-zephyr-tests.sh test/C/src-gen
# rm -rf test/C/src-gen
# - name: Run Zephyr board tests
# run: |
# ./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrBoards* core:integrationTestCodeCoverageReport
# rm -rf test/C/src-gen
- name: Run Zephyr smoke tests
run: |
./gradlew core:integrationTest \
--tests org.lflang.tests.runtime.CZephyrTest.buildZephyrUnthreaded* \
--tests org.lflang.tests.runtime.CZephyrTest.buildZephyrThreaded* core:integrationTestCodeCoverageReport
./.github/scripts/run-zephyr-tests.sh test/C/src-gen
rm -rf test/C/src-gen
- name: Run basic tests
run: |
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildBasic* core:integrationTestCodeCoverageReport
./.github/scripts/run-zephyr-tests.sh test/C/src-gen
rm -rf test/C/src-gen
- name: Run concurrent tests
run: |
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildConcurrent* core:integrationTestCodeCoverageReport
./.github/scripts/run-zephyr-tests.sh test/C/src-gen
rm -rf test/C/src-gen
- name: Run Zephyr board tests
run: |
./gradlew core:integrationTest --tests org.lflang.tests.runtime.CZephyrTest.buildZephyrBoards* core:integrationTestCodeCoverageReport
rm -rf test/C/src-gen
- name: Smoke test of lf-west-template
run: |
export LFC=$(pwd)/bin/lfc-dev
Expand All @@ -68,8 +68,8 @@ jobs:
west lfc apps/NrfBlinky/src/NrfBlinky.lf --lfc $LFC --build "-p always"
west lfc apps/NrfBlinky/src/NrfToggleGPIO.lf --lfc $LFC --build "-p always"
west build -b qemu_cortex_m3 -p always apps/HelloZephyr
# - 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' }}
- 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' }}
5 changes: 4 additions & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,10 @@
[Contributing](CONTRIBUTING.md) |
[Changelog](CHANGELOG.md)

[![Build Status](https://github.com/lf-lang/lingua-franca/workflows/CI/badge.svg)](https://github.com/lf-lang/lingua-franca/actions/)
[![CI (targets)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-targets.yml/badge.svg)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-targets.yml?query=branch%3Amaster)
[![CI (misc)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-misc.yml/badge.svg)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-misc.yml?query=branch%3Amaster)
[![CI (misc)](https://github.com/lf-lang/lingua-franca/actions/workflows/all-embedded.yml/badge.svg)]([https://github.com/lf-lang/lingua-franca/actions/](https://github.com/lf-lang/lingua-franca/actions/workflows/all-embedded.yml?query=branch%3Amaster))

[![Nightly Build](https://github.com/lf-lang/lingua-franca/actions/workflows/nightly-build.yml/badge.svg)](https://github.com/lf-lang/lingua-franca/actions/workflows/nightly-build.yml)
[![CodeCov](https://codecov.io/gh/lf-lang/lingua-franca/branch/master/graph/badge.svg?token=b7LrpihI5a)](https://codecov.io/gh/lf-lang/lingua-franca)
[![GitHub Contributors](https://img.shields.io/github/contributors/lf-lang/lingua-franca)](https://github.com/lf-lang/lingua-franca/graphs/contributors)
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
package org.lflang.federated.generator;

import static org.lflang.generator.docker.DockerGenerator.dockerGeneratorFactory;
import static org.lflang.target.property.type.PlatformType.Platform.supportsFederated;

import com.google.inject.Injector;
import java.io.IOException;
Expand Down Expand Up @@ -63,6 +64,7 @@
import org.lflang.target.property.DockerProperty.DockerOptions;
import org.lflang.target.property.KeepaliveProperty;
import org.lflang.target.property.NoCompileProperty;
import org.lflang.target.property.PlatformProperty;
import org.lflang.target.property.type.CoordinationModeType.CoordinationMode;
import org.lflang.util.Averager;
import org.lflang.util.FileUtil;
Expand Down Expand Up @@ -121,7 +123,7 @@ public FedGenerator(LFGeneratorContext context) {
* @return False if no errors have occurred, true otherwise.
*/
public boolean doGenerate(Resource resource, LFGeneratorContext context) throws IOException {
if (!federatedExecutionIsSupported(resource)) return true;
if (!federatedExecutionIsSupported(resource, context)) return true;
cleanIfNeeded(context);

// In a federated execution, we need keepalive to be true,
Expand Down Expand Up @@ -174,12 +176,6 @@ public boolean doGenerate(Resource resource, LFGeneratorContext context) throws
federates.stream().map(fed -> fed.name).collect(Collectors.toList())));
}

// Do not invoke target code generators if --no-compile flag is used.
if (context.getTargetConfig().get(NoCompileProperty.INSTANCE)) {
context.finish(Status.GENERATED, lf2lfCodeMapMap);
return false;
}

// If the RTI is to be built locally, set up a build environment for it.
prepareRtiBuildEnvironment(context);

Expand Down Expand Up @@ -300,7 +296,7 @@ private void cleanIfNeeded(LFGeneratorContext context) {
}

/** Return whether federated execution is supported for {@code resource}. */
private boolean federatedExecutionIsSupported(Resource resource) {
private boolean federatedExecutionIsSupported(Resource resource, LFGeneratorContext context) {
TargetDecl targetDecl = GeneratorUtils.findTargetDecl(resource);
var target = Target.fromDecl(targetDecl);
var targetOK =
Expand All @@ -316,6 +312,17 @@ private boolean federatedExecutionIsSupported(Resource resource) {
.error("Federated LF programs with a C target are currently not supported on Windows.");
targetOK = false;
}
if (target.equals(Target.C) || target.equals(Target.CCPP)) {
// Currently, only the C runtime has a platform abstraction.
var platform = context.getTargetConfig().get(PlatformProperty.INSTANCE).platform();
if (!supportsFederated(platform)) {
messageReporter
.at(targetDecl)
.error(
"Federations are not supported by the " + platform.getcMakeName() + " platform.");
targetOK = false;
}
}

return targetOK;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -158,8 +158,8 @@ CodeBuilder generateCMakeCode(
cMakeCode.pr("# Selecting default board");
cMakeCode.pr("set(BOARD qemu_cortex_m3)");
}
cMakeCode.pr("# We recommend Zephyr v3.4.0 but we are compatible with older versions also");
cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} 3.4.0)");
cMakeCode.pr("# We recommend Zephyr v3.7.0 but we are compatible with older versions also");
cMakeCode.pr("find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE} 3.7.0)");
cMakeCode.newLine();
cMakeCode.pr("project(" + executableName + " LANGUAGES C)");
cMakeCode.newLine();
Expand Down
Loading

0 comments on commit 06be510

Please sign in to comment.