Skip to content
Merged
Show file tree
Hide file tree
Changes from 25 commits
Commits
Show all changes
40 commits
Select commit Hold shift + click to select a range
6d571b3
good first commit
Ellerbach Mar 20, 2026
8ee3cc5
nanoCLR working
Ellerbach Mar 24, 2026
c787d84
having deployment and erase working, debug and many other things :-D
Ellerbach Mar 25, 2026
76565ed
adding internal storage and file deployment, 32K storage only
Ellerbach Mar 25, 2026
cc683ba
adjusting partitions
Ellerbach Mar 25, 2026
810dfec
wifi *almost* working
Ellerbach Apr 4, 2026
0e0b3c4
changes
Ellerbach Apr 7, 2026
998c7d9
small change
Ellerbach Apr 7, 2026
329e677
temp fix for usb init. Adding internal storage on RP2040 W
Ellerbach Apr 8, 2026
4b2132f
TLS working ❤️
Ellerbach Apr 8, 2026
b1f8759
heavy lifting
Ellerbach Apr 8, 2026
0875056
remove debug from ssl
Ellerbach Apr 10, 2026
4eb8240
fix sntp
Ellerbach Apr 10, 2026
2f929e1
remove debug pico files
Ellerbach Apr 10, 2026
7d58a03
kconfig
Ellerbach Apr 10, 2026
5a32de7
fix again
Ellerbach Apr 10, 2026
e33e6f3
more fixes
Ellerbach Apr 11, 2026
d08c060
fixing ChibiOS to be used for build for RP targets
Ellerbach Apr 11, 2026
85d7a68
fix build
Ellerbach Apr 11, 2026
6c227f8
more fixes for RP2040 and W
Ellerbach Apr 11, 2026
180b69b
nit
Ellerbach Apr 11, 2026
2def0ce
fixing dev container
Ellerbach Apr 11, 2026
21a3570
Fixes for build errors
networkfusion Apr 12, 2026
459c28b
nit
networkfusion Apr 12, 2026
2fcc122
Update Dockerfile.ChibiOS-RP.SRC
networkfusion Apr 12, 2026
6f158c9
Fix SystemState_Query atomic load operating on wrong address (#3302)
Copilot Apr 13, 2026
1a47926
Merge branch 'main' of https://github.com/nanoframework/nf-interprete…
josesimoes Apr 13, 2026
588ae51
quick fix for easy things
Ellerbach Apr 13, 2026
1ecb876
move block storage to chibios common
Ellerbach Apr 14, 2026
cf1c0a5
moving networking all together
Ellerbach Apr 14, 2026
617768c
Add RP targets to build failure.
networkfusion Apr 14, 2026
dbe77b6
making things work fully, finally!
Ellerbach Apr 14, 2026
6d20428
fixing tls3 not available
Ellerbach Apr 15, 2026
45b1650
reverting some changes after testing
Ellerbach Apr 15, 2026
206d8fd
Merge branch 'main' into add-pico-chibios
Ellerbach Apr 15, 2026
bb89fd3
Merge branch 'main' into add-pico-chibios
josesimoes Apr 16, 2026
7e4b186
Merge branch 'main' into add-pico-chibios
Ellerbach Apr 16, 2026
62591fc
Add comments back to Debugger.cpp
networkfusion Apr 16, 2026
2f1a8d9
fixing Mac address
Ellerbach Apr 19, 2026
789a572
Merge branch 'main' into add-pico-chibios
Ellerbach Apr 20, 2026
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
4 changes: 2 additions & 2 deletions .devcontainer/All/devcontainer.json
Original file line number Diff line number Diff line change
Expand Up @@ -9,9 +9,9 @@
// Bind the Unix socket the Docker daemon listens on by default
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
// Keep command history
"source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume",
"source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume"
Comment thread
Ellerbach marked this conversation as resolved.
// OPTIONAL: Mount .azure folder for seamless az cli auth
// "source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind"
// ,"source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind"
Comment thread
Ellerbach marked this conversation as resolved.
],
// Set the *default* container specific settings.json values on container create.
"customizations": {
Expand Down
5 changes: 5 additions & 0 deletions .devcontainer/ChibiOS-RP/Dockerfile.ChibiOS-RP
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
# Pre-built image is not yet available for ChibiOS-RP.
# Use Dockerfile.ChibiOS-RP.SRC to build from source.
# Once published, replace this line with the image reference, e.g.:
# FROM ghcr.io/nanoframework/dev-container-chibios-rp:v1.0
FROM ghcr.io/nanoframework/dev-container-chibios-rp:v1.0
113 changes: 113 additions & 0 deletions .devcontainer/ChibiOS-RP/Dockerfile.ChibiOS-RP.SRC
Original file line number Diff line number Diff line change
@@ -0,0 +1,113 @@
FROM ubuntu:latest AS downloader
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils \
&& apt-get install -y \
curl \
xz-utils \
unzip \
wget

RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted

ARG GCC_VERSION=13.3.rel1
ARG GCC_URI=https://armkeil.blob.core.windows.net/developer/Files/downloads/gnu/$GCC_VERSION/binrel/arm-gnu-toolchain-$GCC_VERSION-x86_64-arm-none-eabi.tar.xz
RUN mkdir -p /tmp/dc-downloads /tmp/dc-extracted/gcc \
&& curl -o /tmp/dc-downloads/gcc-arm.tar.xz $GCC_URI \
&& xz -d /tmp/dc-downloads/gcc-arm.tar.xz \
&& tar -xvf /tmp/dc-downloads/gcc-arm.tar -C /tmp/dc-extracted/gcc --strip-components 1 \
&& rm -rf /tmp/dc-extracted/gcc/share/doc/ /tmp/dc-extracted/gcc/share/gcc-arm-none-eabi/samples/

ARG CMAKE_VERSION=3.31.6
ARG CMAKE_SCRIPT=https://github.com/Kitware/CMake/releases/download/v$CMAKE_VERSION/cmake-$CMAKE_VERSION-linux-x86_64.sh
RUN wget $CMAKE_SCRIPT \
-q -O /tmp/dc-downloads/cmake-install.sh \
&& chmod u+x /tmp/dc-downloads/cmake-install.sh \
&& mkdir -p /tmp/dc-extracted/cmake \
&& /tmp/dc-downloads/cmake-install.sh --skip-license --prefix=/tmp/dc-extracted/cmake \
&& rm /tmp/dc-downloads/cmake-install.sh

FROM ubuntu:latest AS devcontainer

# Avoid warnings by switching to noninteractive
ENV DEBIAN_FRONTEND=noninteractive

# You can set up non-root user
# ARG USERNAME=vscode
# ARG USER_UID=1000
# ARG USER_GID=$USER_UID

# Configure apt and install packages
RUN apt-get update \
&& apt-get -y install --no-install-recommends apt-utils dialog icu-devtools 2>&1 \
&& apt-get install -y \
git \
git-svn \
subversion \
clang-format \
curl \
ninja-build \
srecord \
python3 \
python3-pip \
libusb-1.0-0-dev \
pkg-config \
build-essential

# Create needed directories
RUN mkdir -p /usr/local/bin/gcc

# ============================================================
# KEY DIFFERENCE from ChibiOS container:
# Clone ChibiOS master/trunk which has RP2040/RP2350 support
# The stable_21.11.x branch does NOT include RP ports.
# ============================================================
# Try GitHub mirror first (faster), fall back to SVN trunk
RUN git clone --branch master https://github.com/ChibiOS/ChibiOS.git --depth 1 ./sources/ChibiOs \
|| git svn clone http://svn.code.sf.net/p/chibios/code/trunk -rHEAD ./sources/ChibiOs

# NO STM32 Cube packages — not needed for RP targets

# Clone dependent repos (mbedtls, fatfs, littlefs, lwIP)
RUN git clone --branch R0.16 https://github.com/abbrev/fatfs.git --depth 1 ./sources/fatfs \
&& git clone --branch v2.11.2 https://github.com/littlefs-project/littlefs --depth 1 ./sources/littlefs \
&& git clone --branch STABLE-2_1_3_RELEASE https://github.com/lwip-tcpip/lwip.git --depth 1 ./sources/lwip \
&& git clone --branch mbedtls-3.6.5 https://github.com/ARMmbed/mbedtls.git --depth 1 ./sources/mbedtls \
&& cd ./sources/mbedtls \
&& git submodule update --init --recursive

# set gcc location
ARG TMP_GCC_PATH=/usr/local/bin/gcc
ENV ARM_GCC_PATH=$TMP_GCC_PATH/bin

# Copy from our other container
COPY --from=downloader /tmp/dc-extracted/gcc $TMP_GCC_PATH
COPY --from=downloader /tmp/dc-extracted/cmake /usr/bin/cmake

ENV PATH=/usr/bin/cmake/bin:${PATH}

# picotool is NOT included — it requires the Pico SDK (PICO_SDK_PATH) to build.
# Since we use ChibiOS (not the Pico SDK), picotool can be added later if UF2
# conversion is needed, by also cloning the pico-sdk.
# hex2dfu is NOT included — RP targets use UF2 format, not DFU
# srecord is still useful for bin packaging

# Install Python dependencies for Kconfig configuration system
RUN pip3 install --no-cache-dir --break-system-packages pyserial "kconfiglib>=14.1.0"

# Clean up downloaded files
RUN apt-get autoremove -y \
&& apt-get clean -y \
&& rm -rf /var/lib/apt/lists/*

# Install .NET SDK 9.0 and .NET 8.0 runtime (needed by nanoFramework build tooling)
RUN curl -sSL https://dot.net/v1/dotnet-install.sh -o /tmp/dotnet-install.sh \
&& chmod +x /tmp/dotnet-install.sh \
&& /tmp/dotnet-install.sh --channel 9.0 --install-dir /usr/share/dotnet \
&& /tmp/dotnet-install.sh --channel 8.0 --runtime dotnet --install-dir /usr/share/dotnet \
&& ln -sf /usr/share/dotnet/dotnet /usr/local/bin/dotnet \
&& rm /tmp/dotnet-install.sh

ENV DOTNET_ROOT=/usr/share/dotnet

# Switch back to dialog for any ad-hoc use of apt-get
ENV DEBIAN_FRONTEND=dialog
50 changes: 50 additions & 0 deletions .devcontainer/ChibiOS-RP/devcontainer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,50 @@
{
"name": "nanoFramework-ChibiOS-RP",
// This container is for developing Raspberry Pi Pico (RP2040/RP2350) targets using ChibiOS.
// It uses Dockerfile.ChibiOS-RP.SRC which builds from source because there is no pre-built image yet.
// Once a pre-built image is published, change "dockerFile" to "Dockerfile.ChibiOS-RP".
"dockerFile": "Dockerfile.ChibiOS-RP.SRC",
"context": ".",
"runArgs": ["--privileged", "--device=/dev/ttyUSB0:/dev/ttyUSB0"],
"mounts": [
// Bind the Unix socket the Docker daemon listens on by default
"source=/var/run/docker.sock,target=/var/run/docker.sock,type=bind",
// Keep command history
"source=nano-bashhistory,target=/home/vscode/commandhistory,type=volume",
// Map /dev for USB device access (debug probes, serial ports)
"source=/dev,target=/dev,type=bind"
// OPTIONAL: Mount .azure folder for seamless az cli auth
// ,"source=${env:HOME}${env:USERPROFILE}/.azure,target=/home/vscode/.azure,type=bind"
],
// Set the *default* container specific settings.json values on container create.
"customizations": {
"vscode": {
"settings": {
"cmake.preferredGenerators": [
"Ninja"
],
"cmake.generator": "Ninja",
"cmake.autoRestartBuild" : true,
"cmake.configureSettings": {
"CMAKE_MAKE_PROGRAM":"/usr/bin/ninja"
},
"cmake.configureOnOpen": false
},
// Add the IDs of extensions you want installed when the container is created.
"extensions": [
"ms-vsliveshare.vsliveshare-pack",
"streetsidesoftware.code-spell-checker",
"twxs.cmake",
"ms-vscode.cmake-tools",
"xaver.clang-format"
]
}
},
// Use 'forwardPorts' to make a list of ports inside the container available locally.
// "forwardPorts": [],
// Use 'postCreateCommand' to run commands after the container is created.
// This is needed to allow cloning repositories
"postCreateCommand": "git config --global safe.directory '*'"
// Uncomment to connect as a non-root user. See https: //aka.ms/vscode-remote/containers/non-root.
// ,"remoteUser": "vscode"
}
3 changes: 3 additions & 0 deletions .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ The available pre build images are:
* ghcr.io/nanoframework/dev-container-esp32: contains all elements to build a firmware image for any of the ESP32 targets
* ghcr.io/nanoframework/dev-container-azure-rtos: contains all elements to build a firmware image for any of the Eclipse ThreadX (used to be Azure RTOS) targets
* ghcr.io/nanoframework/dev-container-freertos-nxp: contains all elements to build a firmware image for any of the NXP targets
* ChibiOS-RP: contains all elements to build a firmware image for Raspberry Pi Pico (RP2040/RP2350) ChibiOS targets. Uses ChibiOS master branch which includes RP support.

You can choose the dev container needed when opening a remote container in VSCode. The options are:

Expand All @@ -19,6 +20,7 @@ You can choose the dev container needed when opening a remote container in VSCod
* `nanoFramework-ESP32` to use the pre build container with all the elements to build ESP32 targets
* `nanoFramework-TI` to use the pre build container with all the elements to build TI SimpleLink targets
* `nanoFramework-FreeRTOS-NXP` to use the pre build container with all the elements to build TI SimpleLink targets
* `nanoFramework-ChibiOS-RP` to build from source a container with all the elements to build Raspberry Pi Pico RP2040/RP2350 ChibiOS targets

To use the source dockerfile for the respective platform adjust its `devcontainer.json` file and change the `"dockerFile": "Dockerfile.<platform>"` element for the image you would like to use:

Expand All @@ -28,6 +30,7 @@ To use the source dockerfile for the respective platform adjust its `devcontaine
* `Dockerfile.ESP32.SRC` to build the container image from the source with all the elements to build ESP32 based devices
* `Dockerfile.TI.SRC` to build the container image from the source with all the elements to build TI SimpleLink based devices
* `Dockerfile.FreeRTOS.NXP.SRC` to build the container image from the source with all the elements to build NXP based devices
* `Dockerfile.ChibiOS-RP.SRC` to build the container image from the source with all the elements to build Raspberry Pi Pico (RP2040/RP2350) ChibiOS targets


## Building and releasing Docker images in a fork
Expand Down
64 changes: 64 additions & 0 deletions .github/workflows/devcontainer-chibios-rp.yaml
Original file line number Diff line number Diff line change
@@ -0,0 +1,64 @@
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.

name: Build Dev Container for ChibiOS-RP

env:
CONTAINER_REPO: ghcr.io
CONTAINER_NAME: dev-container-chibios-rp
CONTAINER_SRC_FILE: .devcontainer/ChibiOS-RP/Dockerfile.ChibiOS-RP.SRC

on:
push:
branches:
- main
paths:
- '**Dockerfile.ChibiOS-RP'

workflow_dispatch:

jobs:
build:
if: ${{ vars.PUBLISH_DOCKER_IMAGE == 'true' }}
runs-on: ubuntu-latest
permissions:
contents: read
steps:

- name: Checkout Repository
uses: actions/checkout@v5

- name: Free Disk Space (Ubuntu)
uses: jlumbroso/free-disk-space@main
with:
# this might remove tools that are actually needed,
# when set to "true" but frees about 6 GB
tool-cache: true
large-packages: false

- name: Get container version
run: |
$dockerfileContent = Get-Content(".devcontainer/ChibiOS-RP/Dockerfile.ChibiOS-RP")
$dockerfileContent -match '(?<=\:)(?:[v]\d+.\d+)'
$containerVersion = $Matches[0].ToString()
echo "GCR_VERSION=$containerVersion" | Out-File -FilePath $Env:GITHUB_ENV -Encoding utf-8 -Append
shell: pwsh

- name: Set up Docker Buildx
uses: docker/setup-buildx-action@v3

- name: Login to GitHub Container Registry
uses: docker/login-action@v3
with:
registry: ghcr.io
username: ${{ github.repository_owner }}
password: ${{ secrets.CONTAINER_BUILD_TOKEN }}

- name: Build and Push Docker Image
uses: docker/build-push-action@v6
with:
file: ${{ env.CONTAINER_SRC_FILE }}
push: true # Will only build if this is not here
tags: |
${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:${{ env.GCR_VERSION }}
${{ env.CONTAINER_REPO }}/${{ github.repository_owner }}/${{ env.CONTAINER_NAME }}:latest
1 change: 1 addition & 0 deletions .github/workflows/devcontainer-smoketest.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@ jobs:
# { target: ESP32_H2_THREAD, build-type: Debug, container: ESP32 },
{ target: NXP_MIMXRT1060_EVK, build-type: Debug, container: FreeRTOS-NXP },
{ target: NXP_MIMXRT1060_EVK, build-type: Debug, container: All },
{ target: RP_PICO_W_RP2040, build-type: Debug, container: ChibiOS-RP },
{ target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: TI, radio-freq: 915 },
{ target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: All, radio-freq: 915 },
{ target: TI_CC1352R1_LAUNCHXL, build-type: Debug, container: TI, radio-freq: 868 },
Expand Down
68 changes: 68 additions & 0 deletions CMake/Modules/CHIBIOS_RP2040_GCC_options.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,68 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#

#################################################################
# WHEN ADDING A NEW SERIES add the appropriate GCC options below
#################################################################

# RP2040: ARM Cortex-M0+ (ARMv6-M), no FPU, soft float

# need to specify this for assembler
set(CMAKE_ASM_FLAGS " -mthumb -mcpu=cortex-m0plus -mfloat-abi=soft -mabi=aapcs -x assembler-with-cpp -DCRT0_VTOR_INIT=TRUE" CACHE INTERNAL "asm compiler flags")

# need to specify linker flags here
set(CMAKE_EXE_LINKER_FLAGS " -Wl,--gc-sections -Wl,--no-wchar-size-warning -Wl,--print-memory-usage -Wl,--no-warn-rwx-segments -mthumb -mcpu=cortex-m0plus -mfloat-abi=soft -mabi=aapcs -nostartfiles " CACHE INTERNAL "executable linker flags")


# TARGET parameter to set the target that's setting them for
# optional EXTRA_COMPILE_OPTIONS with compile options to be added
macro(nf_set_compile_options)

# parse arguments
cmake_parse_arguments(NFSCO "" "TARGET" "EXTRA_COMPILE_OPTIONS" ${ARGN})

if(NOT NFSCO_TARGET OR "${NFSCO_TARGET}" STREQUAL "")
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_compile_options()")
endif()

# include any extra options coming from any extra args?
target_compile_options(${NFSCO_TARGET} PUBLIC ${NFSCO_EXTRA_COMPILE_OPTIONS} -mthumb -mcpu=cortex-m0plus -mabi=aapcs -nostdlib -Wall -Wextra -Werror -Wundef -Wshadow -Wimplicit-fallthrough $<$<COMPILE_LANGUAGE:CXX>:-Wno-cast-user-defined> -fshort-wchar -fno-builtin -fno-common -mno-long-calls -fno-exceptions -fcheck-new )

# RP2040 has no FPU (Cortex-M0+)
# Note: RP2040 is defined by ChibiOS board.h, no need to add it here
target_compile_definitions(${NFSCO_TARGET} PUBLIC -DPLATFORM_ARM -DCORTEX_USE_FPU=FALSE -DUSE_FPU=FALSE)

endmacro()


# TARGET parameter to set the target that's setting them for
# optional EXTRA_LINK_FLAGS with link flags to be added
macro(nf_set_link_options)

# parse arguments
cmake_parse_arguments(NFSLO "" "TARGET;EXTRA_LINK_FLAGS" "" ${ARGN})

if(NOT NFSLO_TARGET OR "${NFSLO_TARGET}" STREQUAL "")
message(FATAL_ERROR "Need to set TARGET argument when calling nf_set_link_options()")
endif()

# set optimization linker flags for RELEASE and MinSizeRel
if(CMAKE_BUILD_TYPE STREQUAL "Release" OR CMAKE_BUILD_TYPE STREQUAL "MinSizeRel")
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " -Os -flto -fuse-linker-plugin -fstrict-aliasing -fomit-frame-pointer -fno-unroll-loops -frounding-math -fsignaling-nans -ffloat-store -fno-math-errno -ftree-vectorize -fno-default-inline -finline-functions-called-once -fno-defer-pop ")
endif()

# request specs from newlib nano
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " --specs=nano.specs ")

# include libraries in build
nf_include_libraries_in_build(${NFSLO_TARGET})

# set extra linker flags
set_property(TARGET ${NFSLO_TARGET} APPEND_STRING PROPERTY LINK_FLAGS " ${NFSLO_EXTRA_LINK_FLAGS} ")

# set optimization flags
nf_set_optimization_options(${NFSLO_TARGET})

endmacro()
40 changes: 40 additions & 0 deletions CMake/Modules/CHIBIOS_RP2040_sources.cmake
Original file line number Diff line number Diff line change
@@ -0,0 +1,40 @@
#
# Copyright (c) .NET Foundation and Contributors
# See LICENSE file in the project root for full license information.
#

include(FetchContent)
FetchContent_GetProperties(chibios)

# List of the ChibiOS generic RP2040 startup source files.
# RP2040 uses ARM Cortex-M0+ (ARMv6-M architecture)

set(CHIBIOS_PORT_SRCS

# RT port for ARMv6-M
chcore.c
chcoreasm.S
)

foreach(SRC_FILE ${CHIBIOS_PORT_SRCS})

set(CHIBIOS_RP_SRC_FILE SRC_FILE-NOTFOUND)

find_file(CHIBIOS_RP_SRC_FILE ${SRC_FILE}
PATHS
${chibios_SOURCE_DIR}/os/common/ports/ARMv6-M/compilers/GCC
${chibios_SOURCE_DIR}/os/common/ports/ARMv6-M
${chibios_SOURCE_DIR}/os/hal/ports/common/ARMCMx

CMAKE_FIND_ROOT_PATH_BOTH
)

if (BUILD_VERBOSE)
message("${SRC_FILE} >> ${CHIBIOS_RP_SRC_FILE}")
endif()

list(APPEND CHIBIOS_SOURCES ${CHIBIOS_RP_SRC_FILE})

endforeach()

list(APPEND CHIBIOS_INCLUDE_DIRS ${chibios_SOURCE_DIR}/os/common/ports/ARMv6-M)
Loading
Loading