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

Thread: Could you help us with testing of a new PlatformIO 1.0 and Teensy?

  1. #1

    Could you help us with testing of a new PlatformIO 1.0 and Teensy?


    I would ask you to read original reddit post (pre-release) which contains all key features which have been implemented in the 1.0.0-dev and how to install/try PlatformIO 1.0.

    PlatformIO 1.0 has support for Teens 2.0, Teensy++ 2.0, Teensy 3.0 and Teensy 3.1. Teensy development platform in PlatformIO has the same behaviour in the different OS, including Mac OS X, Linux, Windows and even Linux ARMv6,7. You can develop, build and upload firmware via single command "platformio run". You don't need to install any IDE or toolchains. Just PlatformIO!

    Here is an example which shows how to build single source code "ChatServer.ino" for the all Teensy boards.

    P.S: I've tested a few projects with Teensy 3.1 It works great!

    P.S.S: @PaulStoffregen, thanks a lot for present with Teensy 3.1! It helped me. Excellent board!
    Last edited by ikravets; 02-25-2015 at 09:31 PM.

  2. #2
    Hey, I just tried to use PlatformIO to build one of the USB examples (TriangleMove.ino, source code at the bottom of this message), and get the following error:

    $ platformio run
    [Tue Jun 23 09:21:28 2015] Processing teensylc (platform: teensy, board: teensylc, framework: arduino)
    arm-none-eabi-g++ -o .pioenvs/teensylc/src/tmp_ino_to.o -c -fno-rtti -fno-exceptions -std=gnu++0x -felide-constructors -g -Os -ffunction-sections -fdata-sections -Wall -mthumb -mcpu=cortex-m0plus -nostdlib -MMD -DF_CPU=48000000L -DUSB_SERIAL -DLAYOUT_US_ENGLISH -D__MKL26Z64__ -DARDUINO=10600 -DTEENSYDUINO=121 -DPLATFORMIO=020102 -I.pioenvs/teensylc/FrameworkArduino src/tmp_ino_to.cpp
    src.ino: In function 'void loop()':
    src.ino:13:1: error: 'Mouse' was not declared in this scope
    src.ino:17:1: error: 'Mouse' was not declared in this scope
    src.ino:21:1: error: 'Mouse' was not declared in this scope
    scons: *** [.pioenvs/teensylc/src/tmp_ino_to.o] Error 1
    ======================================================= [ ERROR ] Took 0.54 seconds =======================================================
    Obviously this is because Teensy's USB modes are configured separately from the *.ino source code, using the Tools -> USB Type menu from the Teensyduino/Arduino GUI.

    The question then becomes: how does one utilize these features from the context of PlatformIO?

    TriangleMove.ino file:

    /* Simple USB Mouse Example
       Teensy becomes a USB mouse and moves the cursor in a triangle
       You must select Mouse from the "Tools > USB Type" menu
       This example code is in the public domain.
    void setup() { } // no setup needed
    void loop() {
      int i;
      for (i=0; i<40; i++) {
        Mouse.move(2, -1);
      for (i=0; i<40; i++) {
        Mouse.move(2, 2);
      for (i=0; i<40; i++) {
        Mouse.move(-4, -1);

  3. #3
    Senior Member PaulStoffregen's Avatar
    Join Date
    Nov 2012
    The Tools > USB Type menu merely causes different -D{name} parameters to be passed to the compiler. You can see what they are by looking at boards.txt, or by watching the compiler commands with File > Preferences set to show verbose info while compiling.

  4. #4
    Ah, thanks Paul, that's quite helpful info!

  5. #5
    And this issue is now RESOLVED! Paul's tip about the -D{option} led me to find the correct flag (-DUSB_HID) but then I realized the output still had (in addition to the newly added flag) -DUSB_SERIAL which was causing an error. Then I found this GitHub issue which further educated me about g++'s -U flag which Undefines a previously Define. Combining these bits of knowledge solved my problem.

    The relevant flags may be added to the platformio.ini file, shown below with my particular solution emphasized:

    $ cat platformio.ini 
    # Project Configuration File
    # A detailed documentation with the EXAMPLES is located here:
    # A sign `#` at the beginning of the line indicates a comment
    # Comment lines are ignored.
    # Simple and base environment
    # [env:mybaseenv]
    # framework =
    # board =
    # Automatic targets - enable auto-uploading
    # targets = upload
    platform = teensy
    framework = arduino
    board = teensylc
    build_flags = -UUSB_SERIAL -DUSB_SERIAL_HID
    # targets = upload

  6. #6
    @hoosieree, if you have any problems with PlatformIO, don't hesitate to contact us.

  7. #7
    Thanks ikravets, I will. For this particular issue, it was very Teensy-specific, so I figured here was a good place to ask.

  8. #8
    Senior Member
    Join Date
    Jun 2013
    So. Calif
    Suggestion: Video of example usage.

  9. #9
    To add to stevech's suggestion: if you just want a few short GIF screencasts of your terminal, check out mkcast.

Posting Permissions

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