packages and architecture specific include files
Quoted 1 line · John Schimandle
#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
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
Quoted 1 line · John Schimandle
#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
Quoted 2 lines · John Schimandle
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.
Quoted 8 lines
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.
Quoted 5 lines
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.
Quoted 6 lines
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.
Quoted 4 lines
Quoted 1 line
#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
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
Quoted 1 line
"hartleys" == hartleys <[email protected]> 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.
Signature · 1 line
Bye, Peter Korsgaard