I admit: my work laptop machine is running a Windows 10 OS by default. But this does not prevent me running Linux in a Virtual Machine (VM). Each host platform has its benefits, and I don’t feel biased to one or the other, but I have started using Ubuntu more and more, simply because I have worked more on Embedded Linux projects. While I have used mostly Windows with Eclipse for NXP LPC, Kinetis and i.MX platforms in the past, I started using Ubuntu too from last year with the NXP MCUXpresso SDK. I did not find much documentation about this on the web, so I thought it might be a good idea to write a tutorial about it. So here we go…
This tutorial shows how to install and develop on Linux with the NXP MCUXpresso SDK. It goes through the steps all the needed pieces and to build one of the SDK example projects.
If you want to develop the easy way with MCUXpesso SDK using a GUI: The MCUXpresso IDE (Eclipse based) runs on Ubuntu (and Windows and Mac) too. This article uses make files and no GUI for a ‘headless’ or ‘GUI-less’ environment.
I recommend using Ubuntu Linux. I’m using it in a VM (Virtual Machine) on Windows 10 with the Oracle VirtualBox. There are plenty of tutorials available on the internet about installing Ubuntu on VirtualBox if you are not familiar with it.
NXP MCUXpresso SDK
Select and configure the SDK on https://mcuxpresso.nxp.com. The important part is to select Linux as Host OS and GCC ARM Embedded as toolchain:
Then click on ‘Download SDK’ and download the archive to the user home directory and extract it there in a subdirectory:
$ cd ~ $ mkdir MCUXpresso $ cd MCUXpresso $ mkdir SDK_2.5.0_FRDM-K64F $ cd SDK_2.5.0_FRDM-K64F
Place the SDK .tar.gz file into that created folder. Unzip the downloaded SDK file:
$ gunzip SDK_2.5.0_FRDM-K64F.tar.gz
Then untar the archive:
tar -xvf SDK_2.5.0_FRDM-K64F.tar
Extraced SDK Files
By default the SDK is using CMake and not directly normal make files. As CMake is not installed by default in my Ubuntu distribution, I have to add it:
$ sudo apt install cmake
CMake is a cross-platform make file *generator*. As with the make file syntax, it takes some time to learn using. To learn more about CMake: there are plenty of resources available online, a good starting point is https://cmake.org/.
I’m using cmake 3.10.2. The SDK documentation recommends using an older version 3.0.x. Using the 3.10 version will show warnings like ‘The CMAKE_FORCE_C_COMPILER macro is deprecated. Instead just set CMAKE_C_COMPILER and allow CMake to identify the compiler.’ because the SDK cmake files are not compatible with newer cmake versions. The warnings are annoying, but do not affect the functionality so they can be ignored.
arm-none-eabi-gcc (GNU Tools for Arm Embedded Processors 8-2018-q4-major) 8.2.1 20181213 (release) [gcc-8-branch revision 267074] Copyright (C) 2018 Free Software Foundation, Inc. This is free software; see the source for copying conditions. There is NO warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
CMake needs a variable set to find the compiler. This can be done with