Skip to contentSkip to conversation

xenomai_init does not return

DISCUSSION Yxian Yao 2 participants 3 messages Jan 5, 2023 – Jan 11, 2023

lore
Share & tools
lore

Yxian Yao

author
#0 lore raw

Hi,

The following code(xenomai_test_main.c) is compiled and run, the xenomai_init does not return. Please give me some hints!
Thanks a lot.

#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>

#include <xenomai/init.h>
#include <alchemy/task.h>

int main(int agrc, char *argv[])

{
    printf("Enter main...\n");

    int dummy_argc = 5;
    char dummy_argv0[] = "dummy";
    char dummy_argv1[] = "--session";
    char dummy_argv2[] = "xeno_test";
    char dummy_argv3[] = "--mem-pool-size";
    char dummy_argv4[20] = "256M";
    char *dummy_argv[] = {dummy_argv0, dummy_argv1, dummy_argv2, dummy_argv3, dummy_argv4, NULL}; char *const* const_dummy_argv = dummy_argv;
    xenomai_init(&dummy_argc, &const_dummy_argv);

    printf("Exit main...\n");

    return 0;
}
root@debian:/home/uih/xenomai_test/src# make clean;make
rm -f xenomai_test  xenomai_test_main.o
gcc -I/usr/include/xenomai/cobalt -I/usr/include/xenomai -D_GNU_SOURCE -D_REENTRANT -fasynchronous-unwind-tables -D__COBALT__ -I/usr/include/xenomai/alchemy -g   -c -o xenomai_test_main.o xenomai_test_main.c
gcc -o xenomai_test xenomai_test_main.o -Wl,--no-as-needed -Wl,@/usr/lib/modechk.wrappers -lalchemy -lcopperplate   -L/usr/lib -lcobalt -lmodechk -lpthread -lrt    -lfuse -pthread
root@debian:/home/uih/xenomai_test/src# 
root@debian:/home/uih/xenomai_test/src# xeno-config --info
Xenomai version: Xenomai/cobalt v3.1.1
Linux debian 5.4.133-ipipe-6-xenomai-3.1.1-20221228 #1 SMP PREEMPT Wed Dec 28 04:34:04 EST 2022 x86_64 GNU/Linux
Kernel parameters: BOOT_IMAGE=/boot/vmlinuz-5.4.133-ipipe-6-xenomai-3.1.1-20221228 root=UUID=67ce258c-ca4b-4f9e-ae59-36d2212d366d ro crashkernel=512M xenomai.supported_cpus=0xf idle=halt nosmap nmi_watchdog=panic console=ttyS0,115200n8 panic=1
I-pipe release #6 detected
Cobalt core 3.1.1 detected
Compiler: gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1) 
Build args: --prefix=/usr --includedir=/usr/include/xenomai --mandir=/usr/share/man --with-testdir=/usr/lib/xenomai/testsuite --with-core=cobalt --enable-smp --enable-tls --enable-dlopen-libs --enable-registry --enable-pshared --build x86_64-linux-gnu build_alias=x86_64-linux-gnu
root@debian:/home/uih/xenomai_test/src# 
root@debian:/home/uih/xenomai_test/src# ./xenomai_test
Enter main...
#1 lore raw
Quoted 29 lines

-----Original Message-----
From: Yxian Yao <[email protected]>
Sent: Thursday, January 5, 2023 2:52 PM
To: [email protected]
Subject: xenomai_init does not return

Hi,

The following code(xenomai_test_main.c) is compiled and run, the xenomai_init does not return.
Please give me some hints!
Thanks a lot.

#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>

#include <xenomai/init.h>
#include <alchemy/task.h>

int main(int agrc, char *argv[])

{
   printf("Enter main...\n");
Quoted 10 lines

    int dummy_argc = 5;
    char dummy_argv0[] = "dummy";
    char dummy_argv1[] = "--session";
    char dummy_argv2[] = "xeno_test";
    char dummy_argv3[] = "--mem-pool-size";
    char dummy_argv4[20] = "256M";
    char *dummy_argv[] = {dummy_argv0, dummy_argv1, dummy_argv2, dummy_argv3, dummy_argv4, NULL};
    char *const* const_dummy_argv = dummy_argv; xenomai_init(&dummy_argc, &const_dummy_argv);

You may want to pass --trace to run your xenomai_test to get more trace to debug.
But when you have not built your bin with --no-auto-init, you do not need to call xenomai_init explicitly because system may do auto init before main routine enter as mentioned in doc/asciidoc/man1/xeno-config.adoc

Regards

Hongzhan Chen

Quoted 35 lines
   printf("Exit main...\n");
   return 0;
}
root@debian:/home/uih/xenomai_test/src# make clean;make
rm -f xenomai_test  xenomai_test_main.o
gcc -I/usr/include/xenomai/cobalt -I/usr/include/xenomai -D_GNU_SOURCE -
D_REENTRANT -fasynchronous-unwind-tables -D__COBALT__ -
I/usr/include/xenomai/alchemy -g   -c -o xenomai_test_main.o
xenomai_test_main.c
gcc -o xenomai_test xenomai_test_main.o -Wl,--no-as-needed -
Wl,@/usr/lib/modechk.wrappers -lalchemy -lcopperplate   -L/usr/lib -lcobalt -
lmodechk -lpthread -lrt    -lfuse -pthread
root@debian:/home/uih/xenomai_test/src#
root@debian:/home/uih/xenomai_test/src# xeno-config --info
Xenomai version: Xenomai/cobalt v3.1.1
Linux debian 5.4.133-ipipe-6-xenomai-3.1.1-20221228 #1 SMP PREEMPT Wed
Dec 28 04:34:04 EST 2022 x86_64 GNU/Linux
Kernel parameters: BOOT_IMAGE=/boot/vmlinuz-5.4.133-ipipe-6-xenomai-
3.1.1-20221228 root=UUID=67ce258c-ca4b-4f9e-ae59-36d2212d366d ro
crashkernel=512M xenomai.supported_cpus=0xf idle=halt nosmap
nmi_watchdog=panic console=ttyS0,115200n8 panic=1
I-pipe release #6 detected
Cobalt core 3.1.1 detected
Compiler: gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
Build args: --prefix=/usr --includedir=/usr/include/xenomai --
mandir=/usr/share/man --with-testdir=/usr/lib/xenomai/testsuite --with-
core=cobalt --enable-smp --enable-tls --enable-dlopen-libs --enable-registry --
enable-pshared --build x86_64-linux-gnu build_alias=x86_64-linux-gnu
root@debian:/home/uih/xenomai_test/src#
root@debian:/home/uih/xenomai_test/src# ./xenomai_test
Enter main...
author
#2 lore raw

Hi,Hongzhan,

It is found that there is no problem after installing the fuse library.

Thanks.

Quoted 84 lines · Hongzhan
Quoted 29 lines

-----Original Message-----
From: Yxian Yao <[email protected]>
Sent: Thursday, January 5, 2023 2:52 PM
To: [email protected]
Subject: xenomai_init does not return

Hi,

The following code(xenomai_test_main.c) is compiled and run, the xenomai_init does not return.
Please give me some hints!
Thanks a lot.

#include <stdio.h>
#include <stdarg.h>
#include <string.h>
#include <stdlib.h>

#include <xenomai/init.h>
#include <alchemy/task.h>

int main(int agrc, char *argv[])

{
   printf("Enter main...\n");
Quoted 10 lines

    int dummy_argc = 5;
    char dummy_argv0[] = "dummy";
    char dummy_argv1[] = "--session";
    char dummy_argv2[] = "xeno_test";
    char dummy_argv3[] = "--mem-pool-size";
    char dummy_argv4[20] = "256M";
    char *dummy_argv[] = {dummy_argv0, dummy_argv1, dummy_argv2, dummy_argv3, dummy_argv4, NULL};
    char *const* const_dummy_argv = dummy_argv; xenomai_init(&dummy_argc, &const_dummy_argv);

You may want to pass --trace to run your xenomai_test to get more trace to debug.
But when you have not built your bin with --no-auto-init, you do not need to call xenomai_init explicitly because system may do auto init before main routine enter as mentioned in doc/asciidoc/man1/xeno-config.adoc

Regards

Hongzhan Chen

Quoted 35 lines
   printf("Exit main...\n");
   return 0;
}
root@debian:/home/uih/xenomai_test/src# make clean;make
rm -f xenomai_test  xenomai_test_main.o
gcc -I/usr/include/xenomai/cobalt -I/usr/include/xenomai -D_GNU_SOURCE -
D_REENTRANT -fasynchronous-unwind-tables -D__COBALT__ -
I/usr/include/xenomai/alchemy -g   -c -o xenomai_test_main.o
xenomai_test_main.c
gcc -o xenomai_test xenomai_test_main.o -Wl,--no-as-needed -
Wl,@/usr/lib/modechk.wrappers -lalchemy -lcopperplate   -L/usr/lib -lcobalt -
lmodechk -lpthread -lrt    -lfuse -pthread
root@debian:/home/uih/xenomai_test/src#
root@debian:/home/uih/xenomai_test/src# xeno-config --info
Xenomai version: Xenomai/cobalt v3.1.1
Linux debian 5.4.133-ipipe-6-xenomai-3.1.1-20221228 #1 SMP PREEMPT Wed
Dec 28 04:34:04 EST 2022 x86_64 GNU/Linux
Kernel parameters: BOOT_IMAGE=/boot/vmlinuz-5.4.133-ipipe-6-xenomai-
3.1.1-20221228 root=UUID=67ce258c-ca4b-4f9e-ae59-36d2212d366d ro
crashkernel=512M xenomai.supported_cpus=0xf idle=halt nosmap
nmi_watchdog=panic console=ttyS0,115200n8 panic=1
I-pipe release #6 detected
Cobalt core 3.1.1 detected
Compiler: gcc version 6.3.0 20170516 (Debian 6.3.0-18+deb9u1)
Build args: --prefix=/usr --includedir=/usr/include/xenomai --
mandir=/usr/share/man --with-testdir=/usr/lib/xenomai/testsuite --with-
core=cobalt --enable-smp --enable-tls --enable-dlopen-libs --enable-registry --
enable-pshared --build x86_64-linux-gnu build_alias=x86_64-linux-gnu
root@debian:/home/uih/xenomai_test/src#
root@debian:/home/uih/xenomai_test/src# ./xenomai_test
Enter main...