The Contiki build system
The Contiki build system
http://contiki.sourceforge.net/docs/2.6/a01796.html
先看官方文档的说明,对contiki的构建系统有个总体的概览。
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. 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. 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. 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. 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. 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. 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= by running make TARGET=esb
DEFINES=MYTRACE,MYVALUE= 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: * Makefile: the project's makefile, located in the project directory. * Makefile.include: the system-wide Contiki makefile, located in the root of
the Contiki source tree. * 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. * 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. * 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. 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: 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. 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.$(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. 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).
The Contiki build system
总结如下: (注:以hello-world为例子)
1. Contiki 的构建系统使编译Contiki应用程序很简单,只需要给make命令提供不同的参数,就可以把Contiki应用程序编译成不同平台的不同应用程序的可执行文件,而不用去修改makefiles或者应用程序代码。
2. make 默认会编译成本机(native target)可执行文件,编译完的文件(如hello-world.native)可运行在我们的开发环境上。
3. 指定平台,可以在make命令增加TARGET参数,如指定平台esb,将会生成hello-world.esb文件
make TARGET=esb
4. 编译成Contiki运行时可加载的文件,则需要执行以下命令
make TARGET=esb hello-world.ce
5. 为了避免每次执行make命令都要输入TARGET变量,可运行如下命令
make TARGET=esb savetarget
将TARGET= esb 保存在Makefile.target文件中,作为默认的TARGET.
6. 除了TARGET参数,还有DEFINES参数,可为c预处理设定任意的变量
make TARGET=esb DEFINES=MYTRACE,MYVALUE=4711 savedefines
同样可将DEFINES保存在Makefile.esb.defines中,作为默认的DEFINES。其中esb是平台名称。
7. Makefiles 文件种类
Makefile: 工程Makefile,可理解为总控Makefile
Makefile.include: 在Contiki根目录下, the systme-wide Contiki makefile
Makefile.$(TARGET): 在平台目录下,及platform/$(TARGET),rules for the specific platform
Makefile.$(CPU): $(CPU)是cpu的名字,在cpu/$(CPU)目录下,rules for the CPU architecture
Makefile.$(APP): $(APP)是应用名称,在apps/$(APP)目录下,rules for applications
8. APPS 变量
APPS变量定义apps/目录下那些应用程序需要被Contiki 操作系统包含。
Makefile.include会根据APPS包含进所有apps/目录下相关的makefiles。
9. 工程Makefile
CONTIKI_PROJECT = hello-world
all: $(CONTIKI_PROJECT) CONTIKI = ../..
include $(CONTIKI)/Makefile.include
工程Makefile一般都比较简单,定义Contiki 源代码的根目录位置,用变量CONTIKI存储。
包含Makefile.include文件。
也还可以定义APPS变量,包含所需的应用。
10. 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).
11. Makefile.$(TARGET)
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.
12. Makefile.$(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).
The Contiki build system的更多相关文章
- The Contiki build system 编译系统
The Contiki build system======================== The Contiki build system is designed to make it eas ...
- sublime text 配置 builder [build system]
有时候需要用运行一段 PHP 代码,比如测试某个函数返回值等等,如果启动 Http Server,再打开浏览器,那黄花菜都凉了.我们可以在 Sublime Text 3 中创建 PHP 的 build ...
- Android Build System
归类一些Android build system 相关的知识. http://elinux.org/Android_Build_System make <local_module> - m ...
- Gradle: The New Android Build System
Gradle: The New Android Build System Google selected Gradle as the foundation of the Android SDK bui ...
- Android uiautomator gradle build system
This will guide you through the steps to write your first uiautomator test using gradle as it build ...
- lua语言入门之Sublime Text设置lua的Build System
转自: http://blog.csdn.net/wangbin_jxust/article/details/8911956 最近开始学习LUA语言,使用Sublime Text作为编辑器,不得不说, ...
- 【转】Android ROM研究---Android build system增加模块
原文网址:http://hualang.iteye.com/blog/1141315 Android build system就是编译系统的意思 在我们需要向自己编译的源代码中增加模块的时候,需要一些 ...
- Sublime Text 2 新建C++ build system
首先要有个MinGW(我这里借用ceemple的编译器 ,mingw32) 设置环境变量 右击我的电脑,点属性->高级->环境变量. 在系统环境变量在PATH里加入D:\Ceemple\m ...
- sublime C++ build system配置体验
近期准备实习,于是终于步入了sublime的阵营,sublime确实性感. 在配置win7下C++编译运行集成环境的时候遇到点问题,于是接触了一下JSON格式,最后终于自己搞定了.. 参考文档:htt ...
随机推荐
- Android Studio中利用JavaDoc生成项目API文档
1. 在Android Studio中的菜单项中点击Generate JavaDoc
- win下配置java环境变量
系统变量→新建 JAVA_HOME 变量 . 变量值填写jdk的安装目录(本人是 E:\Java\jdk1.7.0) 系统变量→寻找 Path 变量→编辑 在变量值最后输入 %JAVA_HOME%\ ...
- HDOJ Oulipo 1686【KMP】
Oulipo Time Limit: 3000/1000 MS (Java/Others) Memory Limit: 32768/32768 K (Java/Others) Total Sub ...
- win10多用户远程登录
实现效果:不同的电脑可以同时登录一台windows主机,但是必须使用不同的账号 首先,我们来创建一个新用户 点击设置,搜索用户 点击下一步,一个普通用户就创建完成了. 然后,打开远程设置,右键此电脑, ...
- 牛牛有一个鱼缸。鱼缸里面已经有n条鱼,每条鱼的大小为fishSize[i] (1 ≤ i ≤ n,均为正整数),牛牛现在想把新捕捉的鱼放入鱼缸。鱼缸内存在着大鱼吃小鱼的定律。经过观察,牛牛发现一条鱼A的大小为另外一条鱼B大小的2倍到10倍(包括2倍大小和10倍大小),鱼A会吃掉鱼B。考虑到这个,牛牛要放入的鱼就需要保证:1、放进去的鱼是安全的,不会被其他鱼吃掉 2、这条鱼放进去也不能吃掉其他鱼
// ConsoleApplication5.cpp : 定义控制台应用程序的入口点. // #include<vector> #include<algorithm> #inc ...
- easyUI中 datagrid 格式化日期
$('#List').datagrid({ url: '@Url.Action("GetList")', width:SetGridWidthSub(10), methord: ' ...
- excel表格定义导入到powerdesigner脚本
打开powerdesigner,shift + ctrl + X 打开脚本窗口 输入执行的脚本,点 run 即可. 简单的导入Excel脚本 '开始 Option Explicit Dim mdl ' ...
- Spring MVC获得HttpServletRequest
以下代码是获得Spring MVC中的HttpServletRequest ServletRequestAttributes attr = (ServletRequestAttributes) Req ...
- 2015年多校联合训练第一场OO’s Sequence(hdu5288)
题意:给定一个长度为n的序列,规定f(l,r)是对于l,r范围内的某个数字a[i],都不能找到一个相应的j使得a[i]%a[j]=0.那么l,r内有多少个i,f(l,r)就是几. 问全部f(l,r)的 ...
- Android中怎样控制LogCat的自己定义输出
在Android开发中,LogCat是一个非常重要的调试工具,能够输出非常多关于项目或者手机的信息. 可是正是因为LogCat功能的过于强大,输出的信息量也是极为庞大的,那么我们就须要通过一定的方式依 ...