Segmentation fault with user-space binary
Hi
I get a segmentation fault when I run my user-space RT app (native skin). I did the following steps:
- Cross-Compiled the Kernel with Xenomai support for an i386 target.
- I Cross - Compiled Xenomai with uClibc: run ./configure using the --host=i386-linux-uclibc option, and using the new configure.in I read about in the uClibC discussion.
- I wrote a test program that includes <native/task.h> and <native/timer.h>.
- I then got this segmentation faults and I reduced my program to not using xenomai and only printing something. I igured out that the "-lnative" lib directive in the makefile was causing the problem. Do you know what might be the problem??
Thanks!
Rodolfo Bamberg
Here's my makefile:
obj-m := hallo.o rt_process.o
RTAI_INCLUDE_DIR
:=/home/rodolfo/kernel/linux-2.6.20-xenomai/include/xenomai
XENOMAI_INCLUDE_DIR_USP
:=/home/rodolfo/xenomai/xenomai-2.3.1/src/include
XENOMAI_INCLUDE_DIR_USP2:=/home/rodolfo/xenomai/xenomai-2.3.1/include
XENOMAI_INCLUDE_LIB_USP :=/tftpboot/192.168.0.2/usr/xenomai/libdefault:
i386-linux-uclibc-gcc -I$(XENOMAI_INCLUDE_DIR_USP)
-I$(XENOMAI_INCLUDE_DIR_USP2) -lnative -L$(XENOMAI_INCLUDE_LIB_USP) -o rt_process_user rt_process_user.c
chmod a+x rt_process_user
clean:
rm -f *.mod.c *.o *.ko rt_process
Quoted 4 lines · Rodolfo Bamberg
Hi
I get a segmentation fault when I run my user-space RT app (native skin). I did the following steps:
- Cross-Compiled the Kernel with Xenomai support for an i386 target.
Quoted 8 lines
- I Cross - Compiled Xenomai with uClibc: run ./configure using the --host=i386-linux-uclibc option, and using the new configure.in I read about in the uClibC discussion.
- I wrote a test program that includes <native/task.h> and <native/timer.h>.
- I then got this segmentation faults and I reduced my program to not using xenomai and only printing something. I igured out that the "-lnative" lib directive in the makefile was causing the problem.
Looks like the init code of libnative that is executed automatically on program start is involved here.
Quoted 1 line
Do you know what might be the problem??
Could you attach gdb to your program and check where it segfaults precisely? Also, does the same crash happens with "latency", the Xenomai benchmark tool based on Native services?
Quoted 8 lines
Thanks!
Rodolfo Bamberg
Here's my makefile:
obj-m := hallo.o rt_process.o
RTAI_INCLUDE_DIR
That looks like legacy. ;)
Quoted 9 lines
:=/home/rodolfo/kernel/linux-2.6.20-xenomai/include/xenomai
XENOMAI_INCLUDE_DIR_USP
:=/home/rodolfo/xenomai/xenomai-2.3.1/src/includeXENOMAI_INCLUDE_DIR_USP2:=/home/rodolfo/xenomai/xenomai-2.3.1/include XENOMAI_INCLUDE_LIB_USP :=/tftpboot/192.168.0.2/usr/xenomai/libdefault:
Quoted 9 lines
i386-linux-uclibc-gcc -I$(XENOMAI_INCLUDE_DIR_USP)-I$(XENOMAI_INCLUDE_DIR_USP2) -lnative -L$(XENOMAI_INCLUDE_LIB_USP) -o
rt_process_userrt_process_user.c
chmod a+xrt_process_userclean:
rm -f *.mod.c *.o *.ko rt_process
Jan
I tried to use latency and got this. Am I missing something within the Kernel? I didn't find an option for TSC. I use the 2.6.20.4 kernel
/usr/bin $ latency
Xenomai: incompatible feature set (required="sep tsc", present="sep", missing="tsc").
Quoted 64 lines · Jan Kiszka
Quoted 4 lines · Rodolfo Bamberg
Hi
I get a segmentation fault when I run my user-space RT app (native skin). I did the following steps:
- Cross-Compiled the Kernel with Xenomai support for an i386 target.Quoted 9 lines
- I Cross - Compiled Xenomai with uClibc: run ./configure using the --host=i386-linux-uclibc option, and using the new configure.in I read about in the uClibC discussion.
- I wrote a test program that includes <native/task.h> and <native/timer.h>.
- I then got this segmentation faults and I reduced my program to not using xenomai and only printing something. I igured out that the "-lnative" lib directive in the makefile was causing the problem.Looks like the init code of libnative that is executed automatically on program start is involved here.
Quoted 2 lines
Do you know what might be the problem??
Could you attach gdb to your program and check where it segfaults precisely? Also, does the same crash happens with "latency", the Xenomai benchmark tool based on Native services?
Quoted 9 lines
Thanks!
Rodolfo Bamberg
Here's my makefile:
obj-m := hallo.o rt_process.o
RTAI_INCLUDE_DIRThat looks like legacy. ;)
Quoted 9 lines
:=/home/rodolfo/kernel/linux-2.6.20-xenomai/include/xenomai
XENOMAI_INCLUDE_DIR_USP
:=/home/rodolfo/xenomai/xenomai-2.3.1/src/includeXENOMAI_INCLUDE_DIR_USP2:=/home/rodolfo/xenomai/xenomai-2.3.1/include XENOMAI_INCLUDE_LIB_USP :=/tftpboot/192.168.0.2/usr/xenomai/libdefault:
Quoted 10 lines
i386-linux-uclibc-gcc -I$(XENOMAI_INCLUDE_DIR_USP)-I$(XENOMAI_INCLUDE_DIR_USP2) -lnative -L$(XENOMAI_INCLUDE_LIB_USP) -o
rt_process_userrt_process_user.c
chmod a+xrt_process_userclean:
rm -f *.mod.c *.o *.ko rt_processJan
Quoted 7 lines · Rodolfo Bamberg
I tried to use latency and got this. Am I missing something within the Kernel? I didn't find an option for TSC. I use the 2.6.20.4 kernel
/usr/bin$ latency
Xenomai: incompatible feature set (required="sep tsc", present="sep", missing="tsc").
Make sure your kernel config contains CONFIG_M586TSC or better - or build the user space part with --disable-x86-tsc (but only if your hardware is really predating any Pentium class CPU).
Jan
I recompiled the kernel with TSC and latency works. The native app still throws a segmentation fault. I should debug it
Quoted 18 lines · Jan Kiszka
Quoted 8 lines · Rodolfo Bamberg
I tried to use latency and got this. Am I missing something within the Kernel? I didn't find an option for TSC. I use the 2.6.20.4 kernel
/usr/bin$ latency
Xenomai: incompatible feature set (required="sep tsc", present="sep", missing="tsc").Make sure your kernel config contains
CONFIG_M586TSCor better - or build the user space part with --disable-x86-tsc (but only if your hardware is really predating any Pentium class CPU).Jan
I just can't figure out: If latency works, and it uses the native skin, why does including libnative throw a segmantation fault?
Quoted 18 lines · Jan Kiszka
Quoted 8 lines · Rodolfo Bamberg
I tried to use latency and got this. Am I missing something within the Kernel? I didn't find an option for TSC. I use the 2.6.20.4 kernel
/usr/bin$ latency
Xenomai: incompatible feature set (required="sep tsc", present="sep", missing="tsc").Make sure your kernel config contains
CONFIG_M586TSCor better - or build the user space part with --disable-x86-tsc (but only if your hardware is really predating any Pentium class CPU).Jan
Quoted 2 lines · Rodolfo Bamberg
I just can't figure out: If latency works, and it uses the native skin, why does including libnative throw a segmantation fault?
Have you tried to attach gdb?
What toolchain do you use precisely? How to regenerate it?
Jan
I use buildroot, but cross-compiled apps with shared libs work fine, like busybox
Quoted 13 lines · Jan Kiszka
Quoted 3 lines · Rodolfo Bamberg
I just can't figure out: If latency works, and it uses the native skin, why does including libnative throw a segmantation fault?
Have you tried to attach gdb?
What toolchain do you use precisely? How to regenerate it?
Jan
Quoted 3 lines · Rodolfo Bamberg
I just can't figure out: If latency works, and it uses the native skin, why does including libnative throw a segmantation fault?
Do you have Xenomai support built in-kernel or in external modules? How do you run your application and latency (i.e. do you actually launch the "latency"'s executable)?
Probably, it shouldn't be a case (I don't remember all the installation/runtime details by heart any more) but be sure the xenomai modules are loaded by the moment your application starts.
Although, I'd expect some more user-friendly behavior from the libnative in such a case.. so maybe it's not a case.
Get a core dump when it crushes and feed it to "gdb".. maybe you'll have some relevant bits from the stacktrace.
Signature · 2 lines
Best regards, Dmitry Adamushko
Quoted 13 lines · Dmitry Adamushko
Quoted 3 lines · Rodolfo Bamberg
I just can't figure out: If latency works, and it uses the native skin, why does including libnative throw a segmantation fault?
Do you have Xenomai support built in-kernel or in external modules? How do you run your application and latency (i.e. do you actually launch the "latency"'s executable)?
Probably, it shouldn't be a case (I don't remember all the installation/runtime details by heart any more) but be sure the xenomai modules are loaded by the moment your application starts.
Quoted 7 lines
Although, I'd expect some more user-friendly behavior from the libnative in such a case.. so maybe it's not a case.
Get a core dump when it crushes and feed it to "gdb".. maybe you'll have some relevant bits from the stacktrace.
Xenomai support is built-in within the Kernel. Latency works for both Kernel and User-Space modes, as an executable. Is there any other way to use latency? as a kernel loadable module? I will try to bind-statically everything with Xenomai support to the Kernel and see if it makes a change. If not I'll try to cross-debug my app.