Transcription

Intel Quark SoC X1000Board Support Package (BSP) Build GuideRelease: 0.7.515 October 2013Order Number: 329687-001US

ContentsContents1Before you begin .32Downloading software .43Building the GRUB OS loader .44Creating a file system and building the kernel using Yocto .55Signing files (optional) .76Building the cross compiler toolchain .76.16.26.3Linux* cross compiler .7Windows* cross compiler.8MAC OS* cross compiler .97Creating a flash image for the board .98Defining the platform data file . 109Programming flash on the board using serial interface . 1110Programming flash on the board using DediProg . 1511Booting the board from SD card . 1612Enabling the OpenOCD debugger . 17Intel Quark SoC X1000BSP Build Guide2Order Number: 329687-001US

Before you begin1Before you beginThis guide contains instructions for installing and configuring the Intel Quark SoCX1000 Board Support Package Sources.This software release supports the following hardware and software: Intel Galileo Customer Reference Board (CRB) (Fab D with blue PCB) Board Support Package Sources for Intel Quark SoC X1000 v0.7.5Before you begin: You need a host PC running Linux*. You need an internet connection to download third party sources. The build process may require as much as 30 GB of free disk space. To program the board you can use: serial interface using capsule.efi (see Section 9) DediProg* SF100 SPI Flash Programmer (or equivalent) and the associatedflashing software (see Section 10) Intel Galileo IDE (see the Intel Galileo Board Getting Started Guide)Note: Remove all previous versions of the software before installing the current version.Individual components require very different environments (compiler options andothers). To avoid cross-pollution, the commands in each section below must berun in a new terminal session every time.Note: If these commands fail, it may be due to your proxy settings. You may find answershere: https://wiki.yoctoproject.org/wiki/Working Behind a Network ProxyThis release has been tested with Debian* Linux* 7.0 (Wheezy) but will work withother Linux distributions.Order Number: 329687-001USIntel Quark SoC X1000BSP Build Guide3

Downloading software2Downloading softwareGo here to download the akers/software/driversThis release contains multiple zip files, including: Board Support Package (BSP) sources: Board Support Package Sources for Intel Quark v0.7.5.7z (3.2 MB) (Optional) Files for updating SPI flash using serial interface (Section 9).LITTLE LINUX IMAGE FirmwareUpdate Intel Galileo v0.7.5.7z (5.5 MB) CapsuleApp.efi sysimage Intel Galileo v0.7.5.capYou will create a binary capsule file as part of the build process in this guide.Debian provides a meta package called build-essential that installs a number ofcompiler tools and libraries. Install the meta package and the other packages listed inthe command below before continuing:# sudo apt-get install build-essential gcc-multilib vim-common3Building the GRUB OS loaderNote: GRUB is provided in two places: inside the meta-clanton Yocto BSP or independently.If you will run Yocto, skip this section and use the file output by Yocto in thisdirectory: yocto build/tmp/deploy/images/grub.efiIf you are only interested in building a 4M Flash image and not in using Yocto, thenproceed through this section.Dependencies: GCC (tested with version 4.6.3 and libc6-dev-i386) gnu-efi library (tested with version 3.0) GNU Make Autotools (autoconf and libtool) Python 2.6 git xxdIntel Quark SoC X1000BSP Build Guide4Order Number: 329687-001US

Creating a file system and building the kernel using YoctoThis GRUB build requires the 32 bit gnu-efi library which is included with many Linuxdistributions. Alternatively, you can download the latest version Unpack and compile the gnu-efi library using the commands:# tar -xvf gnu-efi*# cd gnu-efi*/gnuefi# make ARCH "ia32"# cd To build GRUB, first open a new terminal session, extract the grub package, and runthe gitsetup.py script. The script downloads all the upstream code required for gruband applies the Clanton patch.Run the following commands:# tar -xvf grub-legacy *.tar.gz# cd grub-legacy *# ./gitsetup.py# cd work# autoreconf --install# export CC4GRUB 'gcc -m32 -march i586 -fno-stack-protector'# [ GNUEFI LIBDIR /full/path/to/gnu-efi-3.0/gnuefi/ ] CC " {CC4GRUB}"./configure-clanton.sh# make# cd For the configure step, if you are not using Debian and had to manually installgnu-efi in a non-system location, then you need to point GNUEFI LIBDIR at thelocation where gnu-efi was compiled or installed.Note: If these commands fail, it may be due to your proxy settings. You may find answersabout proxy settings here:https://wiki.yoctoproject.org/wiki/Working Behind a Network ProxyThe required output from this build process is the efi/grub.efi file.4Creating a file system andbuilding the kernel using YoctoDependencies: git diffstat texinfo gawk chrpath fileOrder Number: 329687-001USIntel Quark SoC X1000BSP Build Guide5

Creating a file system and building the kernel using YoctoNote: git requires proxy configuration. If these commands fail, it may be due to your proxysettings. You may find answers about proxy settings here:https://wiki.yoctoproject.org/wiki/Working Behind a Network ProxyUse Yocto to create a root file system and kernel that boots the system from an SDcard or USB key. Do not run any of the commands in this section as root.Note: See Section 6 to create a Linux image with development tools such as gcc.First, open a new terminal session, extract the yocto layer, and run the setup.shscript to download the external sources required for the yocto build:# tar -xvf meta-clanton*.tar.gz# cd meta-clanton*# ./setup.shNext, source the oe-init-build-env command to initialize the yocto buildenvironment, and run bitbake target to build the root file system and kernel. Youwill use Galileo-specific target commands described below.Two build methods are supported; the output is slightly different for each one.1.If you want to build a very small Linux to fit into SPI flash, then runbitbake image-spi as shown below:# source poky/oe-init-build-env yocto build# bitbake image-spiThe output of the build process is found in ./tmp/deploy/images/ and includesthe following files: image-spi-clanton.cpio.gz image-spi-clanton.cpio.lzma bzImage grub.efi2.If you want to build a more fully-featured Linux to run out of the SD card, thenrun bitbake image-full as shown below:# source poky/oe-init-build-env yocto build# bitbake image-fullThe output of the build process is found in ./tmp/deploy/images/ and includesthe following files: image-full-clanton.ext3 core-image-minimal-initramfs-clanton.cpio.gz bzImage grub.efi boot (directory)The kernel and root file system (bzImage and image-nnnn.gz, respectively) can becopied onto a USB stick or SD card and booted from grub.Intel Quark SoC X1000BSP Build Guide6Order Number: 329687-001US

Signing files (optional)5Signing files (optional)This step is only needed for secure boot, otherwise it can be skipped.Kernel and root file system (bzImage and image-full-clanton.cpio.gz) requiresignature files for verification.Open a new terminal session and use the following commands:# cd sysimage 4M*/sysimage.CP-4M-release# export LINUX PATH ././meta-clanton*/yocto build/tmp/deploy/images# ././spi-flash-tools*/Makefile SRCS SIGN LINUX PATH/bzImage \ LINUX PATH/bzImage.SVNINDEX 6 LINUX PATH/bzImage.signed# ././spi-flash-tools*/Makefile \SRCS SIGN LINUX PATH/image-full-clanton.cpio.gz \ LINUX PATH/image-full-clanton.cpio.gz.SVNINDEX 7 \ LINUX PATH/image-full-clanton.cpio.gz.signed# cd LINUX PATHSignature files for kernel and root file system (bzImage.csbh and image-fullclanton.cpio.gz.csbh, respectively) can be copied onto a USB stick or SD card.6Building the cross compilertoolchainThis section describes how to build an image that includes development tools for thefollowing operating systems:6.1 Linux* cross compiler Windows* cross compiler MAC OS* cross compilerLinux* cross compilerThe steps to build the cross compiler toolchain are the same as the steps for the Yoctoroot file system and kernel build as described in Section 4, with the exception of thebitbake command.To build the tool chain, open a new terminal session and follow the steps in Section 4but modify the bitbake command as follows:# bitbake image-full -c populate sdkThe same files can be used for both builds, however, you must source thepoky oe-init-build-env yocto build every time you use a new terminal.Order Number: 329687-001USIntel Quark SoC X1000BSP Build Guide7

Building the cross compiler toolchainThe output of the build process is a script that installs the toolchain on anothersystem:clanton-full-eglibc-x86 64-i586-toolchain-1.4.1.shThe script is located in ./tmp/deploy/sdkWhen you are ready to compile your application, first run the source command belowto define default values for CC, CONFIGURE FLAGS, and other environment variables,then you can compile:# source /opt/poky/1.4.2/environment-setup-x86 32-poky-linux# {CC} myfile.c -o myfileor# source /opt/poky/1.4.2/environment-setup-x86 64-poky-linux# {CC} myfile.c -o myfileFor more details, see the Yocto Application Development Toolkit (ADT) Note: The script above may change your environment significantly, thus breaking other,non-Yocto tools you might be using (including anything which uses Python). Tomitigate, Intel recommends that you open one terminal session to source the Yoctoenvironment and run make, and run all your other commands in other terminalsessions.Quark Linux uses uclibc, which is a C library optimized for embedded systems. Thisenables a very small Linux that can fit into SPI flash with the UEFI bootloader andGrub OS loader.If you do not have any size constraints, you can change the C library to a more fullyfeatured C library. Detailed instructions are -manual/mega-manual.htmlspecifically how to change the TCLIBC variable selecting the C library to be used.6.2Windows* cross compiler1.Follow all steps from Section 4.2.Enter the commands below:cd .git clone git://git.yoctoproject.org/meta-mingwcd yocto build3.Edit conf/bblayers.conf and add the full path to cloned meta-mingw layer.4.Make sure the conf/local.conf file contains: SDKMACHINE “i686-mingw32”5.Enter the command: bitbake meta-toolchain6.Toolchain will be created under tmp/deploy/sdkIntel Quark SoC X1000BSP Build Guide8Order Number: 329687-001US

Creating a flash image for the board6.37MAC OS* cross compiler1.Follow all steps from Section 4.2.Enter the commands below:cd .git clone git://git.yoctoproject.org/meta-darwincd yocto build3.Edit conf/bblayers.conf and add the full path to cloned meta-darwin layer.4.Make sure the conf/local.conf file contains: SDKMACHINE “i386-darwin”5.Enter the command: bitbake meta-toolchain6.Toolchain will be created under tmp/deploy/sdkCreating a flash image for theboardDependencies: GCC GNU Make EDKII Firmware Volume Tools (base tools) OpenSSL 0.9.81 or newer libssl-devThe SPI Flash Tools, along with the metadata in the sysimage archive, are used tocreate a Flash.bin file that can be installed on the board and booted.Open a new terminal session and extract the contents of the sysimage archive:# tar -xvf sysimage 4M*.tar.gzExtract and install SPI Flash Tools:# tar -xvf spi-flash-tools*.tar.gzThe directory contains a preconfigured layout.conf file. This file defines how thevarious components will be inserted into the final Flash.bin file to be flashed onto theboard. The layout.conf consists of a number of [sections] with associated addressoffsets, file names, and parameters. Each section must reference a valid file, so it isnecessary to update the paths or create symlinks to the valid files.An example for the GRUB component is:# ln -s grub-legacy */work/ grub-legacyEnsure there is no whitespace around the values defined in the layout.conf file.Once a valid layout.conf has been created, run the SPI Flash Tools makefile tocreate one of the following files.Order Number: 329687-001USIntel Quark SoC X1000BSP Build Guide9

Defining the platform data fileTo build a capsule file (recommended), run the commands:# ln -s ././clanton peak EDK2 * ././clanton peak EDK2# ././spi-flash-tools*/Makefile capsuleThe output of this build is a *.cap file and other required files. Proceed withProgramming the Flash instructions in either Section 9 or Section 10.To build a Flash.bin file:# ln -s ././clanton peak EDK2 * ././clanton peak EDK2# ././spi-flash-tools*/MakefileThe output of this build is a Flash.bin file. Continue with Section 8.8Defining the platform data fileNote: If you created a *.cap file in the previous section, a platform data file is not requiredand you can skip this section.Platform data is part-specific, unique data placed in SPI flash. Every Flash.bin imageflashed to the board must be patched individually to use platform data. A datapatching script is provided in this release.The platform data patching script is stored in the SPI Flash Tools archive. Beforerunning the script, open a new terminal session and edit theplatform-data/platform-data.ini file to include platform-specific data such as MACaddress, platform type, and MRC parameters.On reference platforms, the MAC address to be programmed is printed on the productlabel.Note: The Intel Quark SoC X1000 contains two MACs and each must be configured withone address in the platform.ini file, even on boards (such as Galileo) that have onlyone Ethernet port.For Galileo, MAC 0 is the only MAC wired out, however, you must also configure MAC 1with a dummy valid UNICAST MAC address in the platform.ini file.Galileo / Kips Bay Fab D example is below, recommended values are shown in boldtext:[Platform Type]id 1desc PlatformIDdata.type hex.uint16# ClantonPeak 2, KipsBay 3, CrossHill 4, ClantonHill 5, KipsBay-fabD 6data.value 6# WARNING: the MRC parameters MUST match the platformID used above[Mrc Params]id 6ver 1desc MrcParamsdata.type file#data.value MRC/clantonpeak.v1.bin#data.value MRC/kipsbay.v1.binIntel Quark SoC X1000BSP Build Guide10Order Number: 329687-001US

Programming flash on the board using serial interface#data.value MRC/crosshill.v1.bin#data.value MRC/clantonhill.v1.bindata.value MRC/kipsbay-fabD.v1.bin[MAC address 0]id 3desc 1st MACdata.type hex.stringdata.value 001320FDF4F2#unique MAC address of your device[MAC address 1]id 4desc 2nd MACdata.type hex.stringdata.value 02FFFFFFFF01Next, run the script as follows:####cd py -p sample-platform-data.ini \-i ././sysimage 4M*/sysimage.CP-4M-debug/Flash-missingPDAT.bincd -This creates a Flash PlatformData.bin file to be programmed on the board.To program your board using Dediprog, skip to Section 10.9Programming flash on theboard using serial interfaceThese steps assume you have a microSD card inserted into the slot on the board,which contains the release-specific sysimage nnnn.cap file and the CapsuleApp.efifile.Caution:The CapsuleApp.efi and the *.cap file are a matched pair and must be usedtogether. When a new *.cap file is released, you must use the correspondingCapsuleApp.efi to install it.Perform the steps below:1.Use the files created in Section 7 or download the SPI flash image capsule files asdescribed in Section 2.2.Copy CapsuleApp.efi and sysimage nnnnn.cap to a microSD card and insert itinto the slot on the board .3.Connect the serial cable between the computer and the Galileo board. Set up aserial console session (for example, PuTTY) and connect to the Galileo board’sCOM port at 115200 baud rate.4.Configure the serial console session to recognize special characters. For example,if you are using PuTTY, you must explicitly enable special characters. In the PuTTYOrder Number: 329687-001USIntel Quark SoC X1000BSP Build Guide11

Programming flash on the board using serial interfaceConfiguration options, go to the Terminal Keyboard category and set theFunction keys and Keypad option to SCO.5.Power on the board. A GNU GRUB boot loader menu is displayed (below).Exit GRUB by entering c and quit as shown below.Press c to get a command line.At the GRUB command line, type quit.Intel Quark SoC X1000BSP Build Guide12Order Number: 329687-001US

Programming flash on the board using serial interface6.The serial console displays a boot device selection box (below).Select UEFI Internal Shell.You will see a display similar to this:7.You will see a print out, the top line of which looks like this:fs0 :HardDisk - Alias hd7b blk0This is your SD card. To mount it, type: fs0:8.Verify you are using the correct version of CapsuleApp.efi by using the -? or –hoption. You must use version 1.1 or later.9.Enter the following command:CapsuleApp.efi sysimage nnnnn.capNote: You must enter the full filename of the sysimage nnnnn.cap file.Order Number: 329687-001USIntel Quark SoC X1000BSP Build Guide13

Programming flash on the board using serial interfaceYou will see a display similar to this:The CapsuleApp will update your SPI flash image. This process takes about 2minutes.Warning: DO NOT remove power or try to exit during this process. Wait for theprompt to return, otherwise your board will become non-functional.10. When the update completes, reboot the board by removing and reconnecting thepower cable. You will see a display similar to this:Intel Quark SoC X1000BSP Build Guide14Order Number: 329687-001US

Programming flash on the board using DediProg10Programming flash on theboard using DediProgYou can use a DediProg* SF100 SPI Flash Programmer and the associated flashingsoftware to program the board.Note: These steps require the Flash PlatformData.bin file that was created in Section 8.Once the software has been installed and the programmer is connected to the board,open a new terminal session, and run the DediProg Engineering application.Use the following steps to flash the board:1.Select the memory type if prompted when the application starts.2.Select the File icon and choose the *.bin file you wish to flash.3.Optionally select the Erase button to erase the contents of the SPI flash.4.Select raw file format.5.Select the Prog icon to flash the image onto the board.6.Optionally select the Verify icon to verify that the image flashed correctly.When flashing a 4MB image onto an 8MB SPI part it is important that an offset of 4MBis used. In the DediProg application, Config Program Configuration Programfrom specific address of a chip should be set to 0x400000.Note: Intel recommends that you disconnect the programmer before booting the system.Order Number: 329687-001USIntel Quark SoC X1000BSP Build Guide15

Booting the board from SD card11Booting the board from SD cardTo boot your board from an SD card, follow these steps. This setup allows you to saveyour sketch to the Galileo board, so it will be able to repeat sketches after boardpower-down. This also enables persistent rootfs and persistent /sketch folder.Dependencies: Ran the command bitbake image-full in Section 4.1.The output of the build process in Section 4 is found in ./tmp/deploy/images/Copy the following kernel and root file system files to an SD card: boot (directory) bzImage core-image-minimal-initramfs-clanton.cpio.gz image-full-clanton.ext3Be sure to set up your SD card with the files and structure shown below.2.Insert the SD card, then power on the board.Note: The first time you boot the board may take several minutes. This is expected behaviordue to the SSH component creating cryptographic keys on the first boot.Intel Quark SoC X1000BSP Build Guide16Order Number: 329687-001US

Enabling the OpenOCD debugger12Enabling the OpenOCDdebuggerDependencies: GCC (tested with version 4.5) GNU Make libtoolTo build OpenOCD, open a new terminal session, extract the OpenOCD package, andrun the gitsetup.py script. The script downloads all the upstream code required forOpenOCD and applies the OpenOCD patch.Use the following commands:# tar -xvf openocd *.tar.gz# cd openocd openocd *# ./gitsetup.py# cd work# ./configure4clanton.sh# makeBasic usage:# cp work/src/openocd work/tcl# cd work/tclNote: Errors in this point may be caused by proxy settings for http URLs.You may find answers about proxy settings here:https://wiki.yoctoproject.org/wiki/Working Behind a Network ProxyFirst connect a JTAG debugger to the CRB. Next, run OpenOCD with the correctinterface configuration file for your JTAG debugger.The example that follows is for an "olimex-arm-usb-ocd-h" JTAG debugger:# sudo ./openocd -f interface/olimex-arm-usb-ocd-h.cfg -f \board/clanton board.cfgYou can connect to this OpenOCD session using telnet, and issue OpenOCD commandsas follows:# telnet localhost 4444# halt# resumeFor more information, see the Using OpenOCD and Source Level Debug on ClantonApplication Note which is included in this release.Order Number: 329687-001USIntel Quark SoC X1000BSP Build Guide17

Revision HistoryRevision HistoryDate15 October 2013Revision001DescriptionFirst release with software version 0.7.5.INFORMATION IN THIS DOCUMENT IS PROVIDED IN CONNECTION WITH INTEL PRODUCTS. NO LICENSE, EXPRESS OR IMPLIED,BY ESTOPPEL OR OTHERWISE, TO ANY INTELLECTUAL PROPERTY RIGHTS IS GRANTED BY THIS DOCUMENT. EXCEPT ASPROVIDED IN INTEL'S TERMS AND CONDITIONS OF SALE FOR SUCH PRODUCTS, INTEL ASSUMES NO LIABILITY WHATSOEVERAND INTEL DISCLAIMS ANY EXPRESS OR IMPLIED WARRANTY, RELATING TO SALE AND/OR USE OF INTEL PRODUCTSINCLUDING LIABILITY OR WARRANTIES RELATING TO FITNESS FOR A PARTICULAR PURPOSE, MERCHANTABILITY, ORINFRINGEMENT OF ANY PATENT, COPYRIGHT OR OTHER INTELLECTUAL PROPERTY RIGHT.A "Mission Critical Application" is any application in which failure of the Intel Product could result, directly or indirectly, inpersonal injury or death. SHOULD YOU PURCHASE OR USE INTEL'S PRODUCTS FOR ANY SUCH MISSION CRITICALAPPLICATION, YOU SHALL INDEMNIFY AND HOLD INTEL AND ITS SUBSIDIARIES, SUBCONTRACTORS AND AFFILIATES, AND THEDIRECTORS, OFFICERS, AND EMPLOYEES OF EACH, HARMLESS AGAINST ALL CLAIMS COSTS, DAMAGES, AND EXPENSES ANDREASONABLE ATTORNEYS' FEES ARISING OUT OF, DIRECTLY OR INDIRECTLY, ANY CLAIM OF PRODUCT LIABILITY, PERSONALINJURY, OR DEATH ARISING IN ANY WAY OUT OF SUCH MISSION CRITICAL APPLICATION, WHETHER OR NOT INTEL OR ITSSUBCONTRACTOR WAS NEGLIGENT IN THE DESIGN, MANUFACTURE, OR WARNING OF THE INTEL PRODUCT OR ANY OF ITSPARTS.Intel may make changes to specifications and product descriptions at any time, without notice. Designers must not rely on theabsence or characteristics of any features or instructions marked "reserved" or "undefined". Intel reserves these for futuredefinition and shall have no responsibility whatsoever for conflicts or incompatibilities arising from future changes to them. Theinformation here is subject to change without notice. Do not finalize a design with this information.The products described in this document may contain design defects or errors known as errata which may cause the product todeviate from published specifications. Current characterized errata are available on request.Contact your local Intel sales office or your distributor to obtain the latest specifications and before placing your product order.Copies of documents which have an order number and are referenced in this document, or other Intel literature, may be obtainedby calling 1-800-548-4725, or go to: http://www.intel.com/design/literature.htmIntel and the Intel logo are trademarks or registered trademarks of Intel Corporation or its subsidiaries in the United States andother countries.*Other names and brands may be claimed as the property of others.Copyright 2013, Intel Corporation. All rights reserved.Intel Quark SoC X1000BSP Build Guide18Order Number: 329687-001US

This guide contains instructions for installing and configuring the Intel Quark SoC X1000 Board Support Package Sources. This software release supports the following hardware and software: Intel Galileo Customer Reference Board (CRB) (Fab D with blue PCB) Board Support Package Sources for Intel Quark SoC X1000 v0.7.5 Before you begin: