Using Cloud IDEs for Embedded Development: CodeEnvy

This is the seconds part of our Cloud IDE Testing Blog Posts. Last time, we’ve taken a look at CodeAnywhere . It runs a complete, web-based IDE within a container and gives you access to your own build environment, which works perfectly well with PlatformIO. In our embedded project, we’ve used PlatformIO’s Remoting-Capabilities to build and flash firmware over the internet. This time we’d like to check out a similar product, Codeenvy. Let’s get going!

Codenvy (Eclipse Che)

Codenvy is a Cloud IDE solution for developers and development teams that carries the default Cloud IDE services with different advantages. You can create docker-based stacks and runtimes, integrate version control and automate workspace creation. The best part of Codenvy for us is the PlatformIO runtime is already installed. Codenvy is built on Eclipse Che. Please register on [https://codenvy.io/site/create-account]. Codeeny also allows to log in with Credentials from Google, GitHub or Visual Studio Teams. After sign up and login, the dashboard will be opened as follows: 

Image 1 Codenvy Dashboard

Now click on Workspaces tab, then "Add Workspace". Here you can give your project a name and under the „select stack“ tab, enter „platformio“ into the rightmost search field and then please select PlatformIO for runtime. Click on "Create" in the end.  Image 2: Codenvy Workspaces Creation

PlatformIO can be selected as a built-in runtime on Codenvy, which means that the toolchain is already integrated. You do not need to install it like on Codeanywhere. On the RPi side, please plug your NodeMCU (or whatever module you have) and type in the following in order to login and see the attached devices:

$ pio account login
<Your eMail and Password>
Logged in successfully.
$ pio device list
/dev/cu.thingforwardiot-Bluetoo
-------------------------------
Hardware ID: n/a
Description: n/a
/dev/cu.SLAB_USBtoUART
----------------------
Hardware ID: USB VID:PID=10C4:EA60 SER=0001 LOCATION=20-1
Description: CP2102 USB to UART Bridge Controller - CP2102 USB to UART Bridge Controller

Save the name of port name of NodeMCU on RPi: "/dev/cu.SLAB_USBtoUART". We will use this later*. After that start the remote agent -our RPi- by typing:

$ pio remote agent start

On our local computer, continue with cloning repository:

$ git clone --branch blogpost2 https://github.com/thingforward/unit-testing-with-platformio.git
$ cd unit-testing-with-platformio/
$ pio account login
$ pio run

Here is what you will see:  Image 3: Codeeny git clone

Be sure that the remote agent is alive! Type:

$ pio remote agent list
user@9fcf324234nsf7742:/projects/unit-testing-with-platformio$ pio remote agent list
PlatformIO Plus (https://pioplus.com) v0.10.14
CC-C02SG159FVH6.local
---------------------
ID: 123123lkjwef9i0293rjk290e1
Started: 2017-11-13 09:07:27

In order to perform test-upload functions without problems, please modify the platform.ini file just like in the first part of this blogpost as follows:  Image 4: Editing platformio.ini

Now let's try to upload our project remotely:

$ pio remote run -t upload -e nodemcuv2

Here is the result:  ![Image 5: Doing remote upload

The remote device monitor can be observed by typing:

$ pio remote device monitor
PlatformIO Plus (https://pioplus.com) v0.10.14
Starting Serial Monitor on CC-C02SG159FVH6.local:/dev/cu.SLAB_USBtoUART
--- Miniterm on socket://localhost:53132 9600,8,N,1 ---
--- Quit: Ctrl+C | Menu: Ctrl+T | Help: Ctrl+T followed by Ctrl+H ---
...

The last thing is to perform remote tests:

$ pio remote test -e nodemcuv2

Image 6: Remote testing

On the agent side, remote test and remote upload effects can be traced:  Image 7: Remote Agent Messages (on the pi)

That's it! Comparable to CodeAnywhere, the level of tool integration has been solved really really well. A complete toolchain can be installed within the Development Container, accessible via shell. Integration with Code Repositories is easy, and thanks to PlatformIOs Remoting functionality, we can flash, test and run firmware completely on a remote connection, in very understandable ways.

This concludes the third part of our „Cloud Development for Embedded" blogposts and we're evolving from testing into running a complete IoT Toolchain. With the upcoming blogposts, we will extend our cloud-ready toolchain into continuous integration. Stay tuned!

Eren

Andreas