Setting up the LinkIt Smart MT7688 for C Code
It took me nearly two weeks to to set it up. Hopefully you will not make the same mistakes that I made.
Before you Start
Although it may be possible to compile your projects on the board itself using the SD card, this is not the way it is done. You have to cross-compile on a 64 bit linux distribution.
So if your using Windows, find an old laptop and install a 64 bit distribution such as Mint.
You can set your LinkIt board up with Windows and use Python or Node.js but not for C/C++.
32 bit Linux Distributions
I wasted a week trying to get the C/C++ Compiler to work until I realised that it does not work on 32 bit linux distributions. You have been warned!
Get Started with the LinkIt Smart 7688 Development Board
Follow this tutorial:
If you are using Windows, check that you have "Bonjour print services" installed, if not install it (you have been warned!).
The object of the tutorial is to update firmware (optional - I did not), set a password and set the LinkIt to "Station Mode".
In Station Mode, LinkIt uses your WiFi router to access the Internet and you can talk to your LinkIt via a "scp" (i.e. secure copy) and ssh (i.e. secure shell), and you get your Internet back!
Installing the Cross-Compiler
There are two candidate downloads:
The SDK compiles "ipk" packages for the "opkg" installer:
You may need to install the following dependencies for the SDK:
$ sudo apt-get update
$ sudo apt-get install build-essential subversion libncurses5-dev zlib1g-dev gawk
$ sudo apt-get install gcc-multilib flex git-core gettext libssl-dev ccache
The SDK is a bit "upmarket" for Arduino style use (that is you just want to compile, upload and run a program rather than install a package). However, the SDK does create the executable file if you know where to look. But you need to deal with Makefile(s) and set package dependencies. You may need the package anyway as it has many pre-compiled libraries that you may need.
I used the Toolchain and copied the MRAA library and includes (used to access the GPIOs) from the SDK.
The third option is to download my LinkIt-cc archive (from my files area) and unpack it into your home directory.
I am not an expert with make files (and this is my first try). The make file has been set up so I do not have to set the path environment variable (usually in .profile):
# Build target executable when user executes "make" TARGET=mraa_blink export STAGING_DIR=$(HOME)/LinkIt-cc CC=$(HOME)/LinkIt-cc/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/bin/mipsel-openwrt-linux-uclibc-gcc CFLAGS =-I. CFLAGS+=-I$(HOME)/LinkIt-cc/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/include CFLAGS+=-I$(HOME)/LinkIt-cc/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/include LDFLAGS =-L. LDFLAGS+=-L$(HOME)/LinkIt-cc/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/usr/lib LDFLAGS+=-L$(HOME)/LinkIt-cc/toolchain-mipsel_24kec+dsp_gcc-4.8-linaro_uClibc-0.9.33.2/lib LDFLAGS+=-lmraa -pthread -ldl $(TARGET): $(TARGET).c $(CC) $(CFLAGS) -o $(TARGET).run $(TARGET).c $(LDFLAGS) # remove object files and executable when user executes "make clean" clean: rm $(TARGET).run
Note: the name of the make file has to be "Makefile".
How to use the make file
Set the target name:
Add any additional libraries
LDFLAGS+=-lmraa -pthread -ldl
(note: these are required for the mraa library)
The main limitation of the make file is that it can only compile one C source file....Read more »