Developing the first embedded Linux driver using the Eclipse integrated development Environment __linux

Source: Internet
Author: User

1. Preparatory work

First have to install the GCC tool chain, as well as the development environment, you can look at my previous steps.

Also have to compile a good kernel, the general Development Board are brought, now I do not know how to configure the kernel, only in accordance with the development of the default to compile the board, compiled before the need to compile uboot, suggest like me the novice to learn to drive to write, and slowly to learn the configuration of the kernel cut, I think this is definitely a very simple process, Just did not find the doorway, and so I will be sure to share with you, if there is a meeting can teach me, in the next grateful.

The path to my embedded kernel compilation is:/HOME/CFAN/LINUX/LINUX-3.0.1/, this will be used later.

Today I'm going to teach you to use eclipse to develop one of the simplest drivers, led drivers, in fact, using eclipse to compile this simple driver may seem a bit cumbersome, and if it's a big project I think the advantages of an integrated development environment will be reflected, and Eclipse's editor interface is more friendly , just like RVDS4.0.


2. Set up the drive project, setting eclipse

Open Eclipse

You can create a shortcut key to eclipse on your desktop, or go to Eclipse's directory./eclipse can be started, I set up Eclipse's global variables, so I just need to enter eclipse in the terminal to start, the following figure


It is recommended that the project directory be selected in the NFS-shared directory, so that the driver or the execution program can be loaded from the Development Board, and my choice is in the nfs6410 share directory.

Create a new C project, empty project


Continue to the next step, until the next figure, fill in the path of your ARM-LINUX-GCC.


Click Finish when Setup is complete.

To this step of the new project completed, at this time there are important to do, do not rush to add. c files. Above the project right button, attributes, to C + + general---->code analysis----> Paths and Symbols


Click exportsettings below to export the settings to an XML file. My word is on the top of the table, this is random.

Click OK application exit.

Open the. xml file in the location where you just saved it, open it with a text editor, on my desktop, right click, and use a text editor to open


Now we also need to add the macro definition in autoconf.h to eclipse and perform the following steps

Open the kernel of this directory include/generated/this according to the personal situation, mine is cd/home/cfan/linux/linux-3.0.1/include/generated/, another open a terminal CD to this directory


In just this terminal to execute

[CPP] view plain copy cat autoconf.h |grep define |awk ' {print ' <macro><name> ' $ ' </name>< Value> "$" </value></macro> "} ' > Symbol.xml
Now open this directory/home/cfan/linux/linux-3.0.1/include/generated, there will be one more file


Open Symbol.xml This file with a text editor


Now that the text editor has two XML files open, open the XML file that you exported eclipse to, you need to add a line of code between the two lines (if there are two, the one below)

[HTML] view plain copy <language name= "C source file" > </language> add

[HTML] view plain copy <macro><name>__kernel__</name><value>1</value></ Macro>
The following figure


After adding



Then copy all the code from the Symbol.xml file to the

[HTML] view plain copy <macro><name>__kernel__</name><value>1</value></ Macro> the next line of this line, as shown below


On the top of a

Related Article

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.