Files
Claude f10fa5c08c Add CI workflow that builds and runs the test/bugs harness
Adds .github/workflows/bugs.yml, which configures, builds, and runs
test/bugs (linked against the local src/). The harness exits non-zero on
any failed check, so regressions in the fixed timing/serial/stream
behaviour now fail CI. Also adds a matching status badge to the README.

Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01FAsvzgsaayj2nbZnnQGAav
2026-06-24 19:59:57 +00:00

3.2 KiB

teensy x86 stubs

MIT license blink first root bugs

stub classes implementing basic arduino/teensy functions for compiling and debugging on your x86/x64 architecture (Linux, macOS, Windows/MSVC)

eco-system

sd | audio | st7735 | midi | bounce2 | encoder

quick example

main.cpp

#include <Arduino.h>
IntervalTimer myTimer;

void blinkLED() {
    Serial.printf("BLINK %d\n", 1000);
}

int main(int argc, char **argv){
    initialize_mock_arduino();

    myTimer.begin(blinkLED, 250000);
    delay(1000000);
}

CMakelists.txt reference

  • the DeclareAndFetch macro comes from cmake-declare-and-fetch — copy its cmake_declare_and_fetch.cmake.in next to your CMakeLists.txt (see test/ in this repo for an example)
cmake_minimum_required(VERSION 3.10)
project(thing C CXX)
set(CMAKE_CXX_STANDARD 17)
include(cmake_declare_and_fetch.cmake.in)
DeclareAndFetch(teensy_x86_stubs https://github.com/newdigate/teensy-x86-stubs.git main src)
add_executable(thing main.cpp)
target_link_libraries(thing teensy_x86_stubs)

build instructions:

git clone https://github.com/newdigate/teensy-x86-stubs.git
cd teensy-x86-stubs
mkdir cmake-build-debug
cd cmake-build-debug
cmake -DCMAKE_BUILD_TYPE=Debug ..
cmake --build .
  • this builds only the teensy_x86_stubs library. To actually run something, build one of the standalone test apps (e.g. test/blink or test/first), each of which has its own CMakeLists.txt.

timing emulation

  • to initialize the arduino timing library so that millis() will return the duration in milliseconds since the test app has been running
    initialize_mock_arduino()

credits

license

Unless specified in source code file, all code is MIT license.