The Arduino Due platform is shipped with a very old GCC tool-chain, to know: 4.8.3 (from 2014), and if it works, it ain’t fixed.
However C++ has introduced so many characteristics since then that you might need them or want to add them to your projects in the Arduino Due board. Remember that the core of this board is a 32 bits Cortex-M3 monster: the SAM3X8E chip.
BEWARE: C++ is very strict language, so some older programs and libraries might not compile with the newest GCC releases.
Although the procedure is very simple, I’m assuming that you’ve already coded some sketches for this board.
You need to install the regular BSP for Arduino Due. Follow this instructions and choose «Arduino SAM boards (32-bits ARM Cortex-M3).
The installer will install the BSP in this folder (as per Linux, but in Windows is similar):
(Please note that the folder arduino15/ is hidden, at least in Linux.)
If you navigate into this folder you’ll see two folders: enter into the one called tools
If you navigate inside the tools/ folder you’ll see a folder called arm-none-eabi-gcc/ that in turns includes the folder 4.8.3-2014q1/. In it there are all the things that Arduino needs to compile your apps for the Due board:
Step back and create an empty folder called 10.3-2021.10/ at the same level that 4.8.3-2014q1/ (mine shows 4 elements because I’ve already done this this procedure):
What we want is to add another (and newer) GCC tool-chain, we aren’t going to delete anything. Download the latest GCC tool-chain from its official site here. In my case I chose «gcc-arm-none-eabi-10.3-2021.10-x86_64-linux.tar.bz2». If you are in Windows, then you should download the zip package (we don’t want to install anything)
Open the compressed package with you favorite manager and enter into the folder gcc-arm-none-eabi-10.3.2021.10/. You’ll see 4 folders:
Select the 4 folders and drag and drop them into the folder you created in the last step. The folder 10.3.2021.10/ should look like:
We are almost there! But we need to tell Arduino where to find our newer and shiniest GCC tool-chain.
Locate and open the file platform.txt. It’s located at:
Then look for this line:
and comment it out (don’t delete it):
and immediately below it write this code down:
Save and close the file.
Open your Arduino IDE and compell it to use the Arduino Due board. Please follow this instructions. Compile your project. It must compile and you should see something like this in the output console:
(If you don’t see anything, although the sketch was compiled, you need to activate the verbose output. Go to File->Preferences and tick both options:
Congrats, you’ve done it! You’ve compiled your sketch with the newest GCC tool-chain. Now do crazy things!
Do you already know the KleOS project? With it you can program real time applications for the Arduino UNO boards (and soon with the Arduino Due board).
Note: The KleOS project superseeds Molcajete.
Subscribe and stay tuned for amazing content for programming Arduino as the professionals do.