PlatformIO, how to compile for Teensy 4.0 with beta core

Status
Not open for further replies.
Hi, I'm trying to compile a MIDI-USB project in PlatformIO and I get errors because the stable release of the Teensy 4.0 core used by PlatformIO has no support for USB modes other than Serial.
I successfully compile that project in Arduino and I imagine that it is due to the fact that I installed the Teensyduino 1.49 Beta #3, which has support for all the USB types, including MIDI-USB.
I downloaded the up-to-date Teensy 4.0 core from GIT, but I don't know where to put it in PlatformIO in order to let the IDE use it for compiling my Teensy 4.0 projects.
Any help will be appreciated.
 
What I did on my Mac (probably the same for Linux, not sure about Windows) was to move aside the installed cores directory:

Code:
mv ~/.platformio/packages/framework-arduinoteensy/cores ~/.platformio/packages/framework-arduinoteensy/cores.original
then created a symlink from the cores directory I checked out from git

Code:
ln -s ~/src/cores ~/.platformio/packages/framework-arduinoteensy/cores

This worked for now!
 
What I did on my Mac (probably the same for Linux, not sure about Windows) was to move aside the installed cores directory:

Code:
mv ~/.platformio/packages/framework-arduinoteensy/cores ~/.platformio/packages/framework-arduinoteensy/cores.original
then created a symlink from the cores directory I checked out from git

Code:
ln -s ~/src/cores ~/.platformio/packages/framework-arduinoteensy/cores

This worked for now!


Thanks a lot blackketter. It also works on Linux.
 
It should work fine on Windows as well, although commands will be different:

Note: on Windows 10 at times I also use links in a similar way. Note: I don't use platformio, but I use it for Arduino where I have many github projects that I keep on a different drive and then when I am working with them, I link them into my Arduino/libraries folder. When a new release comes out or when I need/want to compare versus released, I might then remove that link...

So in my case, I might do something like:
Code:
mklink /D C:\Users\kurte\Documents\Arduino\libraries\ili9341_t3 d:\github\ili9341_t3
Note: I would typically not type this whole thing in, but would instead have: C:\Users\kurte\Documents\Arduino\libraries as my working directory and type:
Code:
mklink /D ili9341_t3 d:\github\ili9341_t3

To later remove it, I always want to be careful on which command I use. I believe the correct one is rmdir:
Code:
rmdir ili9341_t3
You don't want to use del command as it will delete everything at the target...
 
Hi, I'm trying to compile a MIDI-USB project in PlatformIO and I get errors because the stable release of the Teensy 4.0 core used by PlatformIO has no support for USB modes other than Serial.
I successfully compile that project in Arduino and I imagine that it is due to the fact that I installed the Teensyduino 1.49 Beta #3, which has support for all the USB types, including MIDI-USB.
I downloaded the up-to-date Teensy 4.0 core from GIT, but I don't know where to put it in PlatformIO in order to let the IDE use it for compiling my Teensy 4.0 projects.
Any help will be appreciated.

Apologies in advance if I've overlooked something obvious, but I'm currently trying to port a PlatformIO MIDI-USB project from Teensy 3.2 to 4.0, and I'm running into compilation errors, I imagine for the same reason. I've done a bunch of googling but I can't figure out which "core" and git repo you're referring to. If someone could hand me an URL I'd really appreciate it. I've got a Teensy 4.0 sitting here on my bench but until I can compile my project it's just going to sit there feeling neglected. :)

Thanks--
--Adam
 
Apologies in advance if I've overlooked something obvious, but I'm currently trying to port a PlatformIO MIDI-USB project from Teensy 3.2 to 4.0, and I'm running into compilation errors, I imagine for the same reason. I've done a bunch of googling but I can't figure out which "core" and git repo you're referring to. If someone could hand me an URL I'd really appreciate it. I've got a Teensy 4.0 sitting here on my bench but until I can compile my project it's just going to sit there feeling neglected. :)
Ha, sorry, that's important information. Here's the repo for the cores: https://github.com/PaulStoffregen/cores
 
Ah, thanks so much. I'd actually found that repo but the magic string "framework-arduinoteensy" doesn't seem to be associated with it, so I thought I was looking in the wrong place. I appreciate it!
 
Another detail: It seems that MIDIUSB.h is missing from cores/teensy4/. It's present in cores/teensy3/ and doesn't appear to have any board-specific code, but MIDI-USB code won't compile for Teensy 4 unless I place a copy of MIDIUSB.h in cores/teensy4/.
 
Try copying that header from the teensy3 folder to the teensy4 folder. It's just a compatibility file for Arduino's API.

Or you could use Teensy's USB MIDI functions, which match the MIDI.h library and are probably much more familiar for anyone using MIDI than Arduino's way.

https://www.pjrc.com/teensy/td_midi.html
 
Thanks, Paul! I did get it to compile by copying that .h file, but then I figured out that, while I was already using the Teensy USB MIDI functions, I had some superfluous #include statements left over from an earlier, Arduino-based version of the project. All sorted now. My homebrew Teensy-based MIDI-CV converter has been successfully upgraded with a Teensy 4.
 
I've just started down the PlatformIO road myself. I have found that you can define the link to the cores files in the platformio.ini file within the project.

  • Download/clone the cores repo https://github.com/PaulStoffregen/cores
  • Put the unzipped repo in your favorite spot. I keep mine in <home>/Developer
  • Add the following to your project's platformio.ini file:
For Windows
Code:
[platformio]
boards_dir = %HOMEPATH%\Developer\cores-master

For Mac / Linux
Code:
[platformio]
boards_dir = ~/Developer/cores-master

Don't forget to add the USB_MIDI build flag

Code:
[env:teensy40]
platform = teensy
board = teensy40
framework = arduino
build_flags = -D USB_MIDI
lib_deps =
; Add additional libraries

I've only tested this on Windows 10 but it compiles successfully and finds the usbMIDI libraries correctly. Good luck!
 
PlatformIO with Teensyduino Beta

Hello everybody,
I'm new to this forum and new to PlatformIO as well.
I installed it on my Ubuntu 20.04 machine aside of Arduino and it works very well.

The only issue I have is the installation of the Teensyduino Beta version.
I installed the beta in the Arduino folder, removed the folders
~/.platformio/packages/framework-arduinoteensy/cores and ~/.platformio/packages/framework-arduinoteensy/libraries
and replaced them with soft links to the folders in the Arduino installation.

The projects in platformIO compile without problems
BUT

I get the following output executing the build command:
Code:
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/teensy/teensy41.html
PLATFORM: Teensy (4.12.0) > Teensy 4.1
HARDWARE: IMXRT1062 600MHz, 512KB RAM, 7.75MB Flash
DEBUG: Current (jlink) External (jlink)
PACKAGES: 
 - framework-arduinoteensy 1.153.0 (1.53) 
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
....

Code:
Advanced Memory Usage is available via "PlatformIO Home > Project Inspect"
RAM:   [==        ]  20.2% (used 105824 bytes from 524288 bytes)
Flash: [          ]   1.1% (used 92744 bytes from 8126464 bytes)

The framework version I would expect is 1.154 beta 6, not 1.153 and the RAM usage should look different as well.
What am I missing?
 
The framework version I would expect is 1.154 beta 6, not 1.153 and the RAM usage should look different as well.
What am I missing?

I believe that the version number it's displaying is obtained from

.platformio/packages/framework-arduinoteensy/.piopm

which hasn't changed, but you've replaced the code in the cores directory, so it should be using that code. Try removing the symlink and see if the build breaks, that'll indicate that it's using the cores directory you specified.
 
@blackketter: thanks for your help!
The problem here is that platformIO automatically restores a folder named framework-arduinoteensy@1.153 containing the complete 1.153 package.
If I delete this 153 version it appears again with the first build command after starting VS code.
Very strange...
 
@blackketter: thanks for your help!
The problem here is that platformIO automatically restores a folder named framework-arduinoteensy@1.153 containing the complete 1.153 package.
If I delete this 153 version it appears again with the first build command after starting VS code.
Very strange...
That IS strange. Can you share your platformio.ini contents and confirm that the only change you are making to the contents of framework-arduinoteensy is to replace the cores and libraries directories with symlinks?
 
I uninstalled PlatformIO and reinstalled it again, and the strange behaviour is gone. With the softlinks back in place I can use the 154 beta version now without interfering with the version 153 anymore.
Nevertheless I still get the output
Code:
PACKAGES: 
 - framework-arduinoteensy 1.153.0 (1.53) 
 - toolchain-gccarmnoneeabi 1.50401.190816 (5.4.1)
But this should be OK as I understood.

I could also reproduce the "strange" behaviour I described above. During my experiments I changed the version of the framework from 1.153 to 1.154 in the files ~/.platformio/packages/framework-arduinoteensy/.piopm and ~/.platformio/packages/framework-arduinoteensy/package.json. When changing the files again after the reinstallation of platformIO the original 1.153 folders get restored when the build is started.

To make a long story short: Don't mess around too much with the files when you don't know exactly what you're doing... ;-)

Thanks for the support!
 
Status
Not open for further replies.
Back
Top