VSCode + command line workflow?

Just got my Tympan in the mail - it works great! I’ve been able to compile/upload code using Teensyduino on MacOS Big Sur.

Separately, I’ve been using VSCode + arduino-cli to upload code to an Arduino Nano. I prefer the VSCode editing experience to Teensyduino.

Is there’s a way to do VSCode + command-line development for Tympan/Teensy?

Thanks!
James

There is a way. I don’t personally know it, but there is a way. Let me see if I can rope in someone with the right experience.

With the holidays, this might take a couple days, though.

If you can’t wait, you can also look for guidance that might exist over on the forums for the Teensy. Anything that works for the Teensy 4.1 means that it’ll work for the Tympan RevE…because the heart of the RevE is a Teensy 4.1.

Chip

Thanks for the reply! I found a project called Teensy Loader CLI that looked promising. It can flash a Teensy, but it needs a .hex file as input. I’m not sure how to build a .hex file from the .ino and library source.

James

Hi Jamescookmd,

I’ve been using VS Code with the Platform I/O extension and love it. Are you interested in a solution like that? It handles the GCC commands for you, and you can select Teensy as the board. Really, the only thing you need to set up is bringing in the Tympan Library. One of the nice features (besides using VS code as your IDE) is the ability to lock in your libraries by referencing the Git branch or commit.

I’ll try to document this as soon as I can. Glad you like the Tympan! We love to hear the different ways that folks intend to use it. So feel free to share what you are working on if you don’t mind publicizing it.

Regarding hex files, check out the Getting Started page: https://github.com/Tympan/Docs/wiki/Program-the-Tympan-from-a-Single-Hex-File

Hi JamesCookMD,

I’ve added a tutorial on setting up VS Code with the Platform IO extension. Thanks for inspiring me to get to this. If you follow the tutorial, let me know if I missed a step or if you run into problems.

Actually, I am getting a build error related to how VS Code includes the Teensy library. I have a hack that works (Let me know if you need to get this working now), but on Tuesday, I will ask my colleague about a better way to fix this.

For reference, here is the error.

In file included from .pio\libdeps\teensy41\SD\src\SD.cpp:24:0:
.pio\libdeps\teensy41\SD\src/SD.h:135:29: error: 'DateTimeFields' has not been declared
  virtual bool getCreateTime(DateTimeFields &tm) {

@chipaudette I believe this stems from play_sd_wav.cpp in the Teensy library referencing an old “SD.h” library.

Thanks for the tutorial. I was able to follow it and it looks promising. However, I’m hitting the same compile error as you:

Indexing .pio/build/teensy41/liba2a/libSdFat.a
In file included from .pio/libdeps/teensy41/SD/src/SD.cpp:24:0:
.pio/libdeps/teensy41/SD/src/SD.h:135:29: error: 'DateTimeFields' has not been declared
  virtual bool getCreateTime(DateTimeFields &tm) {

If you have a workaround I’d love to try it.

Hi JamesCookMD: I’m afraid I led you a bit astray.

The Teensy library is already included in the PlatformIO build, so adding it as a libdep caused the error. If you just list the Tympan as a libdep, then it builds fine. You can refer to the updated guide here: https://github.com/Tympan/Docs/wiki/Program-the-Tympan-using-VS-Code-and-Platform-IO

lib_deps = https://github.com/Tympan/Tympan_Library.git#main

Now, when I tried this after my mistake including the Teensy libdep, I still got errors. What I had to do was clear out the PlatformIO packages, then let VS Code rebuild them:

  • Open VS Code, click on Extensions, then uninstall PlatformIO. Close VS Code
  • Delete the following folder from your PlatformIO directory.
    C:\Users\<YOUR USERNAME\.platformio\packages
  • Open VS Code, then install PlatformIO
  • Open your example project folder, then wait for Intellisense to build (refer to the task status at the bottom of the VS Code window)
  • Then click the build checkmark. It should take longer than usual, as you see all the libraries being pulled in.

Let me know if you still run into issues!