arm-linux-gcc and linux 2.6.32

fred_from_france
Hello,

I would like to understand the likn between "arm-linux-gcc" and the
"linux.2.6.32" kernel...

I install successfully "arm-linux-gcc" and i'm able to compile and run the
examples.
I install and re-compile the linux kernel ( i need gpio ports ) and it was
also good ( i make a zImage that run ).

For me, in the linux kernel, there is some specificty for the mini2440 (
for me know as BSP ). In the arm-linux-gcc, there is no specificity.

My question is how to connect compiler and specific header for gpio ( by
using for example "s3c2410_gpio_setpin, s3c2410_gpio_getpin and
s3c2410_gpio_cfgpin" functions ...

Please can you help me ?

Fred

davef
How did you enable gpio support?  sysfs?

If so,

1. I would verify that /sys/class/gpio exists
2. Then verify that you can turn one gpio (ie one of the on-board LEDs on
and off.  Search <gpio> on this site for the method (echo ...).
3. Read http://www.avrfreaks.net/wiki/index.php/Documentation:Linux/GPIO

fred_from_france
Hello and thank you for your answer...
but my question was to an other point :

I dont know how to include linux kernel library into my application : for
example, if i make a small test software using "s3c2410_gpio_setpin", 
"s3c2410_gpio_setpin" will be unknow because i need to include something !
but what !????

Thank you for your help

davef
How are planning to "talk" to the GPIO?  From user space or direct kernel
calls?

The example code on the DVD shows you how to talk to gpio via directs calls
to the kernel.

The tutorial tells you how to do it using sysfs.

As far as I am aware there is no "library" to be included.  If you do a
Google search (left hand Search button) you should find examples of how to
write a C program to call those functions.

davef
This might be more helpful:

http://members.cox.net/ebrombaugh1/embedded/mini2440/index.html

fred_from_france
Hi davef,

Thank you for your answer, but i'm still not able to compile a sample
application that drive multi-gpio with the function "s3c2410_gpio_setpin"

I include some header that i found on the kernel i re-compile (
linux/arch/arm/mach-s3c2440 ) but i got a lot of compiling errors.


I would like to use this function ( "s3c2410_gpio_setpin" : direct kernel
call : isn't it ??? ) instead of user space ( fopen("/dev/.... : isn't it
??? ), to increase gpio speed : my application need to drive Gpio at 10
Mhz, but i'm not sure that i am in the right way ....

Have you some advices please ?

Thx
Fred

davef
Fred,

I could be wrong, but I thought this is an example of direct calls to the
kernel using ioctl.h

From the DVD
***

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <sys/ioctl.h>

int main(int argc, char **argv)
{
  int on;
  int led_no;
  int fd;
  if (argc != 3 || sscanf(argv[1], "%d", &led_no) != 1 ||
sscanf(argv[2],"%d", &on) != 1 ||
      on < 0 || on > 1 || led_no < 0 || led_no > 3) {
    fprintf(stderr, "Usage: leds led_no 0|1\n");
    exit(1);
  }
  fd = open("/dev/leds0", 0);
  if (fd < 0) {
    fd = open("/dev/leds", 0);
  }
  if (fd < 0) {
    perror("open device leds");
    exit(1);
  }
  ioctl(fd, on, led_no);
  close(fd);
  return 0;
}
***

Can't get to

http://lxr.linux.no/linux

but I recall seeing what you are referring to in the GPIO documentation,
say under one of the recent kernel versions.

Sorry, but I haven't used the GPIO on this machine yet.

Dave

osama
Dear Fred,
 Did u solve your problem? i'm facing up to it.can u share with me?
  thanks.nice day

Mariusz
Hi everyone,
I also have a similar problem. 
I have a program main.c and I'm useing a cellular modem that my embedded
computer has.  
The code seems to be good. There is only a few lines but I hava a problem
with compiling it. 
in instruction is :
compilation for applications:

#arm-linux-gcc -o main -Wall -g -O2 main.c
#arm-linux-strip -s main
#arm-linux-gcc -ggdb -o main-debug main.c

after first line I had this:
[root@mariusz moxalib]# arm-linux-gcc -o main -Wall -g -O2 main.c
main.c: In function ‘main’:
main.c:33: warning: unused variable ‘k’
/tmp/ccKJlaZm.o: In function `main':
/home/mariusz/moxalib/main.c:35: undefined reference to
`cellular_modem_open'
/home/mariusz/moxalib/main.c:39: undefined reference to
`cellular_modem_sms_recv_message'
collect2: ld returned 1 exit status
[root@mariusz moxalib]# 

What is the reason of such a problem ? Can anybody help me ? 

Functions cellular_modem_open and cellular_modem_sms_recv_message are
defined in main.c 

I don't understand it. 
Thank you.

davef
main.c:33: warning: unused variable ‘k’

Just that . . . main.c is not using the variable k.  k is often used as a
loop counter so maybe a for loop has been removed.

Those functions may be defined in main.c but where are they actually
located?  What #includes have you got at the top of the file?