[PYTHON] Startup Intel Edison

This time I did it on a Mac. This is just a ** memo **, so don't expect a lot of information. ..

Work to do on Mac

Firmware update

Anyway, if you don't do this, it won't start. Reference: Flashing Edison (wired) --Mac

Install tools with Homebrew on your mother ship (Mac)

If you have installed it, go to the next section. ruby -e "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/master/install)"

Install the tools you use to bake your farm on your Mac

brew install dfu-util coreutils gnu-getopt

Burn the image of Edison

First download From Edison --Software Downloads, "[Edison Yocto complete image](http://downloadmirror.intel.com/24271] Download /eng/edison-image-ww36-14.zip "Linux image") "and unzip it.

Move to the unzipped directory

Start burning script ./flashall.sh Immediately after starting the script, it says "Please plug and reboot the board", so unplug and reconnect the USB. There is no need to operate the terminal because the re-insertion is automatically recognized. It takes about 5 minutes to bake, so wait slowly so as not to turn off the power.

Work to do serial connection

Serial connection with screen

screen /dev/cu.usbserial-A903BYAS 115200 -L The "-A903BYAS" part changes depending on the environment.

Login

Once connected, press Return twice and the login prompt will appear. login> root And log in as the root user. No password required.

Stop sketching

If the Arduino sketching process is running, the input is motivated and difficult to operate, so stop it with the following command. /opt/edison/sketch_reset.sh

Version confirmation

cat /etc/version If the displayed version is build_68 or later, such as "edison-weekly_build_68_2014-09-08_13-49-07", it is OK.

hostname, password and Wifi settings

configure_edison --setup If you enter, the setting will start, Wifi will be connected as soon as you set it. When the settings are complete, you will be told "Done. Please connect your laptop or PC to the same network as this device and go to http://192.168.0.9 or http://edison.local in your browser." Since you will be able to connect with SSH, work with SSH from here on.

If you only want to set up Wifi configure_edison --wifi Is fine.

Work to connect with SSH

Login

From another terminal ssh [email protected] "Edison.local" is the address confirmed from the serial in the previous section. You will be asked for a password, so enter the one you just set.

Change time zone

rm /etc/localtime After erasing the existing settings with

ln -s /usr/share/zoneinfo/Asia/Tokyo /etc/localtime To match Tokyo / Japan.

Package manager settings

The package manager for Yocto Linux seems to be called opkg.

Registration of Edison's standard repository

vi /etc/opkg/base-feeds.conf Start vi with

src/gz all http://repo.opkg.net/edison/repo/all src/gz edison http://repo.opkg.net/edison/repo/edison src/gz core2-32 http://repo.opkg.net/edison/repo/core2-32

Fill in the 3 lines of.

Registration of Intel repository

vi /etc/opkg/intel-iotdk.conf Start vi with

src intel-iotdk http://iotdk.intel.com/repos/1.1/intelgalactic src intel-all http://iotdk.intel.com/repos/1.1/iotdk/all src intel-i586 http://iotdk.intel.com/repos/1.1/iotdk/i586 src intel-x86 http://iotdk.intel.com/repos/1.1/iotdk/x86

Fill in the 4 lines of.

Package list update

opkg update

Upgrade installed packages

opkg upgrade

Create a location for your own built library

Create a directory under ~ / .local

Since the capacity under __ / __ of Edison is not allocated so much, install the tools and libraries under __ / home / __ where 2.2GB and more than half the capacity of eMMC are allocated.

vi ~/.profile Start vi with

export PATH=~/.local/bin:$PATH

Enter. Now, the applications placed in this directory will be searched preferentially.

After inputting source ~/.profile Then, enable the setting. (Or re-login) If you enter export in the command, you can see that the PATH is set.

Introduction of calculation library

Install gfortran (GCC)

** Oh, this is no good. Edison's memory capacity is too small and it stops halfway. .. Build a cross-build environment. ** **

Install the packages required for build with opkg. opkg install libgmp-dev libmpfr-dev libmpc-dev

Source download wget http://ftp.tsukuba.wide.ad.jp/software/gcc/releases/gcc-4.9.1/gcc-4.9.1.tar.bz2

Defrost tar jxvf ./gcc-4.9.1.tar.bz2

Creating a build directory mkdir ./gcc-4.9.1/build

Move cd ./gcc-4.9.1/build

Config ../configure --prefix=/home/root/.local --enable-languages=c,c++,fortran --with-fpmath=sse

Build make

Installation make install

Installation of ATLAS and Lapack

Introducing Automatically Tuned Linear Algebra Software (ATLAS). An implementation that automatically tunes each CPU architecture of BLAS, which is a linear algebra high-speed arithmetic library. BLAS is often required for libraries specializing in calculations (such as SciPy), so I will include them here.

Get the source of ATLAS wget http://downloads.sourceforge.net/project/math-atlas/Stable/3.10.2/atlas3.10.2.tar.bz2

Defrost tar jxvf ./atlas3.10.2.tar.bz2

Get Lapack source wget http://www.netlib.org/lapack/lapack-3.5.0.tgz

Creating a build directory mkdir ./ATLAS/build

Move cd ./ATLAS/build

Config ** ATLAS automatically tunes the CPU optimally, so it's best to stop sketching as well as nodes and do the rest of the work with as little load on the CPU as possible. ** **

../configure --prefix=/home/root/.local --with-netlib-lapack-tarfile=/home/root/lapack-3.5.0.tgz --nof77 -v 2

Build make build If you try to build in parallel here and enter "-j2", an error will occur. It takes a transcendental time (12 hours or more!) To try various optimization patterns. nohup make build > ./make.log & Then, the build will continue even after logging out, and the log will be written to make.log, so it is better to quickly disconnect the communication with the mother ship and leave it all day with only the power supply.

Installation make install I get an error saying that libf77blas.a does not exist, but it seems that libatlas.a, libcblas.a, liblapack.a, libptcblas.a have been installed. By the way, make check cannot be done because libf77blas.a does not exist.

Confirmation of installation

dgesv_example.c


#include <cblas.h>
#include <clapack.h>
#include <math.h>

#define NDIM 4 

int main (){
        int i, j;
        int N=NDIM, NRHS=1, LDA=NDIM, LDB=NDIM;

        double *A = (double *)malloc(NDIM*NDIM*sizeof(double));
        double *B = (double *)malloc(NDIM*sizeof(double));
        int *IPIV = (int *)malloc(NDIM*sizeof(int));

        A[0] = 1.80; A[4] = 2.88; A[8]  = 2.05; A[12] =-0.89;
        A[1] = 5.25; A[5] =-2.95; A[9]  =-0.95; A[13] =-3.80;
        A[2] = 1.58; A[6] =-2.69; A[10] =-2.90; A[14] =-1.04;
        A[3] =-1.11; A[7] =-0.66; A[11] =-0.59; A[15] = 0.80;
    
        B[0] = 9.52; 
        B[1] = 24.35; 
        B[2] = 0.77;
        B[3] = -6.22;

        clapack_dgesv(CblasColMajor, N, NRHS, A, LDA, IPIV, B, LDB);

        for (i=0;i<N;i++)
                printf("%f\n", B[i]);

        free(A);
        free(B);
        free(IPIV);
}

gcc ./dgesv_example.c -I/home/root/.local/include -L/home/root/.local/lib -llapack -lcblas -latlas

1.000000 -1.000000 3.000000 -5.000000

Is output, OK.

Setting up a Python environment

Make it possible to put various things with pip.

Specify the installation destination under / home

vi ~/.profile Start vi with

export PATH=~/.local/bin:$PATH export PYTHONPATH=~/.local/lib/python2.7/

Enter.

After inputting source ~/.profile Then, enable the setting. (Or re-login)

further. vi ~/.pydistutils.cfg Start vi with

[install] user=1

Enter.

Installation of setuptools

wget https://bootstrap.pypa.io/ez_setup.py --no-check-certificate -O - | python

pip installation

easy_install pip

Install NumPy Pandas

Note that it also takes 3 to 4 hours here. pip install numpy pandas

Other

Make it an access point, make it Beacon / iBeacon, or install Node-Red It seems that you can also install Java. https://communities.intel.com/docs/DOC-23391

Recommended Posts

Startup Intel Edison
Geolocation on Intel Edison
Push notification to Intel Edison
Debian Intel Edison and put scikit-learn
Infrared remote control reception with Intel Edison
Django startup
Control LED bulbs from a microcomputer (Intel Edison) (1)
Control LED bulbs from a microcomputer (Intel Edison) (2)
Set the startup script on Linux (RasPi, Edison)