“PlatformIO is a cross-platform code builder and the missing library manager”
Working on an embedded firmware for SmartAnthill Project I’ve been dealing with building code for different embedded platforms. Nowadays, each platform proposes standalone toolchain, driver-lib and even own IDE:
With each new embedded platform I had to adapt to its own IDE, code highlighter, code autocompletion, debugger and many more. Then I’ve decided to write code in my favourite editor (Vim) and build it only with these IDEs. But a structure of my project looked ugly because each IDE had created own project’s META files and folders. Therefore, I had different project locations for each IDE and “symlinked” source code folder to one location. But this wasn’t for long…
Then I decided to compile different standalone embedded toolchains and write Makefiles for each platform. Yes, this was a good solution, but only for one OS. And I’ve realised that this isn’t a good decision, because it was not the main idea of SmartAnthill. The goal was to allow user to customise own specific firmware for embedded device. And he should have ability to build firmware under different operation systems. Sure, I could have created a few different “toolchain-install” scripts for each OS, write documentation about using these Makefiles and building tools. But here was the one “BUT”… SmartAnthill isn’t aimed only to embedded developers but quite the contrary to people who are not familiar with embedded programming, toolchains or “C”. It is for people who want to connect a few embedded devices to one micro-oriented network and communicate with them over high level API (or high level languages).
Yes, yes, I opened for myself new world named as Python World! SmartAnthill is my first Python-based project. Inspired by it I typed to Google these 3 magic words: “python build tool“. And what did I see? I saw: “SCons: A software construction tool“:
- Configuration files are Python scripts – use the power of a real programming language to solve build problems.
- Reliable, automatic dependency analysis built-in for C, C++ and Fortran–no more “make depend” or “make clean” to get all of the dependencies.
- Dependency analysis is easily extensible through user-defined dependency Scanners for other languages or file types.
- and many more.
And then I realised how much I love this world, The Python World!
Full of inspiration and emotions, I’ve written a few construction scripts for popular embedded platforms, covered with beautiful command line interfaces I released first Alpha version on my favourite day – Friday, 13.
Now, I can build SmartAnthill Firmware Source Code for my favourite embedded platform and upload it to my boards with only one magic command on all OS – $ platformio run