Compilation from Source

Smoothie can be compiled using GCC.

First of all, get Smoothie's source.

You do not need to do any of this if you just want to use your board. This is only needed if you want the absolute latest firmware, or are modifying Smoothie's source.

Getting a toolchain

To compile smoothie, you need a toolchain ( a compiler, a linker, etc … ).

Smoothie provides install scripts to automagically install a great toolchain. Simply go into the Smoothie folder, then run the install script appropriate for your platform:

  • Windows: win_install.cmd
  • OS X: mac_install
  • Linux: linux_install

Windows users

Double click from the Window Explorer screen and the system will install the tools for you.

Trying to execute "win_install.cmd" from a windows command window will not work at all.

I know I tried about 10 different methods and only the windows explorer screen method worked.

This will download and install a working toolchain.

The toolchain requires a 32-bit environment to run in…
In Ubuntu Linux 64bit, you will also need to install libc6-dev-i386
You might also need to install the build-essential package.

You can then run the BuildShell script which will be created during the install to properly configure the PATH environment variable

In Linux or OSX :

./BuildShell

or you can take the appropriate directories and add them to your PATH through your existing environment configuration options/scripts.

Windows users

Double click from the Window Explorer screen "BuildShell" and this will generate a windows command screen that when you type in "make clean all" will build the complete system and leave the binary for download to the board in the "LPC1768" directory.

There are no further steps to be done to build the software.

Space, the final frontier

On some operating systems ( this has been reported with Windows and MacOS ), having a "space" character in the path to your Smoothie installation, can cause the installation of the toolchain to fail.

Please make sure you don't have any space characters in your path ( this is often caused by usernames having spaces in them ). This could also be caused by special characters.

Compiling

Once BuildShell is created, you want to launch it, and compile all of the code that Smoothie consists of: 

make clean all

Ref: "make clean all" will compile|recompile everything needed for Smoothie. The end result will be the file main.bin in the subfolder LPC1768.

32bit compilation error

If you are running a 64bit GNU/Linux system, you might get an error like this :

Compiling vendor/NXP/capi/analogin_api.c
make[3]: arm-none-eabi-gcc : command not found

This is because the toolchain is 32bit but your system is 64bit.
To solve this you need to install the 32bit libraries on your system.

You should do :

sudo dpkg --add-architecture i386
sudo apt-get update 
sudo apt-get install ia32-libs

If that does not work, do :

dpkg --add-architecture i386 
apt-get update
apt-get install libc6:i386

or

dpkg --add-architecture i386 
apt-get update
sudo apt-get install lib32z1 lib32ncurses5

After this, the make command should work.

Mbed online compiler

It is possible to compile Smoothie without having to install a compiler using the mBed online compiler, but please note that this only supports a very old version of Smoothie : Smoothie on Mbed

This is not at all a recommended method

Windows error

On Windows, if you get an error like process_begin: CreateProcess(NULL, echo Building src, …) failed., this means that there is a sh.exe somewhere on your path (such as the one installed by the Windows GitHub client, or WINAVR) - this confuses GNU Make 3.81 into thinking you're on a Unix-like system. Also make sure WinAVR is removed from your PATH. Any failures to build a clean source branch will be due to an environment problem in your windows shell and is NOT a bug.

One solution is to replace build\win32\make.exe with a copy of version 3.82 - downloaded from here, perhaps.

More information on the process of getting mBed code to compile with GCC can be found here ( recommended read ).

Flashing to the board

If you are using a mBed please see here.

If you are using a smoothieboard, the SD bootloader is already present.

If you are using a LPCXpresso1769 then you must first install the SD bootloader.

Once it is compiled, then simply copy the generated .bin file to the SD card with the name firmware.bin, then reset and it will be flashed to the board automatically.

Example :

make
cp LPC1768/main.bin /media/smoothieboard-or-mbed/firmware.bin

Detailled instructions can be found on the Flashing Smoothie page.

Linux and OS/X users

An alternative way to flash main.bin is to use a utility called dfu-util
make upload will use this to flash the new firmware, so long as smoothie is currently running.
If smoothie has crashed, then you can still use make upload by:-

  1. holding the play/pause button
  2. click the reset button
  3. wait one second and release the play/pause button

This puts the boot loader into dfu mode and make upload will now work.

NOTE dfu is not enabled by default, you must add the following to your config file…

dfu_enable                                   true             # enable dfu