2015-10-15 13:19:06 +08:00
|
|
|
.. _apps_object_conf:
|
|
|
|
|
|
|
|
Microkernel Object Configuration
|
|
|
|
################################
|
|
|
|
|
|
|
|
Microkernel objects are explained fully in the :ref:`zephyr_primer`.
|
|
|
|
See :ref:`microkernel` for example MDEF entries.
|
|
|
|
|
|
|
|
Procedure
|
|
|
|
*********
|
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
.. _create_mdef:
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
Creating and Configuring an MDEF for a Microkernel Application
|
|
|
|
==============================================================
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
Create the MDEF to define microkernel objects used in your
|
2015-10-15 13:19:06 +08:00
|
|
|
application when they apply to the application as a whole.
|
|
|
|
You do not need to define every object before writing code. In
|
|
|
|
some cases, the necessary objects aren't obvious until you begin
|
|
|
|
writing code. However, all objects used in your code must be defined
|
|
|
|
before your application will compile successfully.
|
|
|
|
|
2015-10-24 00:42:56 +08:00
|
|
|
.. note::
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
Nanokernel applications do not use an MDEF because microkernel
|
2015-10-15 13:19:06 +08:00
|
|
|
objects cannot be used in applications of this type.
|
|
|
|
|
|
|
|
Before you begin
|
|
|
|
----------------
|
|
|
|
|
|
|
|
* Confirm your :file:`~/appDir` already exists.
|
|
|
|
|
|
|
|
* Confirm Zephyr environment variables are set for each console
|
|
|
|
terminal; for instructions, see :ref:`apps_common_procedures`.
|
|
|
|
|
|
|
|
Steps
|
|
|
|
-----
|
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
1. Create an MDEF in your application directory
|
2015-10-15 13:19:06 +08:00
|
|
|
(:file:`~/appDir ~) using
|
|
|
|
the name you specified in your application Makefile.
|
|
|
|
(See :ref:`Creating an Application Makefile`).
|
|
|
|
|
|
|
|
.. code-block:: bash
|
|
|
|
|
|
|
|
$ touch prj.mdef
|
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
The default MDEF name is :file:`prj.mdef`.
|
2015-10-15 13:19:06 +08:00
|
|
|
|
|
|
|
2. Open the file using a standard text editor.
|
|
|
|
|
|
|
|
3. Add settings to the file to suit your application.
|
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
The syntax for objects that can be defined in :file:`.mdef`
|
|
|
|
is:
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
TASK name priority entry_point stack_size groups
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
TASKGROUP name
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
MUTEX name
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
SEMA name
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
FIFO name depth width
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
PIPE name buffer_size
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
MAILBOX name
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
MAP name num_blocks block_size
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
POOL name min_block_size max_block_size numMax
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-24 00:42:56 +08:00
|
|
|
.. note::
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
Some microkernel objects, such as Task IRQs, are not
|
|
|
|
defined in an :file:`.mdef` file.
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
The following example shows the content of the
|
|
|
|
:file:`samples/microkernel/apps/philosophers/proj.mdef`
|
|
|
|
for the Philosophers' sample application. The sample
|
2015-10-15 13:19:06 +08:00
|
|
|
uses seven tasks and six mutexes.
|
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
Example MDEF
|
|
|
|
------------
|
2015-10-15 13:19:06 +08:00
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
.. literalinclude:: ../../samples/microkernel/apps/philosophers/proj.mdef
|
|
|
|
:linenos:
|
2015-10-15 13:19:06 +08:00
|
|
|
|
|
|
|
Related Topics
|
|
|
|
--------------
|
|
|
|
|
2015-10-20 02:15:41 +08:00
|
|
|
:ref:`src_makefiles_reqs`
|
|
|
|
:ref:`src_files_directories`
|