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