Arduino CLI And IDE now Released - Teensy Supported!

KurtE

Senior Member+
This message was updated from the old details about the first CLI Alpha release to more current versions of both the
CLI as well as the "RC candidates for the Arduino IDE2.

Most of this was taken from a few of Paul's posts.

Arduino IDE 2

You can download the: Future Version of the Arduino IDE from the Arduino Software Page
I started with the RC7 page. I personally will continue to monitor the Github IDE changes and will use daily builds again once there are additional changes.

Many of the earlier rough edges of the earlier builds have improved with RC7. Not saying it is perfect yet, but a lot better! I have started using it again to do some of the Arduino testing. Again this is the first build that supports SEREMU.


Paul has built a "Real" setup to plug into the Arduino Board Manager, currently it is based on TD 1.56

Once you have the IDE 2 up and running, you open open up the Preferences Page: On Windows File->Preferences
You will see a dialog that looks like:
screenshot.jpg

As you can see in the Additional board manager URLS you enter:
Code:
https://www.pjrc.com/teensy/td_156/package_teensy_index.json

Close the dialog.. I found I needed to exit the IDE and restart it and then you can now install the Teensy boards.
You Open the Boards Manager and Scroll down until you see the Teensy Install and click the Install button.
screenshot2.jpg
You then should have the Teensy boards installed. Note: this install stuff in a different location then the Teensyduino installs.
On my Windows machine it is stored at: C:\Users\kurte\AppData\Local\Arduino15\packages\teensy

And if you find any issues with the Arduino IDE, you might want to search the list of issues that have already been open.
You can find them up at: https://github.com/arduino/arduino-ide/issues

Some notes: on issues and things you might run into.

1) If you install the install IDE2 and the Teensy board. When you try to use Arduino builds like 1.8.19 and for example install TD 1.57B2, by default Arduino will see your install for teensy from the board manager (arduino15) and use it. Paul has posted a patch to the Arduino install for it to instead use the one installed within the Arduino install: more details and zip file up at: https://forum.pjrc.com/threads/5354...Teensy-Support?p=307482&viewfull=1#post307482

2) On the first install of the IDE2, installs a set of default libraries into your <Sketches folder>/libraries/ Including an SD library. With our current install this one will take priority over the one installed by Teensyduino. I have potential fix for this, mentioned in the post #202. And that is to update the library.properties file in TD version of
SD library to change the: architectures=*
to: architectures=avr,*
More information on Search order can be found at: https://arduino.github.io/arduino-cli/dev/sketch-build-process/#dependency-resolution

Edit: Arduino is now looking at adding another directory to store the Arduino level libraries, like it has been done in Arduino 1.x:
https://github.com/arduino/arduino-ide/issues/1055


3) When I installed RC7 (actually the nightly before it), when it ran on my main machine, it wiped out my list of installed boards. The board manager showed there were
no boards...
This is issue: https://github.com/arduino/arduino-ide/issues/1036
Had do do with with the install of certain releases of ESP8236. Also replicates if you type in a URL in the extras boards which does not exist.
There is a pending Pull Request to hopefully fix this. I resolved it by deleting (rename) my arduino15 directory and started from scratch.

4) If you edit boards.txt or local.boards.txt, the system may not see these changes. I ran into this, by copying over the 1.57B2 stuff, which had the new Serial + MTP
But also could reproduce, by editing boards.txt and say I want to enable faster speed on T3.2.
Issue: https://github.com/arduino/arduino-ide/issues/1030 also https://github.com/arduino/arduino-ide/issues/591
As per @per1234 (github) PerT? work around:

Code:
    Select File > Quit from the Arduino IDE menus if it is running.
    Delete the "User data" folder:
        Windows:  C:\Users\<user name>\AppData\Roaming\arduino-ide\
        Linux:  ~/.config/arduino-ide/
        macOS: ~/Library/Application Support/arduino-ide/

    Start the Arduino IDE.

5) Suggestion by @PerT in post #204, that the Teensy Board URL at some point be a static URL that covers all of the releases of it and does not contain
the actual release number: That is instead of: https://www.pjrc.com/teensy/td_156/package_teensy_index.json
hopefully there will be something like: https://www.pjrc.com/teensy/package_teensy_index.json

6) Stability issues with Language Server. This is the code that when you hover over something, it will show you something like:
screenshot.jpg
Makes me want to go in and edit some of our header files and add more details.
Issues include: https://github.com/arduino/arduino-ide/issues/1042

Edit (6/17): 7) There appears to be issue with at least the daily build, should check on RC7 as well. But Serial.available and the like does not appear to return data if Teeny port is selected, until something in your code does an output to Serial... i.e. Serial.print(...)
https://github.com/arduino/arduino-ide/issues/1072

Edit: (7/6): This appears to be a Windows only issue and the problem appears to be in teensy-monitor code as can replicate without any Arduino IDE/CLI code.

Edit 7/9 (more in https://forum.pjrc.com/threads/5354...Teensy-Support?p=309070&viewfull=1#post309070)

7) Teensy Examples - How to install them in IDE2

8) Teensy 4 Security

Probably others...

Arduino CLI
Updated this information and moved to post #3 below
 

Attachments

  • screenshot3.png
    screenshot3.png
    210.4 KB · Views: 254
Last edited:
<Reused this post for Arduino-CLI updated notes> Also posted on Arduino forum
More recent notes of trying out arduino-cli with teensy support on both Windows and Raspberry PI running ubuntu 64 bits.

Installing it - Is it already installed as part of the IDE?
Yes: It is in the resources/app/node_modules/arduino-ide-extension/build subfolder of the Arduino IDE installation folder.
So my nightly build it is installed at: C:\arduino-ide_nightly\resources\app\node_modules\arduino-ide-extension\build
and released version: C:\Program Files\Arduino IDE\resources\app\node_modules\arduino-ide-extension\build

But: before I knew this, I installed from: [arduino/arduino-cli: Arduino command line tool (github.com)](https://github.com/arduino/arduino-cli) Clicked on the latest release on the right-hand side of screen. And made sure add the location to the Path.

Compiling
Doing the command: arduino-cli --help
Gives you a clue to use the compile: compile Compiles Arduino sketches.

Likewise, the help on that command helps some:

Code:
C:\Users\kurte>arduino-cli compile --help
Compiles Arduino sketches.

Usage:
  arduino-cli compile [flags]

Examples:
  arduino-cli compile -b arduino:avr:uno /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=\"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property "build.extra_flags=-DPIN=2 \"-DMY_DEFINE=\"hello world\"\"" /home/user/Arduino/MySketch
  arduino-cli compile -b arduino:avr:uno --build-property build.extra_flags=-DPIN=2 --build-property "compiler.cpp.extra_flags=\"-DSSID=\"hello world\"\"" /home/user/Arduino/MySketch


Flags:
      --board-options strings        List of board options separated by commas. Or can be used multiple times for multiple options.
      --build-cache-path string      Builds of 'core.a' are saved into this path to be cached and reused.
      --build-path string            Path where to save compiled files. If omitted, a directory will be created in the default temporary path of your OS.
      --build-property stringArray   Override a build property with a custom value. Can be used multiple times for multiple properties.
      --clean                        Optional, cleanup the build folder and do not use any cached build.
      --discovery-timeout duration   Max time to wait for port discovery, e.g.: 30s, 1m (default 1s)
      --dump-profile                 Create and print a profile configuration from the build.
      --encrypt-key string           The name of the custom encryption key to use to encrypt a binary during the compile process. Used only by the platforms that support it.
  -e, --export-binaries              If set built binaries will be exported to the sketch folder.
  -b, --fqbn string                  Fully Qualified Board Name, e.g.: arduino:avr:uno
  -h, --help                         help for compile
      --keys-keychain string         The path of the dir to search for the custom keys to sign and encrypt a binary. Used only by the platforms that support it.
      --libraries strings            Path to a collection of libraries. Can be used multiple times or entries can be comma separated.
      --library strings              Path to a single library’s root folder. Can be used multiple times or entries can be comma separated.
      --only-compilation-database    Just produce the compilation database, without actually compiling. All build commands are skipped except pre* hooks.
      --optimize-for-debug           Optional, optimize compile output for debugging, rather than for release.
      --output-dir string            Save build artifacts in this directory.
  -p, --port string                  Upload port address, e.g.: COM3 or /dev/ttyACM2
      --preprocess                   Print preprocessed code to stdout instead of compiling.
  -m, --profile string               Sketch profile to use
  -P, --programmer string            Programmer to use, e.g: atmel_ice
  -l, --protocol string              Upload port protocol, e.g: serial
      --quiet                        Optional, suppresses almost every output.
      --show-properties              Show all build properties used instead of compiling.
      --sign-key string              The name of the custom signing key to use to sign a binary during the compile process. Used only by the platforms that support it.
  -u, --upload                       Upload the binary after the compilation.
  -t, --verify                       Verify uploaded binary after the upload.
      --vid-pid string               When specified, VID/PID specific build properties are used, if board supports them.
      --warnings string              Optional, can be: none, default, more, all. Used to tell gcc which warning level to use (-W flag). (default "none")

Global Flags:
      --additional-urls strings   Comma-separated list of additional URLs for the Boards Manager.
      --config-file string        The custom config file (if not specified the default will be used).
      --format string             The output format for the logs, can be: text, json, jsonmini, yaml (default "text")
      --log-file string           Path to the file where logs will be written.
      --log-format string         The output format for the logs, can be: text, json
      --log-level string          Messages with this level and above will be logged. Valid levels are: trace, debug, info, warn, error, fatal, panic
      --no-color                  Disable colored output.
  -v, --verbose                   Print the logs on the standard output.

So what is the FQBN (yet another TLA ;) actually FLA) for a Teensy?
One way to get an idea is to use the command:
Code:
C:\Users\kurte>arduino-cli board list
Port               Protocol Type         Board Name FQBN                Core
usb:0/140000/0/8/4 teensy   Teensy Ports Teensy 4.0 teensy:avr:teensy40 teensy:avr

So found out both the FQBN and the port name, in this case it was T40 compiled with a USB type that does not include USB Serial. Another run with a Teensy MicroMod
Code:
C:\Users\kurte>arduino-cli board list
Port                 Protocol Type              Board Name      FQBN                Core
COM27                serial   Serial Port (USB) Unknown
usb:0/140000/0/8/1/1 teensy   Teensy Ports      Teensy MicroMod teensy:avr:teensyMM teensy:avr
Now how to do I compile a sketch: first attempt (actually probably 10th) :

Note: one of my first attempts failed to find any of the libraries. Turns out the CLI does not look into the same configuration stuff as either IDE... And it was defaulting to default location which is under the onedrive... on my W11 machine. My sketchbook is not there. So fiddled around with it for a while and found:
Code:
arduino-cli config init

Then edited the file mentioned and set the correct location.

But now that is working, In this case I changed directory to the location of sketch
Code:
D:\github\mtp_tft_picture_view>arduino-cli compile -b teensy:avr:teensyMM
D:\github\mtp_tft_picture_view\mtp_tft_picture_view.ino:18:17: note: '#pragma message: Note Built without MTP support'
   18 | #pragma message "Note Built without MTP support"
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
D:\github\mtp_tft_picture_view\mtp_tft_picture_view.ino:147:17: note: '#pragma message: Display: ILI9341_t3n'
  147 | #pragma message "Display: ILI9341_t3n"
      |                 ^~~~~~~~~~~~~~~~~~~~~~
Memory Usage on Teensy MicroMod:
  FLASH: code:140840, data:33204, headers:8224   free for files:16332804
   RAM1: variables:102080, code:135240, padding:28600   free for local variables:258368
   RAM2: variables:12384  free for malloc/new:511904

Used library        Version Path
SPI                 1.0     C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.3\libraries\SPI
SD                  2.0.0   D:\github\SD
SdFat               2.1.2   D:\github\SdFat
JPEGDEC             1.2.8   C:\Users\kurte\Documents\Arduino\libraries\JPEGDEC
PNGdec              1.0.1   C:\Users\kurte\Documents\Arduino\libraries\PNGdec
ILI9341_t3n         1.1.0   D:\github\ili9341_t3n
XPT2046_Touchscreen 1.4     C:\Users\kurte\Documents\Arduino\libraries\XPT2046_Touchscreen

Used platform Version Path
teensy:avr    0.58.3  C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.3

How do I define Build Options?
That is how do I Build with using not the default options? The CLI help gave a couple examples of using a larger hammer to replace major settings, but nothing appears to apply (at least to me)

Updated: the FQBN in this case is far more than just information about the board, it also allows you to specify all of the values for the menu items as part of it.

So the short answer on how to build with USB set to MTP Serial is:
Code:
D:\github\mtp_tft_picture_view>arduino-cli compile -b teensy:avr:teensyMM:usb=serialmtp
D:\github\mtp_tft_picture_view\mtp_tft_picture_view.ino:147:17: note: '#pragma message: Display: ILI9341_t3n'
  147 | #pragma message "Display: ILI9341_t3n"
      |                 ^~~~~~~~~~~~~~~~~~~~~~
Memory Usage on Teensy MicroMod:
  FLASH: code:167972, data:36440, headers:8576   free for files:16302084
   RAM1: variables:105632, code:162360, padding:1480   free for local variables:254816
   RAM2: variables:28800  free for malloc/new:495488

Used library        Version Path
SPI                 1.0     C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.3\libraries\SPI
SD                  2.0.0   D:\github\SD
SdFat               2.1.2   D:\github\SdFat
MTP_Teensy          1.0.0   D:\github\MTP_Teensy
JPEGDEC             1.2.8   C:\Users\kurte\Documents\Arduino\libraries\JPEGDEC
PNGdec              1.0.1   C:\Users\kurte\Documents\Arduino\libraries\PNGdec
ILI9341_t3n         1.1.0   D:\github\ili9341_t3n
XPT2046_Touchscreen 1.4     C:\Users\kurte\Documents\Arduino\libraries\XPT2046_Touchscreen

Used platform Version Path
teensy:avr    0.58.3  C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.3
Which is a lot cleaner than my previous fumbling around solution I tried before this:
Code:
D:\github\mtp_tft_picture_view>arduino-cli compile -b teensy:avr:teensyMM --build-property="build.usbtype=USB_MTPDISK_SERIAL" --clean
Which worked, but I had to manually add --clean as the command did not know directly I changed settings and so the core files were not rebuilt.
Also - was considered a major hack that may or may not work i the future.

:D

But how do you find out about what are the valid FQBN options? That is where the command:
Code:
D:\github\mtp_tft_picture_view>arduino-cli board details -b teensy:avr:teensyMM
Board name:                Teensy MicroMod
FQBN:                      teensy:avr:teensyMM
Board version:             0.58.3

Identification properties: modelID=0x26

Package name:              teensy
Package maintainer:        Paul Stoffregen
Package URL:               https://www.pjrc.com/teensy/package_teensy_index.json
Package website:           https://www.pjrc.com/teensy/td_download.html
Package online help:       https://forum.pjrc.com/forum.php

Platform name:             Teensy
Platform category:         Contributed
Platform architecture:     avr
Platform URL:              https://www.pjrc.com/teensy/td_158-beta3/teensy-package.tar.bz2
Platform file name:        teensy-package.tar.bz2
Platform size (bytes):     33761456
Platform checksum:         SHA-256:593b43c860ac16208fc0e506ed2cf1581a52e9cfcb44fca8a0f94a252b9f8095

Required tool:             teensy:teensy-tools                                 0.58.3

Required tool:             teensy:teensy-compile                               11.3.1-beta2

Option:                    USB Type                                                         usb
                           Serial                                              ✔            usb=serial
                           Dual Serial                                                      usb=serial2
                           Triple Serial                                                    usb=serial3
                           Keyboard                                                         usb=keyboard
                           Keyboard + Touch Screen                                          usb=touch
                           Keyboard + Mouse + Touch Screen                                  usb=hidtouch
                           Keyboard + Mouse + Joystick                                      usb=hid
                           Serial + Keyboard + Mouse + Joystick                             usb=serialhid
                           MIDI                                                             usb=midi
                           MIDIx4                                                           usb=midi4
                           MIDIx16                                                          usb=midi16
                           Serial + MIDI                                                    usb=serialmidi
                           Serial + MIDIx4                                                  usb=serialmidi4
                           Serial + MIDIx16                                                 usb=serialmidi16
                           Audio                                                            usb=audio
                           Serial + MIDI + Audio                                            usb=serialmidiaudio
                           Serial + MIDIx16 + Audio                                         usb=serialmidi16audio
                           MTP Disk (Experimental)                                          usb=mtp
                           Serial + MTP Disk (Experimental)                                 usb=serialmtp
                           Raw HID                                                          usb=rawhid
                           Flight Sim Controls                                              usb=flightsim
                           Flight Sim Controls + Joystick                                   usb=flightsimjoystick
Option:                    CPU Speed                                                        speed
                           600 MHz                                             ✔            speed=600
                           528 MHz                                                          speed=528
                           450 MHz                                                          speed=450
                           396 MHz                                                          speed=396
                           150 MHz                                                          speed=150
                           24 MHz                                                           speed=24
                           720 MHz (overclock)                                              speed=720
                           816 MHz (overclock)                                              speed=816
                           912 MHz (overclock, cooling req'd)                               speed=912
                           960 MHz (overclock, cooling req'd)                               speed=960
                           1.008 GHz (overclock, cooling req'd)                             speed=1008
Option:                    Optimize                                                         opt
                           Faster                                              ✔            opt=o2std
                           Fast                                                             opt=o1std
                           Fastest                                                          opt=o3std
                           Debug                                                            opt=ogstd
                           Smallest Code                                                    opt=osstd
Option:                    Keyboard Layout                                                  keys
                           US English                                          ✔            keys=en-us
                           Canadian French                                                  keys=fr-ca
                           Canadian Multilingual                                            keys=xx-ca
                           Czech                                                            keys=cz-cz
                           Danish                                                           keys=da-da
                           Finnish                                                          keys=fi-fi
                           French                                                           keys=fr-fr
                           French Belgian                                                   keys=fr-be
                           French Swiss                                                     keys=fr-ch
                           German                                                           keys=de-de
                           German (Mac)                                                     keys=de-dm
                           German Swiss                                                     keys=de-ch
                           Icelandic                                                        keys=is-is
                           Irish                                                            keys=en-ie
                           Italian                                                          keys=it-it
                           Norwegian                                                        keys=no-no
                           Portuguese                                                       keys=pt-pt
                           Portuguese Brazilian                                             keys=pt-br
                           Serbian (Latin Only)                                             keys=rs-rs
                           Spanish                                                          keys=es-es
                           Spanish Latin America                                            keys=es-mx
                           Swedish                                                          keys=sv-se
                           Turkish (partial)                                                keys=tr-tr
                           United Kingdom                                                   keys=en-gb
                           US International                                                 keys=usint
Programmers:               Id                                                  Name
Note: you do not need to specify all of the options, only those which are not the default ones.

Next up Upload:
For my main computer, which in my case is Windows 11, or secondary computers one running Ubuntu (64 bit) or MAC, where I have displays connected, have a few different options:

Do it as part of the compile like:
Code:
D:\github\mtp_tft_picture_view>arduino-cli compile -b teensy:avr:teensyMM:usb=serialmtp --upload -p usb:0/140000/0/8/1/1

Or could do as two steps. Here showing with not building in the sketch directory.
Code:
C:\Users\kurte>arduino-cli compile -b teensy:avr:teensyMM:usb=serialmtp D:\github\mtp_tft_picture_view
D:\github\mtp_tft_picture_view\mtp_tft_picture_view.ino:147:17: note: '#pragma message: Display: ILI9341_t3n'
  147 | #pragma message "Display: ILI9341_t3n"
      |                 ^~~~~~~~~~~~~~~~~~~~~~
Memory Usage on Teensy MicroMod:
  FLASH: code:167972, data:36440, headers:8576   free for files:16302084
   RAM1: variables:105632, code:162360, padding:1480   free for local variables:254816
   RAM2: variables:28800  free for malloc/new:495488

Used library        Version Path
SPI                 1.0     C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.3\libraries\SPI
SD                  2.0.0   D:\github\SD
SdFat               2.1.2   D:\github\SdFat
MTP_Teensy          1.0.0   D:\github\MTP_Teensy
JPEGDEC             1.2.8   C:\Users\kurte\Documents\Arduino\libraries\JPEGDEC
PNGdec              1.0.1   C:\Users\kurte\Documents\Arduino\libraries\PNGdec
ILI9341_t3n         1.1.0   D:\github\ili9341_t3n
XPT2046_Touchscreen 1.4     C:\Users\kurte\Documents\Arduino\libraries\XPT2046_Touchscreen

Used platform Version Path
teensy:avr    0.58.3  C:\Users\kurte\AppData\Local\Arduino15\packages\teensy\hardware\avr\0.58.3


C:\Users\kurte>arduino-cli upload -p usb:0/140000/0/8/1/1 D:\github\mtp_tft_picture_view

Headless uploads, for example to Raspberry PI over SSH. I am ussing KiTTy (derived from PuTTy)
If you actually running on the RPI using a monitor, keyboard, mouse, you can use all of the same as above.

Currently when building for Teensy boards, headless uploads are not fully supported yet. That is the upload will try to launch the GUI teensy app.

So currently I am using teensly_loader_cli, or may also try TyTools.

To make it easier I thought I would use the --export-binaries
Code:
kurte@kurte-rpi4:~/github/mtp_tft_picture_view$ arduino-cli compile -b teensy:avr:teensyMM:usb=serialmtp --export-binaries
/home/kurte/github/mtp_tft_picture_view/mtp_tft_picture_view.ino:211:17: note: '#pragma message: Display: ST7735_t3 or ST7789_t3'
  211 | #pragma message "Display: ST7735_t3 or ST7789_t3"
      |                 ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
Memory Usage on Teensy MicroMod:
  FLASH: code:171352, data:36368, headers:8340   free for files:16299012
   RAM1: variables:106784, code:167544, padding:29064   free for local variables:220896
   RAM2: variables:28800  free for malloc/new:495488

Used library Version Path
SPI          1.0     /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/SPI
SD           2.0.0   /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/SD
SdFat        2.1.2   /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/SdFat
MTP_Teensy   1.0.0   /home/kurte/github/mtp_teensy
JPEGDEC      1.2.8   /home/kurte/Arduino/libraries/JPEGDEC
PNGdec       1.0.1   /home/kurte/Arduino/libraries/PNGdec
ST7735_t3    1.0.0   /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3/libraries/ST7735_t3

Used platform Version Path
teensy:avr    0.58.3  /home/kurte/.arduino15/packages/teensy/hardware/avr/0.58.3

kurte@kurte-rpi4:~/github/mtp_tft_picture_view$ ls build/teensy.avr.teensyMM/
mtp_tft_picture_view.ino.eep   mtp_tft_picture_view.ino.elf  mtp_tft_picture_view.ino.lst
mtp_tft_picture_view.ino.ehex  mtp_tft_picture_view.ino.hex  mtp_tft_picture_view.ino.sym
As you can see it saves the output files into sub-directory build and subdirectory based off of the main FQBN string.

So was able to program it using the command:
Code:
kurte@kurte-rpi4:~/github/mtp_tft_picture_view$ teensy_loader_cli --mcu=TEENSY_MICROMOD -w build/teensy.avr.teensyMM/mtp_tft_picture_view.ino.hex
kurte@kurte-rpi4:~/github/mtp_tft_picture_view$

Note: In this case I pressed the program button.

And I was also able to program the teensy using the tytools which I downloaded sources from: https://github.com/Koromix/tytools
And built them on the RPI using the instructions given in the Readme file
Code:
Supported firmware formats: elf, ihex.
kurte@kurte-rpi4:~$ tycmd upload ~/github/mtp_tft_picture_view/build/teensy.avr.teensyMM/mtp_tft_picture_view.ino.hex
       upload@8493450-Teensy  Uploading to board '8493450-Teensy' (Teensy MicroMod)
       upload@8493450-Teensy  Triggering board reboot
       upload@8493450-Teensy  Firmware: mtp_tft_picture_view.ino.hex
       upload@8493450-Teensy  Flash usage: 211 kiB (1.3%)
       upload@8493450-Teensy  Uploading... 100%
       upload@8493450-Teensy  Sending reset command (with RTC)
kurte@kurte-rpi4:~$

Hopefully this version of the information is a little easier to understand!
 
Last edited:
Id love to abandon the Arduino IDE and move to visual code which is a far superior editor, if work is required to help teensy get enabled Ill tentatively put my hand up.

having just tried it out - it appears to require the new http://package.json support instead of the manual installation into the hardware folder.

all my other boards that have that packaging layer are just working as - is but the teensy and other manual ones dont show.
 
Last edited:
@rjp: In the IDE 'file / Preferences' you can select 'Use external editor' that opens the file 'Read Only' to Build and upload using the provided toolchain - the IDE uses the externally saved disk copy to build - that is if using a preferred external editor.

If using Visual Studio [for 'visual code' ?] there is a 'Visual Micro' plug in for that is used by some and generally seems to be kept working for Teensy. I just installed VS but haven't bothered trying VMicro yet as I'm doing okay with IDE and SublimeText for the editor.
 
thanks @defragster but alas ive tried all that.


Visual Micro is for the big fat version of visual studio, not the new lean mean visual code.

it was also quite clumsy from memory, i didnt want to persist with it or visual studio.


the arduino ide is just terrible to me - i dislike the menu behaviour and the awkward hovering games, i dislike the startup time, the actual builtin editor is the least of the problems :)

visual code is like vim, super fast to start, dumps you into a folder of your code to edit as you please, command shell to trigger tools and actions.

Ill raise my voice as someone who would love a command line only version of teensy and ill do my best to help make it happen if required.
 
Went looking for 'visual code' - is that the subset of MSFT Visual Studio app?

Will it work as external editor?

I share the finding of terrible 'awkward hovering games' in the IDE - the Menu usage is very non-standard Windows behavior from keyboard and the twitchy mouse jumping on undesired menu items on a whim is painful.

IDE startup was just now 9 seconds on closing and opening with it and reopening 11 sketches? I have all that running from a secondary SSD drive. It does take some time to scan any library and hardware chain it seems - but not as bad now as it has been, then I just leave it open - which is why I have 11 open sketches.

I generally suffer with the IDE for editing but use TyCommander for the loader and SerMon portions which takes out some of the pain of the IDE. Using the external editor is not as handy for navigating recent and creating new projects with the directory name of the sketch name.

I tried Visual Micro when I had VS2015 and it was a bit green then - not anxious to wade back in again as what I have it working.
 
https://code.visualstudio.com/

its super fast on startup and it works off a completely agnostic "open folder" paradigm which defies project file madness.

an open source effort from microsoft that runs seperately to visual studio, the linux version is identical to the windows one which makes my platform jumping realities much easier to deal with.

ctrl ~ toggles a terminal shelll with history so you can fire off tools and builds, microsoft accidently created a winner.
 
That is what I found VisualStudio Code - they have an Arduino Extension - but not Visual Micro so it may not fit the Teensy install/extend model the way VisualMicro has done.

It requires the non-windows IDE - just like Teensy - but I don't know if it is ready to set up and run with the Teensy layout of tools and building, have you tried that?
 
:) ill give it a go.

ideally, the command line tool would replace the need for the whole dance with that Java IDE and its unfortunate ui.

im not ready to give up on the dream just yet!
 
That is what I found VisualStudio Code - they have an Arduino Extension - but not Visual Micro so it may not fit the Teensy install/extend model the way VisualMicro has done.

It requires the non-windows IDE - just like Teensy - but I don't know if it is ready to set up and run with the Teensy layout of tools and building, have you tried that?

nope this one also only detects the boards in the package manager system and ignores the ones manually installed in /hardware

i wonder how much work it is to make a layer for teensyduino that obeys that package.json system.

this would appear to fix both the arduino-cli and the visual code plugin.
 
I'm using VisualStudio without VisualMicro. I'm building and uploading using the makefile support of the IDE. This is surprisingly easy, sketches compile very fast and intellisense works nicely. I'm sure you can do the same in Visual Code.

I also wrote a little tool (https://github.com/luni64/Board2Make) which extracts the info from boards.txt and converts it into a make-compatible format. So switching between different boards, or optimizer settings etc. is as easy as with the Arduino IDE. The most important thing for me is that this setup allows for self contained projects (I usually copy all used libraries and the Teensy core to the project directory). So, no dependency on the IDE, Arduino or Teensyduino version etc. You can open a project years later and be sure that it just compiles and you can continue working.
 
the only trick would be fudging the teensyduino install package into that format

Well that would be quite a trick indeed, since the json-based package does not provide any way to install Teensy's custom USB discovery tools.

I will be talking with the Arduino devs later this week. Not much to report right now.
 
Well that would be quite a trick indeed, since the json-based package does not provide any way to install Teensy's custom USB discovery tools.

I will be talking with the Arduino devs later this week. Not much to report right now.


thanks for the detail.

does this mean nagging them into adding a new "post install hook" to the format ?
 
does this mean nagging them into adding a new "post install hook" to the format ?

It's much more complicated than that. Sorry, don't have time to write a lengthy explanation. But I can tell you we're going to soon talk about it.
 
Hey Paul, from what I can tell your discussion with the arduino guys is to provide a one-stop solution to use the arduino-cli like the IDE and build/load the Teensy with the one cli.
Is there a way to use the board support files needed for the Teensy with the arduino-cli to compile the hex file and then use the teensy-loader-cli to load the hex file onto the board? I was hoping to perform terminal-only build and board loading.
 
Is there a way to use the board support files needed for the Teensy with the arduino-cli

No. We need Arduino to merge "Pluggable Discovery" before Teensy can be supported. Work was been done on this feature for the IDE, still waiting to be merged.

https://github.com/arduino/Arduino/pull/8038

Cristian said last week he will merge it soon, but plans to alter the JSON format later. Scroll to near the end of that page for details.


Of course, after they merge this into the IDE, it's also needed on the CLI. Cristian & Luca said that's what they intend to do. But it's a slow process. I do not have any idea of the time frame for the CLI to gain the Pluggable Discovery feature. But I would be amazed if it happens within the next few months.


I was hoping to perform terminal-only build and board loading.

Did you know the IDE can be run from the command line? It's not fast due to the Java JRE startup, but it can be done.
 
No. We need Arduino to merge "Pluggable Discovery" before Teensy can be supported. Work was been done on this feature for the IDE, still waiting to be merged.

Thank you for explaining, I apologize for asking a question which you already answered. I was hoping there was a way to disconnect the two: board support and discovery methodology. I will await this functionality to be integrated in the future.

Did you know the IDE can be run from the command line? It's not fast due to the Java JRE startup, but it can be done.

Fantastic, I did not know that, thank you!
 
I was hoping there was a way to disconnect the two: board support and discovery methodology.

Well, you can, more or less. Just run arduino-builder. In the IDE, turn on verbose output while compiling to see how the IDE runs it.

That will let you do the build part, but not the rest which the IDE and CLI do.
 
Hello Paul,

I see that the Teensy 3.2 is detected by arduino-cli as

Code:
        FQBN    Port            ID              Board Name
        /dev/ttyACM0    16c0:0483       unknown

Is there a way to make arduino-cli download all supporting files by adding an url to the "cli-config.yml" file, as done for the esp8266com?

Code:
board_manager:
  additional_urls:
    - http://arduino.esp8266.com/stable/package_esp8266com_index.json

or can the files / libraries be installed manually ?

The primary goal is to compile for Teensy 3.2 with "arduino-cli", not using "arduino" (which is slow to use, as "command line")

The secondary goal is to program the board via the arduino-cli.

Any advice or direction-pointing is fine.

Thank you.
 
Back
Top