doc: update quick start guide

Change-Id: Ib9619257da6f405766501e8b067ca316de58faf7
Signed-off-by: Anas Nashif <anas.nashif@intel.com>
This commit is contained in:
Anas Nashif 2015-10-18 12:17:32 -04:00
commit b3395c338b
6 changed files with 174 additions and 422 deletions

View file

@ -0,0 +1,83 @@
.. _building_zephyr:
Building and Running a Sample Application
#########################################
Building a Sample Application from Source
=========================================
To build an example application follow these steps:
#. Go to the root directory of the |project|.
#. Set the paths properly in the :file:`$ZEPHYR_BASE` directory,
type:
.. code-block:: console
$ source zephyr-env.sh
#. Build the example project, type:
.. code-block:: console
$ cd $ZEPHYR_BASE/samples/microkernel/apps/hello_world
$ make
The above invocation of make will build the hello_world sample application using
the default settings defined in the application Makefile, for example:
.. code-block:: console
$ make PLATFORM_CONFIG=basic_atom
You can build for a different platform by defining the variable PLATFORM_CONFIG
with one of the supported platforms.
For a list of supported platforms of a particular architecture, run:
.. code-block:: console
$ make ARCH=<arch> help
The sample projects for the microkernel and the nanokernel are found
at :file:`$ZEPHYR_BASE/samples/microkernel/apps` and
:file:`$ZEPHYR_BASE/samples/nanokernel/apps` respectively.
After building an application successfully, the results can be found in the
:file:`outdir` sub-directory under the application root directory.
The default ELF binaries generated by the build system are named zephyr.elf. The
build system generates different format for different use cases and depending on
the hardware and platforms used.
Running a Sample Application
============================
To perform rapid testing of an application in the development environment you can
use QEMU with some of the supported platforms and architecture. This can be easily
accomplished by calling a special target when building an application that
invokes Qemu once the build process is completed.
To run an application using the default platform configuration, type:
.. code-block:: console
$ make qemu
To run an application using the x86 basic_atom platform configuration, type:
.. code-block:: console
$ make PLATFORM_CONFIG=basic_atom qemu
To run an application using the ARM basic_cortex_m3 platform configuration, type:
.. code-block:: console
$ make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm qemu
Qemu is not supported on all platforms and architectures and some samples and
test cases might fail when running in the emulator. When developing for a
specific hardware target you should always test on the actual hardware and should
not rely on testing in the QEMU emulation environment only.

View file

@ -1,63 +0,0 @@
.. _building_zephyr:
Building the Zephyr Kernel
##########################
This section describes the procedure to build the kernel with a sample
application in a development system and describes how to get access to the
kernel's source code.
Building a Sample Application
*****************************
You can speed up builds by optionally using the :program:`ccache` utility.
.. code-block:: bash
$ export USE_CCACHE=1
To build an example application follow these steps:
#. Go to the root directory of the |project|.
#. Set the paths properly in the :file:`$ZEPHYR_BASE` directory,
type:
.. code-block:: bash
$ source zephyr-env.sh
#. Build the example project, type:
.. code-block:: bash
$ cd $ZEPHYR_BASE/samples/microkernel/apps/hello_world
$ make pristine && make
.. note::
You can override the default PLATFORM_CONFIG with the one you want
by adding :makevar:`PLATFORM_CONFIG=`. The complete options
available for the PLATFORM_CONFIG flag can be derived from the
names of the platform configuration files located under
:file:`$ZEPHYR_BASE/arch/$ARCH/configs`. For example, the following
command will use
:file:`$ZEPHYR_BASE/arch/x86/configs/micro_basic_atom_defconfig` if
building a microkernel, and
:file:`$ZEPHYR_BASE/arch/x86/configs/nano_basic_atom_defconfig` if
building a nanokernel.
:command:`make PLATFORM_CONFIG=basic_atom ARCH=x86`
The complete options available for the ARCH flag can be found under
:file:`$ZEPHYR_BASE/arch`, for example :file:`$ZEPHYR_BASE/arch/x86`.
The sample projects for the microkernel are found
at :file:`$ZEPHYR_BASE/samples/microkernel/apps`. After building the
application successfully, the results can be found in the :file:`outdir`
directory in the application root directory.
:file:`$SAMPLE_PROJECT/outdir/zephyr.elf`.
For sample projects in the :file:`$ZEPHYR_BASE/samples/nanokernel/apps`
directory, the results can be found at :file:`$SAMPLE_PROJECT/outdir/zephyr.elf`.

View file

@ -0,0 +1,66 @@
.. _installing_zephyr:
Development Environment Setup
#############################
This section describes how to build the kernel in a development system
and how to access the project source code.
.. _linux_development_system:
Installing the Host's Operating System
======================================
Building the project's software components including the kernel has been tested
on Ubuntu and Fedora systems. Instructions for installing these OSes are beyond
the scope of this document.
Configuring Network and Proxies
===============================
Building the kernel requires the command-line tools of git, ssh, wget,
curl. Verify that each service can be run as both user and root and that access
to the Internet and is not impeded by a firewall.
Update Your Operating System
============================
Before proceeding with the build, ensure your OS is up to date. On Ubuntu:
.. code-block:: console
$ sudo apt-get update
On Fedora:
.. code-block:: console
$ sudo dnf update
.. _required_software:
Installing Requirements and Dependencies
========================================
Install the following with either apt-get or dnf.
.. note::
Minor version updates of the listed required packages might also
work.
Install the required packages in a Ubuntu host system with:
.. code-block:: console
$ sudo apt-get install git make gcc gcc-multilib g++ libc6-dev-i386 \
g++-multilib
Install the required packages in a Fedora host system with:
.. code-block:: console
$ sudo dnf group install "Development Tools"
$ sudo dnf install git make gcc glib-devel.i686 glib2-devel.i686 \
glibc-static libstdc++-static

View file

@ -1,71 +1,7 @@
.. _installing_zephyr:
.. _setup_development_environment:
Installing the Zephyr Kernel
############################
This section describes how to install the kernel in a development system
and how to get access to the kernel's source code.
.. _linux_development_system:
Prerequisites
*************
Installing the Operating System
===============================
The kernel has been tested on Ubuntu and Fedora. Instructions for
installing these OSes are beyond the scope of this document.
Configuring Network and Proxies
===============================
Building the kernel requires the command-line tools of git, ssh, wget,
curl, and apt-get. Verify that each service can be run as both
user and root and that access to the Internet and is not impeded
by a firewall.
Update Your Operating System
============================
Before proceeding with the build, ensure your OS is up to date. On Ubuntu:
.. code-block:: bash
$ sudo apt-get update
On Fedora:
.. code-block:: bash
$ sudo dnf update
.. _required_software:
Installing Requirements and Dependencies
========================================
Install the following with either apt-get or yum.
.. note::
Minor version updates of the listed required packages might also
work.
Install the required packages in a Ubuntu host system with:
.. code-block:: bash
$ sudo apt-get install git make gcc gcc-multilib g++ \
libc6-dev-i386 g++-multilib
Install the required packages in a Fedora host system with:
.. code-block:: bash
$ sudo yum groupinstall "Development Tools"
$ sudo yum install git make gcc glib-devel.i686 \
glib2-devel.i686 g++ libc6-dev-i386 g++-multilib \
glibc-static libstdc++-static
Setup a Local Development Environment
#####################################
.. _zephyr_sdk:
@ -76,8 +12,7 @@ Zephyr's :abbr:`SDK (Software Development Kit)` contains all
necessary tools and cross-compilers needed to build the kernel on all supported
architectures.
Additionally, it includes host tools such as a custom QEMU and a host compiler
for building host tools if necessary. With this SDK, there is no need to build
any cross compilers or emulation environments. The SDK supports the following
for building host tools if necessary. The SDK supports the following
architectures:
* :abbr:`IA-32 (Intel Architecture 32 bits)`
@ -92,14 +27,14 @@ Follow these steps to install the SDK on your host system.
https://zephyr-download.01.org/zephyr-sdk/zephyr-sdk-0.6-i686-setup.run
.. code-block:: bash
.. code-block:: console
$ wget --user=USERNAME --ask-password \
https://zephyr-download.01.org/zephyr-sdk/zephyr-sdk-0.6-i686-setup.run
#. Run the installation binary, type:
.. code-block:: bash
.. code-block:: console
$ chmod +x zephyr-sdk-0.6-i686-setup.run
@ -109,7 +44,7 @@ Follow these steps to install the SDK on your host system.
#. Follow the installation instructions on the screen. The
toolchain's default installation location is :file:`/opt/zephyr-sdk/0.6`.
.. code-block:: bash
.. code-block:: console
Verifying archive integrity... All good.
@ -119,7 +54,7 @@ Follow these steps to install the SDK on your host system.
#. Enter a new location or hit :kbd:`Return` to accept default.
.. code-block:: bash
.. code-block:: console
Installing SDK to /opt/zephyr-sdk/0.6
@ -142,79 +77,16 @@ Follow these steps to install the SDK on your host system.
#. To use the Zephyr SDK, export the following environment variables and
use the target location where SDK was installed, type:
.. code-block:: bash
.. code-block:: console
$ export ZEPHYR_GCC_VARIANT=zephyr
$ export ZEPHYR_SDK_INSTALL_DIR=/opt/zephyr-sdk/0.6
Installing a Custom QEMU for ARM Platforms
==========================================
The SDK comes with a QEMU binary suitable for running sample |codename|
applications. The steps below are needed only if you choose not to use the
provided binary and use a custom built binary instead.
If you require testing ARM builds, a local patch to the QEMU source
is needed. The patch corrects the issues with the locking interfaces
QEMU uses. If you are working with the x86 builds of the kernel,
install QEMU from your systems default package manager.
Follow these steps to enable a customized build of QEMU:
#. Clone the QEMU repository:
.. code-block:: bash
$ git clone git://git.qemu-project.org/qemu.git
#. Checkout the v2.1 stable branch:
.. code-block:: bash
$ cd qemu
$ git checkout stable-2.1
#. Apply our internal patch:
.. code-block:: bash
$ git am $ZEPHYR_BASE/scripts/0001-armv7m-support-basepri-primask-
interrupt-locking.patch
#. Update the submodules as needed:
.. code-block:: bash
$ git submodule update --init pixman
$ git submodule update --init dtc
#. Build QEMU v2.1:
.. code-block:: bash
$ ./configure && make
* You can also build QEMU to a private directory:
.. code-block:: bash
$ ./configure --prefix=$MY_PREFERED_INSTALL_LOCATION && make
* Install QEMU:
.. code-block:: bash
$ sudo make install
.. _setup_development_environment:
Setup a Local Development Environment
*************************************
The |project|'s source code is maintained using GIT and is served using
The Zephyr Project's source code is maintained using Git and is served using
Gerrit.
Gerrit access requires some basic user setup. The following process shows
@ -227,8 +99,7 @@ Getting Access
#. `Create`_ or `update`_ a `01.org`_ account.
#. Submit your your `01.org`_ account and corporate email address to
|PM| hirally.santiago.rodriguez@intel.com.
#. Request access by contacting the Zephyr project team.
#. Once access is granted, `access Gerrit`_.
@ -245,7 +116,7 @@ Getting Access
Configuring SSH to Use Gerrit
=============================
Gerrit uses SSH to interact with your GIT client. A SSH private key
Gerrit uses SSH to interact with your Git client. A SSH private key
needs to be generated on the development machine with a matching public
key on the Gerrit server.
@ -253,7 +124,7 @@ If you already have a SSH key-pair, skip this section.
#. Create a key-pair in your Linux machine, type:
.. code-block:: bash
.. code-block:: console
$ ssh-keygen -t rsa -C "John Doe john.doe@example.com"
@ -267,7 +138,7 @@ If you already have a SSH key-pair, skip this section.
#. Add the private key in the :file:`id_rsa` file in your key ring:
.. code-block:: bash
.. code-block:: console
$ ssh-add ~/.ssh/id_rsa
@ -280,7 +151,7 @@ If you already have a SSH key-pair, skip this section.
c) From the pop-up menu, select :guilabel:`Settings`.
d) On the left side menu select, click on :guilabel:`SSH Public Keys`.
d) On the left side menu, click on :guilabel:`SSH Public Keys`.
e) Click Add key and paste the contents of your public key :file:`~/.id/id_rsa.pub`.
@ -301,26 +172,25 @@ Checking Out the Source Code
============================
#. Ensure that SSH has been set up properly. See `Configuring SSH to Use Gerrit`_ for details.
#. Ensure that SSH has been set up properly. See `Configuring SSH to Use Gerrit`_
for details.
#. Clone the repository:
.. code-block:: bash
.. code-block:: console
$ git clone ssh://01ORGUSERNAME@oic-review.01.org:29418/forto-collab
$ git clone ssh://01ORGUSERNAME@oic-review.01.org:29418/forto-collab zephyr-project
#. You have successfully checked out a copy of the source code to your local machine.
Develop freely, issuing as many commits and rebases as needed.
#. Change to the main project directory:
.. code-block:: bash
.. code-block:: console
$ cd forto-collab
$ cd zephyr-project
#. Source the project environment file to setup project variables:
.. code-block:: bash
.. code-block:: console
$ source zephyr-env.sh

View file

@ -24,6 +24,6 @@ Perform the steps in the installation procedures in the order they appear.
.. toctree::
:maxdepth: 2
installing.rst
building.rst
running.rst
installation.rst
local_development.rst
application.rst

View file

@ -1,204 +0,0 @@
.. _running_apps:
Running Applications
####################
Running Applications in QEMU
****************************
Using QEMU from a different path
================================
If the QEMU binary path is different to the default path, set the
variable :envvar:`QEMU_BIN_PATH` with the new path, type:
.. code-block:: bash
$ export QEMU_BIN_PATH=/usr/local/bin
Another option is to add it to the make command, for example:
.. code-block:: bash
$ make QEMU_BIN_PATH=/usr/local/bin qemu
Running a Microkernel Application
=================================
Run a microkernel application using the default platform configuration, type:
.. code-block:: bash
$ make pristine && make qemu
Run an application using the x86 basic_atom platform configuration, type:
.. code-block:: bash
$ make pristine && make PLATFORM_CONFIG=basic_atom ARCH=x86 qemu
Run an application using the ARM basic_cortex_m3 platform configuration, type:
.. code-block:: bash
$ make pristine && make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm qemu
Running a Nanokernel Application
================================
Run a nanokernel application using the default platform configuration use the
following commands:
.. code-block:: bash
$ make pristine && make qemu
Run an application using the x86 basic_atom platform configuration, use the
following commands:
.. code-block:: bash
$ make pristine && make PLATFORM_CONFIG=basic_atom ARCH=x86 qemu
Run an application using the ARM basic_cortex_m3 platform configuration use the
following commands:
.. code-block:: bash
$ make pristine && make PLATFORM_CONFIG=basic_cortex_m3 ARCH=arm qemu
Running an Application on Galileo Gen2
**************************************
#. Set the platform configuration to Galileo by changing the :command:`make`
command to:
.. code-block:: bash
make PLATFORM_CONFIG=galileo
#. Use one of these cables for serial output:
`<http://www.ftdichip.com/Products/Cables/USBTTLSerial.htm>`_
#. Format a microSD as FAT
#. Create the following directories
:file:`efi`
:file:`efi/boot`
:file:`kernel`
#. Copy the kernel file :file:`zephyr.elf` to the :file:`$SDCARD/kernel` folder.
#. Copy your built version of GRUB to :file:`$SDCARD/efi/boot/bootia32.efi`
#. Create :file:`$SDCARD/efi/boot/grub.cfg` containing the following:
.. code-block:: bash
set default=0
set timeout=10
menuentry "Zephyr Kernel" {
multiboot /kernel/zephyr.elf
}
#. Insert the SDcard in the Galileo board.
#. Connect the board to the host system using the serial cable.
#. Configure your host system to watch for serial data.
* On Linux, screen is a popular method for reading serial
data.
* On Windows, PuTTY has an option to set up configuration for
serial data.
#. Power on the Galileo board.
Building a Custom GRUB
**********************
If you are having problems running an application using the default GRUB
of the hardware, follow these steps to test on Galileo2 boards using a custom
GRUB.
#. Install the requirements to build GRUB on your host machine.
In Ubuntu, type:
.. code-block:: bash
$ sudo apt-get install gnu-efi:i386 bison libopts25 \
libselinux1-dev autogen m4 autoconf help2man libopts25-dev flex \
libfont-freetype-perl automake autotools-dev libfreetype6-dev \
texinfo \
In Fedora, type:
.. code-block:: bash
$ sudo dnf install gnu-efi-i386 bison libopts25 \
libselinux1-dev autogen m4 autoconf help2man libopts25-dev flex \
libfont-freetype-perl automake autotools-dev libfreetype6-dev texinfo
2. Clone and build the GRUB repository using the script in Zephyr tree, type:
.. code-block:: bash
$ cd $ZEPHYR_BASE
$ ./scripts/build_grub.sh
4. Look for the binary at :file:`$ZEPHYR_BASE/scripts/grub/bin/grub.efi`.
Troubleshoot
============
If your custom built GRUB version returns the error:
.. error::
error reported: Invalid parameter
Follow these steps:
#. Use the built-in version of GRUB with the following file:
.. code-block:: bash
$ grub.efi
#. Locate your SDcard in the system
.. code-block:: bash
$ ls
#. You see two entries similar to:
:file:`(hd0)`, :file:`(hd0,msdos1)`
#. Verify the contents, type:
.. code-block:: bash
$ ls (hd0,msdos1)/efi/
The command shows the contents of your SDcard.
#. If the command did not work, find the correct mount, type:
.. code-block:: bash
$ configfile (hd0,msdos1)/efi/boot/grub.cfg
The command uses the Galileos built-in GRUB to parse your configuration file
and list the options youve set.