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.

S
Description
stub classes to allow certain teensy code to be compiled and run on a desktop PC
Readme MIT 772 KiB
Languages
C 78.2%
C++ 21.3%
CMake 0.5%