From b8776c0b3a7ee20d76256304b51be1df5d5513c2 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Mon, 16 Feb 2026 10:47:35 -0500 Subject: [PATCH 01/11] Update shell.nix show how to explicitly set Pico environment variables, use lolcat to colorize notable Pico settings in shell output, added shell message to tell how to exit the shell made by nix develop --- shell.nix | 13 +++++++++++-- 1 file changed, 11 insertions(+), 2 deletions(-) diff --git a/shell.nix b/shell.nix index 3a1abd7..03ffc12 100644 --- a/shell.nix +++ b/shell.nix @@ -5,6 +5,7 @@ let in pkgs.mkShell { packages = with pkgs; [ + lolcat picotool cmake gcc-arm-embedded @@ -20,6 +21,10 @@ pkgs.mkShell { # lingo ]; + # set environment variables + #PICO_BOARD = "pico"; + #PICO_PLATFORM = "rp2040"; + # TODO: integrate dependencies into nix shellHook = '' echo "[shell] hook start" @@ -28,13 +33,17 @@ pkgs.mkShell { cd pico-sdk/ git submodule update --init export PICO_SDK_PATH="$PWD" + echo "[shell] PICO_SDK_PATH: $PICO_SDK_PATH" | lolcat cd ../ - echo "[shell] copy robot header" + echo "[shell] copy robot header (pololu_3pi_2040_robot.h)" | lolcat cp pololu_3pi_2040_robot.h pico-sdk/src/boards/include/boards/ + echo "[shell] PICO_BOARD: $PICO_BOARD" | lolcat + echo "[shell] PICO_PLATFORM: $PICO_PLATFORM" | lolcat echo "[shell] setup testbed" cd test/ npm install - echo "[shell] hook end" cd ../ + echo '[shell] To exit the shell, type `exit` or press `Ctrl`+`D`' + echo "[shell] hook end" ''; } From 3a7e3b3a6274ece34dade63abcb52fe9831bbed7 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Tue, 24 Feb 2026 20:47:55 -0500 Subject: [PATCH 02/11] Update shell.nix No need to set PICO_PLATFORM because it is optional (it can be auto-set from within the header file specified by PICO_BOARD.) Include reference to and quotes from Pico-series C/C++ SDK --- shell.nix | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/shell.nix b/shell.nix index 03ffc12..85fdf63 100644 --- a/shell.nix +++ b/shell.nix @@ -22,8 +22,8 @@ pkgs.mkShell { ]; # set environment variables - #PICO_BOARD = "pico"; - #PICO_PLATFORM = "rp2040"; + # per "Raspberry Pi Pico-series C/C++ SDK", 7.2 Platform and Board Configuration: "PICO_BOARD=my_board_name in your environment will cause the header my_board_name.h to be included by all other SDK headers in order to provide #defines particular to the board you are using...If PICO_BOARD is specified but not PICO_PLATFORM, PICO_PLATFORM will be set if a value for it is specified in the board header." + #PICO_BOARD = "pico2_w"; # specify if your board is not plain pico, for example: pico_w, pico2, pico2_w, etc # TODO: integrate dependencies into nix shellHook = '' From 464ce1b180e4e6dd61e7dede1b812d0ebdf14471 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Wed, 25 Feb 2026 07:18:08 -0500 Subject: [PATCH 03/11] Update shell.nix explicitly set PICO_PLATFORM to empty value, which allows board header to set it automatically. this is presumably better than leaving it to whatever was last set in the environment --- shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/shell.nix b/shell.nix index 85fdf63..22884f3 100644 --- a/shell.nix +++ b/shell.nix @@ -24,6 +24,7 @@ pkgs.mkShell { # set environment variables # per "Raspberry Pi Pico-series C/C++ SDK", 7.2 Platform and Board Configuration: "PICO_BOARD=my_board_name in your environment will cause the header my_board_name.h to be included by all other SDK headers in order to provide #defines particular to the board you are using...If PICO_BOARD is specified but not PICO_PLATFORM, PICO_PLATFORM will be set if a value for it is specified in the board header." #PICO_BOARD = "pico2_w"; # specify if your board is not plain pico, for example: pico_w, pico2, pico2_w, etc + PICO_PLATFORM = ""; # intentionally empty valued, allowing board header to set it # TODO: integrate dependencies into nix shellHook = '' From 681e49a341f67bee2078556a41e47b19071b7a5b Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Wed, 25 Feb 2026 08:06:20 -0500 Subject: [PATCH 04/11] Update README.md: Support for RP2350-based boards How to use LF with the newer RP2350-based boards like Pico 2 and Pico 2 W. Environment variables can be set in shell.nix. Note that PICO_PLATFORM is auto-set in board headers. --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index c012601..ff4efa3 100644 --- a/README.md +++ b/README.md @@ -16,6 +16,9 @@ To launch the lf-pico shell environment, run the following in the root of the lf nix develop ``` +### Support for RP2350-based boards +This template can also support RP2350-based boards, such as the Pico 2 and Pico 2 W. Prior to running `nix develop`, ensure that the environment variables are set correctly. For example, to accomodate the Pico 2 W, you may edit `shell.nix` to add the following line above `shellHook`: `PICO_BOARD = "pico2_w";`. You may also optionally specify `PICO_PLATFORM = "";`, where the blank value means the board header will automatically set it. + ## Building Lingua Franca applications are code generated into the target language. To both code generate and build application binaries one can either use lfc or lingo. Lingo ultimately uses lfc as a backend but provides an additional experimental interface for managing multiple application binaries builds. From d082d5ba00a8cc8d3c991c454f25d1e3b62a0a6f Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Wed, 25 Feb 2026 10:59:41 -0500 Subject: [PATCH 05/11] Update shell.nix To find board header files for RP2350-based boards, `git switch master -f`. Without this, the Pico SDK is too early to know about them. With it, there are 60 boards referencing the RP2350. --- shell.nix | 1 + 1 file changed, 1 insertion(+) diff --git a/shell.nix b/shell.nix index 22884f3..0cb48c7 100644 --- a/shell.nix +++ b/shell.nix @@ -32,6 +32,7 @@ pkgs.mkShell { echo "[shell] setup pico-sdk" git submodule update --init cd pico-sdk/ + # git switch master -f # needed for newer Pico 2 boards git submodule update --init export PICO_SDK_PATH="$PWD" echo "[shell] PICO_SDK_PATH: $PICO_SDK_PATH" | lolcat From 8c35ebf6cace0934a8320d483605168bd03c4cc0 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Sat, 28 Feb 2026 17:14:10 -0500 Subject: [PATCH 06/11] Update README.md combine "Support for RP2350-based boards" into the "Setup" section, before `nix develop` --- README.md | 8 +++----- 1 file changed, 3 insertions(+), 5 deletions(-) diff --git a/README.md b/README.md index ff4efa3..392eec9 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,5 @@ # Template for the Lingua Franca RP2040 target platform -This repo is a template for [Lingua Franca](https://www.lf-lang.org/) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico board and the [Pololu 3pi+ 2040 robot](https://www.pololu.com/docs/0J86). Currently the repo supports MacOS, Linux, and Windows through [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). -To support RP2040-based boards, the repo uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master/src) as a dependency which includes a light set of headers, libraries and a build system. +This repo is a template for [Lingua Franca](https://www.lf-lang.org/) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico 1 board and the [Pololu 3pi+ 2040 robot](https://www.pololu.com/docs/0J86). Currently the repo supports MacOS, Linux, and Windows through [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). To support RP2040-based boards, the repo uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master/src) as a dependency which includes a light set of headers, libraries and a build system. This template can also be used with RP2350-based boards, such as the Pico 2 and Pico 2 W. ## Setup This template uses nix to manage toolchains and other applications. Install [nix](https://nixos.org/download.html) first for your preferred platform. Make note of the installation type since a **multi-user** install will require sudo permissions and will interact with a system-wide `/nix/store`. After installation, run the following in the shell to enable the experimental nix flakes feature. @@ -10,15 +9,14 @@ mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf ``` +The board is specified via the `PICO_BOARD` CMake variable, which may be specified on the CMake command line or in the environment. One way to set environment variables for your build is in the file `shell.nix`, right above `shellHook`. Insert `PICO_BOARD = "my_board_name"`, where `my_board_name.h` is the board header file found in `pico-sdk/src/boards/include/boards/`. For example, to accomodate the Pico 2 W, insert `PICO_BOARD = "pico2_w"`. We can also insert `PICO_PLATFORM = "";`, where the empty value means the board header will automatically set it via `pico_board_cmake_set`. + To launch the lf-pico shell environment, run the following in the root of the lf-pico repository. The launched shell will include the various required toolchains and applications needed for development. ```bash nix develop ``` -### Support for RP2350-based boards -This template can also support RP2350-based boards, such as the Pico 2 and Pico 2 W. Prior to running `nix develop`, ensure that the environment variables are set correctly. For example, to accomodate the Pico 2 W, you may edit `shell.nix` to add the following line above `shellHook`: `PICO_BOARD = "pico2_w";`. You may also optionally specify `PICO_PLATFORM = "";`, where the blank value means the board header will automatically set it. - ## Building Lingua Franca applications are code generated into the target language. To both code generate and build application binaries one can either use lfc or lingo. Lingo ultimately uses lfc as a backend but provides an additional experimental interface for managing multiple application binaries builds. From 55c48ba80a800c14da45815510bf2989aca71180 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Sat, 28 Feb 2026 19:24:25 -0500 Subject: [PATCH 07/11] Update README.md: copyedit Setup --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 392eec9..a7ca2a2 100644 --- a/README.md +++ b/README.md @@ -9,7 +9,7 @@ mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf ``` -The board is specified via the `PICO_BOARD` CMake variable, which may be specified on the CMake command line or in the environment. One way to set environment variables for your build is in the file `shell.nix`, right above `shellHook`. Insert `PICO_BOARD = "my_board_name"`, where `my_board_name.h` is the board header file found in `pico-sdk/src/boards/include/boards/`. For example, to accomodate the Pico 2 W, insert `PICO_BOARD = "pico2_w"`. We can also insert `PICO_PLATFORM = "";`, where the empty value means the board header will automatically set it via `pico_board_cmake_set`. +The board is specified via the `PICO_BOARD` CMake variable, which may be specified on the CMake command line or in the environment. One way to set environment variables for your build is in the file `shell.nix`, in the block above `shellHook`. Set `PICO_BOARD = "my_board_name"`, where `my_board_name.h` is the board header file found in `pico-sdk/src/boards/include/boards/`. For example, to build for Pico 2 W: `PICO_BOARD = "pico2_w"`. We also set `PICO_PLATFORM = "";`, where the empty value means the board header will automatically set it via `pico_board_cmake_set`. To launch the lf-pico shell environment, run the following in the root of the lf-pico repository. The launched shell will include the various required toolchains and applications needed for development. From 6b26d4a931b6f240afb1c376ce8d540224444e5d Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Mon, 2 Mar 2026 09:38:17 -0500 Subject: [PATCH 08/11] Update shell.nix remove # git switch master -f # needed for newer Pico 2 boards TODO: bump up pico-sdk --- shell.nix | 1 - 1 file changed, 1 deletion(-) diff --git a/shell.nix b/shell.nix index 0cb48c7..22884f3 100644 --- a/shell.nix +++ b/shell.nix @@ -32,7 +32,6 @@ pkgs.mkShell { echo "[shell] setup pico-sdk" git submodule update --init cd pico-sdk/ - # git switch master -f # needed for newer Pico 2 boards git submodule update --init export PICO_SDK_PATH="$PWD" echo "[shell] PICO_SDK_PATH: $PICO_SDK_PATH" | lolcat From 33615fb3a0ccfd5067f9f0e2954a637cd561c248 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Tue, 3 Mar 2026 10:04:49 -0500 Subject: [PATCH 09/11] Update README.md: PICO_BOARD * reduce information details * add link to SDK book * used alert/callout to avoid making another section just for nix develop --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index a7ca2a2..fe1f98c 100644 --- a/README.md +++ b/README.md @@ -8,8 +8,8 @@ This template uses nix to manage toolchains and other applications. Install [nix mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf ``` - -The board is specified via the `PICO_BOARD` CMake variable, which may be specified on the CMake command line or in the environment. One way to set environment variables for your build is in the file `shell.nix`, in the block above `shellHook`. Set `PICO_BOARD = "my_board_name"`, where `my_board_name.h` is the board header file found in `pico-sdk/src/boards/include/boards/`. For example, to build for Pico 2 W: `PICO_BOARD = "pico2_w"`. We also set `PICO_PLATFORM = "";`, where the empty value means the board header will automatically set it via `pico_board_cmake_set`. +> [!NOTE] +> This template is applicable to both RP2040 and RP2350 based boards. In many cases, you can rely on the board configuration to automatically set the platform. For example, `export PICO_BOARD=pico2` will lead to `PICO_PLATFORM=rp2350`. This can be done in the file `shell.nix`, in the block above `shellHook`. We also set `PICO_PLATFORM = "";` to ensure the board header automatically sets it. For more information, see the "Platform and Board Configuration" chapter of the [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) book. To launch the lf-pico shell environment, run the following in the root of the lf-pico repository. The launched shell will include the various required toolchains and applications needed for development. From ade18409a0e2eab5e8f38e25dc93dffbeaa340a4 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:38:14 -0500 Subject: [PATCH 10/11] Update README.md - copyedit * restored lede by containing RP2350 to the Note in Setup --- README.md | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/README.md b/README.md index fe1f98c..9117c5c 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Template for the Lingua Franca RP2040 target platform -This repo is a template for [Lingua Franca](https://www.lf-lang.org/) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico 1 board and the [Pololu 3pi+ 2040 robot](https://www.pololu.com/docs/0J86). Currently the repo supports MacOS, Linux, and Windows through [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). To support RP2040-based boards, the repo uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master/src) as a dependency which includes a light set of headers, libraries and a build system. This template can also be used with RP2350-based boards, such as the Pico 2 and Pico 2 W. +This repo is a template for [Lingua Franca](https://www.lf-lang.org/) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico 1 board and the [Pololu 3pi+ 2040 robot](https://www.pololu.com/docs/0J86). Currently the repo supports MacOS, Linux, and Windows through [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). To support RP2040-based boards, the repo uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master/src) as a dependency which includes a light set of headers, libraries and a build system. ## Setup This template uses nix to manage toolchains and other applications. Install [nix](https://nixos.org/download.html) first for your preferred platform. Make note of the installation type since a **multi-user** install will require sudo permissions and will interact with a system-wide `/nix/store`. After installation, run the following in the shell to enable the experimental nix flakes feature. @@ -9,7 +9,7 @@ mkdir -p ~/.config/nix echo "experimental-features = nix-command flakes" >> ~/.config/nix/nix.conf ``` > [!NOTE] -> This template is applicable to both RP2040 and RP2350 based boards. In many cases, you can rely on the board configuration to automatically set the platform. For example, `export PICO_BOARD=pico2` will lead to `PICO_PLATFORM=rp2350`. This can be done in the file `shell.nix`, in the block above `shellHook`. We also set `PICO_PLATFORM = "";` to ensure the board header automatically sets it. For more information, see the "Platform and Board Configuration" chapter of the [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) book. +> We are finding that this template is also applicable to RP2350-based boards, such as the Pico 2 and Pico 2 W. In many cases, you can rely on the board configuration (`PICO_BOARD`) to automatically set the platform (`PICO_PLATFORM`). For example, `export PICO_BOARD=pico2` will lead to `PICO_PLATFORM=rp2350`. This can be done in the file `shell.nix`, in the block above `shellHook`, where we have also set `PICO_PLATFORM = "";` to ensure the board header automatically sets it. For more information, see the "Platform and Board Configuration" chapter of the [Raspberry Pi Pico-series C/C++ SDK](https://rptl.io/pico-c-sdk) book. To launch the lf-pico shell environment, run the following in the root of the lf-pico repository. The launched shell will include the various required toolchains and applications needed for development. From dd70f4f2dbf2206cc8768e727cd4f59326cb7292 Mon Sep 17 00:00:00 2001 From: khasc <200988182+khasc@users.noreply.github.com> Date: Fri, 6 Mar 2026 15:40:24 -0500 Subject: [PATCH 11/11] Update README.md - rm "1" from Pico 1 --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 9117c5c..b4f7592 100644 --- a/README.md +++ b/README.md @@ -1,5 +1,5 @@ # Template for the Lingua Franca RP2040 target platform -This repo is a template for [Lingua Franca](https://www.lf-lang.org/) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico 1 board and the [Pololu 3pi+ 2040 robot](https://www.pololu.com/docs/0J86). Currently the repo supports MacOS, Linux, and Windows through [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). To support RP2040-based boards, the repo uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master/src) as a dependency which includes a light set of headers, libraries and a build system. +This repo is a template for [Lingua Franca](https://www.lf-lang.org/) projects using the bare metal RP2040 target platform such as found on the Raspberry Pi Pico board and the [Pololu 3pi+ 2040 robot](https://www.pololu.com/docs/0J86). Currently the repo supports MacOS, Linux, and Windows through [WSL](https://learn.microsoft.com/en-us/windows/wsl/install). To support RP2040-based boards, the repo uses the [Pico SDK](https://github.com/raspberrypi/pico-sdk/tree/master/src) as a dependency which includes a light set of headers, libraries and a build system. ## Setup This template uses nix to manage toolchains and other applications. Install [nix](https://nixos.org/download.html) first for your preferred platform. Make note of the installation type since a **multi-user** install will require sudo permissions and will interact with a system-wide `/nix/store`. After installation, run the following in the shell to enable the experimental nix flakes feature.