Thanks, I tried to compile my module fine and it works.
On 6/27/07, Jan Kiszka <[EMAIL PROTECTED]> wrote:
Perrine Martignoni wrote:
> Hello,
>
> Currently, I use xenomai 2.3.1 on an ARM9.
> I try to cross compile a module for my kernel and I don't find the right
> way
> to do it, I guess.
>
> Here is the code (it's to put the led off and on) :
>
> #include <rtdm/rtdm_driver.h>
> MODULE_LICENSE("GPL");
>
> rtdm_task_t heartbeat_task;
> int end = 0;
>
> #define HEARTBEAT_PERIOD 100000000 /* 100 ms */
> void heartbeat(void *cookie)
> {
> int state = 0;
> int led_state[] = { 0, 1 };
> while (!end) {
> rtdm_task_wait_period();
>
> at91_set_gpio_value(AT91_PIN_PB2,led_state[state++]);
>
> if (state > 1)
> state = 0;
> }
> }
>
> int init_module(void)
> {
>
> leds_init();
> return rtdm_task_init(&heartbeat_task, "heartbeat", heartbeat, NULL,99,
> HEARTBEAT_PERIOD);
> }
>
> void cleanup_module(void)
> {
> end = 1;
> rtdm_task_join_nrt(&heartbeat_task, 100);
> at91_led_off(AT91_PIN_PB2);
> }
>
> And here is my Makefile :
>
> CFLAGS = -g -D__KERNEL__ -DMODULE -I/usr/xenomai_arm-2.3.1uClibc/include
>
> LDFLAGS = -D__KERNEL__ -DMODULE
>
> test:test_leds.o
>
> ld -r -o test.ko -L/usr/xenomai_arm-2.3.1uClibc/lib -lnative -lrtdm
> test_leds.o
>
> test_leds.o:test_leds.c
>
> arm-linux-gcc $(CFLAGS) -c test_leds.c
>
>
> When I compile, I have a lot of errors whose the begin is :
>
>
> In file included from
> /usr/src/ELDK_arm/usr/../arm/usr/include/linux/capability.h:45,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/sched.h:46,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/ptrace.h:81,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/asm/system.h:28,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/asm/bitops.h:23,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/bitops.h:9,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/asm/atomic.h:29,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/rtdm/rtdm_driver.h:33,
>
> from test_leds.c:21:
>
> /usr/src/ELDK_arm/usr/../arm/usr/include/linux/spinlock.h:280: error:
parse
> error before '*' token
>
> In file included from
> /usr/src/ELDK_arm/usr/../arm/usr/include/linux/jiffies.h:4,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/sched.h:51,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/ptrace.h:81,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/asm/system.h:28,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/asm/bitops.h:23,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/bitops.h:9,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/asm/atomic.h:29,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/rtdm/rtdm_driver.h:33,
>
> from test_leds.c:21:
>
> /usr/src/ELDK_arm/usr/../arm/usr/include/linux/calc64.h: In function
> 'do_div_llr':
>
> /usr/src/ELDK_arm/usr/../arm/usr/include/linux/calc64.h:25: error: parse
> error before '__asmeq'
>
> In file included from
> /usr/src/ELDK_arm/usr/../arm/usr/include/linux/sched.h:51,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/linux/ptrace.h:81,
>
> from /usr/xenomai_arm-2.3.1uClibc/include/asm/system.h:28,
>
> from /usr/src/ELDK_arm/usr/../arm/usr/include/asm/bitops.h:23,
>
>
>
> I think it's a problem of option in the Makefile but I don't see. It's
the
> first time I do a module for Linux so ...
Have you seen this version of "hearbeat" already?
http://svn.gna.org/viewcvs/xenomai/trunk/examples/rtdm/driver-api/
It's now prepared to handle more than just x86 keyboards. Maybe you want
to put your LED show into this framework as well.
You can build it with the provided Makefile, calling "make
KSRC=<kernel-srcdir> XENO=<xenomai-userland-instdir> CROSS_COMPILE=..
ARCH=...".
Jan
_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help