Skip to content
/ lf-3pi-template Public template
generated from lf-lang/lf-pico-template

Program the Pololu 3pi+ 2040 robot using Lingua Franca

License

Notifications You must be signed in to change notification settings

lf-lang/lf-3pi-template

Repository files navigation

Template for the Lingua Franca RP2040 target platform

This repo is a template for Lingua Franca (LF) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico board and the Pololu 3pi+ 2040 robot. This template is particularly well suited for the LF Embedded Lab exercises. Students should create a repository using this template and record their work within their repo.

The repo supports MacOS, Linux, and Windows through WSL. To support RP2040-based boards, the repo uses the Pico SDK as a submodule. It also includes some code from the pololu-3pi-2040-robot library by DavidEGrayson.

See the getting started instructions to get started.

Emulator

To run basic tests and monitor GPIO, UART, and other supported peripherals, a Node.js-based emulator for the Raspberry Pi Pico is provided in this repo. During the nix shell setup for the repo, the Node modules in the test directory are installed. This emulator is based on Wokwi. Because it emulates the Pico board, not the Pololu robot, it will not be able to run all the programs for the robot.

By default, the emulator uses hex binaries which are generated by both build options. Any hex files that are in need of testing must be placed in the /test directory.

Run the following from the /test directory. It will run an emulator instance for each hex file in the directory in parallel and report results as plain text files in the same directory.

cd test/
npm start

The text framework source code is available and can be easily extended. Currently, a test is set to report a FAILING status if it does not terminate within 10 seconds but this callback condition is marked in run.ts and can be modified. To set a timeout in a LF program add the following target property to the program header.

target C {
    ...
    timeout: 5 sec,
}