All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] regarding ARMv.s error
@ 2011-06-21 13:11 suresh reddy
  2011-06-21 14:02 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 12+ messages in thread
From: suresh reddy @ 2011-06-21 13:11 UTC (permalink / raw)
  To: Xenomai help

[-- Attachment #1: Type: text/plain, Size: 2578 bytes --]

Dear all,


i have downloaded ipipe patched kernel from xenomai git .and applied the
patches to the xenomai 2.5.6 sources as mentioned .

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build
omap2plus_defconfig
make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build menuconfig

i just removed all the other boards from TI except Pandaboard. I did not
touched any other options.

then I run the command

make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build uImage

then it giving me the error as below

test06:/home/balijepalli/omap4/ipipe-gch# make ARCH=arm
CROSS_COMPILE=arm-none-linux-gnueabi- O=/home/balijepalli/omap4/build uImage
  GEN     /home/balijepalli/omap4/build/Makefile
scripts/kconfig/conf --silentoldconfig Kconfig
  Using /home/balijepalli/omap4/ipipe-gch as source for kernel
  GEN     /home/balijepalli/omap4/build/Makefile
  CHK     include/linux/version.h
  CHK     include/generated/utsrelease.h
make[2]: `include/generated/mach-types.h' is up to date.
  CC      arch/arm/kernel/asm-offsets.s
  GEN     include/generated/asm-offsets.h
  CALL    /home/balijepalli/omap4/ipipe-gch/scripts/checksyscalls.sh
  CC      init/main.o
  CHK     include/generated/compile.h
  CC      init/version.o
  CC      init/do_mounts.o
  CC      init/do_mounts_rd.o
  CC      init/do_mounts_initrd.o
  LD      init/mounts.o
  CC      init/initramfs.o
  CC      init/calibrate.o
  LD      init/built-in.o
  CC      arch/arm/nwfpe/fpa11_cpdt.o
  CC      arch/arm/nwfpe/fpmodule.o
  AS      arch/arm/nwfpe/entry.o
  LD      arch/arm/nwfpe/nwfpe.o
  LD      arch/arm/nwfpe/built-in.o
  CC      arch/arm/vfp/vfpmodule.o
  AS      arch/arm/vfp/entry.o
  AS      arch/arm/vfp/vfphw.o
  CC      arch/arm/vfp/vfpsingle.o
  CC      arch/arm/vfp/vfpdouble.o
  LD      arch/arm/vfp/vfp.o
  LD      arch/arm/vfp/built-in.o
  CC      arch/arm/kernel/elf.o
  AS      arch/arm/kernel/entry-armv.o
/home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S: Assembler
messages:
/home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
undefined symbol `.L99973' in operation setting `up_b_offset'
/home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
undefined symbol `.L99973' in operation setting `up_b_offset'
/home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
local label `"9997" (instance number 3 of a fb label)' is not defined
make[2]: *** [arch/arm/kernel/entry-armv.o] Error 1
make[1]: *** [arch/arm/kernel] Error 2
make: *** [sub-make] Error 2



Suresh balijepalli
Rosenehim,Baveria.

[-- Attachment #2: Type: text/html, Size: 3536 bytes --]

^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] regarding ARMv.s error
  2011-06-21 13:11 [Xenomai-help] regarding ARMv.s error suresh reddy
@ 2011-06-21 14:02 ` Gilles Chanteperdrix
  2011-06-22  7:19   ` Gilles Chanteperdrix
  0 siblings, 1 reply; 12+ messages in thread
From: Gilles Chanteperdrix @ 2011-06-21 14:02 UTC (permalink / raw)
  To: suresh reddy; +Cc: Xenomai help

On 06/21/2011 03:11 PM, suresh reddy wrote:
> Dear all,
> 
> 
> i have downloaded ipipe patched kernel from xenomai git .and applied the
> patches to the xenomai 2.5.6 sources as mentioned .
> 
> make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build
> omap2plus_defconfig
> make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build menuconfig
> 
> i just removed all the other boards from TI except Pandaboard. I did not
> touched any other options.
> 
> then I run the command
> 
> make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build uImage
> 
> then it giving me the error as below
> 
> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S: Assembler
> messages:
> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
> undefined symbol `.L99973' in operation setting `up_b_offset'
> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
> undefined symbol `.L99973' in operation setting `up_b_offset'
> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
> local label `"9997" (instance number 3 of a fb label)' is not defined
> make[2]: *** [arch/arm/kernel/entry-armv.o] Error 1
> make[1]: *** [arch/arm/kernel] Error 2
> make: *** [sub-make] Error 2

Disable SMP kernel boot on UP system, you do not need it for OMAP4,
since OMAP4 is an SMP system.

-- 
					    Gilles.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] regarding ARMv.s error
  2011-06-21 14:02 ` Gilles Chanteperdrix
@ 2011-06-22  7:19   ` Gilles Chanteperdrix
  2011-06-22  8:43     ` [Xenomai-help] rt_dev_ioctl David Wiebe
  0 siblings, 1 reply; 12+ messages in thread
From: Gilles Chanteperdrix @ 2011-06-22  7:19 UTC (permalink / raw)
  To: suresh reddy; +Cc: Xenomai help

On 06/21/2011 04:02 PM, Gilles Chanteperdrix wrote:
> On 06/21/2011 03:11 PM, suresh reddy wrote:
>> Dear all,
>>
>>
>> i have downloaded ipipe patched kernel from xenomai git .and applied the
>> patches to the xenomai 2.5.6 sources as mentioned .
>>
>> make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build
>> omap2plus_defconfig
>> make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build menuconfig
>>
>> i just removed all the other boards from TI except Pandaboard. I did not
>> touched any other options.
>>
>> then I run the command
>>
>> make ARCH=arm CROSS_COMPILE=arm-none-linux-gnueabi- O=../build uImage
>>
>> then it giving me the error as below
>>
>> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S: Assembler
>> messages:
>> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
>> undefined symbol `.L99973' in operation setting `up_b_offset'
>> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
>> undefined symbol `.L99973' in operation setting `up_b_offset'
>> /home/balijepalli/omap4/ipipe-gch/arch/arm/kernel/entry-armv.S:1407: Error:
>> local label `"9997" (instance number 3 of a fb label)' is not defined
>> make[2]: *** [arch/arm/kernel/entry-armv.o] Error 1
>> make[1]: *** [arch/arm/kernel] Error 2
>> make: *** [sub-make] Error 2
> 
> Disable SMP kernel boot on UP system, you do not need it for OMAP4,
> since OMAP4 is an SMP system.
> 

It turns out the SMP on UP option can be enabled. Please try the .config
I use:
http://sisyphus.hd.free.fr/~gilles/omap4_panda_config

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* [Xenomai-help] rt_dev_ioctl
  2011-06-22  7:19   ` Gilles Chanteperdrix
@ 2011-06-22  8:43     ` David Wiebe
  2011-06-22  8:57       ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: David Wiebe @ 2011-06-22  8:43 UTC (permalink / raw)
  To: xenomai

Hello,

I'm re-writing my code to work with xenomai and I don't know how to get 
rt_dev_ioctl to compile in my program.

#include <rtdk.h> in my program doesn't help


david@domain.hid$ 
arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS 
xenomai-spi-eth-00002.c $LDFLAGS -I 
/home/david/122720101858-beagleboard-working-set/kernel/linux/include/
xenomai-spi-eth-00002.c: In function 'main':
xenomai-spi-eth-00002.c:137: warning: implicit declaration of function 
'rt_dev_open'
xenomai-spi-eth-00002.c:145: warning: implicit declaration of function 
'rt_dev_ioctl'
/tmp/ccZErCuj.o: In function `main':
xenomai-spi-eth-00002.c:(.text+0x2c4): undefined reference to `rt_dev_open'
xenomai-spi-eth-00002.c:(.text+0x318): undefined reference to `rt_dev_ioctl'
collect2: ld returned 1 exit status


David



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22  8:43     ` [Xenomai-help] rt_dev_ioctl David Wiebe
@ 2011-06-22  8:57       ` Philippe Gerum
  2011-06-22 16:19         ` David Wiebe
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2011-06-22  8:57 UTC (permalink / raw)
  To: David Wiebe; +Cc: xenomai

On Wed, 2011-06-22 at 01:43 -0700, David Wiebe wrote:
> Hello,
> 
> I'm re-writing my code to work with xenomai and I don't know how to get 
> rt_dev_ioctl to compile in my program.
> 
> #include <rtdk.h> in my program doesn't help


#include <rtdm/rtdm.h>

> 
> david@domain.hid$ 
> arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS 
> xenomai-spi-eth-00002.c $LDFLAGS -I 
> /home/david/122720101858-beagleboard-working-set/kernel/linux/include/
> xenomai-spi-eth-00002.c: In function 'main':
> xenomai-spi-eth-00002.c:137: warning: implicit declaration of function 
> 'rt_dev_open'
> xenomai-spi-eth-00002.c:145: warning: implicit declaration of function 
> 'rt_dev_ioctl'
> /tmp/ccZErCuj.o: In function `main':
> xenomai-spi-eth-00002.c:(.text+0x2c4): undefined reference to `rt_dev_open'
> xenomai-spi-eth-00002.c:(.text+0x318): undefined reference to `rt_dev_ioctl'
> collect2: ld returned 1 exit status
> 
> 
> David
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22  8:57       ` Philippe Gerum
@ 2011-06-22 16:19         ` David Wiebe
  2011-06-22 16:28           ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: David Wiebe @ 2011-06-22 16:19 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 11-06-22 01:57 AM, Philippe Gerum wrote:
Still not compiling.

> On Wed, 2011-06-22 at 01:43 -0700, David Wiebe wrote:
>> Hello,
>>
>> I'm re-writing my code to work with xenomai and I don't know how to get
>> rt_dev_ioctl to compile in my program.
>>
>> #include<rtdk.h>  in my program doesn't help
>
> #include<rtdm/rtdm.h>
>
>> david@domain.hid$
>> arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS
>> xenomai-spi-eth-00002.c $LDFLAGS -I
>> /home/david/122720101858-beagleboard-working-set/kernel/linux/include/
>> xenomai-spi-eth-00002.c: In function 'main':
>> xenomai-spi-eth-00002.c:137: warning: implicit declaration of function
>> 'rt_dev_open'
>> xenomai-spi-eth-00002.c:145: warning: implicit declaration of function
>> 'rt_dev_ioctl'
>> /tmp/ccZErCuj.o: In function `main':
>> xenomai-spi-eth-00002.c:(.text+0x2c4): undefined reference to `rt_dev_open'
>> xenomai-spi-eth-00002.c:(.text+0x318): undefined reference to `rt_dev_ioctl'
>> collect2: ld returned 1 exit status
>>
>>
>> David
>>
>>
>> _______________________________________________
>> Xenomai-help mailing list
>> Xenomai-help@domain.hid
>> https://mail.gna.org/listinfo/xenomai-help



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22 16:19         ` David Wiebe
@ 2011-06-22 16:28           ` Philippe Gerum
  2011-06-22 17:54             ` David Wiebe
  0 siblings, 1 reply; 12+ messages in thread
From: Philippe Gerum @ 2011-06-22 16:28 UTC (permalink / raw)
  To: David Wiebe; +Cc: xenomai

On Wed, 2011-06-22 at 09:19 -0700, David Wiebe wrote:
> On 11-06-22 01:57 AM, Philippe Gerum wrote:
> Still not compiling.
> 

Your build flags are likely wrong. Did you get them via xeno-config?

> > On Wed, 2011-06-22 at 01:43 -0700, David Wiebe wrote:
> >> Hello,
> >>
> >> I'm re-writing my code to work with xenomai and I don't know how to get
> >> rt_dev_ioctl to compile in my program.
> >>
> >> #include<rtdk.h>  in my program doesn't help
> >
> > #include<rtdm/rtdm.h>
> >
> >> david@domain.hid$
> >> arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS
> >> xenomai-spi-eth-00002.c $LDFLAGS -I
> >> /home/david/122720101858-beagleboard-working-set/kernel/linux/include/
> >> xenomai-spi-eth-00002.c: In function 'main':
> >> xenomai-spi-eth-00002.c:137: warning: implicit declaration of function
> >> 'rt_dev_open'
> >> xenomai-spi-eth-00002.c:145: warning: implicit declaration of function
> >> 'rt_dev_ioctl'
> >> /tmp/ccZErCuj.o: In function `main':
> >> xenomai-spi-eth-00002.c:(.text+0x2c4): undefined reference to `rt_dev_open'
> >> xenomai-spi-eth-00002.c:(.text+0x318): undefined reference to `rt_dev_ioctl'
> >> collect2: ld returned 1 exit status
> >>
> >>
> >> David
> >>
> >>
> >> _______________________________________________
> >> Xenomai-help mailing list
> >> Xenomai-help@domain.hid
> >> https://mail.gna.org/listinfo/xenomai-help
> 

-- 
Philippe.




^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22 16:28           ` Philippe Gerum
@ 2011-06-22 17:54             ` David Wiebe
  2011-06-22 18:00               ` Gilles Chanteperdrix
  0 siblings, 1 reply; 12+ messages in thread
From: David Wiebe @ 2011-06-22 17:54 UTC (permalink / raw)
  To: Philippe Gerum; +Cc: xenomai

On 11-06-22 09:28 AM, Philippe Gerum wrote:
> On Wed, 2011-06-22 at 09:19 -0700, David Wiebe wrote:
>> On 11-06-22 01:57 AM, Philippe Gerum wrote:
>> Still not compiling.
>>
> Your build flags are likely wrong. Did you get them via xeno-config?

Here are my build flags.

CFLAGS=`DESTDIR=/home/david/sdir 
/home/david/sdir/usr/xenomai/bin/xenomai-config --skin native --cflags`

LDFLAGS=`DESTDIR=/home/david/sdir 
/home/david/sdir/usr/xenomai/bin/xenomai-config --skin native --ldflags`



>>> On Wed, 2011-06-22 at 01:43 -0700, David Wiebe wrote:
>>>> Hello,
>>>>
>>>> I'm re-writing my code to work with xenomai and I don't know how to get
>>>> rt_dev_ioctl to compile in my program.
>>>>
>>>> #include<rtdk.h>   in my program doesn't help
>>> #include<rtdm/rtdm.h>
>>>
>>>> david@domain.hid$
>>>> arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS
>>>> xenomai-spi-eth-00002.c $LDFLAGS -I
>>>> /home/david/122720101858-beagleboard-working-set/kernel/linux/include/
>>>> xenomai-spi-eth-00002.c: In function 'main':
>>>> xenomai-spi-eth-00002.c:137: warning: implicit declaration of function
>>>> 'rt_dev_open'
>>>> xenomai-spi-eth-00002.c:145: warning: implicit declaration of function
>>>> 'rt_dev_ioctl'
>>>> /tmp/ccZErCuj.o: In function `main':
>>>> xenomai-spi-eth-00002.c:(.text+0x2c4): undefined reference to `rt_dev_open'
>>>> xenomai-spi-eth-00002.c:(.text+0x318): undefined reference to `rt_dev_ioctl'
>>>> collect2: ld returned 1 exit status
>>>>
>>>>
>>>> David
>>>>
>>>>
>>>> _______________________________________________
>>>> Xenomai-help mailing list
>>>> Xenomai-help@domain.hid
>>>> https://mail.gna.org/listinfo/xenomai-help



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22 17:54             ` David Wiebe
@ 2011-06-22 18:00               ` Gilles Chanteperdrix
  2011-06-22 18:50                 ` David Wiebe
  0 siblings, 1 reply; 12+ messages in thread
From: Gilles Chanteperdrix @ 2011-06-22 18:00 UTC (permalink / raw)
  To: David Wiebe; +Cc: xenomai

On 06/22/2011 07:54 PM, David Wiebe wrote:
> On 11-06-22 09:28 AM, Philippe Gerum wrote:
>> On Wed, 2011-06-22 at 09:19 -0700, David Wiebe wrote:
>>> On 11-06-22 01:57 AM, Philippe Gerum wrote:
>>> Still not compiling.
>>>
>> Your build flags are likely wrong. Did you get them via xeno-config?
> 
> Here are my build flags.
> 
> CFLAGS=`DESTDIR=/home/david/sdir 
> /home/david/sdir/usr/xenomai/bin/xenomai-config --skin native --cflags`
> 
> LDFLAGS=`DESTDIR=/home/david/sdir 
> /home/david/sdir/usr/xenomai/bin/xenomai-config --skin native --ldflags`

You need to obtain flags for rtdm with xeno-config --skin rtdm etc...

-- 
                                                                Gilles.


^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22 18:00               ` Gilles Chanteperdrix
@ 2011-06-22 18:50                 ` David Wiebe
  2011-06-23  3:35                   ` David Wiebe
  0 siblings, 1 reply; 12+ messages in thread
From: David Wiebe @ 2011-06-22 18:50 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai

On 11-06-22 11:00 AM, Gilles Chanteperdrix wrote:
> On 06/22/2011 07:54 PM, David Wiebe wrote:
>> On 11-06-22 09:28 AM, Philippe Gerum wrote:
>>> On Wed, 2011-06-22 at 09:19 -0700, David Wiebe wrote:
>>>> On 11-06-22 01:57 AM, Philippe Gerum wrote:
>>>> Still not compiling.
>>>>
>>> Your build flags are likely wrong. Did you get them via xeno-config?
>> Here are my build flags.
>>
>> CFLAGS=`DESTDIR=/home/david/sdir
>> /home/david/sdir/usr/xenomai/bin/xenomai-config --skin native --cflags`
>>
>> LDFLAGS=`DESTDIR=/home/david/sdir
>> /home/david/sdir/usr/xenomai/bin/xenomai-config --skin native --ldflags`
> You need to obtain flags for rtdm with xeno-config --skin rtdm etc...
>
OK,

I changed --skin native to --skin rtdm. The previous errors with 
rt_dev_open and rt_dev_ioctl are gone but now I have errors with 
rt_task_create etc. I assume I need flags for both native and rtdm. How 
might I accomplish that?





^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-22 18:50                 ` David Wiebe
@ 2011-06-23  3:35                   ` David Wiebe
  2011-06-23  6:57                     ` Philippe Gerum
  0 siblings, 1 reply; 12+ messages in thread
From: David Wiebe @ 2011-06-23  3:35 UTC (permalink / raw)
  To: xenomai

Hello,

The program included in this email compiles and runs on my beagleboard 
xm. The compiler gives no warnings or anything.

Once I prepend an ioctl call with rt_dev_, I get the following

david@domain.hid$ 
arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS 
xenomai-spi-eth-00002.c $LDFLAGS -I 
/home/david/122720101858-beagleboard-working-set/kernel/linux/include/
/tmp/cc9aLEWN.o: In function `main':
xenomai-spi-eth-00002.c:(.text+0x334): undefined reference to `rt_dev_ioctl'
collect2: ld returned 1 exit status

I'm perplexed because as I understand it including rtdm/rtdm.h should 
allow the function rt_dev_ioctl to be used.

In a previous email I received, it was suggested I change the skin to 
rtdm. I set both skin to rtdm. This gave me a different set of errors 
referencing rt_task_set_periodic and the like.


Thanks for reading this,

Sincerely,

David

CFLAGS=`DESTDIR=/home/david/sdir 
/home/david/sdir/usr/xenomai/bin/xeno-config --skin native --cflags`

LDFLAGS=`DESTDIR=/home/david/sdir 
/home/david/sdir/usr/xenomai/bin/xeno-config --skin native --ldflags`


#include <stdio.h>
#include <stdlib.h>
#include <fcntl.h>
#include <unistd.h>
#include <sys/stat.h>
#include <sys/types.h>
#include <sys/ioctl.h>
#include <signal.h>
#include <sys/mman.h>

#include <getopt.h>
#include <linux/types.h>
#include <linux/spi/spidev.h>
#include <string.h>
#include <sys/socket.h>
#include <netinet/in.h>
#include <netdb.h>

#include <native/task.h>
#include <native/timer.h>
#include <native/pipe.h>
#include <rtdk.h>
#include <rtdm/rtipc.h>
#include <rtdm/rtdm.h>
#include <rtdm/rtcan.h>

RT_TASK blink_task;

#define TIMESLEEP 1000000 /* 1 msec(ns) */

#define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
#define PORT           8080
#define HOST           "192.168.1.101"
#define DIRSIZE        8192
#define    HIGH        1
#define    LOW        0

#define HIGH_TIME    12
#define    LOW_TIME    1
#define    TIME_USEC    0

static const char *device = "/dev/spidev3.0";
static uint8_t mode;
static uint8_t bits = 8;
static uint32_t speed = 11000000;
//static uint16_t delay=1;


int fd;
FILE    *fp;
FILE    *fpx;
char    set_value[4];
int     state;
int    ret = 0;
//struct    sockaddr_in sin;
struct    sockaddr_in pin;
struct    hostent *hp;
int    sd;
char    hostname[100];
char    return_array[400];
int     i;
void blink(void *arg __attribute__((__unused__)))
{
     uint8_t tx[] = {
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
     };
     uint8_t rx[ARRAY_SIZE(tx)] = {0, };
     struct spi_ioc_transfer tr = {
         .tx_buf = (unsigned long)tx,
         .rx_buf = (unsigned long)rx,
         .len = ARRAY_SIZE(tx),
         .delay_usecs = TIME_USEC,
         .speed_hz = speed,
         .bits_per_word = bits,
     };
      rt_task_set_periodic(NULL, TM_NOW, TIMESLEEP);
     if (ret == -1)
         printf("can't set spi mode");
     while(1)
     {
         rt_task_wait_period(NULL);
     ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
     for(i = 0;i < 360;i++)
         {
         return_array[i] = 68;
         }
     return_array[359] = 0;

     if (ret < 1)
         printf("can't send spi message");

     if (send(sd, return_array, strlen(return_array), 0) == -1)
             {
             perror("send");
             exit(1);
             }
     }
}

void catch_signal() {}

int main(void)
{
     signal(SIGTERM, catch_signal);
     signal(SIGINT, catch_signal);

     /* Avoids memory swapping for this program */
     mlockall(MCL_CURRENT|MCL_FUTURE);

        fd = open(device, O_RDWR);
   //     fd = rt_dev_open(device, O_RDWR);
     if (fd < 0)
         printf("can't open device");

     mode |= SPI_CPHA;
/*
      * spi mode
      */
     ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
     if (ret == -1)
         printf("can't set spi mode");

     ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
     if (ret == -1)
         printf("can't get spi mode");

     /*
      * bits per word
      */
     ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
     if (ret == -1)
         printf("can't set bits per word");

     ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
     if (ret == -1)
         printf("can't get bits per word");

     /*
      * max speed hz
      */
     ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
     if (ret == -1)
         printf("can't set max speed hz");

     ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
     if (ret == -1)
         printf("can't get max speed hz");
     /************************************************/
     /*    Ethernet stuff                */
     /************************************************/
     strcpy(hostname,"192.168.0.101");//HOST);


     /* go find out about the desired host machine */
     if ((hp = gethostbyname(hostname)) == 0)
         {
         perror("gethostbyname");
         exit(1);
         }

     /* fill in the socket structure with host information */
     memset(&pin, 0, sizeof(pin));
     pin.sin_family = AF_INET;
     pin.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr;
     pin.sin_port = htons(PORT);

     /* grab an Internet domain socket */
     if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
         {
         perror("socket");
         exit(1);
         }

     /* connect to PORT on HOST */
     if (connect(sd,(struct sockaddr *) &pin, sizeof(pin)) == -1)
         {
         perror("connect");
         exit(1);
         }

     /* Task Creation */
     rt_task_create(&blink_task, "blinkLed", 0, 99, 0);
     rt_task_start(&blink_task, &blink, NULL);
     getchar();
     rt_task_delete(&blink_task);
     close(fd);

     return 0;
}



^ permalink raw reply	[flat|nested] 12+ messages in thread

* Re: [Xenomai-help] rt_dev_ioctl
  2011-06-23  3:35                   ` David Wiebe
@ 2011-06-23  6:57                     ` Philippe Gerum
  0 siblings, 0 replies; 12+ messages in thread
From: Philippe Gerum @ 2011-06-23  6:57 UTC (permalink / raw)
  To: David Wiebe; +Cc: xenomai

On Wed, 2011-06-22 at 20:35 -0700, David Wiebe wrote:
> Hello,
> 
> The program included in this email compiles and runs on my beagleboard 
> xm. The compiler gives no warnings or anything.
> 
> Once I prepend an ioctl call with rt_dev_, I get the following
> 
> david@domain.hid$ 
> arm-none-linux-gnueabi-gcc -o xenomai-spi-eth-00002 $CFLAGS 
> xenomai-spi-eth-00002.c $LDFLAGS -I 
> /home/david/122720101858-beagleboard-working-set/kernel/linux/include/
> /tmp/cc9aLEWN.o: In function `main':
> xenomai-spi-eth-00002.c:(.text+0x334): undefined reference to `rt_dev_ioctl'
> collect2: ld returned 1 exit status
> 
> I'm perplexed because as I understand it including rtdm/rtdm.h should 
> allow the function rt_dev_ioctl to be used.
> 
> In a previous email I received, it was suggested I change the skin to 
> rtdm. I set both skin to rtdm. This gave me a different set of errors 
> referencing rt_task_set_periodic and the like.

The proper way to build a (simple) native API based foo.c application
using the ancillary RTDM library would be this one:

CFLAGS = $(shell xeno-config --skin=native --cflags)
LDFLAGS = $(shell xeno-config --skin=native --ldflags)
CC = $(shell xeno-config --cc)

all: foo

%: %.c
	$(CC) $(CFLAGS) -o $@ $< $(LDFLAGS) -lnative -lrtdm

With the POSIX API, you would have specified --skin=posix.

RTDK is not RTDM-related, it is a set of helper routines to use in
real-time context. It currently provides rt-compatible printf(3) like
services. You get these with the additional -lrtdk spec.

> 
> 
> Thanks for reading this,
> 
> Sincerely,
> 
> David
> 
> CFLAGS=`DESTDIR=/home/david/sdir 
> /home/david/sdir/usr/xenomai/bin/xeno-config --skin native --cflags`
> 
> LDFLAGS=`DESTDIR=/home/david/sdir 
> /home/david/sdir/usr/xenomai/bin/xeno-config --skin native --ldflags`
> 
> 
> #include <stdio.h>
> #include <stdlib.h>
> #include <fcntl.h>
> #include <unistd.h>
> #include <sys/stat.h>
> #include <sys/types.h>
> #include <sys/ioctl.h>
> #include <signal.h>
> #include <sys/mman.h>
> 
> #include <getopt.h>
> #include <linux/types.h>
> #include <linux/spi/spidev.h>
> #include <string.h>
> #include <sys/socket.h>
> #include <netinet/in.h>
> #include <netdb.h>
> 
> #include <native/task.h>
> #include <native/timer.h>
> #include <native/pipe.h>
> #include <rtdk.h>
> #include <rtdm/rtipc.h>
> #include <rtdm/rtdm.h>
> #include <rtdm/rtcan.h>
> 
> RT_TASK blink_task;
> 
> #define TIMESLEEP 1000000 /* 1 msec(ns) */
> 
> #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0]))
> #define PORT           8080
> #define HOST           "192.168.1.101"
> #define DIRSIZE        8192
> #define    HIGH        1
> #define    LOW        0
> 
> #define HIGH_TIME    12
> #define    LOW_TIME    1
> #define    TIME_USEC    0
> 
> static const char *device = "/dev/spidev3.0";
> static uint8_t mode;
> static uint8_t bits = 8;
> static uint32_t speed = 11000000;
> //static uint16_t delay=1;
> 
> 
> int fd;
> FILE    *fp;
> FILE    *fpx;
> char    set_value[4];
> int     state;
> int    ret = 0;
> //struct    sockaddr_in sin;
> struct    sockaddr_in pin;
> struct    hostent *hp;
> int    sd;
> char    hostname[100];
> char    return_array[400];
> int     i;
> void blink(void *arg __attribute__((__unused__)))
> {
>      uint8_t tx[] = {
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
> 0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,0x00,
>      };
>      uint8_t rx[ARRAY_SIZE(tx)] = {0, };
>      struct spi_ioc_transfer tr = {
>          .tx_buf = (unsigned long)tx,
>          .rx_buf = (unsigned long)rx,
>          .len = ARRAY_SIZE(tx),
>          .delay_usecs = TIME_USEC,
>          .speed_hz = speed,
>          .bits_per_word = bits,
>      };
>       rt_task_set_periodic(NULL, TM_NOW, TIMESLEEP);
>      if (ret == -1)
>          printf("can't set spi mode");
>      while(1)
>      {
>          rt_task_wait_period(NULL);
>      ret = ioctl(fd, SPI_IOC_MESSAGE(1), &tr);
>      for(i = 0;i < 360;i++)
>          {
>          return_array[i] = 68;
>          }
>      return_array[359] = 0;
> 
>      if (ret < 1)
>          printf("can't send spi message");
> 
>      if (send(sd, return_array, strlen(return_array), 0) == -1)
>              {
>              perror("send");
>              exit(1);
>              }
>      }
> }
> 
> void catch_signal() {}
> 
> int main(void)
> {
>      signal(SIGTERM, catch_signal);
>      signal(SIGINT, catch_signal);
> 
>      /* Avoids memory swapping for this program */
>      mlockall(MCL_CURRENT|MCL_FUTURE);
> 
>         fd = open(device, O_RDWR);
>    //     fd = rt_dev_open(device, O_RDWR);
>      if (fd < 0)
>          printf("can't open device");
> 
>      mode |= SPI_CPHA;
> /*
>       * spi mode
>       */
>      ret = ioctl(fd, SPI_IOC_WR_MODE, &mode);
>      if (ret == -1)
>          printf("can't set spi mode");
> 
>      ret = ioctl(fd, SPI_IOC_RD_MODE, &mode);
>      if (ret == -1)
>          printf("can't get spi mode");
> 
>      /*
>       * bits per word
>       */
>      ret = ioctl(fd, SPI_IOC_WR_BITS_PER_WORD, &bits);
>      if (ret == -1)
>          printf("can't set bits per word");
> 
>      ret = ioctl(fd, SPI_IOC_RD_BITS_PER_WORD, &bits);
>      if (ret == -1)
>          printf("can't get bits per word");
> 
>      /*
>       * max speed hz
>       */
>      ret = ioctl(fd, SPI_IOC_WR_MAX_SPEED_HZ, &speed);
>      if (ret == -1)
>          printf("can't set max speed hz");
> 
>      ret = ioctl(fd, SPI_IOC_RD_MAX_SPEED_HZ, &speed);
>      if (ret == -1)
>          printf("can't get max speed hz");
>      /************************************************/
>      /*    Ethernet stuff                */
>      /************************************************/
>      strcpy(hostname,"192.168.0.101");//HOST);
> 
> 
>      /* go find out about the desired host machine */
>      if ((hp = gethostbyname(hostname)) == 0)
>          {
>          perror("gethostbyname");
>          exit(1);
>          }
> 
>      /* fill in the socket structure with host information */
>      memset(&pin, 0, sizeof(pin));
>      pin.sin_family = AF_INET;
>      pin.sin_addr.s_addr = ((struct in_addr *)(hp->h_addr))->s_addr;
>      pin.sin_port = htons(PORT);
> 
>      /* grab an Internet domain socket */
>      if ((sd = socket(AF_INET, SOCK_STREAM, 0)) == -1)
>          {
>          perror("socket");
>          exit(1);
>          }
> 
>      /* connect to PORT on HOST */
>      if (connect(sd,(struct sockaddr *) &pin, sizeof(pin)) == -1)
>          {
>          perror("connect");
>          exit(1);
>          }
> 
>      /* Task Creation */
>      rt_task_create(&blink_task, "blinkLed", 0, 99, 0);
>      rt_task_start(&blink_task, &blink, NULL);
>      getchar();
>      rt_task_delete(&blink_task);
>      close(fd);
> 
>      return 0;
> }
> 
> 
> _______________________________________________
> Xenomai-help mailing list
> Xenomai-help@domain.hid
> https://mail.gna.org/listinfo/xenomai-help

-- 
Philippe.




^ permalink raw reply	[flat|nested] 12+ messages in thread

end of thread, other threads:[~2011-06-23  6:57 UTC | newest]

Thread overview: 12+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-06-21 13:11 [Xenomai-help] regarding ARMv.s error suresh reddy
2011-06-21 14:02 ` Gilles Chanteperdrix
2011-06-22  7:19   ` Gilles Chanteperdrix
2011-06-22  8:43     ` [Xenomai-help] rt_dev_ioctl David Wiebe
2011-06-22  8:57       ` Philippe Gerum
2011-06-22 16:19         ` David Wiebe
2011-06-22 16:28           ` Philippe Gerum
2011-06-22 17:54             ` David Wiebe
2011-06-22 18:00               ` Gilles Chanteperdrix
2011-06-22 18:50                 ` David Wiebe
2011-06-23  3:35                   ` David Wiebe
2011-06-23  6:57                     ` Philippe Gerum

This is an external index of several public inboxes,
see mirroring instructions on how to clone and mirror
all data and code used by this external index.