The Contiki build system 編譯系統

來源:互聯網
上載者:User

標籤:

 

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 編譯系統

聯繫我們

該頁面正文內容均來源於網絡整理,並不代表阿里雲官方的觀點,該頁面所提到的產品和服務也與阿里云無關,如果該頁面內容對您造成了困擾,歡迎寫郵件給我們,收到郵件我們將在5個工作日內處理。

如果您發現本社區中有涉嫌抄襲的內容,歡迎發送郵件至: info-contact@alibabacloud.com 進行舉報並提供相關證據,工作人員會在 5 個工作天內聯絡您,一經查實,本站將立刻刪除涉嫌侵權內容。

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.