Introduction to XDC in davinci---8148/8168/8127 of embedded development

Source: Internet
Author: User

XDC is a set of standards developed by TI for embedded real-time system reusable software components (in xdc became packages, the following become packages). It includes some useful tools, standard API functions, static configuration files, and packaging (packaging) operations. The main highlight of XDC is that it standardizes the delivery process and simplifies the process of referencing other packages under the target platform in the application.

This article from a simple "Hello,World" to start, leading everyone into the xdc development.

In the xdc development World, the first two concepts, packageand repository, need to be clarified .

The so-called package, like the jar file in Java or the assembly in the . NET World , is a set of collections that developers use to deliver the source code after it is packaged. like the Java package ,Xdc's package is also stored in a hierarchical folder organization ( unlike. NET,. NET is simply compiled into a dll), The name of the directory is the name of the package.

The so-called repository, is actually a folder containing multiple package , for example , in xdc, we use packages as a repository, the folder contains a lot of ti.xdc . * The package. In the development of XDC, there is a very important variable Xdcpath, the path developed in Xdcpath is repository. This is somewhat similar to the C + + inclusion file directory.

Installing and uninstalling XDC

You can download from TI's website, the installation process is very simple, if the Windows platform, directly double-click installation files installed to a specific directory on the Linux platform, you may need to modify the file's properties to set the file to executable, and then double-click Install.

As for uninstall, locate the uninstall file and double-click it.

add XDC to your environment variable

In order to make it easier to use XDC (in fact, not to add a long path to XS), XDC is added to the environment variable.

If the development platform is Windows, after installing xdc, add the XDC installation directory (as in Java) to the path of the environment variable, and in addition, create a new xdcpath environment variable, which is used to make the location of the repository.

If you are using Linux, check the documentation yourself:-)

Test

After you have completed the above steps, congratulations, you can now start the xdc programming tour, try typing at the command line:

Xs–version

And

XS Xdc.tools.echo Hello World

Very simple, huh? After the ad we began to write the first XDC-based application, the next section is more exciting, don't go away oh.

Here's how to create an XDC-based application.

In general, we use the traditional C language for xdc development, and we also need to use Javascript in our configuration . However, in general, it is easy to develop xdc, just follow these steps:

Configure the application (that is, write the configuration file AH)

Write C language

Compiling, linking

According to the TI Standard development process,XDC development of the main focus or writing C code, as for the other (mainly refers to 1,3) is very simple (the document said, I do not think ~ ~ ~),Ti provides some tools.

Talk less, start our "Hello, World" tour!

Configure the Application

Unlike Java andC, developing XDC applications requires the use of JavaScript syntax to write a configuration file, with some pre-configured work for the application (for example, what module to use, and some constants to set). Of course, the second step is to write the C language can also do some dynamic settings.

As for why write the configuration file,Ti gives the answer is:

At compile time, you develop which modules need to be used, and which static objects to generate.

Review development packages and inheritance packages

Sets the properties of a specified module or object

Shows the entire process of XDC compilation:





XDC configuration file is the end of the CFG, in the Codec engine development process, we are mainly application and server side use xdc to compile.

As shownin CONFIG output, some intermediate files (such as C code,. cmd files) generated by the XDC compiler based on the configuration file do not need to be written by themselves, and do not even need to know what they are doing.

Now go back to "Hello, World" development, we first create a folder named Hello in the development directory , and then create a file named Hello.cfg in this folder:

Next, enter the following JavaScript expression in the file , declaring a Xdc.runtime.System object:

var System = xdc.usemodule ("Xdc.runtime.System");

Write C language

Create a file named hello.c and add the following code to it:

#include <xdc/std.h>
#include <xdc/runtime/System.h>

int main ()
{
system_printf ("Hello world!\n");
return (0);
}

Compile

Identify goals and platforms

Before compiling, we first need to make clear what platform our program is running on and compile it with what it compiles. In TI's documentation, these attributes are defined with the targetand platform (Platform), compiler:

Target (-t): Developed compiler, such as TI ' C6000 compiler.

Platform (-p): A running environment, such as DM6446 EVM.

Compiler (-C): Compiles xdc compilers, such as Code Gen tools or Visual Studio 2008 provided by TI Corporation .

In this example, the target is Ti.targets.C64P and the platform is positioned ti.platforms.evmDM6446.

Run Configuro

XDC provides a tool called "Configuro" to process the configuration file, and we can enter the following command at the command line:

XS xdc.tools.configuro-t ti.targets.c64p-p ti.platforms.evmdm6446-c d:/opt/cgtools hello.cfg

Note: You need to download Code Gen Tools in https://www-a.ti.com/downloads/sds_support/CodeGenerationTools.htm.

After compiling, a folder named Hello is generated:

Http://blog.sina.com.cn/s/blog_693301190100sitz.html

Http://blog.sina.com.cn/s/blog_69620aac0100q9e6.html

Introduction to XDC in davinci---8148/8168/8127 of embedded development

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

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.