PlatformIO IDE: The next generation IDE for IoT development

Status
Not open for further replies.

ikravets

Well-known member
Dear Community,

We are glad to present PlatformIO an open source ecosystem for IoT development with cross platform build system and library manager for Teensy development platform. It works on the popular host OS: Mac OS X, Windows, Linux 32/64, Linux ARM (like Raspberry Pi, BeagleBone, CubieBoard).


PlatformIO IDE Features

  • Cross-platform build system without external dependencies to the OS software: 200+ embedded boards, 15+ development platforms, 10+ frameworks
  • C/C++ Intelligent Code Completion and Smart Code Linter for rapid professional development
  • Multi-projects workflow with multiple panes and Themes support with dark and light colors
  • Built-in Terminal with PlatformIO CLI tool and powerful Serial Port Monitor
ide-atom-platformio.png



Regards, The PlatformIO Team.
 
I'm using the command-line version of this to build and upload my projects now. It's MUCH faster than the Arduino toolchain and was easy to set up.

I did have an issue with my largest project where the build failed, but the team there (hi Ivan) has been great about working on the issues.

(The workaround in my case was to rename the .ino file to .cpp).

Highly recommended.
 
@blackketter thanks a lot for the great feedback! We work on the improvements for PlatformIO ecosystem each day.

@defragster I've just fixed docs as @stevech proposed above.
 
I took the first step and installed. Having read about nothing except on my way to finding the download/install buttons. I found and said 'Teensy 3.1/3.2' - It started and asked for my 'project' so I pointed to my SKETCHBOOK folder - which I now think was not I was supposed to do. I opened one sketch and told it to compile and got yelled at for some STM cpu kraap. Here I just tried to build blink.ino:
MPU-9250-9DOF\STM32F401\main.cpp:31:18: fatal error: mbed.h: No such file or directory
#include "mbed.h"
^
compilation terminated.
scons: *** [.pioenvs\teensy31\src\MPU-9250-9DOF\STM32F401\main.o] Error 1
Prop\Audio\bleep\AudioSynthKS.cpp:1:26: fatal error: AudioSynthKS.h: No such file or directory
#include "AudioSynthKS.h"
^
compilation terminated.
scons: *** [.pioenvs\teensy31\src\Prop\Audio\bleep\AudioSynthKS.o] Error 1
[ ERROR ] Took 22.33 seconds

Perhaps I was only to open a SINGLE sketch as my project? I just tried a new project from Blink.ino - but it didn't ask me to associate the Teensy - so now it can't build - I don't find a way to say build this as Teensy without starting a project and picking Teensy from way down the list? Okay I deleted the SKETCHBOOK project and then 'found' the initialize and it had the path filled in so I could scroll way down to Teensy and select it. and then I get this from build:
.pioenvs\teensy31\libFrameworkArduino.a(main.o): In function `main':
C:\tCode\BLINK/.pioenvs\teensy31\FrameworkArduino/main.cpp:21: undefined reference to `setup'
C:\tCode\BLINK/.pioenvs\teensy31\FrameworkArduino/main.cpp:23: undefined reference to `loop'
collect2.exe: error: ld returned 1 exit status
scons: *** [.pioenvs\teensy31\firmware.elf] Error 1
[ ERROR ] Took 17.05 seconds

Also at first it gave two helpful popups ( where I had to copy paste the HTTP links to the browser ) about clang and needing LLVM - downloaded LLVM - . . . then went back to work after briefly reading I had to edit each project to have it deal with "Arduino.H". I'd paste those links but I closed them and they are not in history?
 
PlatformIO Project != Sketch from Arduino IDE.

Please use PlatformIO IDE `Menu: PlatformIO > Import Arduino IDE Project...`. This wizard allows to import Arduino IDE based project and even to keep it compatible between PlatformIO and Arduino IDE. Also, take a look at this example.

What is more, please note that Smart Code Linter is disabled for Arduino files. You can enable it manually or convert *.ino files to *.cpp.
 
Thanks for the reply - I'll have to read more - but just wanted to show what I saw when I stumbled in.

PlatformIO Project != Sketch from Arduino IDE.

Please use PlatformIO IDE `Menu: PlatformIO > Import Arduino IDE Project...`. This wizard allows to import Arduino IDE based project and even to keep it compatible between PlatformIO and Arduino IDE. Also, take a look at this example.

Still not clear on what a PIO-project is in relation to a sketch when it says "Import Arduino IDE Project", what is that? I pointed to the sketch folder?
I selected maintain Arduino compatibility during setup.

What is more, please note that Smart Code Linter is disabled for Arduino files. You can enable it manually or convert *.ino files to *.cpp.

Yeah - that was one of the popups I copied the URL for then after looking a minute - went back to work. Arduino.h was at the top of the file. The second comment block in my post #6 shows setup and loop - as the reason the compile failed?
 
Still not clear on what a PIO-project is in relation to a sketch when it says "Import Arduino IDE Project", what is that? I pointed to the sketch folder?
I selected maintain Arduino compatibility during setup.
Do you mean that you have used this "Import Wizard" and still have problems? Here is detailed info about PlatformIO Project Structure.

Also, please check a few Teensy examples http://docs.platformio.org/en/latest/platforms/teensy.html#examples

Yeah - that was one of the popups I copied the URL for then after looking a minute - went back to work.
We want to create really professional IDE. In this case, user expects really professional Linter and Code Autocompletion. I hope you had practice with other IDEs where Code Completion or Linter doesn't work properly. In the most cases, they parse source code and don't apply real build environment to it. As result, in other IDE Linter will not work as "compiler".

PlatformIO IDE 100% depends on PlatformIO CLI. We can even say that it is GUI for PlatformIO CLI. Here are the +/-. For example, our Code Linter which is based on PlatformIO Build System is the best feature which I ever seen in the other IDEs. It uses information which are 100% equal to the information which will be used for the further compiling. It means, that with PlatformIO IDE you will not see errors in the build results. Why? Because on each save of any file from the project we lint your source code with the REAL BUILD ENVIRONMENT and instantly inform about any problems.
PlatformIO IDE Linter and PlatformIO Build system keep tight connection about different modifications to the project: user added new build flags, added new library, use new library and etc.

I recommend you to try all benefits from PlatformIO IDE and test it simultaneously on the projects with the different development platforms(archs). You will be impressed how IDE automatically switches Code Completion & Linter to appropriate environment.

P.S: INO format is disabled by default because not each developer has `Arduino.h` in the file and valid prototype declarations. For us is better to disable it instead user will see "stupid" errors from our Linter and in the same time will be able to build project without problems. If you prefer to work with INO files, please force GCC compiler to handle them as C++. More details http://docs.platformio.org/en/latest/ide/atom.html#force-arduino-file-as-c.

The second comment block in my post #6 shows setup and loop - as the reason the compile failed?
It means, that something is wrong with your PlatformIO Project structure. Compiler doesn't see "setup/loop" implementation. Could you share somewhere `tree -L 3 /path/to/project` of your project?

-------

Please sorry for any problems/questions. We are doing very complicated work and we have only 1 month since the first release of our IDE. Also, we are so close to finish PlatformIO IDE 1.1.0 with auto-pause for Serial Monitor and automatic rebuilding of C/C++Project Index. I hope that 1.1.0 will be released this week. Nevertheless, we have ~8000 downloads of PlatformIO IDE for this short time.

Don't hesitate to post issues to https://github.com/platformio/platformio-atom-ide/issues
 
I knew what Lint is, but now I know:
A linter is a small program that checks code for stylistic or programming errors.
We want to create really professional IDE.
Perhaps these are already in PlatformIO, but (as a professional firmware developer), these are my top must-have's:
(IAR and Visual Studio do most of these.. weakness where ! is shown.
This list is perhaps too much for a freeware or low cost IDE (given Visual GDB's low price, high value).
Don't want another Eclipse-style IDE (too esoteric, too much is not intuitive).
  1. SWD debugger with trace, breakpoints, symbolic memory browse, step in, step out, etc
  2. refactor a variable, constant in same file or all project files
  3. In editor, goto declaration of function or variable
  4. In editor, goto definition of function or variable
  5. Many editors are following same (MS) conventions such as CTRL-F, CTRL-SHIFT-F for searches, etc. Polite.
  6. list all references to a function or variable, click on item and jump there
  7. Intuitive way to add/remove source files from project
  8. ! Intuitive and easy way to clone project
  9. ! Intuitive linker control file editor in the IDE
  10. Compiler/linker with __weak, align on n byte boundary, linker file with scatter load, vector table placement, scripting
  11. Automatic build # as text and a compiler directive.
  12. In this world we have: Need source code obfuscator utility for .c, c.pp, .h files. E.g., by hashing to yield alphabetic everything.
  13. Linter might be a nice-to-have, it's far down the wish list. Great for Python, Javascript. Hard for compiled languages (e.g. Komodo Edit (free) and IDE (not free).

IDE has to be intuitive.
Searching to find the reverse/forward switch on a power drill, or the right buttons on a laser level, how long would that last on a construction site?
Same idea.
 
Last edited:
I finally got my project to mostly compile and resolve all libraries in the local lib directory, but I get the following error now and I am stuck

Code:
collect2: error: ld returned 1 exit status
scons: *** [.pioenvs/teensy31/firmware.elf] Error 1

I followed a recommendation here:
https://github.com/platformio/platformio/issues/214

my mk20dx256.ld file is present, and I deleted appstate.json and ran platformio run to reinstall the teensy framework. Still get the same error.
 
Last edited:
I gave this a good few hours today but I keep hitting the most bizarre bug. On running Atom (on Debian Jessie, Mate Desktop) everything is fine. After I run a build and upload my Capslock and Ctrl swap around. If I exit Atom this keyboard aberration stays until I logout. I couldn't quite pin down exactly what was causing it, but it only happened sometime after running a build. If I uninstalled or disabled platformio and played with Atom it never happened. I also failed to repeat this on a laptop running Debian Sid with XFCE.

I'll try Emacs integration next and see if it happens with that setup.
 
Do you have any problems when build project usin PlatformIO IDE Terminal? Type `pio run` or `pio run -t upload`. I would understand where problem is hidden. Thanks.
 
Do you have any problems when build project usin PlatformIO IDE Terminal? Type `pio run` or `pio run -t upload`. I would understand where problem is hidden. Thanks.

I'm an idiot. I modded the PATH to pio in my .bash_profile not realising I had some xmodmap stuff in there from previously toying with with Emacs. Removed it and all good now. I'll continue using Atom and see how I go.

Thanks.
 
Is there a way to install a specific version of the teensy framework with platform IO? 1.29 is the current version, but platform is still on 1.28. Is there a way to revert to a previous version? Make sure my version is the latest?
 
PlatformIO 3.0 allows to manage external development platforms and their packages. See platform.json manifest for Teensy development platform.

If you use PlatformIO 2.0, you can update Teensy framework manually. Please visit `~/.platformio/packages/framework-arduinoteensy` folder.
 
ah, awesome! I will manually do it for now. PIO 3.0 looks great, but I am a bit weary of an alpha release with critical projects in the pipe!

Thanks! ikravets!
 
ah, awesome! I will manually do it for now. PIO 3.0 looks great, but I am a bit weary of an alpha release with critical projects in the pipe!

Thanks! ikravets!

PlatformIO 3.0 is very stable. Please don't see on "Alpha" label. PlatformIO and its satellite projects covered with dozens unit and integration tests. We would be thankful if you try it with your projects. PlatformIO 3.0 is planned for release next week. Here is documentation how to install the latest development version and revert back to stable.

Thanks you, that using PlatformIO!
 
ikravets -

I am running into an issue where I have a sketch that works just fine in the regular arduino environment, but does not work when compiled and uploaded in the PlatformIO environment. I manually replaced the framework-arduinoteensy folder with the one I used when successfully testing in the regular arduino.app environment.

Here is the code:
Code:
#include <Audio.h>
#include <SPI.h>
#include <Wire.h>

AudioInputAnalog              adc(A7);
AudioAnalyzeNoteFrequency     notefreq;
AudioConnection               patchCord1(adc, 0, notefreq, 0);

void setup() {
  AudioMemory(30);

  Serial.begin(9600);

  delay(1000);
  Serial.println("setup complete");
  delay(500);
  pinMode(13, OUTPUT);
  notefreq.begin(.15);
}

void loop() {
  digitalWrite(13, HIGH);
  delay(100);
  digitalWrite(13, LOW);
  delay(100);
  Serial.println(String( millis() ) + "\t");

  if (notefreq.available()) {
    float note = notefreq.read();
    float prob = notefreq.probability();
    Serial.printf("Note: %3.2f | Probability: %.2f\n", note, prob);
  }

}


You don't actually need to hook any signal up to test. When I run in the arduino environment, everything is working and the LED is blinking. When running in the platform IO environment, the device doesn't get past the notefreq.begin() stage, and does not begin to blink the LED, and then spits about a bunch of garbage into the serial port.

The teensy is running at 96mhz. Is there anything you would have me do to further test this, or should I report this bug elsewhere? This happened in the latest version of platform 2.x. I will update to platform 3.0 and see if anything changes.

Thanks!
 
Last edited:
I want to put an embedded ARM Linux board in my field devices to remotely flash the Teensy. Turns out Arduino doesn't support headless operation :rolleyes: . Can PlatformIO be a an alternative, like can I SSH into the Linux board and have PlatformIO compile and flash the connected Teensy with the sketches I developed on my main rig? Keeping in mind I do my main development in Arduino IDE and that I need customised libraries (shakes fist at Particle).
 
Status
Not open for further replies.
Back
Top