Skip to content

os: add support for windows - #2427

Draft
AmyJeanes wants to merge 7 commits into
commaai:masterfrom
AmyJeanes:windows
Draft

os: add support for windows#2427
AmyJeanes wants to merge 7 commits into
commaai:masterfrom
AmyJeanes:windows

Conversation

@AmyJeanes

@AmyJeanes AmyJeanes commented Sep 7, 2026

Copy link
Copy Markdown
Contributor

Native Windows support for panda's firmware build and libpanda test library (MSYS2 CLANG64, clang), plus a windows-latest CI entry. openpilot's Windows build uses this to build and flash panda.

  • SCons uses the mingw tool with clang on Windows (the default picks MSVC); the .dll target and cffi path are named per platform.
  • CANPacket_t keeps its wire layout: the DLL builds with -mno-ms-bitfields and the flag bitfields are declared unsigned int so cffi's MSVC rules match the firmware. Linux/macOS layout unchanged (same fix as opendbc's libsafety).
  • The signing step runs sign.py through the SCons interpreter (cmd.exe honours neither a shebang nor a VAR=value prefix).
  • The dev toolchain and cppcheck come from their PyPI wheels; the setup and test scripts use the venv's python.

Line endings were split out and comma has already merged them.

Draft: the one TEMP commit at the tip (marked TODO REMOVE) drops once commaai/dependencies#107 publishes the win_amd64 toolchain/cppcheck wheels; it points uv at a pre-release index meanwhile.

Part of a six-repo series: commaai/openpilot#38810, commaai/msgq#709, commaai/opendbc#3724, commaai/rednose#61, commaai/dependencies#107. dependencies merges first; the rest independently.

Generated with Claude, human-reviewed and tested locally and in CI.

@AmyJeanes AmyJeanes changed the title os: add support for windows os: add support for windows (1/2) Sep 7, 2026
@AmyJeanes
AmyJeanes marked this pull request as draft September 7, 2026 23:22
@AmyJeanes AmyJeanes changed the title os: add support for windows (1/2) os: add support for windows Sep 7, 2026
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 9, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq's series on openpilot's current pin
(windows-tidy-pin). The lock follows the submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 9, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq's series on openpilot's current pin
(windows-tidy-pin). The lock follows the submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 9, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq's series on openpilot's current pin
(windows-tidy-pin). The lock follows the submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
adeebshihadeh pushed a commit that referenced this pull request Sep 9, 2026
AmyJeanes and others added 4 commits September 9, 2026 18:14
SCons' default tools pick MSVC there; the mingw tool with clang builds
both. CANPacket_t is copied onto the wire, so libpanda needs GCC's packed
bitfield layout (-mno-ms-bitfields) and cffi's MSVC rules must produce
the same one: unsigned int flag bits, like addr, do on both.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
`SETLEN=1 sign.py ...` is a shell command cmd.exe cannot run. The
interpreter running SCons has the dependencies, and SETLEN moves into
the command's environment; the same command on every platform.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
The release shim branches only know Linux and macOS; the comma-deps
wheels cover Windows too (import names unchanged). They declare Python
>=3.12, so the marker keeps the 3.11 half of requires-python resolving.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
An MSYS2 CLANG64 shell, like openpilot's Windows job; setup.sh installs
clang, git and uv there with pacman. The misra script calls python (a
venv on Windows has no python3), and the mutation test runs it through
the bash on PATH, since cmd.exe cannot.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 9, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 9, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 9, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
Quote $DIR (and the misra script's paths) in the setup and test scripts so
a checkout path containing spaces works. Cross-platform: unquoted, these
break on Linux too, spaces are just far more common on Windows.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 10, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 10, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 10, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
AmyJeanes added a commit to AmyJeanes/openpilot-upstream that referenced this pull request Sep 10, 2026
--- TODO REMOVE AFTER THE SUBMODULE PRS MERGE (commaai/msgq#709, commaai/panda#2427, commaai/rednose#61, commaai/opendbc#3724) ---

Until the four submodule PRs merge, the pointers move to the windows-tidy
branches on my fork and .gitmodules fetches them from there: panda and
opendbc just below their own TEMP index commits (their uv sources would
leak into this lockfile), rednose at its TEMP commit (its source supplies
comma-deps-eigen for Windows), msgq at its tip. The lock follows the
submodules' metadata.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
debug_console.py polled stdin with select(), which on Windows only works on
sockets, so som_debug.sh failed there. Poll the console with msvcrt on Windows
and keep select() elsewhere. Also quote `cd "$DIR"` in som_debug.sh so a
checkout path with spaces works.

Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
…ies#107 publishes

--- TODO REMOVE AFTER DEPENDENCY PR MERGES (commaai/dependencies#107) ---

Dropped once the win_amd64 wheels are on PyPI; until then uv takes
comma-deps-gcc-arm-none-eabi and comma-deps-cppcheck for win32 from a
release on my fork built from that PR.

Co-Authored-By: Claude Fable 5.1 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_016AgqYZYWLpwE2T5vS3nVEt
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant