码迷,mamicode.com
首页 > 其他好文 > 详细

The Contiki build system 编译系统

时间:2015-06-26 17:41:49      阅读:251      评论:0      收藏:0      [点我收藏+]

标签:

 

The Contiki build system
========================

The Contiki build system is designed to make it easy to compile Contiki
applications for different hardware platforms or into a simulation platform by
simply supplying different parameters to the make command, without having to
edit makefiles or modify the application code.
编译系统旨在设计成在不同的硬件平台上都通用的编译系统,仅仅主需要几个不同的参数就可以比哪一不用编辑makefiles文件或者修改应用代码。

The file example project in examples/hello-world/ shows how the Contiki build
system works. The hello-world.c application can be built into a complete
Contiki system by running make in the examples/hello-world/ directory. 在example项目中的Helloworld项目真是了contiki编译系统是怎么工作的。
其中的Helloworld.c文件可以被编译进入contiki系统中通过在hello-world文件夹下执行make命令
Running make without parameters will build a Contiki system using the native target.
The native target is a special Contiki platform that builds an entire Contiki
system as a program that runs on the development system.
执行没有参数的make命令将会编译一个 本地的目标,
本地目标是一个特殊的contiki平台它编译了一个完整的contiki系统。
After compiling the
application for the native target it is possible to run the Contiki system with
the application by running the file hello-world.native. To compile the
application and a Contiki system for the ESB platform the command make
TARGET=esb is used. This produces a hello-world.esb file that can be loaded
into an ESB board.
在编译完之后可以通过运行 hello-world.native 来运行, 为了编译应用和contiki系统能够在ESB平台下运行,那么可以使用命令 make TARGET=esb 这将会产生一个 hello-world.esb文件,能够下载到ESB板中。

To compile the hello-world application into a stand-alone executable that can
be loaded into a running Contiki system, the command make hello-world.ce is
used. To build an executable file for the ESB platform, make TARGET=esb
hello-world.ce is run.
为了编译hello-world应用成为一个独立的可执行的文件并可以加载到一个正在运行的contiki系统中,那么可以使用 make hello-world.ce 命令。 如果需要指定平台为ESB的话可以用命令
make TARGET=ESB hello-world.ce
To avoid having to type TARGET= every time make is run, it is possible to run
make TARGET=esb savetarget to save the selected target as the default target
platform for subsequent invocations of make. A file called Makefile.target
containing the currently saved target is saved in the project‘s directory.
为了避免每次都要输入TARGET= ....可以在makfile.targe 中进行配置默认的平台

Beside TARGET= there‘s DEFINES= which allows to set arbitrary variables for the
C preprocessor in form of a comma-separated list. Again it is possible to avoid
having to re-type i.e. DEFINES=MYTRACE,MYVALUE=4711 by running make TARGET=esb
DEFINES=MYTRACE,MYVALUE=4711 savedefines. A file called Makefile.esb.defines is
saved in the project‘s directory containing the currently saved defines for the
ESB platform.

Makefiles used in the Contiki build system The Contiki build system is composed
of a number of Makefiles. These are:

contiki编译系统中的makefiles文件由几个makefile文件组成。
* Makefile: the project‘s makefile, located in the project directory.
1:工程项目自己的makefile文件 在自己的工程目录下
* Makefile.include: the system-wide Contiki makefile, located in the root of
the Contiki source tree.
2:makefile.include contiki系统的makefile文件在contiki系统源文件的根目录下。
* Makefile.$(TARGET) (where $(TARGET) is the name of the platform that is
currently being built): rules for the specific platform, located in the
platform‘s subdirectory in the platform/ directory.
3: makefile.(平台) 位于platform文件夹对应的平台文件夹下面。
* Makefile.$(CPU) (where $(CPU) is the name of the CPU or microcontroller
architecture used on the platform for which Contiki is built): rules for the
CPU architecture, located in the CPU architecture‘s subdirectory in the cpu/
directory.
4:makefile.(CPU) 在CPU文件夹下对应微处理器文件夹下。

* Makefile.$(APP) (where $(APP) is the name of an application in the apps/
directory): rules for applications in the apps/ directories. Each application
has its own makefile.
5: makefile.(应用) 在apps文件夹下对应的应用文件夹下面,每个应用对应一个文件夹。

The Makefile in the project‘s directory is intentionally simple. It specifies
where the Contiki source code resides in the system and includes the
system-wide Makefile, Makefile.include. The project‘s makefile can also define
in the APPS variable a list of applications from the apps/ directory that
should be included in the Contiki system. The Makefile used in the hello-world
example project looks like this:
makefile在工程项目目录中非常的简单。它指定了contiki源代码在系统中的位置,并且包含了系统全局的
makefile文件——makefile-include文件。这个工程的makefile可以定义在apps变量。

CONTIKI_PROJECT = hello-world
all: $(CONTIKI_PROJECT)

CONTIKI = ../..
include $(CONTIKI)/Makefile.include

First, the location of the Contiki source code tree is given by defining the
CONTIKI variable. Next, the name of the application is defined. Finally, the
system-wide Makefile.include is included.
首先 contiki的源代码树为位置由 CONTIKI变量给出,然后,应用的名称已经定义了 最后系统的makefile文件 makefile.include也需要被包含进来。

The Makefile.include contains definitions of the C files of the core Contiki
system. Makefile.include always reside in the root of the Contiki source tree.
When make is run, Makefile.include includes the Makefile.$(TARGET) as well as
all makefiles for the applications in the APPS list (which is specified by the
project‘s Makefile).
makefile.include 包含了 contiki系统的核心c文件。
makefile.include 文件总是位于contiki源代码的根目录下。当make命令执行时
makefile.include 包括了makefile.$(TARGET)并且也包含了所有的 应用的makefile文件——被工程项目指定的makefile文件。

Makefile.$(TARGET), which is located in the platform/$(TARGET)/ directory,
contains the list of C files that the platform adds to the Contiki system. This
list is defined by the CONTIKI_TARGET_SOURCEFILES variable. The
Makefile.$(TARGET) also includes the Makefile.$(CPU) from the cpu/$(CPU)/
directory.
makefile.$(TARGET) 在platform文件夹/$(TARGET)/directory 包含了一系列的平台添加到contiki系统的的c文件,这个c文件列表是由CONTIKI_TARGET_SOURCEFILES 变量定义。 makefile.$(TARGET) 也包含了makfile.$(CPU) 文件。

The Makefile.$(CPU) typically contains definitions for the C compiler used for
the particular CPU. If multiple C compilers are used, the Makefile.$(CPU) can
either contain a conditional expression that allows different C compilers to be
defined, or it can be completely overridden by the platform specific makefile
Makefile.$(TARGET).
makefile.$(CPU)一般包含针对某种型号CPU的c编译器。 如果有多个c编译器被使用,那么此文件可以包含一个条件判断语句允许不同的c编译器,或者可以被 平台指定的makefile.$(TARGET) overridden

The Contiki build system 编译系统

标签:

原文地址:http://www.cnblogs.com/RealMan/p/4602562.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!