Author Topic: Easy Migration from Arduino IDE to Platform IO  (Read 4406 times)

0 Members and 1 Guest are viewing this topic.

Offline jcrubinTopic starter

  • Frequent Contributor
  • **
  • Posts: 354
  • Country: us
    • Technocoma
Easy Migration from Arduino IDE to Platform IO
« on: July 18, 2020, 07:24:07 pm »
As I use more than one IDE for the development of code for the ESP32, I would like to demonstrate, alternatively the benefits of platform IO, as opposed to Arduino IDE, if you are a more seasoned developer who is looking for more features.  One will find that the installation and time to get up and running is also significantly quicker by comparison.   This is by no means an attack or slight on Arduino IDE, just an alternative.  I still use Arduino IDE in many smaller projects and demos, but not for larger complex ones.

  The video goes into the specifics as to the ground up installation of platform IO and connected to the same TTGO T-display device as in the last project.

   For this specific demonstration, there will be no importation, I will be doing a cut and paste do demonstrate compatibility, showing all that is required to accomplish this task.  Most of which should be obvious.   One notable difference is the addition of Arduino.h in the include section which will be needed in platform.io.

  Another important file platformio.ini allows for a non centralized configuration per project , per device.  This is different from Arduino's global based config.  This is revisited as library configs and serial speed configs are demonstrated.  Libraries are not installed per se, but compiled in on a per project basis.  This file provides more value than this, also compile time options, which was useful for TFT_ESPI setting all display parameters within that file under build_flags.

  As we compile with no errors after our work we end up with the same output product on the device.  I do however find a strange issue which ill get into in the follow on video before I expand on Platformio.

DEMO CODE and platformio.ini example at:
https://technocoma.blogspot.com/p/blog-page_18.html


« Last Edit: July 18, 2020, 07:25:44 pm by jcrubin »
CVM CATAPVLTAE PROSCRIPTAE ERVNT TVM SOLI PROSCRIPTI CATAPVLTAS HABEBVNT

https://www.youtube.com/c/jordanrubin6502
 
The following users thanked this post: Mechatrommer, netdudeuk

Online brucehoult

  • Super Contributor
  • ***
  • Posts: 6068
  • Country: nz
Re: Easy Migration from Arduino IDE to Platform IO
« Reply #1 on: July 18, 2020, 08:54:14 pm »
Nice.

If you're having to #include <Arduino.h> yourself then presumably this means choosing the "arduino" framework in platformio doesn't include an Arduino C preprocessor in the build process.

That means that you may have to change your C code by reordering functions or adding forward declarations. The Arduino IDE scans your source code and automatically adds forward declarations for everything right after the #include <Arduino.h" that it adds.
 

Offline jcrubinTopic starter

  • Frequent Contributor
  • **
  • Posts: 354
  • Country: us
    • Technocoma
Re: Easy Migration from Arduino IDE to Platform IO
« Reply #2 on: July 25, 2020, 01:14:54 pm »
That's correct , some of my code does require per-declaration or reorder.
CVM CATAPVLTAE PROSCRIPTAE ERVNT TVM SOLI PROSCRIPTI CATAPVLTAS HABEBVNT

https://www.youtube.com/c/jordanrubin6502
 

Offline jcrubinTopic starter

  • Frequent Contributor
  • **
  • Posts: 354
  • Country: us
    • Technocoma
Re: Easy Migration from Arduino IDE to Platform IO
« Reply #3 on: July 25, 2020, 01:15:56 pm »
We continue with part two of the Arduino IDE to PlatformIO series. I'd stopped part 1 becuase in the last video I'd found something unexpected.  It would seem that there is an inconsistency between the two but only when serial output is added on the terminal.  This is manifested only when the terminal is activated, where the interrupt for GPIO 0 is disabled as it flips to the second window option.  If I attempt the reset button after this the result is also unexpected with a waiting for download indication, requiring a second press.  While clearly there is something special about GPIO 0 on the TTGO, its not expressed the same between Arduino IDE and platformIO.  This was tested by moving that control off to another GPIO and retesting.  This move solved the issue.

The Code is posted here for others to retry --
https://technocoma.blogspot.com/p/test-programme-2-of-2.html
 
  Getting past this issue, we can talk about some of the reasons I've migrated to PlatformIO, one primary reason being library development which simply doesn't exist in Arduino IDE.  Local libraries are easily added into projects as shown.  A demonstration of how PlatformIO autocompletes information , methods and parameters is immediately seen, as well as navigation to definitions, constructions , methods, functions.


  SPIFFS data upload is also simplified in Platform IO with no special add-ons nor software installations allowing for a push from a data directory from within our project.  Then requesting Upload file system image.  The verbose output of the activity shown that everything worked as expected.


  Another feature for people creating libraries is GIT integration allowing for library modification and pushing to git in a manner which allows for the library to appear in the Arduino library manager, and by extension also in platformio.


  At this point developers would be encouraged to discover the many features for themselves.


CVM CATAPVLTAE PROSCRIPTAE ERVNT TVM SOLI PROSCRIPTI CATAPVLTAS HABEBVNT

https://www.youtube.com/c/jordanrubin6502
 
The following users thanked this post: netdudeuk


Share me

Digg  Facebook  SlashDot  Delicious  Technorati  Twitter  Google  Yahoo
Smf