zephyr/doc/application/apps_structure.rst
axy c4546589fb Revert "build: Document outputexports"
This reverts commit d4d9ac2d21.

This is broken:
core:static_lib(master): sanitycheck -T .
Generating LALR tables
Cleaning output directory /home/nashif/Work/zephyr/sanity-out
Selecting default platforms per test case
Building testcase defconfigs...
1 tests selected, 28 tests discarded due to filters
total complete:   1/  1  failed:   0
1 of 1 tests passed with 0 warnings in 0 seconds
Traceback (most recent call last):
  File "//home/nashif/Work/zephyr/scripts/sanitycheck", line 1887, in <module>
    main()
  File "//home/nashif/Work/zephyr/scripts/sanitycheck", line 1879, in main
    ts.testcase_report(LAST_SANITY)
  File "//home/nashif/Work/zephyr/scripts/sanitycheck", line 1551, in testcase_report
    rowdict["ram_size"] = goal.metrics["ram_size"]
KeyError: 'ram_size'
core:static_lib(master): find -name *elf
core:static_lib(master): make pristine
make -C mylib clean
make[1]: Entering directory '/home/nashif/Work/zephyr/samples/static_lib/mylib'
Makefile:19: *** $(O) is not set.  Try `make all-mylib` from hello_world.  Stop.
make[1]: Leaving directory '/home/nashif/Work/zephyr/samples/static_lib/mylib'
Makefile:37: recipe for target 'pristine' failed
make: *** [pristine] Error 2

Change-Id: I61700b0df34790aef94a6700c7c7e0605343787f
Signed-off-by: axy <anas.nashif@intel.com>
2016-11-11 01:14:51 +00:00

132 lines
3.4 KiB
ReStructuredText

.. _apps_structure:
Create an Application Directory
###############################
Each application resides in a uniquely-named application
directory created by the developer, typically in the developer's
workspace directory. The application developer also creates a
:file:`src` directory for the application's source code.
.. contents:: Procedures
:local:
:depth: 1
Creating an Application and Source Code Directory
=================================================
Create one directory for your application and a sub-directory for the
application's source code; this makes it easier to organize directories
and files in the structure that the kernel expects.
Before You Begin
----------------
* Ensure the Zephyr environment variables are set for each console terminal;
see :ref:`apps_common_procedures`.
Steps
-----
1. Create an application directory structure outside of the kernel's
installation directory tree. Often this is your workspace directory.
a) In a console terminal, navigate to a location where you want your
application to reside.
b) Create the application's directory, enter:
.. code-block:: console
$ mkdir application_name
.. note::
This directory and the path to it, are referred to in the documentation
as :file:`~/appDir`.
2. Create a source code directory in your :file:`~/appDir`, enter:
.. code-block:: console
$ mkdir src
The source code directory :file:`~/appDir/src` is created.
.. code-block:: console
-- appDir
|-- src
Creating an Application Makefile
================================
Create an application Makefile to define basic information,
such as the board configuration used by the application.
The build system uses the Makefile to build a :file:`zephyr.elf` image
that contains both the application and the kernel libraries.
Before You Begin
----------------
* Be familiar with the standard GNU Make language.
* Be familiar with the board configuration used for your application
and, if it is a custom board configuration, where it is located.
* Ensure the Zephyr environment variables are set for each console terminal;
see :ref:`apps_common_procedures`.
Steps
-----
1. In the :file:`appDir` directory, create a Makefile. Enter:
.. code-block:: bash
$ touch Makefile
2. Open the :file:`Makefile` and add the following mandatory
entries using any standard text editor.
.. note::
Ensure that there is a space after each ``=``.
a) Add the name of the default board configuration for your application on a
new line:
.. code-block:: make
BOARD ?= board_configuration_name
The supported boards can be found in :ref:`board`.
b) Add the name of the default kernel configuration file for your
application on a new line:
.. code-block:: make
CONF_FILE ?= kernel_configuration_name
The default kernel configuration file entry may be omitted if the file
is called :file:`prj.conf`. It may also be omitted if the default board
configuration's kernel settings are sufficient for your application.
c) Include the mandatory :file:`Makefile` fragments on a new line:
.. code-block:: make
include ${ZEPHYR_BASE}/Makefile.inc
3. Save and close the :file:`Makefile`.
Example Makefile
----------------
.. code-block:: make
BOARD ?= qemu_x86
CONF_FILE ?= prj.conf
include ${ZEPHYR_BASE}/Makefile.inc