ARM toolchain for Windows (distortos v0.1.0 – v0.6.0)

Note: This article applies only to distortos v0.1.0 – v0.6.0.

This guide is based on current version of WindowsWindows 10 – but apart from some visual aspects, the steps required to prepare the toolchain should be identical for all recent versions of this system.

Please note that the steps presented in this guide are not the one and only correct approach. They just happen to be simple and working, requiring minimum number of easily reproducible steps. If you are an advanced user and if you know what you are doing, then treat this article as a mere guidance and description of requirements, not as a collection of rules carved in stone.

Check bitness of your system

This step is required to determine whether you have 32-bit or 64-bit Windows and thus whether we should install 32-bit or 64-bit tools. It’s best to use tools with the same bitness as the operating system – this will give you the best performance and compatibility. However, if you have any doubts about your system, then you can always use 32-bit tools – they will work on both 32-bit and 64-bit system.

Please note that the important thing here is whether you use 32-bit or 64-bit system, not 32-bit or 64-bit machine – for a long time all manufactured CPUs are 64-bit anyway.

Open Start menu, type control panel and open the application that was found with that exact name. Now click System and Security and then System. You can see bitness of your system next to System type label.

MSYS2 and make

Download current installer of MSYS2 – make sure to select right version for your system: either 32-bit msys2-i686-... or 64-bit msys2-x86_64-.... After the download completes, run the installer and follow the on-screen instructions. It’s best to leave default values for all settings – I strongly suggest to leave the default installation folder, but if you really need to change it, please try to keep it short and avoid spaces or any special characters (like parentheses) in the complete path.

Once the installation is over, you should have MSYS2 shell already opened (thanks to the checkbox in the last installation step), but if it isn’t, open Start menu, type MSYS2 and click “MSYS2 MSYS”. Perform the first phase of MSYS2 update by typing pacman -Syu and pressing Enter. If there are any conflicts requiring removal of already installed package (:: xxx and yyy are in conflict. Remove yyy? [y/N]), confirm each one with y + Enter. After a short while confirm the installation of downloaded packages by pressing y followed by another Enter. Usually after this phase you’ll have to manually force-close the window, which may take a moment – the terminal will behave as if it hanged.

Open MSYS2 shell again from Start menu, type pacman -Su and press Enter to follow up with the second phase of the update. Just as previously – confirm the installation when asked.

The last step is to install make – type pacman -S make, press Enter, confirm the installation, wait a moment until it is done and – finally – close the window.

bleeding-edge-toolchain

Download most recent package with bleeding-edge-toolchain. As previously, select version which will be appropriate for your system. Extract it somewhere using 7-Zip – I would again recommend a path which is short and simple (no spaces, no unusual characters, …), for example directly on your C:/ partition. Navigate to downloaded file with File Explorer, right click it and select 7-Zip > Extract files…. In the window that will appear enter the destination path in Extract to field, make sure the checkbox below is not selected, click OK and wait until extraction process is complete.

kconfig-frontends

You can download Windows binaries with kconfig-frontends from this website > Downloads > Toolskconfig-frontends for Windows. Just as with bleeding-edge-toolchain, extract it anywhere you like, for example into the main folder of your C:/ partition – to keep the path short and simple.

Add tools to PATH environment variable

In order to use installed tools from command prompt or IDE, you have to add the folders with executables to PATH environment variable of your system. Open System information page (the same that was used to check bitness of your system in first chapter) and click Advanced system settings on the left. Then click Environment Variables… button at the bottom of System Properties window that will appear. It doesn’t matter much whether you modify your user’s PATH environment variable (top frame) or the system-wide PATH environment variable (bottom frame). To keep things simple, let’s stick to user’s environment variables. Select “Path” (or “PATH”) variable from the list and click Edit… button.

Editing PATH in more recent versions of Windows

New versions of Windows present the user with an advanced Edit environment variable window with multi-line editbox and nine buttons.

Click New and then Browse… to easily navigate to folder in question. Under This PC group locate the folder with MSYS2 executables, which is MSYS2’s installation folder followed by \usr\bin – if you used default values during installation, this would be C:\msys32\usr\bin or C:\msys64\usr\bin for 32-bit or 64-bit version respectively.

Repeat the process from previous paragraph for remaining two paths which are required:

  • the path to prefixed executables of bleeding-edge-toolchain from its /bin subfolder – something like C:\arm-none-eabi-gcc-...-...\bin (e.g. C:\arm-none-eabi-gcc-7.3.0-180127\bin) if you extracted the archive directly on C:\,
  • path to the folder with kconfig-frontends binaries – assuming that you extracted them in main folder of C:\, this would be similar to C:\kconfig-frontends-...-windows. (e.g. C:\kconfig-frontends-3.12.0-windows).

After that you should have three new entries for the edited environment variable.

Click OK and close all windows opened so far.

Editing PATH in older versions of Windows

Older versions of Windows present the user with a very simple window titled Edit User Variable or Edit System Variable – it contains just two textboxes (Variable name and Variable value) and four buttons.

Place the cursor at the end of contents of Variable value field and make sure that there’s one semicolon (;) at the end. Now type the path to MSYS2 executables, which is MSYS2’s installation folder followed by \usr\bin – if you used default values during installation, this would be C:\msys32\usr\bin or C:\msys64\usr\bin for 32-bit or 64-bit version respectively.

Add another semicolon and enter the path to prefixed executables of bleeding-edge-toolchain from its /bin subfolder – something like C:\arm-none-eabi-gcc-...-...\bin (e.g. C:\arm-none-eabi-gcc-7.3.0-180127\bin) if you extracted the archive directly on C:\.

After third semicolon you should add the path to the folder with kconfig-frontends binaries. Assuming that you extracted them in main folder of C:\, this would be similar to C:\kconfig-frontends-...-windows (e.g. C:\kconfig-frontends-3.12.0-windows).

Click OK and close all windows opened so far.

OpenOCD

If you don’t plan to debug your application on real hardware, you may skip this section. Otherwise download the most recent package with Windows binaries of OpenOCD and extract it somewhere, like – and now for something completely different – directly in C:/. Who would expect that…?

Java SE Runtime Environment

In order to use Eclipse IDE, you also need Java SE Runtime Environment. Download most recent offline installer for your version of WindowsWindows x86 Offline (jre-...-windows-i586.exe) for 32-bit system or Windows x64 Offline (jre-...-windows-x64.exe) for 64-bit system. Remember to select the radio button next to Accept License Agreement. After the download is complete, run the installer and follow on-screen instructions.

Eclipse

Visit Eclipse’s website and click Download button at the top of the page. In the Tool Platforms row on the next page click Download Packages link. To download zip archive with most recent version, click on 32 bit or 64 bit link in the Eclipse IDE for C/C++ Developers row and then click Download button on the next page.

Once the download is finished, extract the package somewhere – as usually, try not to get too creative with the path. You can run the software by executing eclipse.exe file from the extracted folder.