Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/formatting.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
clang-format --version
make format-check
- name: LFC format check
run: cd lfc && ./gradlew spotlessCheck
run: cd lfuc && ./gradlew spotlessCheck
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ benchmarks/include
cmake-build-debug
cmake-build-release
.idea
!lfc/bin
!lfuc/bin
doc/html
doc/latex
doc/markdown/platform
4 changes: 2 additions & 2 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -46,12 +46,12 @@ HDR_FILES := $(shell find ./include -path ./include/reactor-uc/generated -prune

format:
clang-format -i -style=file $(SRC_FILES) $(HDR_FILES)
cd lfc && ./gradlew ktfmtFormat && ./gradlew spotlessApply && cd ..
cd lfuc && ./gradlew ktfmtFormat && ./gradlew spotlessApply && cd ..

# Check that the code base is formatted
format-check:
clang-format --dry-run --Werror -style=file $(SRC_FILES) $(HDR_FILES)
cd lfc && ./gradlew ktfmtCheck && ./gradlew spotlessCheck && cd ..
cd lfuc && ./gradlew ktfmtCheck && ./gradlew spotlessCheck && cd ..

# Run the entire CI flow
ci: clean format-check test coverage
Expand Down
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ main reactor {
=}
}
EOF
./lfc/bin/lfc-dev HelloWorld.lf
./lfuc/bin/lfuc-dev HelloWorld.lf
bin/HelloWorld
```

Expand Down Expand Up @@ -92,7 +92,7 @@ make
### Code organization
The project is organized as follows:
- `./src` and `./include`: The runtime.
- `./lfc`: A minimal copy of the Lingua Franca Compiler including a new code-generator
- `./lfuc`: A minimal copy of the Lingua Franca Compiler including a new code-generator
- `./examples`: Example programs for the different target platforms
- `./external`: External dependencies, such as nanopb
- `./test`: Unit, platform and integration tests
Expand Down
2 changes: 1 addition & 1 deletion benchmarks/runAll.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
set -e

LFC=lfc
LFCG=${REACTOR_UC_PATH}/lfc/bin/lfc-dev
LFCG=${REACTOR_UC_PATH}/lfuc/bin/lfuc-dev

$LFC src/PingPongC.lf
$LFCG src/PingPongUc.lf
Expand Down
2 changes: 1 addition & 1 deletion cmake/lfc.cmake → cmake/lfuc.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ function(lf_run_lfc LF_SOURCE_DIR LF_MAIN)
message(FATAL_ERROR "LF main file does not exist: ${LF_SOURCE_DIR}/${LF_MAIN}.lf")
endif()

set(LFC_COMMAND $ENV{REACTOR_UC_PATH}/lfc/bin/lfc-dev ${LF_SOURCE_DIR}/${LF_MAIN}.lf -n -o ${CMAKE_CURRENT_SOURCE_DIR})
set(LFC_COMMAND $ENV{REACTOR_UC_PATH}/lfuc/bin/lfuc-dev ${LF_SOURCE_DIR}/${LF_MAIN}.lf -n -o ${CMAKE_CURRENT_SOURCE_DIR})
execute_process(COMMAND echo "Running LFC: ${LFC_COMMAND}")
execute_process(
COMMAND ${LFC_COMMAND}
Expand Down
2 changes: 1 addition & 1 deletion doc/markdown/2_introduction.md
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ targeting the Native platform.
=}
}
EOF
reactor-uc/lfc/bin/lfc-dev HelloWorld.lf
reactor-uc/lfuc/bin/lfuc-dev HelloWorld.lf
bin/HelloWorld
\endcode

Expand Down
14 changes: 7 additions & 7 deletions doc/markdown/3_philosophy.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,19 @@ beginners.

The design of systems with reactor-uc and LF follows a top-down design
approach, where the programmer starts with his design written in LF. The LF
compiler (`lfc`) translates your design into C code. This generated code uses the
compiler (`lfuc`) translates your design into C code. This generated code uses the
reactor-uc runtime functions to execute the program. When you create federated
(distributed) programs, `lfc` generates subfolders for each federate (node) in your
(distributed) programs, `lfuc` generates subfolders for each federate (node) in your
system. The goal of reactor-uc is to enable integration into existing toolchains.
For example, for projects based on Zephyr, we provide `lfc`-integration through
For example, for projects based on Zephyr, we provide `lfuc`-integration through
a custom `west` command. When building an application the programmer interacts
with `west` as usual, and `west` calls `lfc` to generate C code from the LF source
with `west` as usual, and `west` calls `lfuc` to generate C code from the LF source
files, finally `west` uses CMake to configure and build the final executable.
Another example is RIOT OS, which has a Make-based toolchain. For RIOT we
integrate `lfc` into the application Makefile such that calling `make all`
first invokes `lfc` on the LF sources before compiling the generated sources.
integrate `lfuc` into the application Makefile such that calling `make all`
first invokes `lfuc` on the LF sources before compiling the generated sources.

`lfc` produces importable CMake and make files that you can import into your
`lfuc` produces importable CMake and make files that you can import into your
build-system. For common platforms like [Zephyr](https://zephyrproject.org/),
[RIOT](https://riot-os.org) or the
[pico-sdk](https://www.raspberrypi.com/documentation/pico-sdk/) we provide
Expand Down
2 changes: 1 addition & 1 deletion env.bash
Original file line number Diff line number Diff line change
Expand Up @@ -3,5 +3,5 @@

curdir=$(pwd)
export REACTOR_UC_PATH=$( cd -- "$( dirname -- "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )
alias lfcg='${REACTOR_UC_PATH}/lfc/bin/lfc-dev'
alias lfuc='${REACTOR_UC_PATH}/lfuc/bin/lfuc-dev'
cd $curdir
4 changes: 2 additions & 2 deletions env.fish
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@ cd $curdir

# Define the function
function do_lfc
{$REACTOR_UC_PATH}/lfc/bin/lfc-dev $argv
{$REACTOR_UC_PATH}/lfuc/bin/lfuc-dev $argv
end

# Create an alias for the function
function lfcg
function lfuc
do_lfc $argv
end
2 changes: 1 addition & 1 deletion env.zsh
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@
script_dir=$(dirname "$0:A")

export REACTOR_UC_PATH=$script_dir
alias lfcg='${REACTOR_UC_PATH}/lfc/bin/lfc-dev'
alias lfuc='${REACTOR_UC_PATH}/lfuc/bin/lfuc-dev'
6 changes: 3 additions & 3 deletions examples/fed-template/buildAll.sh
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
#!/usr/bin/env bash
set -e

${REACTOR_UC_PATH}/lfc/bin/lfc-dev --gen-fed-templates src/MyFed.lf
${REACTOR_UC_PATH}/lfuc/bin/lfuc-dev --gen-fed-templates src/MyFed.lf


pushd MyFed/src
./run_lfc.sh
./run_lfuc.sh
cmake -Bbuild
cmake --build build
popd

pushd MyFed/dest
./run_lfc.sh
./run_lfuc.sh
west build
popd

2 changes: 1 addition & 1 deletion examples/flexpret/buildAll.sh
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
# set -e
# ${REACTOR_UC_PATH}/lfc/bin/lfc-dev src/Smoke.lf
# ${REACTOR_UC_PATH}/lfuc/bin/lfuc-dev src/Smoke.lf
# cmake -Bbuild
# make -C build
# bin/fp-smoke
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

LF_MAIN=CoapFederatedLF

$REACTOR_UC_PATH/lfc/bin/lfc-dev ../../src/$LF_MAIN.lf -n -o .
$REACTOR_UC_PATH/lfuc/bin/lfuc-dev ../../src/$LF_MAIN.lf -n -o .
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@

LF_MAIN=CoapFederatedLF

$REACTOR_UC_PATH/lfc/bin/lfc-dev ../../src/$LF_MAIN.lf -n -o .
$REACTOR_UC_PATH/lfuc/bin/lfuc-dev ../../src/$LF_MAIN.lf -n -o .
6 changes: 3 additions & 3 deletions examples/riot/coap_federated_lf/build.sh
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@
LF_MAIN=CoapFederatedLF

# Generate configuration templates if they don't exist already
$REACTOR_UC_PATH/lfc/bin/lfc-dev --gen-fed-templates src/$LF_MAIN.lf
$REACTOR_UC_PATH/lfuc/bin/lfuc-dev --gen-fed-templates src/$LF_MAIN.lf

# Generate and build r1 sources
pushd ./$LF_MAIN/r1
./run_lfc.sh
./run_lfuc.sh
PORT=tap0 make all
popd

# Generate and build r2 sources
pushd ./$LF_MAIN/r2
./run_lfc.sh
./run_lfuc.sh
PORT=tap1 make all
popd
2 changes: 1 addition & 1 deletion examples/riot/hello_lf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ LF_MAIN ?= HelloLF

# Execute the LF compiler if build target is "all"
ifeq ($(firstword $(MAKECMDGOALS)),all)
_ := $(shell $(REACTOR_UC_PATH)/lfc/bin/lfc-dev src/$(LF_MAIN).lf)
_ := $(shell $(REACTOR_UC_PATH)/lfuc/bin/lfuc-dev src/$(LF_MAIN).lf)
endif

# ---- RIOT specific configuration ----
Expand Down
2 changes: 1 addition & 1 deletion examples/zephyr/hello_lf/README.md
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
# Simple example of using the reactor-uc with LF and Zephyr

```
lfc src/HelloLF.lf -c
lfuc src/HelloLF.lf -c
west build -b qemu_cortex_m3
west build -t run
```
2 changes: 1 addition & 1 deletion examples/zephyr/hello_lf/run/build.sh
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
#!/usr/bin/env bash

${REACTOR_UC_PATH}/lfc/bin/lfc-dev src/HelloLF.lf
${REACTOR_UC_PATH}/lfuc/bin/lfuc-dev src/HelloLF.lf
west build -b qemu_cortex_m3 -p always
Binary file removed lfc/gradle/wrapper/gradle-wrapper.jar
Binary file not shown.
2 changes: 0 additions & 2 deletions lfc/settings.gradle

This file was deleted.

File renamed without changes.
File renamed without changes.
4 changes: 2 additions & 2 deletions lfc/bin/lfc-dev → lfuc/bin/lfuc-dev
Original file line number Diff line number Diff line change
Expand Up @@ -55,5 +55,5 @@ fi
gradlew="${base}/gradlew"

# Launch the tool.
"${gradlew}" --quiet -p "${base}" assemble ":cli:lfc:assemble"
"${base}/build/install/lf-cli/bin/lfc" "$@"
"${gradlew}" --quiet -p "${base}" assemble ":cli:lfuc:assemble"
"${base}/build/install/lf-cli/bin/lfuc" "$@"
4 changes: 2 additions & 2 deletions lfc/bin/lfc-dev.ps1 → lfuc/bin/lfuc-dev.ps1
Original file line number Diff line number Diff line change
Expand Up @@ -11,5 +11,5 @@ $base="$PSScriptRoot\..\"
$gradlew="${base}/gradlew.bat"

# invoke script
& "${gradlew}" --quiet -p "${base}" assemble ":cli:lfc:assemble"
& "${base}/build/install/lf-cli/bin/lfc" @args
& "${gradlew}" --quiet -p "${base}" assemble ":cli:lfuc:assemble"
& "${base}/build/install/lf-cli/bin/lfuc" @args
6 changes: 3 additions & 3 deletions lfc/build.gradle → lfuc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ distributions {
distributionClassifier = platform.os + '-' + platform.arch
}
contents {
from tasks.getByPath('cli:lfc:installDist').outputs
from tasks.getByPath('cli:lfuc:installDist').outputs
duplicatesStrategy = DuplicatesStrategy.EXCLUDE
}
}
Expand All @@ -47,6 +47,6 @@ assemble.dependsOn('installDist')


// Alias tasks for simpler access
tasks.register('runLfc', JavaExec) {
dependsOn('cli:lfc:run')
tasks.register('runLfuc', JavaExec) {
dependsOn('cli:lfuc:run')
}
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 1 addition & 1 deletion lfc/cli/lfc/build.gradle → lfuc/cli/lfuc/build.gradle
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,6 @@ dependencies {
}

application {
mainClass = 'org.lflang.cli.Lfc'
mainClass = 'org.lflang.cli.Lfuc'
tasks.run.workingDir = System.getProperty("user.dir")
}
Original file line number Diff line number Diff line change
Expand Up @@ -35,11 +35,11 @@
* @author Atharva Patil
*/
@Command(
name = "lfc",
name = "lfuc",
// Enable usageHelp (--help) and versionHelp (--version) options.
mixinStandardHelpOptions = true,
versionProvider = VersionProvider.class)
public class Lfc extends CliBase {
public class Lfuc extends CliBase {
/** Injected code generator. */
@Inject private GeneratorDelegate generator;

Expand Down Expand Up @@ -187,7 +187,7 @@ public static void main(final String[] args) {
* @param args Command-line arguments.
*/
public static void main(Io io, final String... args) {
cliMain("lfc", Lfc.class, io, args);
cliMain("lfuc", Lfuc.class, io, args);
}

/** Load the resource, validate it, and, invoke the code generator. */
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
Original file line number Diff line number Diff line change
Expand Up @@ -30,10 +30,10 @@ class UcFederatedTemplateGenerator(
|
|LF_MAIN=${mainDef.name}
|
|${S}REACTOR_UC_PATH/lfc/bin/lfc-dev ../../src/${S}LF_MAIN.lf -n -o .
|${S}REACTOR_UC_PATH/lfuc/bin/lfuc-dev ../../src/${S}LF_MAIN.lf -n -o .
"""
.trimMargin()
val filePath = projectRoot.resolve("run_lfc.sh")
val filePath = projectRoot.resolve("run_lfuc.sh")
FileUtil.writeToFile(shellScript, filePath)
filePath.setPosixFilePermissions(
setOf(
Expand All @@ -54,7 +54,7 @@ class UcFederatedTemplateGenerator(
|project(${mainDef.name}_${targetName})
|
|${if (createMainTarget) "add_executable($S{LF_MAIN_TARGET})" else ""}
|include(${S}ENV{REACTOR_UC_PATH}/cmake/lfc.cmake)
|include(${S}ENV{REACTOR_UC_PATH}/cmake/lfuc.cmake)
|lf_setup()
|lf_build_generated_code($S{LF_MAIN_TARGET} $S{CMAKE_CURRENT_SOURCE_DIR}/src-gen/$S{LF_MAIN}/$S{FEDERATE})
|
Expand Down Expand Up @@ -119,7 +119,7 @@ class UcFederatedTemplateGenerator(
|# Change this to 0 show compiler invocation lines by default:
|QUIET ?= 1
|
|include $S(REACTOR_UC_PATH)/make/riot/riot-lfc.mk
|include $S(REACTOR_UC_PATH)/make/riot/riot-lfuc.mk
"""
.trimMargin()
FileUtil.writeToFile(make, projectRoot.resolve("Makefile"))
Expand Down
File renamed without changes.
File renamed without changes.
File renamed without changes.
File renamed without changes.
2 changes: 2 additions & 0 deletions lfuc/settings.gradle
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
rootProject.name = 'org.lflang'
include('core', 'cli:base', 'cli:lfuc')
File renamed without changes.
6 changes: 3 additions & 3 deletions test/lf/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -9,14 +9,14 @@ BINS_ONLY_BUILD = $(patsubst src/only_build/%.lf, bin/%, $(SRCS_ONLY_BUILD))
SRCS_LEGACY = $(wildcard src/legacy/*.lf)
BINS_LEGACY = $(patsubst src/legacy/%.lf, bin/%, $(SRCS_LEGACY))

LFC_PATH=../../lfc
LFC = ${LFC_PATH}/build/install/lf-cli/bin/lfc
LFC_PATH=../../lfuc
LFC = ${LFC_PATH}/build/install/lf-cli/bin/lfuc

.PHONY: all clean legacy
all: build_lfc ${BINS} legacy

build_lfc:
${LFC_PATH}/bin/lfc-dev --version
${LFC_PATH}/bin/lfuc-dev --version

bin/%: src/%.lf
${LFC} $^ -c
Expand Down
Loading