* [Buildroot] packages and architecture specific include files
@ 2008-10-15 18:33 John Schimandle
0 siblings, 0 replies; 5+ messages in thread
From: John Schimandle @ 2008-10-15 18:33 UTC (permalink / raw)
To: buildroot
I'm adding additional application software to my buildroot environment and
trying to integrated it into the system as it was designed but I'm running
into a problem and have not found any documentation that resolves this
issue. It's probably something simple.
First of all my application is trying to access the GPIO capabillities of
the processor to turn on and off various outputs to control functions on the
board. The processor is the at91sam9263 arm processor. The functions and
macros are defined in gpio.h which for this environment is located at
project_build_arm/at91sam9263ek/linux/2.6.24/include/asm/arch/gpio. This is
a symbolic link path. The actual physical path is
project_build_arm/at91sam9263ek/linux/2.6.24/include/asm/arch-arm/gpio and
I'm assuming the symbolic link is set so that packages can specify
<asm/arch/xxxx.h> and the code is more portable.
My difficulty is in setting up the package .mk file so the code will compile
and somehow I need to put a -I option with the
project_build_arm/at91sam9263ek/linux/2.6.24/include path so the gcc
compiler can find the include file. I'm assuming this goes in the package
mk file during the configure stage. I could just specify the path as a
constant but then I would have to change it every time I change to a new
linux kernel version or if buildroot changes the directory structure. There
are variables that can be used in the package .mk file like BUILD_DIR and
STAGING_DIR but these don't point to the directory I need. I'm wondering if
there is a well defined variable or set of variables that could be used to
construct the target architecture linux include file path. Or possibly there
is a buildroot configuration problem at the menuconfig level.
Documentation states that the STAGING_DIR holds include files but gpio.h was
not found here.
C Code include statement
#include <asm/arch/gpio.h>
Regards,
John
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://busybox.net/lists/buildroot/attachments/20081015/4d0e6d7e/attachment.htm
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] packages and architecture specific include files
[not found] <014301c92ef4$75909f80$6901a8c0@iguana3>
@ 2008-10-15 18:43 ` hartleys
2008-10-17 21:01 ` John Schimandle
[not found] ` <00db01c9309b$91456c80$6901a8c0@iguana3>
0 siblings, 2 replies; 5+ messages in thread
From: hartleys @ 2008-10-15 18:43 UTC (permalink / raw)
To: buildroot
On Wednesday, October 15, 2008 11:33 AM, John Schimandle wrote:
> #include <asm/arch/gpio.h>
That file is a kernel header. It shouldn't be included in userspace
code.
As an example, all the inline functions will and extern function
prototypes will not work and generate build errors if you try and use
them. Also, the other #include statements in the file are going to break
if you try to include the file.
Your probably better off just working out what you need from the file
and creating a local "API" header for your application.
Hartley
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] packages and architecture specific include files
2008-10-15 18:43 ` [Buildroot] packages and architecture specific include files hartleys
@ 2008-10-17 21:01 ` John Schimandle
[not found] ` <00db01c9309b$91456c80$6901a8c0@iguana3>
1 sibling, 0 replies; 5+ messages in thread
From: John Schimandle @ 2008-10-17 21:01 UTC (permalink / raw)
To: buildroot
Actually I found a better was to access GPIOs in user space using sysfs.
The file that registers the GPIOs for the at91sam9263ek board is a file in
the kernel named arch/arm/mach-at91/board-sam9263ek.c. This file registered
two LED GPIOs and they work fine. I'll just set up more GPIOs in the kernel
in the same way and use them from sysfs. I'll change this source file or
figure out how to create a new source file for my customer's board. The
later is probably a little harder.
The other board level functionality is also in the sysfs file system so I
can just use it directly from there.
Basically, sysfs appears to be a better way access the hardware components
of the board from a user space application.
There was one problem with the /sys directory not being in the root file
system and so the fstab mount of sysfs did not occur. I created the
directory manually in my embedded system and then sysfs mounted with no
problem and I was able to access the GPIOs. I have to go back and figure out
why /sys is not created in the root file system.
-----Original Message-----
From: hartleys [mailto:hartleys at visionengravers.com]
Sent: Wednesday, October 15, 2008 11:44 AM
To: John Schimandle; buildroot at uclibc.org
Subject: RE: [Buildroot] packages and architecture specific include files
On Wednesday, October 15, 2008 11:33 AM, John Schimandle wrote:
> #include <asm/arch/gpio.h>
That file is a kernel header. It shouldn't be included in userspace code.
As an example, all the inline functions will and extern function prototypes
will not work and generate build errors if you try and use them. Also, the
other #include statements in the file are going to break if you try to
include the file.
Your probably better off just working out what you need from the file and
creating a local "API" header for your application.
Hartley
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] packages and architecture specific include files
[not found] ` <00db01c9309b$91456c80$6901a8c0@iguana3>
@ 2008-10-17 22:00 ` hartleys
2008-10-18 13:02 ` Peter Korsgaard
0 siblings, 1 reply; 5+ messages in thread
From: hartleys @ 2008-10-17 22:00 UTC (permalink / raw)
To: buildroot
On Friday, October 17, 2008 2:02 PM, John Schimandle wrote:
> Actually I found a better was to access GPIOs in user space
> using sysfs.
Yes. With the newer kernel the sysfs interface to the gpio's is much
cleaner.
> The file that registers the GPIOs for the at91sam9263ek
> board is a file in the kernel named
> arch/arm/mach-at91/board-sam9263ek.c. This file registered
> two LED GPIOs and they work fine. I'll just set up more
> GPIOs in the kernel in the same way and use them from
> sysfs. I'll change this source file or figure out how
> to create a new source file for my customer's board.
> The later is probably a little harder.
If you are using the 2.6.27 kernel you might want to look at the export
functionality in the Sysfs interface for gpio's. I think the only gpio's
that need to be registered in the kernel are the ones it actually uses.
Just export the one you need in user space on the fly. Look at
Documentation/gpio.txt for more information.
> The other board level functionality is also in the sysfs
> file system so I can just use it directly from there.
>
> Basically, sysfs appears to be a better way access the
> hardware components of the board from a user space application.
Agree.
> There was one problem with the /sys directory not being in
> the root file system and so the fstab mount of sysfs did not
> occur. I created the directory manually in my embedded system
> and then sysfs mounted with no problem and I was able to
> access the GPIOs. I have to go back and figure out why /sys
> is not created in the root file system.
In buildroot I'm currently using a custom target/device since my setup
is a bit goofy.
You probably have the target/generic/target_busybox_skeleton selected in
your busybox config. The /sys directory is missing in that skeleton.
>> #include <asm/arch/gpio.h>
>
> That file is a kernel header. It shouldn't be included in
> userspace code.
My only point with the above comment is you shouldn't reference kernel
headers in application code.
Best of luck,
Hartley
^ permalink raw reply [flat|nested] 5+ messages in thread
* [Buildroot] packages and architecture specific include files
2008-10-17 22:00 ` hartleys
@ 2008-10-18 13:02 ` Peter Korsgaard
0 siblings, 0 replies; 5+ messages in thread
From: Peter Korsgaard @ 2008-10-18 13:02 UTC (permalink / raw)
To: buildroot
>>>>> "hartleys" == hartleys <hartleys@visionengravers.com> writes:
Hi,
hartleys> You probably have target/generic/target_busybox_skeleton
hartleys> selected in your busybox config. The /sys directory is
hartleys> missing in that skeleton.
That seems kinda broken as /etc/fstab has sysfs listed. Fixed in
r23711.
--
Bye, Peter Korsgaard
^ permalink raw reply [flat|nested] 5+ messages in thread
end of thread, other threads:[~2008-10-18 13:02 UTC | newest]
Thread overview: 5+ messages (download: mbox.gz follow: Atom feed
-- links below jump to the message on this page --
[not found] <014301c92ef4$75909f80$6901a8c0@iguana3>
2008-10-15 18:43 ` [Buildroot] packages and architecture specific include files hartleys
2008-10-17 21:01 ` John Schimandle
[not found] ` <00db01c9309b$91456c80$6901a8c0@iguana3>
2008-10-17 22:00 ` hartleys
2008-10-18 13:02 ` Peter Korsgaard
2008-10-15 18:33 John Schimandle
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox