Intel Do-It-Yourself Challenge Arduino sketches and full SD image Nicolas Vailliet www.Intel-Software-Academic-Program.com paul.guermonprez@intel.com Intel Software 2014-02-01 We’ll need Hardware and Software - Linux 64bits (Ubuntu LTE 12.05) The cross compile tool chain for Intel Quark (cf. previous slides) Arduino IDE SW 1.5.3 A Galileo board and network connectivity Micro-SD card with a full Linux image, installed and working Warnings Please consider using Linux file system instead of Arduino sketches. Compatibility issues with AVR instruction from Arduino libs are expected. This procedure is not straightforward and difficulties to debug could appear. Executing Arduino sketches on full SD image Preparing the board Procedure, from BSP package home folder - - source /opt/clanton-full/1.4.2/environment-******-linux Go into meta-clanton-galileo/recipes-galileo/galileo-target/files Extract files from the archive galileo-target.tar.bz2 Go into galileo-target-0.1 Makefile Move binary files and folders to the board, into /opt/cln/galileo/ Move files in scripts folder to their location (see the subfolders in scripts to know where to move .sh files) You can use the script clloader.sh from the tiny image (/etc/init.d) mkdir /sketch (preparing the sketch location) ln –s /dev/stdout /dev/ttyGS0 Here is a pipe from a non-existent ttyGS0 to standard output You should handle it safer with a serial port or a socket… Arduino IDE eglibc under Linux From https://communities.intel.com/thread/48967 • • • • Delete some files from Arduino IDE. $ rm -rf hardware/tools/sysroots $ rm hardware/tools/environment-setup-i586-poky-linux-uclibc $ rm hardware/tools/site-config-i586-poky-linux-uclibc $ rm hardware/tools/version-i586-poky-linux-uclibc Create symlink for cross-tools. $ ln -s /opt/clanton-full/1.4.2/sysroots ~/dev/galileo/eglibc/arduino1.5.3/hardware/tools/sysroots $ cp -s /opt/clanton-full/1.4.2/environment-setup-i586-poky-linux /opt/clantonfull/1.4.2/site-config-i586-poky-linux /opt/clanton-full/1.4.2/version-i586-poky-linux ~/dev/galileo/eglibc/arduino-1.5.3/hardware/tools/ Replace text in *.txt and *.sh in hardware directory $ sed -i 's/i586-pokysdk/i686-pokysdk/g' hardware/arduino/x86/*.txt hardware/tools/*.sh $ sed -i 's/-uclibc//g' hardware/arduino/x86/*.txt hardware/tools/*.sh $ sed -i 's/clanton-tiny/clanton-full/g' hardware/arduino/x86/*.txt hardware/tools/*.sh Comment out last ~30 lines from “for e in executables_list” to “f.close()” in hardware/tools/relocate_sdk.py Executing your sketch - Open the IDE and compile the Blinck demo. - Move the elf file from /tmp/build***.tmp/Blick.cpp.elf to your board (destination location and name are: /sketch/sketch.elf) - sh /etc/init.d/clloader.sh Reset button should also work (with an error displayed in terminal). Could be fixed with script galileo_sketch_reset.sh in /opt/cln/galileo. Why it doesn’t work If a file exists for you but not for the board, - You’re trying to execute a file not compiled for x86 and eglibc. If you read the following message in the terminal and the program ends, “Starting /sketch/sketch.elf /dev/pts/1 /dev/ttyS0 unable to exevp - may not exist/sketch/sketch.elf /dev/pts/1 critical fault during select errno=4 clloader waiting to receive. (followed by binary data or numbers)” - To fix it, verify you are using the correct files for eglibc Sounds like the kernel doesn’t want to create pts in /dev/pts Restart your installation from scratch if you don’t find an easier solution PLEASE NOTE: THIS IS NOT A DURABLE SOLUTION Error messages are expected… IT NEEDS TO BE IMPROVED AND FIXED License Creative Commons – By 3.0 You are free: • to Share — to copy, distribute and transmit the work • to Remix — to adapt the work • to make commercial use of the work Under the following conditions: • Attribution — You must attribute the work in the manner specified by the author or licensor (but not in any way that suggests that they endorse you or your use of the work). With the understanding that: • Waiver — Any of the above conditions can be waived if you get permission from the copyright holder. • Public Domain — Where the work or any of its elements is in the public domain under applicable law, that status is in no way affected by the license. • Other Rights — In no way are any of the following rights affected by the license: – – – • Your fair dealing or fair use rights, or other applicable copyright exceptions and limitations; The author's moral rights; Rights other persons may have either in the work itself or in how the work is used, such as publicity or privacy rights. Notice — For any reuse or distribution, you must make clear to others the license terms of this work. The best way to do this is with a link to this web page. http://creativecommons.org/licenses/by/3.0/