Arduino CLI 0.23 makes your projects future-proof with Build Profiles
This latest Arduino CLI version includes more than just bug fixes and performance improvements. We're excited to bring you Build Profiles today. These have been in the works for a long time, and despite the fact that a public RFC was released just over a year ago, we kept it under wraps.
After completing a project, Arduino users may find themselves unable to develop and upload a Sketch. This might be due to libraries altering an API or cores deprecating old components in favor of a more contemporary approach.
Legacy is the enemy of progress, thus developers must occasionally pull off the band-aid and damage things. This is something we see all the time.
Build Profiles attempts to address this by allowing Arduino CLI users to create a configuration file that specifies the precise version of platforms and libraries to use, guaranteeing that the project may be produced at any point in the future.
All platforms built by Arduino are available by default, but users can add extra URLs to their setup to ensure that the appropriate platform can be located and installed at all times.
Check out the official Arduino CLI manuals on GitHub for further information. But let's look at how it works in more detail so you can start making your Arduino project future-proof.
What is the mechanism behind this?
Assume you have an Arduino IoT Cloud project that is based on the following:
- Platform: Arduino Mbed OS Nano Boards 3.1.1
- Libraries:
- ArduinoIoTCloud 1.6.0
- Arduino_ConnectionHandler 0.6.6
- WiFiNINA 1.8.13
- Arduino_DebugUtils 1.1.0
- ArduinoECCX08 1.3.6
- ArduinoMqttClient 0.1.5
Your project will compile without a hitch, but what about in five years?
Libraries are always being updated. That is the beauty of the open-source idea, which is why Arduino is so popular, and the same is true of platforms.
Any dependence might cause an API to be deprecated or introduce other types of breaking changes, causing your sketch to fail to build. You won't be able to upload it to a board at that time.
By defining a future Build Profile, we can finally fix this problem.
Let's look at how to make one and how to utilize it when the time comes.
We need to know which libraries and platforms are used during compilation to construct a Build Profile, and such dependencies may be made available to the user by compiling with 'arduino-cli' and adding '–dump-profile' to the 'compile' command, as shown below.
The core platforms and libraries used during the build will be listed in the report at the end of the operation and can be copied and saved into your Build Profile. However, in the future, you will be able to create a Profile entry directly from a 'compile' directive, eliminating the need for any additional legwork.
It's worth noting that the Build Profile can have various profile settings that can be utilised at a later time.
This is what the final product will look like.
After that, there will be a detailed summary of your system's dependencies and their routes, which we will disregard in this article.
Creating a Build Profile is a process that involves putting together a list of
Using the aforementioned information, we can create a file called'sketch.yaml' and fill it with the following text.
We can now use this file to compile our project even if none of the libraries or the Mbed core are installed by following these steps:
This program will set up the necessary platforms and libraries before converting your sketch to a functioning firmware for your board.
Multiple profiles can be added to the Project file, allowing you to build with different versions of a platform or any library.
Make sure your'sketch.yaml' file is included in the archive when you keep or share your drawing, so it may be built cleanly at any point in the future.
No, we can't change the past, but you can invest some effort in updating your older projects and generating their own'sketch.yaml' file, which will ensure that your work is future-proof.