The Contiki build system 编译系统

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

时间: 2024-10-13 16:32:16

The Contiki build system 编译系统的相关文章

【转】Android ROM研究---Android build system增加模块

原文网址:http://hualang.iteye.com/blog/1141315 Android build system就是编译系统的意思 在我们需要向自己编译的源代码中增加模块的时候,需要一些规则,当然这个规则都是类似的. Android.mk文件解析 让我们来看一个 Android.mk 文件的样子 Java代码 LOCAL_PATH := $(call my-dir) include $(CLEAR_VARS) LOCAL_MODULE :=Hello LOCAL_SRC_FILES

在Sublime Text3中配置Python3的Build System

Sublime Text是风靡世界的文本编辑器,支持多种编程语言.由于它的安装包短小精悍方便携带,笔者考虑把它作为Python开发环境.下面的设置可以让Sublime Text 3同时支持Python2和Python3开发环境. 工具/原料 Sublime Text 3 build3103 配置代码(见文末) 方法/步骤 1 打开Sublime Text 3,依次进入new build system菜单(如图~) 2 点击菜单后,会生成一个空配置文件.我们需要在这个配置文件内覆盖配置信息.配置部

OpenWrt's build system

https://wiki.openwrt.org/about/toolchain Table of Contents OpenWrt build system – Features OpenWrt build system – Make Targets OpenWrt build system – Build sequence Patch management Packaging considerations Documentation History OpenWrt's build syste

RPMForge——Quick Start build system

How to setup multimedia on CentOS-5 CentOS ships with basic sound support for audio content encoded with codecs for a variety of sound formats, including .wav and .ogg files. The alsa-utils and sox audio players are included for a TUI (CLI) environme

sublime C++ build system配置体验

近期准备实习,于是终于步入了sublime的阵营,sublime确实性感. 在配置win7下C++编译运行集成环境的时候遇到点问题,于是接触了一下JSON格式,最后终于自己搞定了.. 参考文档:http://sublime-text.readthedocs.org/en/latest/reference/build_systems.html 其实最终是在C++.sublime-build里写以下东西就好了(tools->build system->new build system) { &qu

Gradle: The New Android Build System

Gradle: The New Android Build System Google selected Gradle as the foundation of the Android SDK build system because it provides flexibility along with the ability to define common standards for Android builds. With Gradle, Android developers can us

Android Build System Ultimate Guide

Android Build System Ultimate Guide April 8,2013 Lately, Android Open Source Project has gone through various changes. For instance, Since JB Google decided to replace bluez bluetooth stack with an open source stack implemented by Broadcom claiming t

Android Build System

Android Build System 原文地址:  http://elinux.org/Android_Build_System 另外一篇也比较好的文章: http://www.ibm.com/developerworks/cn/opensource/os-cn-android-build/#author 之前都是片断性的了解, 读完这个文章,编译 android 系统的过程就梳理清晰了. Basics of the Android Build system were described a

构建系统(Build System)

构建系统(build system)是用来从源代码生成用户可以使用的目标(targets)的自动化工具. 目标可以包括库.可执行文件.或者生成的脚本等等. 常用的构建系统包括GNU Make.GNU autotools.CMake.Apache Ant(主要用于JAVA). 此外,所有的集成开发环境(IDE)比如Qt Creator.Microsoft Visual Studio和Eclipse都对他们支持的语言添加了自己的构建系统配置工具. 通常IDE中的构建系统只是基于控制台的构建系统(比如