Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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
14 changes: 8 additions & 6 deletions .clang-tidy
Original file line number Diff line number Diff line change
Expand Up @@ -176,13 +176,15 @@ CheckOptions:
# it, at times through a second one, as iom2560.h through iomxx0_1.h, which
# include-cleaner does not take back to <avr/io.h>. Any core's folder, not
# only cores/arduino/ of Arduino's: a third party's core has its own, as
# cores/xmega/ of XMegaForArduino's, where Serial comes from.
# cores/xmega/ of XMegaForArduino's, where Serial comes from. And
# avr/common.h, which <avr/io.h> includes as well, for the registers every
# AVR has, SREG and the stack pointer among them.
# MaxMatrix's own, at the end, alike: a header that a public one includes and
# include-cleaner takes for the provider of a name. avr/common.h, SREG's,
# which <avr/io.h> includes; glibc's bits/ and sys/poll.h, which <poll.h>,
# <sys/socket.h> and <sys/time.h> include; Linux's asm-generic/, through
# <sys/ioctl.h>; and the port of wxWidgets, wx/gtk/ and wx/generic/, which
# wx/panel.h or wx/app.h include, and which a build on Windows does not have.
# include-cleaner takes for the provider of a name. glibc's bits/ and
# sys/poll.h, which <poll.h>, <sys/socket.h> and <sys/time.h> include; Linux's
# asm-generic/, through <sys/ioctl.h>; and the port of wxWidgets, wx/gtk/ and
# wx/generic/, which wx/panel.h or wx/app.h include, and which a build on
# Windows does not have.
misc-include-cleaner.IgnoreHeaders: '.*/cores/[^/]+/.*;.*/variants/.*;.*/avr/io[^/]*\.h;.*/avr/common\.h;.*/bits/.*;.*/sys/poll\.h;.*/asm-generic/.*;.*/wx/(gtk|generic)/.*'
# Google's names, which readability-identifier-naming checks only once it is told them; the
# same block in every project, so that every project names alike. Two exceptions Google
Expand Down
2 changes: 1 addition & 1 deletion .copier-answers.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
# The answers this project was made from, which `copier update` reads. Change one with
# `copier update --data name=value`, not here.
_commit: v0.12.0
_commit: v0.12.1
_src_path: gh:theAndreas/embedded-cpp-template
arduino: true
arduino_core: arduino:avr@1.8.8
Expand Down
8 changes: 5 additions & 3 deletions .devcontainer/Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -132,15 +132,17 @@ COPY llvm-headers.sh /tmp/llvm-headers.sh
RUN /tmp/llvm-headers.sh "${LLVM_MAJOR}" "/opt/llvm-${LLVM_MAJOR}/include" && \
rm /tmp/llvm-headers.sh

# The Arduino data directory and uv's cache are named volumes: the AVR core and its
# The Arduino data directory, uv's cache and ccache's are named volumes: the AVR core and its
# toolchain, and the checkers from PyPI, are downloaded on first use, and the volumes are
# what keep a rebuild from fetching them again. An empty named volume takes its ownership
# what keep a rebuild from fetching them again; ccache's keeps what the host builds compiled,
# which a rebuild would otherwise throw away. An empty named volume takes its ownership
# from the path it covers, so the path has to exist and belong to the remote user first,
# or nothing can write into it. `install -d` gives only the last component to the owner and
# creates missing parents as root, so ~/.cache is named on its own: a base image without it
# would otherwise leave it to root, and arduino-cli could not put its build cache there.
RUN install -d -o vscode -g vscode -m 0755 /home/vscode/.arduino15 && \
install -d -o vscode -g vscode -m 0755 /home/vscode/.cache /home/vscode/.cache/uv
install -d -o vscode -g vscode -m 0755 /home/vscode/.cache /home/vscode/.cache/uv \
/home/vscode/.cache/ccache

# The same arrangement for the logins a rebuild would otherwise throw away: Codex and Claude
# Code, whose extensions the shared feature installs, and gh, which every push and every pull request
Expand Down
3 changes: 2 additions & 1 deletion .devcontainer/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ home; `/usr/local/bin/clangd` links to the binary itself.

The Arduino core and its toolchain, and the checkers uv fetches, are not part of the image. They live
in the named volumes `max_matrix-arduino15` and `max_matrix-uv-cache`, so that a rebuild does not download them
again. Three more carry a login across a rebuild: `max_matrix-codex` at `/home/vscode/.codex`,
again. What ccache compiled for the host builds lives in `max_matrix-ccache` at `/home/vscode/.cache/ccache`, so
that the first build after a rebuild takes it from there rather than compiling everything again. Three more carry a login across a rebuild: `max_matrix-codex` at `/home/vscode/.codex`,
`max_matrix-claude` at `/home/vscode/.claude` (with `CLAUDE_CONFIG_DIR` pointing there, so that
Claude Code's `.claude.json` lands in it too) and `max_matrix-gh` at `/home/vscode/.config/gh`, all at
mode 0700, as `gh` refuses a config directory others can enter. Those three hold credentials: do not share, export or remove one unless the login should go.
Expand Down
5 changes: 5 additions & 0 deletions .devcontainer/shared/devcontainer-feature.json
Original file line number Diff line number Diff line change
Expand Up @@ -75,6 +75,11 @@
"target": "/home/vscode/.cache/uv",
"type": "volume"
},
{
"source": "max_matrix-ccache",
"target": "/home/vscode/.cache/ccache",
"type": "volume"
},
{
"source": "max_matrix-codex",
"target": "/home/vscode/.codex",
Expand Down
2 changes: 1 addition & 1 deletion OIL.md
Original file line number Diff line number Diff line change
Expand Up @@ -1050,7 +1050,7 @@ A first look found, besides those two:
Where include-cleaner takes for a name's provider a header that a public one includes,
`IgnoreHeaders` leaves it out, as the template does for `avr/io*.h`, decided on 2026-11-16
against a NOLINT on each of some 20 lines: `avr/common.h`, where `SREG` is, which the
template's pattern misses as well and is the template's to take up; glibc's `bits/` and
template's pattern missed as well and has since v0.12.1; glibc's `bits/` and
`sys/poll.h`, Linux's `asm-generic/`, and the GTK port of wxWidgets. Six includes that the
check takes for unused stay, with `// IWYU pragma: keep`: four of wxWidgets that only include
the port's header, `<sys/time.h>` for `timeval`, and `MaxMatrixConfig.h` in
Expand Down
2 changes: 1 addition & 1 deletion tools/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ through.
| `self_contained_headers.py` | `make headers`: every header compiled on its own |
| `docs.sh` | `make docs`: Doxygen, failing on a gap |
| `arduino_lint.sh` | `make arduino-lint` |
| `common.sh` | What the shell scripts share: the paths, the defaults of `project.sh`, the targets, `select_target()` and the `target_` functions each build system answers. A script of the project's own sources it as well |
| `common.sh` | What the shell scripts share: the paths, the defaults of `project.sh`, the targets, `select_target()`, the `target_` functions each build system answers, and `download`, which tries a download three times. A script of the project's own sources it as well |
| `project.sh` | The project's: the targets, each with its board and core, the variants and the hooks |
| `project.mk` | The project's: its own targets of the `Makefile` |
| `lib/` | What the scripts above call, a target of none: `arduino_cli.sh`, `cmake.sh` and `platformio.sh`, the build systems of those names, for the scripts that build a target, and `clang_database.py`, which rewrites the database of a CMake or a PlatformIO build for clang-tidy; `doc_indent.py` and `cpplint_house.py`, cpplint with the NOLINT of a check of our own, for `lint.sh`, `tidy_module.sh` and the clang-tidy module in `tidy_module/` for `tidy.sh`, and `tidy_cache.py`, through which it calls clang-tidy and which skips a file that passed before on the same input |
Expand Down
21 changes: 21 additions & 0 deletions tools/common.sh
Original file line number Diff line number Diff line change
Expand Up @@ -103,6 +103,27 @@ err() {
echo "$*" >&2
}

# Runs a command that downloads, and again where it fails: a server resets a connection at times,
# and arduino-cli gives up at once, which failed the dev container's postCreateCommand and
# everything after it. Three tries, 10 and 20 seconds apart; the third's failure is returned.
# Arguments:
# the command and its arguments
download() {
local pause=10
local try
local status
for try in 1 2 3; do
status=0
"$@" || status=$?
if ((status == 0 || try == 3)); then
return "${status}"
fi
err "Failed with ${status}: $*. Again in ${pause} s (try ${try} of 3)."
sleep "${pause}"
pause=$((pause * 2))
done
}

# Makes the target named the one the tools work on: TARGET is its name, and the settings of
# TARGET_SETTINGS are those of tools/project.sh with what target_settings() sets for it. Fails on
# a target TARGETS does not name or whose name is no folder's, and on a build system the template
Expand Down
4 changes: 2 additions & 2 deletions tools/lib/arduino_cli.sh
Original file line number Diff line number Diff line change
Expand Up @@ -37,8 +37,8 @@ arduino_cli_setup() {
if [[ -n "${ARDUINO_BOARD_URLS}" ]]; then
urls=(--additional-urls "${ARDUINO_BOARD_URLS}")
fi
arduino-cli core update-index "${urls[@]}"
arduino-cli core install "${ARDUINO_CORE[@]}" "${urls[@]}"
download arduino-cli core update-index "${urls[@]}"
download arduino-cli core install "${ARDUINO_CORE[@]}" "${urls[@]}"
}

# Prints the bin directory of the avr-gcc that arduino-cli uses for FQBN.
Expand Down
2 changes: 1 addition & 1 deletion tools/lib/platformio.sh
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ platformio_setup() {
err "Target ${TARGET}: PIO_DIR=${PIO_DIR} holds no platformio.ini."
return 1
fi
"${PIO[@]}" pkg install --silent -d "${ROOT_DIR}/${PIO_DIR}" -e "${PIO_ENV}"
download "${PIO[@]}" pkg install --silent -d "${ROOT_DIR}/${PIO_DIR}" -e "${PIO_ENV}"
}

# Prints the build folder of a variant.
Expand Down
Loading