-
Notifications
You must be signed in to change notification settings - Fork 4
edison
First off, some useful links:
- Breakout Board Hardware Guide
- Intel® Edison Downloads
- Latest Edison Yocto release direct link
- MRAA main page and Edison specifics (includes breakout pin table)
- OPKG reference
- Edison Developer Forums
The standard Intel® Edison we use in the ES group currently runs with the latest prebuilt Yocto release image provided by Intel®. The Yocto Project build system can be used to create an embedded Linux for the Edison with e.g. a custom kernel, preinstalled packages and configurations, device drivers, partitioning, etc.
However the image provided by Intel® is more than sufficient for most applications and is easily installed and ready-to-go.
You may also try the Ubilinux distribution for the Edison, but the rest of this guide assumes you want to use the Yocto image. (see also here) Edit: Ubilinux for Edison was discontinued, i.e. it will not be updated anymore!
It also assumes you use a linux system as your host PC.
If you are using Windows, you can follow this guide, and ignore the IDE parts if you are not interested.
Note: The Edisons distributed in the lab already have installation done. Note 2: If you don't use this method to install the image, the Edisons internal flash might not be repartitioned. This will work as well, but might lead to some problems later on.
- Assemble the Edison with the Mini Breakout Board. Refer to the Hardware Guide if necessary.
- On the Download page, download the "Yocto complete image" (currently Release 2.1) and extract it on your PC.
- In the extracted folder, run
sudo ./flashall.sh
to begin flashing the software to the edison. - When prompted, connect the Breakout Board with attached Edison via both USB cables to your PC.
- The script should recognize the board and continue the installation. Follow on-screen instructions. If it does not, try changing cables and/or switch the USB ports.
- When finished, the Edison automatically reboots, which might take some time the first time after flashing.
- Connect to the Edison via your serial USB tty by running
sudo screen /dev/ttyUSB0 115200
. You might have to pressEnter
once or twice to have something show up. - Log in with user
root
and no password. - Run
configure_edison --setup
. Here you set your password for the root user, the device name, and connect to a WiFi if available. - It is recommended to connect to a WiFi and use ssh any time you want to work on the Edison. The serial connection is sometimes not very reliable and should be used only for debugging or if no WiFi is available.
The current Yocto distribution uses the opkg software package manager, originally developed for the OpenWRT operating system but is now maintained by the Yocto project. It works very similar to other package managers:
opkg update
opkg install <pkg>
opkg remove <pkg>
opkg list | grep <search>
The current Yocto image comes preconfigured with many useful packages and a basic package repository. For a lot of other packages however additional sources must be configured. This can be done via the user package sources file
/etc/opkg/base-feeds.conf
where each line represents an additional source for opkg to look for packages.
We have started maintaining a package repository of our own, where we can add our own software binaries or prebuilt software packages that might not be available elsewhere. Add
src/gz sb_edirepo https://github.com/sboettcher/edirepo/raw/master
to your base-feeds.conf
and run opkg update
.
MRAA is a low-level library for a number of communication protocols on linux-based embedded systems. Among others, it also supports the Edison and has APIs written in C/C++, Java, Python and Node.js. Basically, mraa is your best friend when it comes to using GPIO, I²C, SPI, PWM or UART on the Edison.
It should be ready to use on the Yocto image, and can be updated with opkg install mraa
.
For the lab, the C/C++ API is especially interesting. Note the sentence "The C++ classes directly wrap the C API and provide a near 1:1 mapping of functionality." Meaning that nearly all of the C++ classes simply call the respective C functions.
For some example code, see the platypus page.
A good source for a lot of useful software is AlexT's Edison repo. Add
src/gz at_all http://repo.opkg.net/edison/repo/all
src/gz at_edison http://repo.opkg.net/edison/repo/edison
src/gz at_core2-32 http://repo.opkg.net/edison/repo/core2-32
to your base-feeds.conf
and run opkg update
.
NOTE: This may not be necessary anymore with newer Yocto versions (3.5+)! The preconfigured Intel repo was updated with a lot of these packages. Add these repos only if you need newer versions of packages, eg. boost-1.60.
The Yocto distribution uses systemd to handle services and autostart scripts. To start any kind of executable or script on boot, you need to create a service file in /lib/systemd/system
, update the daemon and enable the service. (see here for more)
A simple service file /lib/systemd/system/[name].service
could look like this:
[Unit]
Description=[name]
After=network.target
[Service]
ExecStart=[/path/to/executable]
Restart=on-failure
RestartSec=10s
[Install]
WantedBy=multi-user.target
After creating the file, run systemctl daemon-reload
once. Then, the following commands are enabled:
systemctl status [name]
systemctl start [name]
systemctl stop [name]
systemctl enable [name]
systemctl disable [name]
The bluetooth antenna is disabled by default in the Yocto image, if you need it you can enable it via rfkill unblock bluetooth
and then configure it via bluetoothctl
. In the tool, type help
to get a list of commands. A lot more and advanced info can be found in the Edison Bluetooth User Guide.
Cross compilation for C and C++ is available for all systems, follow this guide for your respective host system.
For Linux:
- Download the cross compile tools from the Edison Downloads page.
- Unzip and run the
.sh
installation script. - Source the environment variables setup, e.g.
source /opt/poky-edison/1.6.1/environment-setup-core2-32-poky-linux
. (Repeat for every terminal you want to compile in.) - Use
$CC
instead ofgcc
, and$CXX
instead ofg++
to crosscompile
Since the Yocto image does not include some common software, here are some I found useful in working on the edison:
opkg install git vim nano less bash make coreutils packagegroup-core-buildessential htop cronie diffutils
You need to have opkg configured according to section 3. Package Control.