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

Thread: Arduino CLI Alpha Release - Teensy Support?

  1. #51
    Junior Member
    Join Date
    Dec 2021
    Posts
    6
    I've been using the arduino-cli for other projects, I appreciate the work being done toward Teensy support.

  2. #52
    Member
    Join Date
    Jan 2020
    Location
    Port Elizabeth
    Posts
    80
    Yes, I am looking forward to be able to use the arduino-cli with the Teensy 4. It will greatly simplify using external editors. I am already using the arduino-cli very effectively with my Raspberry Pico.

  3. #53
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,212
    Good news. I've been working on arduino-cli support recently. So far only an experimental Linux x86_64 version is available. Here is the package index URL.

    https://www.pjrc.com/teensy/td_156/p...nsy_index.json
    Code:
    https://www.pjrc.com/teensy/td_156/package_teensy_index.json
    This has only been tested with arduino-cli "Version: nightly-20220120 Commit: 5beeba4 Date: 2022-01-20T01:32:18Z". It's unlikely to work with any earlier versions.

    One major known limitation is the upload command (eg, running something like "/tmp/arduino-cli upload -b teensy:avr:teensy36 --port usb16/16-1/16-1.2 ~/teensy/sketch/Blink") will run GUI-based Teensy Loader to perform the actual upload. I plan to support headless upload when Arduino commits this feature:

    https://github.com/arduino/arduino-cli/pull/1640

    If you try this now, please know the upload is GUI only until we get an updated arduino-cli with #1640 merged.

    Please reply on this forum thread (not Arduino's issue tracker) if you run this. I could really use some feedback on whether it works for you?!

  4. #54
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,854
    Yay for linux progress!

    Is Windows coming along in parallel or some time away yet?

    Will it be built against the same nightly build that might be preinstalled/tested?

  5. #55
    Junior Member
    Join Date
    Dec 2021
    Posts
    6
    I successfully compiled and uploaded a basic blink sketch. The serial monitor worked as well. I used my currently installed instance of arduino-cli to do so.

    Version: 0.20.2 Commit: 1378380

    excellent work!

  6. #56
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,854
    I got a working Windows Verify build with:
    Code:
    Version: 2.0.0-rc3-nightly.20220128
    Date: 2022-01-28T03:03:44.410Z
    CLI Version: 0.20.2 [13783819]
    
    Copyright  2022 Arduino SA
    Click image for larger version. 

Name:	IDE2Teensy.jpg 
Views:	29 
Size:	102.7 KB 
ID:	27356

    After Verify it opened Teensy Loader and passed the name, but Verify only.

    Builds HEX and eHex for T_4.1 and Teensy Loader works

    Just put TD 1.56 into "C:\Users\Tim\AppData\Local\Arduino15\packages\tee nsy", removed a path '..', and changed a lot of '/' to '\', and added explicit ".exe" as needed in the Boards and Platform TXT files - and restarted IDE 2.0.

    IDE: Slow to load, no windows text resize, SerMon window is hard DOCKED and won't float to a stand alone window.
    SerMon ID's Teensy as 3.1/3.2, and keeps needing it reselected to connect.
    Arrggh: Everything in ARDUINO15 folder means harder to copy, and only single install?

    Upload has a PATH making glitch - not doing 'macro' replacment for this .path?:
    Code:
    Compilation complete.
    "{runtime.hardware.path}\tools\teensy_post_compile.exe" "-file=BlinkWithoutDelay.ino" "-path=R:\TEMP\arduino-sketch-57B791B5A63BFE52DB74090D946EF1E5" "-tools={runtime.hardware.path}\tools" "-board=TEENSY41" -reboot "-port=COM45" "-portlabel={serial.port.label}" "-portprotocol={serial.port.protocol}"
    Upload error: Failed uploading: cannot execute upload tool: exec: "{runtime.hardware.path}\\tools\\teensy_post_compile.exe": file does not exist

  7. #57
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,212
    Quote Originally Posted by defragster View Post
    Is Windows coming along in parallel or some time away yet?
    Right now I'm working on a MacOS port for the hardware discovery tool. Hope to at least give Windows a first look later today, to at least get an idea of how much work it's going to be.

    For these new port discovery and serial monitor tools, I switched to a multi-thread model. Previously I did everything from a single event dispatch loop, except for the minor caveat of 2 extra threads on Windows to work around missing WIN32 "overlapped" capability on stdin & stdout. My main reason for such a huge internal change is the horrible MacOS crashing problem. If this works, I'll backport teensy_discovery (for Arduino 2.0) threads to at least the MacOS version of teensy_ports (for Arduino 1.8).

    Unfortunately, Microsoft's thread API is completely different than POSIX pthreads. Not sure how I'm going to deal with that. Will come up with something. Right now, focusing on MacOS....

  8. #58
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,212
    Turns out all hardware detection needs to be on the same thread in MacOS, because it's all based on "run loop" dispatch built deep into MacOS. So if you want to know when the initial detection of devices is complete and you're now just detecting real-time changes, using 2 separate threads with a join (wait for completion) with the first thread is a no-no for MacOS.

  9. #59
    Senior Member+ mjs513's Avatar
    Join Date
    Jul 2014
    Location
    New York
    Posts
    8,122
    Ran into the issue with pthreads on windows as well when I was trying to do some rtos stuff. Not home right now and have no power at home either so right now hard to get the references but I did find ports of pthreads for windows. Examples
    https://github.com/dji-sdk/Windows-S...lude/pthread.h

    https://sourceforge.net/projects/pthreads4w/

  10. #60
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,327
    Good morning Paul,

    Couple of simple Ubuntu things... Not my primary environment... At least today on my test machine, I got Ubuntu to use my whole screen
    Needed to install the Nvidia driver... the Auto install crashed but appeared to work.

    How to launch the IDE? - I downloaded the nightly... You can not double click on the arduino... it errors out, can launch from command prompt, but not sure that is the prefered way? Is there an install script that adds it to the Show Applications list?

    Board Manager - I did the preferences, added you address, then went back to board manager and was not there... Exited restarted and it was there and I installed...

    So I github desktop updated my libraries for the MTP... integration over to current stuff. May do minor updates to it to not totally rely on core changes...

    Brought over your MMOD board, with an ILI9341 display on it, that was built on Windows for MTP Disk.

    I see at the top of the display: X no board selected drop down list, and so click on the drop down and the teensy is not shown (No /dev/tty*)...

    Luckily I found we can still select everything from the tools menu.
    But the tools->Port menu is less than ideal! It shows:
    Code:
    Seriial Ports
    /dev/ttyS10
    <about 30 of these ttySnn>
    
    Network ports
    192.168.2.175  (Have no idea what that is)
    
    Teensy Ports  (Finally)
    usb1/1-1/... (Teensy Micromod)
    So did the verify command and compiler started... And it exited with compiler errors...

    Someone overwrote my ~/arduino/libraries/SD code... I had it with link to my github project but now it is some random version
    1.2.4, Author=Arduino, Sparkfun

    I am guessing pretty strongly this is the Arduino IDE2, probably automatically updated this library. As it happened as well previously on my Windows machine. Aargh...

    It will be interesting to see how this all works out. So far IDE wise not sure how much we gain. Will be good with the CLI stuff as maybe better for integrating into other editors...

    Now back to playing (first by getting the right SD library)

    Edit - looking at the ~/Arduino/libraries folder it looks like Arduino RC3 updated several libraries when I installed and tried it about a week ago: SD, Servo, LiquidCrystal, Firmata, Arduino_builtin, TFT, Stepper, Mouse, Ethernet

  11. #61
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,212
    So far I've been focusing only on arduino-cli. In theory the entire 2.0 IDE is supposed to be built on top of arduino-cli. In practice, this stuff is still pretty new and probably has a lot of rough edges.

    Looks like PTHREAD_MUTEX_INITIALIZER is the only pthreads feature I'm using that's not easily available on Windows. Switching now to pthread_mutex_init(). Hopeful I can just substitute CRITICAL_SECTION for pthread_mutex_t and call CreateThread rather than pthread_create(), since I'm really using only very basic pthread features.

    But the invisible window needed to get WM_DEVICECHANGE events might be an issue with threads. Will explore that later today.

  12. #62
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,327
    Update: restored the proper SD library... It built.

    Tried to open Serial monitor: It errors saying:
    Not Connected. Select a board and port to connect automatically...
    Guessing: no SEREMU support yet.

    Is there a way to have monitor in different window?

  13. #63
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,212
    Quote Originally Posted by KurtE View Post
    Guessing: no SEREMU support yet.
    Definitely does work with arduino-cli.

    Code:
    ./arduino-cli monitor -v --port usb16/16-1/16-1.2
    Tested here with a Teensy 4.1 running RawHID. Haven't checked MTP.

  14. #64
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,327
    Quote Originally Posted by PaulStoffregen View Post
    Definitely does work with arduino-cli.

    Code:
    ./arduino-cli monitor -v --port usb16/16-1/16-1.2
    Tested here with a Teensy 4.1 running RawHID. Haven't checked MTP.
    Sounds good.

    My guess as with the others above is there top drop down list, for boards is probably only looking at /dev/tty*
    And when we select the bits and pieces from the tools menu, this data is maybe not handled by their gui...

  15. #65
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,327
    It worked from the CLI with the MTP...

    Note for others: the CLI is located: <install point?/resources/app/nod_modules/arduino-ide-extensions/build

  16. #66
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,808
    Quote Originally Posted by KurtE View Post
    ....
    It will be interesting to see how this all works out. So far IDE wise not sure how much we gain. Will be good with the CLI stuff as maybe better for integrating into other editors...
    ...
    For me the most intriguing use case is: with the CLI stuff it should be possible to setup GitHub actions! If I understood correctly, this would allow for fully automatic unit tests for various targets, configurations... whenever you push to gitHub. If it works out this would be a huge time saver for library development. Will give it a try as soon as the CLI runs stable.

    Some info: https://blog.arduino.cc/2019/11/14/a...ithub-actions/

  17. #67
    Senior Member
    Join Date
    Apr 2014
    Location
    -
    Posts
    9,756
    Could do the same with Defragsters TSET (or a variant)? Well, it compiles from commandline with the "official" builder.

  18. #68
    Senior Member
    Join Date
    Apr 2014
    Location
    Germany
    Posts
    1,808
    Quote Originally Posted by Frank B View Post
    Could do the same with Defragsters TSET (or a variant)?
    If you refer to GitHub Actions, I don't think so. The stuff is running on GitHub servers, I don't think that you can simply plug in your own stuff. But, I didn't read into it very deeply so far.

    Edit: Here an example control file: https://github.com/arduino/arduino-c...lows/test.yaml

  19. #69
    Senior Member
    Join Date
    Apr 2014
    Location
    -
    Posts
    9,756
    Well, doesn't matter much if it would work or not

    This looks like a simple batch command, which looks like it can run a batch too:
    Code:
          # Finally, we compile the sketch, using the FQBN that was set
          # in the build matrix.
          - name: Compile Sketch
            run: arduino-cli compile --fqbn ${{ matrix.fqbn }} ./blink
    It's not important.

  20. #70
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,327
    Quote Originally Posted by defragster View Post
    I got a working Windows Verify build with:
    Code:
    Version: 2.0.0-rc3-nightly.20220128
    Date: 2022-01-28T03:03:44.410Z
    CLI Version: 0.20.2 [13783819]
    
    Copyright  2022 Arduino SA
    Click image for larger version. 

Name:	IDE2Teensy.jpg 
Views:	29 
Size:	102.7 KB 
ID:	27356

    After Verify it opened Teensy Loader and passed the name, but Verify only.

    Builds HEX and eHex for T_4.1 and Teensy Loader works

    Just put TD 1.56 into "C:\Users\Tim\AppData\Local\Arduino15\packages\tee nsy", removed a path '..', and changed a lot of '/' to '\', and added explicit ".exe" as needed in the Boards and Platform TXT files - and restarted IDE 2.0.

    IDE: Slow to load, no windows text resize, SerMon window is hard DOCKED and won't float to a stand alone window.
    SerMon ID's Teensy as 3.1/3.2, and keeps needing it reselected to connect.
    Arrggh: Everything in ARDUINO15 folder means harder to copy, and only single install?

    Upload has a PATH making glitch - not doing 'macro' replacment for this .path?:
    Code:
    Compilation complete.
    "{runtime.hardware.path}\tools\teensy_post_compile.exe" "-file=BlinkWithoutDelay.ino" "-path=R:\TEMP\arduino-sketch-57B791B5A63BFE52DB74090D946EF1E5" "-tools={runtime.hardware.path}\tools" "-board=TEENSY41" -reboot "-port=COM45" "-portlabel={serial.port.label}" "-portprotocol={serial.port.protocol}"
    Upload error: Failed uploading: cannot execute upload tool: exec: "{runtime.hardware.path}\\tools\\teensy_post_compile.exe": file does not exist
    Note: I installed nightly on windows (earlier on Ubuntu, then edited the extra boards, reloaded and tried to install:
    Click image for larger version. 

Name:	screenshot.jpg 
Views:	20 
Size:	73.3 KB 
ID:	27361

  21. #71
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,854
    Quote Originally Posted by KurtE View Post
    Note: I installed nightly on windows (earlier on Ubuntu, then edited the extra boards, reloaded and tried to install:
    ...
    Cool. Does it build?

    Seems like the ID T_3.1/3.2 is related to the above 'board ID' for "port" code?

    Seems the boards and platform TXT files - once installed work about the same - except the post_compile step for upload I didn't resolve.

    >> Except as done here - there is no selection for USB TYPE or Compile Optimization or Speed

    But hooking the TD 1.56 toolchain copied from "{path}\arduino-1.8.19\hardware\teensy" to here can do the Verify - once all the other 'onlline install' mucking about is done:
    Code:
     Directory of C:\Users\Tim\AppData\Local\Arduino15\packages\teensy
    
    01/28/2022  01:29 AM    <DIR>          .
    01/28/2022  01:25 AM    <DIR>          ..
    01/28/2022  01:22 AM    <DIR>          avr
    01/28/2022  01:29 AM    <DIR>          tools
    Though looking at the IDE ... I'm not sure how it is any improvement worth fighting for, hopefully a TSET like kick off for the IDE 2.0 CLI still works like for the current version.

    I've modified TSET to work with another STM board in %appdata%\...\Arduino15\... and that worked where it was a Manager installed board.

  22. #72
    Senior Member+ KurtE's Avatar
    Join Date
    Jan 2014
    Posts
    10,327
    Quote Originally Posted by defragster View Post
    Cool. Does it build?

    Though looking at the IDE ... I'm not sure how it is any improvement worth fighting for, hopefully a TSET like kick off for the IDE 2.0 CLI still works like for the current version.

    I've modified TSET to work with another STM board in %appdata%\...\Arduino15\... and that worked where it was a Manager installed board.
    Yep I probably could manually copy the stuff like you mentioned... But I think I will wait until Paul has initial setup...

    Yes not much new useful things for me. Unless I am missing some obvious things like:
    ability to edit core files
    ability to edit library files

    ...

  23. #73
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,854
    Quote Originally Posted by KurtE View Post
    Yep I probably could manually copy the stuff like you mentioned... But I think I will wait until Paul has initial setup...

    Yes not much new useful things for me. Unless I am missing some obvious things like:
    ability to edit core files
    ability to edit library files

    ...
    Good enough. Now that Teensy has an entry in Arduino15\packages - the OLD IDE is building from there it seems when using TSET?

    Looks like lots of details from install to build and upload for Paul to work out, but the general package layout from BuildMgr wasn't morphed it seems. And good news the TD 1.56 layout conforms for use here on Windows, just needed noted TXT file edits in p#56.

    @KurtE - that just means edits to CORES and LIBS come from the %appdata% ... local/packages install location, as noted even the old 'builder' is using that, see Sublime console output using TSET below.

    And building from there MalwareBytes refused to allow the SECURE.exe to run! Required putting an exclusion on that to build needed .eHex to upload.

    Tset still builds using the old arduino-builder, but the usage of "...\resources\app\node_modules\arduino-ide-extension\build\arduino-cli.exe" will take some edits, though the cmdline isn't exposed in the console.

    This gives a working mtpserial MakeFiles build from TSET - with lib sources : Used: C:\Users\Tim\AppData\Local\Arduino15\packages\teen sy\avr\libraries
    Code:
    Building Sketch: ".\MakeFiles.ino"
    Using board 'teensy41' from platform in folder: C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\avr
    Using core 'teensy4' from platform in folder: C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\avr
    Detecting libraries used...
    
    ... /// build here
    
    "C:\\Users\\Tim\\AppData\\Local\\Arduino15\\packages\\teensy\\tools\\teensy_size" "R:\\temp\\arduino_build_MakeFiles.ino\\MakeFiles.ino.elf"
    teensy_size: Memory Usage on Teensy 4.1:
    teensy_size:   FLASH: code:103968, data:16476, headers:8576   free for files:7997444
    teensy_size:    RAM1: variables:18752, code:101288, padding:29784   free for local variables:374464
    teensy_size:    RAM2: variables:28800  free for malloc/new:495488
    Multiple libraries were found for "SD.h"
     Used: C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\avr\libraries\SD
     Not used: C:\T_Drive\Arduino-1.8.19\libraries\SD
    Using library SD at version 2.0.0 in folder: C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\avr\libraries\SD 
    Using library SdFat at version 2.1.0 in folder: C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\avr\libraries\SdFat 
    Using library SPI at version 1.0 in folder: C:\Users\Tim\AppData\Local\Arduino15\packages\teensy\avr\libraries\SPI 
    Using library MTP_Teensy at version 1.0.0 in folder: C:\T_Drive\tCode\libraries\MTP_Teensy 
           upload@9706370-Teensy  Uploading to board '9706370-Teensy' (Teensy 4.1)
           upload@9706370-Teensy  Triggering board reboot
           upload@9706370-Teensy  Waiting for Teensy Loader
    [Finished in 17.0s]

  24. #74
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    Posts
    26,212
    Quote Originally Posted by KurtE View Post
    Yep I probably could manually copy the stuff like you mentioned... But I think I will wait until Paul has initial setup...
    Yes, indeed, best to wait.

    Just to confirm, 2 of the tools are completely different implementations for Arduino 1.8 vs Arduino 2.0 & arduino-cli. When Arduino merges #1640, I will be adding code to specifically check for which version of Arduino we're using and whether it is running with a GUI or headless.

    So there's not much value to testing by kludging the tools designed for Arduino 1.8 into use on Arduino 2.0. By doing so, you may discover problems which will be present with the properly updated tools, but you'll probably encounter all sorts of issues due to using the not-meant-for-2.0 tools.

    I got the Wincows multithreaded discovery tool to compile this morning. Will begin testing here this afternoon (at the moment, Robin & I are working on PJRC business stuff.... can't spend all hours programming). Hopefully by tonight I should have a feeling for whether the Windows stuff is going to be "soon" or "troublesome".

  25. #75
    Senior Member+ defragster's Avatar
    Join Date
    Feb 2015
    Posts
    15,854
    Quote Originally Posted by PaulStoffregen View Post
    Yes, indeed, best to wait.

    Just to confirm, 2 of the tools are completely different implementations for Arduino 1.8 vs Arduino 2.0 & arduino-cli. When Arduino merges #1640, I will be adding code to specifically check for which version of Arduino we're using and whether it is running with a GUI or headless.

    So there's not much value to testing by kludging the tools designed for Arduino 1.8 into use on Arduino 2.0. By doing so, you may discover problems which will be present with the properly updated tools, but you'll probably encounter all sorts of issues due to using the not-meant-for-2.0 tools.

    I got the Wincows multithreaded discovery tool to compile this morning. Will begin testing here this afternoon (at the moment, Robin & I are working on PJRC business stuff.... can't spend all hours programming). Hopefully by tonight I should have a feeling for whether the Windows stuff is going to be "soon" or "troublesome".
    Indeed I'm done and need to undo arduino15 copy and get back to overload of tasks at hand. But it looked like that 'packages' part could work with current layout, and it does. Just noted heads up on the TXT file issues that may show up with Windows 'path' declaration and it seems as the IDE 2.0 runs it needs explicit .exe on the programs - at least on Win11. And there may be issues with code running from that %appdata% folder when it comes to AntiVirus stuff. Hopefully save you the few IDE 2.0 restarts in your Faux Windows environment - and maybe one less Beta release when the Windows stuff is ready.

    There is now on Win11 a "Windows TERMINAL" that runs instead of "CMD.exe" for a 'dos box' - a new third option opposed to PowerShell. When in "Terminal" session - the old DOS CMD style does not work the same ... requiring the explicit ".exe" to run something and the IDE 2.0 may be getting executed using that?

    Good Luck!

Posting Permissions

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