Repository navigation
Run the Teensy tests from one test image, and give the firmware its clock and FreeRTOS settings - #19
Merged
Merged
Conversation
…'s warning switch The root project gives src and firmware/lib -Wall -Wextra -Werror through build_src_flags in both environments. FastLED 3.10.9's fl/gfx/colorutils.h turns warnings off twice and back on once, so every #include <FastLED.h> stands between a diagnostic push and pop. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
…ograms Every project keeps its build cache in one folder under %LOCALAPPDATA%\pio. The cache serves an object file only to the build folder that compiled it, and worktrees share each project's build folder, so a build after another worktree's build takes back what it compiled before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The test image in firmware/tests/teensy holds the Teensy tests of every program of testing.md, each program in src/<program>, and takes its tests from the host over USB serial. The old projects of driver-tick, lighting, servo and every-driver move into it, and each program reports through test-harness.h. firmware/tools/teensy-tests.py flashes the image with --upload, restarts the Teensy before each program and runs one test at a time with the limit the image lists for it. It fails a test that reports FAIL or ERROR, outlasts its limit, crashes or loses the port, and exits with 1 then. A run is quick by default. --soak takes the durations testing.md states, and --bench adds the bench tests. quiet-libraries.py resolves lib_dir against the project, so a project below the root counts firmware/lib as its own, and it counts the include folder as its own as well. CI checks the format of the tests too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
The settings stood in firmware/gist/freertos-config.h, and no build included them, so malloc() took its memory from RAM1 instead of RAM2. They now stand in firmware/include/freertos_config_override.h, the name the port includes, and the firmware and the bench programs put that folder on the include path with build_flags. A project's include folder does not reach the libraries with lib_ldf_mode = off, so the bench programs' wrapper headers go. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
firmware/lib/clock holds nowUs(), elapsedUs(), elapsedMs() and before() of general-design.md and startClock(), which sets GPT2 to count microseconds from the 24 MHz crystal. The code leaves the gist and the design document, which link to it now. clock.wrap runs on the computer against a fake GPT2 counter and compares every answer across the wrap with the one away from it. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
… blinks setup() starts the clock and creates the main task with xTaskCreateStatic. Its stack is the rest of RAM1, with an MPU guard of 32 bytes below the interrupts' stack. The main task restores the temperature panic's and the pin interrupts' priorities, which the start of FreeRTOS resets, and its main loop blinks the LED by nowUs() without waiting. The port's event responder, a timer and a task for PJRC's MillisTimer, stays off. The task function is runMainTask in the bench programs too. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
psram.found compares the chip Teensyduino found with the design's 8 MB, and psram.patterns writes 12 fixed patterns and 4 pseudo-random sequences over the whole PSRAM and reads each back past the cache. clock.rate reads nowUs() between two reads of the cycle counter for 5 s, or a minute in a soak run. start-up.heap checks that a malloc() before main() and one in the main task lie apart in RAM2. The image now runs its tests in a FreeRTOS task, as the firmware runs its main loop, with the firmware's FreeRTOS settings, and starts the clock in setup(). Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Summary
Every Teensy test of
docs/firmware/testing.mdnow lives in one test image,firmware/tests/teensy, which is flashed once. The runnerfirmware/tools/teensy-tests.pypicks the tests over USB serial, gives each one its time limit, and reads the result lines back. It restarts the Teensy before each program, detects a crash through PJRC's CrashReport or a lost port, and exits with 1 on a failure, a hang or a crash. A quick run is the default.--soaktakes the durations testing.md states, and--benchadds the tests that need a person at the bench.The image holds the programs driver-tick, psram, clock, lighting, servo, every-driver and start-up. The image runs them in a FreeRTOS task, as the firmware runs its main loop.
Writing the start-up test showed that no build included the firmware's four FreeRTOS settings. malloc() therefore took its memory from RAM1 instead of RAM2. The settings now stand in
firmware/include/freertos_config_override.h, and the firmware, the test image and the bench programs put that folder on the include path throughbuild_flags.Commits
-Wall -Wextra -Werrorreachessrcandfirmware/libin both environments. FastLED 3.10.9 turns warnings off twice and back on once, so every#include <FastLED.h>stands between a diagnostic push and pop.build_cache_dir. It serves an object file only to the build folder that compiled it, and worktrees share that folder.quiet-libraries.pyresolveslib_diragainst the project, so a project below the root countsfirmware/libas its own.firmware/include. The bench programs' wrapper headers are gone.firmware/lib/clockholdsnowUs()on GPT2 withelapsedUs(),elapsedMs(),before()andstartClock().clock.wrapchecks the wrap on the computer.nowUs()without waiting.psram.found,psram.patterns,clock.rateandstart-up.heap.Test plan
python firmware/tools/teensy-tests.py --upload: 12 passed, 0 failed, 4 skipped in 29.2 s. The servo tests skip without the wire from pin 0 to pin 1.clock.ratein a soak run over 60 s passes.pio test -e computer: 5 of 5.-Werror._g_heap_startlies in RAM2 in the ELF of the firmware, the image and the benches.tools/figcheck.pyand clang-format 18 pass.--bench, and the servo tests with the wire fitted, have not run on the new image.🤖 Generated with Claude Code