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

Status
Not open for further replies.

ikravets

Well-known member
Hey,

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! :eek:
 
Last edited:
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:

Code:
$ 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:

Code:
/* 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);
    delay(25);
  }
  for (i=0; i<40; i++) {
    Mouse.move(2, 2);
    delay(25);
  }
  for (i=0; i<40; i++) {
    Mouse.move(-4, -1);
    delay(25);
  }
}
 
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.
 
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:

Code:
$ cat platformio.ini 
#
# Project Configuration File
#
# A detailed documentation with the EXAMPLES is located here:
# [url]http://docs.platformio.org/en/latest/projectconf.html[/url]
#

# A sign `#` at the beginning of the line indicates a comment
# Comment lines are ignored.

# Simple and base environment
# [env:mybaseenv]
# platform = %INSTALLED_PLATFORM_NAME_HERE%
# framework =
# board =
#
# Automatic targets - enable auto-uploading
# targets = upload

[env:teensylc]
platform = teensy
framework = arduino
board = teensylc
[I][B]build_flags = -UUSB_SERIAL -DUSB_SERIAL_HID[/B][/I]
# targets = upload
 
Thanks ikravets, I will. For this particular issue, it was very Teensy-specific, so I figured here was a good place to ask.
 
Status
Not open for further replies.
Back
Top