Forum Rule: Always post complete source code & details to reproduce any issue!
Page 1 of 7 1 2 3 ... LastLast
Results 1 to 25 of 168

Thread: Arduino CLI Alpha Release - Teensy Support?

  1. #1
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,348

    Arduino CLI Alpha Release - Teensy Support?

    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 RC3 page, but more recently I have been using the Nightly builds.

    As Paul mentions in the CLI part below, the IDE has some rough points at this point with working with Teensy boards, but I have been using it to do simple testing versus using the Arduino 1 versions. One of the main limitations is that the Serial monitor code only works with USB Types that include Serial...
    But I personally work around that if necessary by using TyCommander.

    Paul has built a "Real" setup to plug into the Arduino Board Manager.

    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:
    Click image for larger version. 

Name:	screenshot.jpg 
Views:	29 
Size:	28.5 KB 
ID:	27533

    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.
    Click image for larger version. 

Name:	screenshot2.jpg 
Views:	24 
Size:	317.1 KB 
ID:	27535
    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\te ensy

    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


    Arduino CLI

    From post #110
    Here's a quick recap, where we're at today... for anyone else who wants to give this new software a try.

    Arduino CLI seems to be working pretty well, but with the caveat that uploading is done by running the GUI-based Teensy Loader. Packages are available for Windows, MacOS and Linux x86_64. If you *really* need another Linux arch, just ask. True headless mode is planned, but we're waiting on an IDE update, specifically issue 790, before we can reliably detect whether upload should be done headless or with the GUI.

    Arduino IDE 2.0-rc3 isn't really usable for Teensy at this point. The main thing to be done is reporting issues, which is an awesome way to contribute to the Arduino & Teensy community. Hopefully the new 2.0 IDE will become more usable with 2.0-rc4 as the Arduino developers fix the issues we've already reported.

    To use Arduino CLI, download the nightly build from this page. When you extract, it's just a single executable file. Put it somewhere like /usr/local/bin on Linux or MacOS, or edit your PATH environment variable so it runs when you type "arduino-cli" on the command line.

    The first step is to run "config init" like this:

    Code:
    ./arduino-cli config init
    or on Windows....

    Code:
    arduino-cli.exe config init
    It will create a arduino-cli.yaml config file and tell you the full pathname. Edit that file and add "https://www.pjrc.com/teensy/td_156/package_teensy_index.json". It should look like this:

    Code:
    board_manager:
      additional_urls: [
        https://www.pjrc.com/teensy/td_156/package_teensy_index.json
      ]
    After editing, run "arduino-cli config dump". You should see something similar to this:

    Click image for larger version. 

Name:	screenshot3.png 
Views:	24 
Size:	210.4 KB 
ID:	27536

    To install Teensy's files, run "arduino-cli core install teensy:avr". Today the package version is 1.56.1. Once it's installed, you can run commands like "arduino-cli board list" and it should probably detect Teensy, even when running in non-Serial modes. You can compile, upload, monitor (even in Teensy's non-Serial modes).

    Just remember, today upload always runs the GUI-based Teensy Loader, so if running on Linux you need a full desktop environment. But if you've been wanting to use Arduino CLI for scripts or other automation, hopefully now you can begin to move forward. An update to run fully headless will be coming, once Arduino updates fix those issues mentioned above.
    Last edited by KurtE; 02-15-2022 at 12:55 AM. Reason: Updated instructions on the cli and IDE 2

  2. #2
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,226
    Can't say I'm excited about having to dive into Google Go language....

  3. #3
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,348
    Yep - I have never looked at it before....

    I downloaded it to my windows machine, and it looked like it was finding most of the boards installed on my machine,

    Either ones that are installed in the Arduino15 location by Board Manager and I think maybe those installed in the <sketch folder>/hardware/... Although I would have to double check that part.

    I thought I would try building for a Robotis OpenCM9.04 board, it listed it, but then failed with some other error, maybe windows specific. I might try installing on MAC or Linux to see if any of that works...

  4. #4
    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 by rjp; 08-27-2018 at 06:25 AM.

  5. #5
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,882
    @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.

  6. #6
    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.

  7. #7
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,882
    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.

  8. #8
    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.

  9. #9
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,882
    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?

  10. #10
    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!

  11. #11
    Quote Originally Posted by defragster View Post
    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.

  12. #12
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,813
    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.

  13. #13
    the rules for https://github.com/arduino/Arduino/w...-specification seem somewhat easy enough.

    the only trick would be fudging the teensyduino install package into that format

  14. #14
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,226
    Quote Originally Posted by rjp View Post
    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.

  15. #15
    Quote Originally Posted by PaulStoffregen View Post
    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 ?

  16. #16
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,226
    Quote Originally Posted by rjp View Post
    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.

  17. #17
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,226
    Talked with the Arduino developers today. Summary is online as this issue:

    https://github.com/arduino/Arduino/issues/7942

  18. #18
    Quote Originally Posted by PaulStoffregen View Post
    Talked with the Arduino developers today. Summary is online as this issue:

    https://github.com/arduino/Arduino/issues/7942

    thankyou very much for providing the feedback.

    hopefully they will make this happen.

  19. #19
    Junior Member
    Join Date
    Nov 2018
    Location
    Colorado
    Posts
    3
    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.

  20. #20
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,226
    Quote Originally Posted by crypticvapor View Post
    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.

  21. #21
    Junior Member
    Join Date
    Nov 2018
    Location
    Colorado
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    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!

  22. #22
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,226
    Quote Originally Posted by crypticvapor View Post
    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.

  23. #23
    Junior Member
    Join Date
    Nov 2018
    Location
    Colorado
    Posts
    3
    Quote Originally Posted by PaulStoffregen View Post
    Just run arduino-builder. In the IDE, turn on verbose output while compiling to see how the IDE runs it.
    This makes sense, thank you!

  24. #24
    Junior Member
    Join Date
    Nov 2015
    Posts
    9
    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.

  25. #25
    Junior Member
    Join Date
    Nov 2015
    Posts
    9
    Hello Paul,

    It seems platformio had it all figured out already, so I went with that.

    Thanks for the teensies.

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •