An easy starting point for a Teensy 3.X project which might not fit inside the arduino build environment.
Modified to be used under WSL and VSCode
Note that this will not work under VSCodium as Microsoft wont let us for now :/
- You need to modify the teensy core
- You don't love Java IDE's
- You love Make
- Because
Install the Teensy udev rule: sudo cp tools/49-teensy.rules /etc/udev/rules.d/
Then unplug your Teensy and plug it back in.
Install and enable ( or enable per workspace ) the Remote Extension Pack
When using with WSL and VSCode cd into the folder and then run code .
Also run sudo chmod 777 -R folder-name
where folder-name
is the name of the entire folder, I was running into permission issues with WSL
Set the baudrate and port that should be used to upload/monitor in .vscode/settings.json
This template should still work on pure linux, however, the current CLI tools will not
- Put your code in
src/main.cpp
- Put any libraries you need in
libraries
- Set the TEENSY variable in
Makefile
according to your teensy version - Build your code
make
- Upload your code
make upload
Clean
: Runmake clean
Build
: Runmake build
Stop Monitor
: Run a CMD command to stop the monitor ( VS does not close it automatically )Reboot
: Connect to teensy at 134 Baud to reboot itUpload
: Runmake upload
with WSL Mode enabledMonitor
: Run monitor program to read serial data
By default, Ctrl + Shift + B
(Run Build Task) should run all of the above in order except for Clean
make
alias formake hex
make build
compiles everything and produces a .elfmake upload
uploads the hex file to a teensy boardmake clean
clean up build files
- The
teensy
sub-folder is taken from a Teensyduino installation from the arduino install directoryhardware/teensy
- The
tools
sub-folder is also taken from the same Teensyduino directory - The
src/main.cpp
file is moved, modified fromteensy/avr/cores/teensy3/main.cpp
- The
Makefile
file is moved, modified fromteensy/avr/cores/teensy3/Makefile
- The
49-teensy.rules
file is taken from PJRC's udev rules - The
ComMonitor.exe
file is from ComMonitor-CLI - The
teensy_loader_cli.exe
file is the Teensy Loader Command Line compiled for windows
Modifications to Makefile
include
- Add support for arduino libraries
- Change tools directory
- Calculate target name from current directory
- Prettify rule output
- Do not upload by default, only build
- Other modifications which might have broken that arduino part
- Usage of the teensy cli loader