From 2fe299ea2c8adc316c7300d6be24bffb433da48d Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Mon, 16 Nov 2026 21:13:05 +0100 Subject: [PATCH 1/6] Pin Vega build tools and honor workflow commit SHA --- .github/workflows/merge-criteria.yml | 8 +++++++- README.md | 9 +++++++++ flight_computer/platformio.ini | 6 ++++-- 3 files changed, 20 insertions(+), 3 deletions(-) diff --git a/.github/workflows/merge-criteria.yml b/.github/workflows/merge-criteria.yml index 2d770c6b..f68b3a26 100644 --- a/.github/workflows/merge-criteria.yml +++ b/.github/workflows/merge-criteria.yml @@ -74,6 +74,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 + with: + ref: ${{ inputs.commit_sha || github.sha }} - name: Run clang-format uses: jidicula/clang-format-action@v4.18.0 @@ -97,6 +99,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 + with: + ref: ${{ inputs.commit_sha || github.sha }} - name: Check cache uses: actions/cache@v6 @@ -179,6 +183,8 @@ jobs: steps: - name: Checkout uses: actions/checkout@v7 + with: + ref: ${{ inputs.commit_sha || github.sha }} - name: Check cache uses: actions/cache@v6 @@ -190,7 +196,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v7 with: - python-version: '3.11' + python-version: ${{ matrix.project == 'flight_computer' && '3.15.2' || '3.11' }} cache: 'pip' - name: Install dependencies diff --git a/README.md b/README.md index 7f715925..6ee1e475 100644 --- a/README.md +++ b/README.md @@ -70,6 +70,15 @@ platformio run -d flight_computer --environment debug Pull requests are automatically checked for formatting, build errors, and static-analysis warnings. +### Reproducing the Vega release build + +Use 64-bit Windows and a Python 3.15.2 virtual environment. Install `requirements.txt` as shown above and build from the commit used by the GitHub Actions upload job. Use a dedicated PlatformIO Core directory for Vega so other installed SCons versions cannot affect the build. + +```powershell +$env:PLATFORMIO_CORE_DIR = "$env:LOCALAPPDATA\CATS\vega-platformio" +python -m platformio run -d flight_computer -e release +``` + ## Contributing Contributions are welcome. Examples include: diff --git a/flight_computer/platformio.ini b/flight_computer/platformio.ini index cb6cfbff..13cc925d 100644 --- a/flight_computer/platformio.ini +++ b/flight_computer/platformio.ini @@ -6,10 +6,12 @@ default_envs = release [env] -platform = ststm32 +platform = platformio/ststm32@20.0.0 board = genericSTM32F411CE #framework = stm32cube -platform_packages = platformio/toolchain-gccarmnoneeabi@^1.100301.220327 +platform_packages = + platformio/toolchain-gccarmnoneeabi@1.140201.0 + platformio/tool-scons@4.40801.0 upload_protocol = stlink debug_tool = stlink board_build.ldscript = src/target/VEGA/STM32F411CCUX_FLASH.ld From dfb9dcf88f25a891081e14afd715172618af3fbd Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Mon, 16 Nov 2026 22:13:03 +0100 Subject: [PATCH 2/6] build(gs): normalize embedded source paths --- ground_station/pre_config.py | 12 +++++++++++- 1 file changed, 11 insertions(+), 1 deletion(-) diff --git a/ground_station/pre_config.py b/ground_station/pre_config.py index d8f7a01e..fb59477a 100644 --- a/ground_station/pre_config.py +++ b/ground_station/pre_config.py @@ -9,13 +9,23 @@ # below the PlatformIO package root. A shared PlatformIO home can retain the # package metadata while losing the installer-added PATH adjustment, leaving # an otherwise valid compiler undiscoverable on Windows. -toolchain_root = env.PioPlatform().get_package_dir("toolchain-xtensa-esp-elf") +platform = env.PioPlatform() +toolchain_root = platform.get_package_dir("toolchain-xtensa-esp-elf") if toolchain_root: nested_toolchain_bin = os.path.join(toolchain_root, "xtensa-esp-elf", "bin") compiler_name = "xtensa-esp32s2-elf-g++.exe" if os.name == "nt" else "xtensa-esp32s2-elf-g++" if os.path.isfile(os.path.join(nested_toolchain_bin, compiler_name)): env.PrependENVPath("PATH", nested_toolchain_bin) +# Keep source paths in diagnostics and debug information independent of the build machine. +project_root = env.subst("$PROJECT_DIR").replace(os.sep, "/") +core_root = platform.config.get("platformio", "core_dir").replace(os.sep, "/") +prefix_map_flags = [ + f"-ffile-prefix-map={project_root}=.", + f"-ffile-prefix-map={core_root}=platformio", +] +env.Append(CCFLAGS=prefix_map_flags, LINKFLAGS=prefix_map_flags) + env.Append( # Unfortunately we can't use the standard standard, # we have to use the GNU standard as the arduino library requires it.. From b7c05a123ce9d61aee4045ba8086e6634b414405 Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Mon, 16 Nov 2026 22:31:20 +0100 Subject: [PATCH 3/6] build(gs): normalize Xtensa debug paths --- ground_station/pre_config.py | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) diff --git a/ground_station/pre_config.py b/ground_station/pre_config.py index fb59477a..7ec6b6c9 100644 --- a/ground_station/pre_config.py +++ b/ground_station/pre_config.py @@ -12,10 +12,12 @@ platform = env.PioPlatform() toolchain_root = platform.get_package_dir("toolchain-xtensa-esp-elf") if toolchain_root: - nested_toolchain_bin = os.path.join(toolchain_root, "xtensa-esp-elf", "bin") + nested_toolchain_root = os.path.join(toolchain_root, "xtensa-esp-elf") + nested_toolchain_bin = os.path.join(nested_toolchain_root, "bin") compiler_name = "xtensa-esp32s2-elf-g++.exe" if os.name == "nt" else "xtensa-esp32s2-elf-g++" if os.path.isfile(os.path.join(nested_toolchain_bin, compiler_name)): env.PrependENVPath("PATH", nested_toolchain_bin) + toolchain_root = nested_toolchain_root # Keep source paths in diagnostics and debug information independent of the build machine. project_root = env.subst("$PROJECT_DIR").replace(os.sep, "/") @@ -24,6 +26,10 @@ f"-ffile-prefix-map={project_root}=.", f"-ffile-prefix-map={core_root}=platformio", ] +if toolchain_root: + # Use the same DWARF paths for flat and nested toolchain installations. + compiler_root = toolchain_root.replace(os.sep, "/") + prefix_map_flags.append(f"-fdebug-prefix-map={compiler_root}=platformio/packages/toolchain-xtensa-esp-elf") env.Append(CCFLAGS=prefix_map_flags, LINKFLAGS=prefix_map_flags) env.Append( From 34b3a99ee492422b394febeb37b8f273a442de47 Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Mon, 16 Nov 2026 22:51:48 +0100 Subject: [PATCH 4/6] build: pin Telemetry and Ground Station release toolchains --- .github/workflows/merge-criteria.yml | 2 +- README.md | 17 +++++++++++++---- ground_station/AGENTS.md | 5 +++-- ground_station/platformio.ini | 5 +++++ telemetry/platformio.ini | 8 ++++++-- 5 files changed, 28 insertions(+), 9 deletions(-) diff --git a/.github/workflows/merge-criteria.yml b/.github/workflows/merge-criteria.yml index f68b3a26..a677f5fe 100644 --- a/.github/workflows/merge-criteria.yml +++ b/.github/workflows/merge-criteria.yml @@ -196,7 +196,7 @@ jobs: - name: Set up Python uses: actions/setup-python@v7 with: - python-version: ${{ matrix.project == 'flight_computer' && '3.15.2' || '3.11' }} + python-version: ${{ matrix.project == 'ground_station' && '3.14.10' || '3.15.2' }} cache: 'pip' - name: Install dependencies diff --git a/README.md b/README.md index 6ee1e475..ba7842ba 100644 --- a/README.md +++ b/README.md @@ -70,13 +70,22 @@ platformio run -d flight_computer --environment debug Pull requests are automatically checked for formatting, build errors, and static-analysis warnings. -### Reproducing the Vega release build +### Reproducing Windows release builds -Use 64-bit Windows and a Python 3.15.2 virtual environment. Install `requirements.txt` as shown above and build from the commit used by the GitHub Actions upload job. Use a dedicated PlatformIO Core directory for Vega so other installed SCons versions cannot affect the build. +On 64-bit Windows, create a virtual environment with the Python version used by the GitHub Actions upload job. Install `requirements.txt` as shown above and build the same commit as that job. + +| Project | Python | +| --- | --- | +| `flight_computer` | 3.15.2 | +| `telemetry` | 3.15.2 | +| `ground_station` | 3.14.10 | + +Use a dedicated PlatformIO Core directory for each project to isolate the installed SCons version. Set `$project` to the directory you want to build. ```powershell -$env:PLATFORMIO_CORE_DIR = "$env:LOCALAPPDATA\CATS\vega-platformio" -python -m platformio run -d flight_computer -e release +$project = 'flight_computer' +$env:PLATFORMIO_CORE_DIR = "$env:LOCALAPPDATA\CATS\${project}-platformio" +python -m platformio run -d $project ``` ## Contributing diff --git a/ground_station/AGENTS.md b/ground_station/AGENTS.md index 7c767775..01b94837 100644 --- a/ground_station/AGENTS.md +++ b/ground_station/AGENTS.md @@ -81,8 +81,9 @@ QR navigation, and live compass checks on hardware. Preserve those deltas when rebasing a vendored library and record the exact upstream tag or commit. - Do not blanket-format vendored libraries. Preserve upstream source unless a documented CATS compatibility patch is necessary. -- Use PlatformIO 6.1.19 with Python 3.11 from the root `requirements.txt`. Upload-only packages are pinned in - `ground_station/requirements-upload.txt`; never install the unrelated Python package named `serial`. +- Install PlatformIO 6.1.19 from the root `requirements.txt`. Use Python 3.14.10 for Windows release builds and + Python 3.11 for WSL pre-commit checks. Upload-only packages are pinned in `ground_station/requirements-upload.txt`; + never install the unrelated Python package named `serial`. - On Windows, if `platformio` is not on `PATH`, use `& "$env:USERPROFILE\.platformio\penv\Scripts\platformio.exe"` and verify that it reports version 6.1.19. Do not create a separate legacy environment just to make the command available. diff --git a/ground_station/platformio.ini b/ground_station/platformio.ini index a6ffa67b..b690780e 100644 --- a/ground_station/platformio.ini +++ b/ground_station/platformio.ini @@ -6,6 +6,7 @@ board = esp32-s2-saola-1 framework = arduino platform = https://github.com/tasmota/platform-espressif32/releases/download/2026.05.50/platform-espressif32.zip +platform_packages = platformio/tool-scons@4.40801.0 board_build.boot=qio board_build.bootloader=qio @@ -19,6 +20,7 @@ board_build.mcu = esp32s2 lib_deps = adafruit/Adafruit SPIFlash@5.1.1 + adafruit/Adafruit NeoPixel@1.15.5 adafruit/SdFat - Adafruit Fork@2.3.103 bblanchon/ArduinoJson@7.4.3 jchristensen/JC_Button@2.1.6 @@ -26,6 +28,9 @@ lib_deps = Wire paulstoffregen/Time@1.6.1 +; Keep the pinned NeoPixel dependency of SPIFlash out of the firmware build. +lib_ignore = Adafruit NeoPixel + build_flags = -fexceptions ; Required by the Nayuki C++ QR encoder -DFIRMWARE_VERSION='"1.3.3"' ; Enter Firmware Version here diff --git a/telemetry/platformio.ini b/telemetry/platformio.ini index 5910fa1a..8eb3fca4 100644 --- a/telemetry/platformio.ini +++ b/telemetry/platformio.ini @@ -4,8 +4,12 @@ [env:telemetry] -platform = ststm32 -platform_packages = platformio/toolchain-gccarmnoneeabi@^1.100301.220327 +platform = platformio/ststm32@20.0.0 +platform_packages = + platformio/toolchain-gccarmnoneeabi@1.140201.0 + platformio/framework-stm32cubeg0@1.6.3 + platformio/tool-ldscripts-ststm32@0.3.0 + platformio/tool-scons@4.40801.0 board = disco_g071rb framework = stm32cube From c9e65e61575b06f888b7ae98596a149b55b033ad Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Tue, 17 Nov 2026 20:09:48 +0100 Subject: [PATCH 5/6] ci: use checkout defaults when no commit is requested --- .github/workflows/merge-criteria.yml | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/.github/workflows/merge-criteria.yml b/.github/workflows/merge-criteria.yml index a677f5fe..d3fd1fe3 100644 --- a/.github/workflows/merge-criteria.yml +++ b/.github/workflows/merge-criteria.yml @@ -75,7 +75,7 @@ jobs: - name: Checkout uses: actions/checkout@v7 with: - ref: ${{ inputs.commit_sha || github.sha }} + ref: ${{ inputs.commit_sha }} - name: Run clang-format uses: jidicula/clang-format-action@v4.18.0 @@ -100,7 +100,7 @@ jobs: - name: Checkout uses: actions/checkout@v7 with: - ref: ${{ inputs.commit_sha || github.sha }} + ref: ${{ inputs.commit_sha }} - name: Check cache uses: actions/cache@v6 @@ -184,7 +184,7 @@ jobs: - name: Checkout uses: actions/checkout@v7 with: - ref: ${{ inputs.commit_sha || github.sha }} + ref: ${{ inputs.commit_sha }} - name: Check cache uses: actions/cache@v6 From 4a2a9aa5929fc308672ee2646410759ae1181eba Mon Sep 17 00:00:00 2001 From: Nemanja Stojoski Date: Tue, 17 Nov 2026 21:31:12 +0100 Subject: [PATCH 6/6] ci: pass matrix filter inputs through the environment --- .github/workflows/merge-criteria.yml | 12 +++++++----- 1 file changed, 7 insertions(+), 5 deletions(-) diff --git a/.github/workflows/merge-criteria.yml b/.github/workflows/merge-criteria.yml index d3fd1fe3..52b407c2 100644 --- a/.github/workflows/merge-criteria.yml +++ b/.github/workflows/merge-criteria.yml @@ -33,6 +33,9 @@ jobs: - name: Filter changed directories id: changed-files-filtered + env: + REQUESTED_COMMIT_SHA: ${{ inputs.commit_sha }} + CHANGED_DIRECTORIES: ${{ steps.changed-files.outputs.all_changed_files }} # The build pipeline is triggered only for the project in which the changes happened. # For example if a change was made in flight_computer/src/main.cpp, a pipeline will # run only for the 'flight_computer' project. @@ -42,14 +45,13 @@ jobs: # Additionally, the pipeline will also run for all three projects if it is triggered # when pushing to main. run: | - contains_dot=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq 'map(select(. == ".")) | length') - contains_dotgithub=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq 'map(select(. == ".github")) | length') - is_manual_trigger=$(echo '${{ github.event.inputs.commit_sha }}') + contains_dot=$(jq 'map(select(. == ".")) | length' <<< "$CHANGED_DIRECTORIES") + contains_dotgithub=$(jq 'map(select(. == ".github")) | length' <<< "$CHANGED_DIRECTORIES") - if [[ -n "$is_manual_trigger" || "${GITHUB_REF}" == "refs/heads/main" || $contains_dot -gt 0 || $contains_dotgithub -gt 0 ]]; then + if [[ -n "$REQUESTED_COMMIT_SHA" || "$GITHUB_REF" == "refs/heads/main" || $contains_dot -gt 0 || $contains_dotgithub -gt 0 ]]; then filtered_array='["flight_computer","ground_station","telemetry"]' else - filtered_array=$(echo '${{ steps.changed-files.outputs.all_changed_files }}' | jq -c '[.[] | select(. == "flight_computer" or . == "ground_station" or . == "telemetry")]') + filtered_array=$(jq -c '[.[] | select(. == "flight_computer" or . == "ground_station" or . == "telemetry")]' <<< "$CHANGED_DIRECTORIES") fi echo "$filtered_array"