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:
https://docs.labs.mediatek.com/resource/linkit-smart-7688/en/get-started
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:
OpenWrt SDK for C/C++ for Linux
and
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.
Make Files
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:
TARGET=mraa_blink
Add any additional libraries
LDFLAGS+=-lmraa -pthread -ldl
(note: these are required for the mraa library)
Limitations
The main limitation of the make file is that it can only compile one C source file....
Read more »
Hi Bartosz (and again),
Have a look at https://www.sparkfun.com/pages/wireless_guide for the various transceiver options available (I note that Sonnet is 433/915 MHz and that seem to match what hardware is available).
This web-page (https://en.wikipedia.org/wiki/ALOHAnet#ALOHA_protocol) offers some good ideas for collision recover protocols, assuming your are implementing some form of master/save packet system.
Also have a look at AX.25 (https://tapr.org/pub_ax25.html) for a documented packet system.
It also discusses collision recovery and round-table operations.
---
Long long time ago (mid 90s) I wrote a telephone-modem text-chat program that used a QuickCam. It would take a snapshot every minute (after a beep to let you compose yourself), and while you were typing it would update the screen. One difficulty I had was getting the software to decide who was the master and who as the slave. Basically the two programs would randomly take the master or slave role until one was master and one was slave. It sometime took a while for the "fight" to decide who was the winner!
AlanX