Forum Rule: Always post complete source code & details to reproduce any issue!
Results 1 to 7 of 7

Thread: Teensy Development Environment

  1. #1
    Junior Member knickish's Avatar
    Join Date
    May 2021
    Posts
    8

    Teensy Development Environment

    I went to start a new project (on a 3.6) and got frustrated that I couldn't use vscode/cli very easily with the makefile and also use Arduino libraries, so I made a docker container build env that handles both building and programming using a CMake build system instead of the included Makefile. Any of the Arduino libraries (or any extras that are added to the libs folder) can just be included from the source code with no fuss.

    Link

    I tested it with my 3.2 and 3.6 with a variety of random teensy code that I found around the internet and my old projects, and it seems to work for everything I've tried so far. The setup scripts are for Linux, but there's nothing fundamentally preventing it from being used on Windows. Pull requests or comments are welcome if you encounter an issue.

  2. #2
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    711
    Neat! Nice to see more CMake love.

    I've been using Vagrant / VirtualBox as a multi-platform build environment with CMake:
    https://github.com/bolderflight/build-tools

    On Linux or WSL, I just work with them natively rather than through VirtualBox. One item you might consider is an upload target to flash the Teensy with the CLI tools:

    Code:
      add_custom_command(OUTPUT ${HEX_CMD}
        DEPENDS ${TARGET}
        COMMAND ${CMAKE_SIZE} ${TARGET}
        COMMAND ${CMAKE_OBJCOPY} -O ihex -R .eeprom ${TARGET} ${HEX_CMD}
      )
      add_custom_target(${HEX_TARGET}
        DEPENDS ${HEX_CMD}
      )
        add_custom_target(${UPLOAD_TARGET}
          COMMAND ${CMAKE_SOURCE_DIR}/tools/teensy_loader_cli ${MCU_CMD} -s ${HEX_CMD} -v
          DEPENDS ${HEX_CMD}
        )

  3. #3
    Junior Member knickish's Avatar
    Join Date
    May 2021
    Posts
    8
    Thanks, I will take a look at flashing with a CMake target rather than with the control script.

    How are build times with the Vagrant/VirtualBox combo?

  4. #4
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    711
    About as you would expect. The first build takes several minutes with a template-heavy code base. With CMake's caching, subsequent builds are fast. I think Docker would likely be a little faster.

  5. #5
    Junior Member knickish's Avatar
    Join Date
    May 2021
    Posts
    8
    I have about zero experience with vagrant, so I wasn't sure. Your cross-compiler setup looks way cleaner than mine, might have to go try and fix that at some point. Thanks for the input.

  6. #6
    Senior Member brtaylor's Avatar
    Join Date
    Mar 2016
    Location
    Portland, OR
    Posts
    711
    I don't have a ton of experience with Vagrant, but it's a way of automating the setup of a virtual machine, in this case a Virtual Box. So in a sense, it's kind of like a Dockerfile. Once the VM is setup, performance is the same as if you had setup the VM by hand and were using it.

  7. #7
    Junior Member knickish's Avatar
    Join Date
    May 2021
    Posts
    8
    As an update, I've added build scripts for Windows, tested with a variety of other Teensy versions, and have fixed all issues that I'm aware of with using Arduino libraries. Haven't figured out why the LC seems to not work with it (failing silently), but 3.2, 3.6, 4.0, 4.1 are all working. Compile times are at about 30s for first build on my machine, and 5s thereafter.

Posting Permissions

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