This repository contains a template for Lingua Franca applications using the
Zephyr target platform. It contains a west
extension which takes care of
invoking lfc
.
- Linux system (or WSL). Should be fine on MacOS also, but not tested yet.
- An installation of
lfc
which is more recent than commit788ba74
where zephyr support was added. The nightly release can be downloaded here. This version oflfc
must the firstlfc
on the system path. Alternatively you can edit this line to give the path to the new lfc.
NB: This is a temporary workaround until v0.4 is released
- In order to use this template the following Zephyr dependencies are needed:
- West meta build tool (see West information)
- Zephyr SDK and toolchains
Please refer to Zephyr Getting Started Guide. NB. You can skip steps 5,6,7 which clones the entire Zephyr project. Instead we will clone Zephyr into this workspace using west.
If west
is installed in a virtual environment, this environment is assumed activated for the rest of this guide.
- Clone this template and remove old git history:
git clone https://github.com/lf-lang/lf-zephyr-template/ lf-zephyr-app
cd lf-zephyr-app
- Clone the Zephyr project into
deps/zephyr
:
west update
- Install Zephyr python dependencies:
pip3 install -r deps/zephyr/scripts/requirements.txt
cd application
west lf-build src/HelloWorld.lf -w "-t run"
This requires that the nrfjprog
utility is installed. See installation guide here
cd application
west lf-build src/NrfBlinky.lf -w "-b nrf52dk_nrf52832 -p always"
west flash
The custom lf-build
west command can be inspected in scripts/lf_build.py
. It
invokes lfc
on the provided LF source file. It then invokes west build
on
the generated sources. See west lf-build -h
for more information.