2011-09-20 10:29:32     dist 2010R1-RC4 and xenomai

Document created by Aaronwu Employee on Aug 27, 2013
Version 1Show Document
  • View in full screen mode

2011-09-20 10:29:32     dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103460   

 

Hi!

 

Me again. Since we still have not found a solution for

 

https://blackfin.uclinux.org/gf/project/uclinux-dist/forum/?_forum_action=ForumMessageBrowse&thread_id=46417&action=ForumBrowse&forum_id=39

 

we tried the newest distro 2010R1-RC5. Even less luck here. But now we can provide a very basic test appl which leads to an immediate freeze. I hope somone can reproduce this behavior or can tell me what my mistake is.

 

The program is as simple as that:

 

main creates a rt_event and spawns two rt_threads. The first does a loop with rt_wait_event(INFINITE), the second rt_sleep and a event_signal. The system freezes immediately.

 

 

 

Its a custom BF537-0.3 board running with 600/120MHz 64MB, attached is the eclipse-project with the test-appl and the kernel-config.

 

 

 

regards, Thorsten

 

 

make all

Building file: ../main.cpp

Invoking: GCC C++ Compiler

/opt/uClinux/bfin-linux-uclibc/bin/bfin-linux-uclibc-g++ -mcpu=bf537-0.3 -I/opt/ucLinux/2010R1-RC5/blackfin-linux-dist/staging/usr/include -I/opt/ucLinux/2010R1-RC5/blackfin-linux-dist/linux-2.6.x/drivers/udaks/ -O1 -g3 -Wall -c -fmessage-length=0 -mcpu=bf537-0.2 -MMD -MP -MF"main.d" -MT"main.d" -o"main.o" "../main.cpp"

Finished building: ../main.cpp

 

Building target: allestester1

Invoking: GCC C++ Linker

/opt/uClinux/bfin-linux-uclibc/bin/bfin-linux-uclibc-g++ -L/opt/ucLinux/2010R1-RC5/blackfin-linux-dist/staging/usr/lib -o"allestester1"  ./main.o   -lpthread -lrtdm -lxenomai -lnative

Finished building target: allestester1

 

 

 

 

 

 

 

 

Linux version 2.6.34.7-ADI-2010R1 (pohlmann@z-tp-30suse102) (gcc version 4.3.5 (ADI-2010R1-RC4) ) #26 Thu Sep 15 11:37:55 CEST 2011

 

Bytes transferred = 10844247 (a57857 hex)

## Booting image at 01000000 ...

   Image Name:   bf537-2.6.34.7-ADI-2010R1

   Created:      2011-09-15   9:38:25 UTC

   Image Type:   Blackfin Linux Kernel Image (gzip compressed)

   Data Size:    10844183 Bytes = 10.3 MB

   Load Address: 00001000

   Entry Point:  00313748

   Verifying Checksum ... OK

   Uncompressing Kernel Image ... OK

Starting Kernel at = 313748

console [ttyBF0] enabled, bootconsole disabled

Calibrating delay loop... 1183.74 BogoMIPS (lpj=2367488)

Security Framework initialized

Mount-cache hash table entries: 512

Blackfin Scratchpad data SRAM: 4 KB

Blackfin L1 Data A SRAM: 16 KB (4 KB free)

Blackfin L1 Data B SRAM: 32 KB (32 KB free)

Blackfin L1 Instruction SRAM: 48 KB (32 KB free)

NET: Registered protocol family 16

Blackfin DMA Controller

uDAKS: registering device resources

            Warning: Hardware-watchdog is disabled

bio: create slab <bio-0> at 0

bfin-spi bfin-spi.0: Blackfin on-chip SPI Controller Driver, Version 1.0, regs_base@ffc00500, dma channel@7

i2c-bfin-twi i2c-bfin-twi.0: Blackfin BF5xx on-chip I2C TWI Contoller, regs_base@ffc01400

NET: Registered protocol family 2

IP route cache hash table entries: 1024 (order: 0, 4096 bytes)

TCP established hash table entries: 2048 (order: 2, 16384 bytes)

TCP bind hash table entries: 2048 (order: 3, 40960 bytes)

TCP: Hash tables configured (established 2048 bind 2048)

TCP reno registered

UDP hash table entries: 128 (order: 0, 6144 bytes)

UDP-Lite hash table entries: 128 (order: 0, 6144 bytes)

NET: Registered protocol family 1

RPC: Registered udp transport module.

RPC: Registered tcp transport module.

RPC: Registered tcp NFSv4.1 backchannel transport module.

I-pipe: Domain Xenomai registered.

Xenomai: hal/blackfin started.

Xenomai: scheduling class idle registered.

Xenomai: scheduling class rt registered.

Xenomai: real-time nucleus v2.5.3 (Hordes Of Locusts) loaded.

Xenomai: starting native API services.

Xenomai: starting POSIX services.

Xenomai: starting RTDM services.

Installing knfsd (copyright (C) 1996 okir@monad.swb.de).

msgmni has been set to 92

alg: No test for stdrng (krng)

io scheduler noop registered

io scheduler cfq registered (default)

bfin-uart: Blackfin serial driver

bfin-uart.0: ttyBF0 at MMIO 0xffc00400 (irq = 18) is a BFIN-UART

bfin-uart.1: ttyBF1 at MMIO 0xffc02000 (irq = 20) is a BFIN-UART

brd: module loaded

loop: module loaded

bfin_mii_bus: probed

bfin_mac: attached PHY driver [SMSC LAN83C185] (mii_bus:phy_addr=0:01, irq=-1, mdc_clk=2500000Hz(mdc_div=23)@sclk=120MHz)

bfin_mac bfin_mac.0: Blackfin on-chip Ethernet MAC driver, Version 1.1

rtc-bfin rtc-bfin: rtc core: registered rtc-bfin as rtc0

i2c /dev entries driver

bfin-wdt: initialized: timeout=20 sec (nowayout=0)

mmc_spi spi0.6: ASSUMING 3.2-3.4 V slot power

mmc_spi spi0.6: SD/MMC host mmc0, no DMA, no WP, no poweroff

TCP cubic registered

NET: Registered protocol family 17

mmc_spi spi0.6: can't change chip-select polarity

rtc-bfin rtc-bfin: setting system clock to 2011-09-20 14:11:06 UTC (1316527866)

mmc0: host does not support reading read-only switch. assuming write-enable.

mmc0: new SD card on SPI

mmcblk0: mmc0:0000 SU01G 968 MiB

mmcblk0:

p1 p2 p3 p4

dma_alloc_init: dma_page @ 0x030d6000 - 256 pages at 0x03f00000

IP-Config: Complete:

     device=eth0, addr=192.168.5.33, mask=255.255.248.0, gw=192.168.0.254,

     host=bf537-udaks-linux, domain=, nis-domain=(none),

     bootserver=192.168.6.34, rootserver=192.168.6.34, rootpath=

Freeing unused kernel memory: 13680k freed

 

config

allestester1.tar.gz

TranslateQuoteReplyEditDelete

 

 

2011-09-20 10:40:49     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103461   

 

Hm, file not found error for the attachments?

 

allestester1.tar.gz

TranslateQuoteReplyEditDelete

 

 

2011-09-20 10:45:26     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103462   

 

tried again...

 

config

allestester1.tar.gz

TranslateQuoteReplyEditDelete

 

 

2011-09-20 10:47:54     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103463   

 

OK, plain text then...

 

 

 

#include "stdio.h"

#include <unistd.h>

#include <sys/mman.h>

#include <rtdm/rtdm.h>

#include <native/task.h>

#include <native/timer.h>

#include <native/event.h>

#include <native/intr.h>

#include <stdlib.h>

 

static RT_TASK task1, task2;

static RT_EVENT event __attribute__ ((l1_data));

 

static void th1(void* p)  __attribute__ ((l1_text));

static void th1(void* p)

{

    RT_EVENT ev;

 

    int ret = rt_event_bind(&ev,"at_evt",TM_NONBLOCK);

    if(ret)

    {

        printf("bind at_evt failed: %s\r\n",strerror(-ret));

        exit(1);

    }

 

    unsigned long ix;

 

    do

    {

        int e = rt_event_wait(&ev,(unsigned long)-1,&ix,EV_ANY,TM_INFINITE);

        if(e)

        {

            printf("at_evt failed: %s\r\n",strerror(-e));

        }

 

        ix = 0;

 

        rt_event_clear(&ev,(unsigned long)-1,0L);

 

        printf("evt\r\n");

 

 

    }while(1);

}

 

static void th2(void* p)  __attribute__ ((l1_text));

static void th2(void* p)

{

    RT_EVENT ev;

 

    int ret = rt_event_bind(&ev,"at_evt",TM_NONBLOCK);

    if(ret)

    {

        printf("bind at_evt failed: %s\r\n",strerror(-ret));

        exit(1);

    }

 

    do

    {

        rt_task_sleep(100*1000*1000);

        rt_event_signal(&ev,1);

    }while(1);

}

 

int main(int argc, const char*argv[])

{

    static RT_TASK th;

 

    mlockall(MCL_CURRENT|MCL_FUTURE);

 

    if(rt_task_shadow(&th,"xudaks_main",50,0) != 0)

    {

        printf("rt_task_shadow failed\r\n");

        exit(1);

    }

 

    int ret = rt_event_create(&event,"at_evt",0,EV_PRIO);

    if(ret)

    {

        printf("rt_event_create returned %i\r\n",ret);

    }

 

    ret = rt_task_create(&task1,"th1",32768,90,T_FPU|T_CPU(0));

    rt_task_sleep(0);

 

    if(ret)

    {

        printf("rt_task_create returned %i\r\n",ret);

    }

 

    if(ret == 0)

    {

        ret = rt_task_start(&task1,th1,0);

        rt_task_sleep(0);

 

        if(ret)

        {

            printf("rt_task_start returned %i\r\n",ret);

        }

    }

 

    ret = rt_task_create(&task2,"th2",32768,90,T_FPU|T_CPU(0));

    rt_task_sleep(0);

 

    if(ret)

    {

        printf("rt_task_create returned %i\r\n",ret);

    }

 

    if(ret == 0)

    {

        ret = rt_task_start(&task2,th2,0);

        rt_task_sleep(0);

 

        if(ret)

        {

            printf("rt_task_start returned %i\r\n",ret);

        }

    }

 

    rt_task_sleep(100*1000*1000);

 

    printf("rt_task_sleep\r\n");

 

    do

    {

        usleep(100000);

        printf("usleep\r\n");

    }while(1);

 

    return(0);

}

 

TranslateQuoteReplyEditDelete

 

 

2011-09-20 10:50:32     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103464   

 

Why can't i edit/erase a post?? Buttons are disabled...

 

And an excerpt from .config:

 

 

 

#

# Real-time sub-system

#

CONFIG_XENOMAI=y

CONFIG_XENO_GENERIC_STACKPOOL=y

CONFIG_XENO_OPT_NUCLEUS=y

CONFIG_XENO_OPT_PERVASIVE=y

CONFIG_XENO_OPT_PRIOCPL=y

CONFIG_XENO_OPT_PIPELINE_HEAD=y

# CONFIG_XENO_OPT_SCHED_CLASSES is not set

CONFIG_XENO_OPT_PIPE=y

CONFIG_XENO_OPT_PIPE_NRDEV=32

CONFIG_XENO_OPT_REGISTRY_NRSLOTS=512

CONFIG_XENO_OPT_SYS_HEAPSZ=256

CONFIG_XENO_OPT_SYS_STACKPOOLSZ=128

CONFIG_XENO_OPT_SEM_HEAPSZ=12

CONFIG_XENO_OPT_GLOBAL_SEM_HEAPSZ=12

CONFIG_XENO_OPT_STATS=y

# CONFIG_XENO_OPT_DEBUG is not set

CONFIG_XENO_OPT_SHIRQ=y

CONFIG_XENO_OPT_SELECT=y

 

#

# Timing

#

# CONFIG_XENO_OPT_TIMING_PERIODIC is not set

CONFIG_XENO_OPT_TIMING_VIRTICK=1000

CONFIG_XENO_OPT_TIMING_SCHEDLAT=0

 

#

# Scalability

#

# CONFIG_XENO_OPT_SCALABLE_SCHED is not set

CONFIG_XENO_OPT_TIMER_LIST=y

# CONFIG_XENO_OPT_TIMER_HEAP is not set

# CONFIG_XENO_OPT_TIMER_WHEEL is not set

 

#

# Machine

#

 

#

# NMI watchdog

#

# CONFIG_XENO_HW_NMI_DEBUG_LATENCY is not set

 

#

# Interfaces

#

CONFIG_XENO_SKIN_NATIVE=y

CONFIG_XENO_OPT_NATIVE_PERIOD=0

CONFIG_XENO_OPT_NATIVE_PIPE=y

CONFIG_XENO_OPT_NATIVE_PIPE_BUFSZ=16384

CONFIG_XENO_OPT_NATIVE_SEM=y

CONFIG_XENO_OPT_NATIVE_EVENT=y

CONFIG_XENO_OPT_NATIVE_MUTEX=y

CONFIG_XENO_OPT_NATIVE_COND=y

CONFIG_XENO_OPT_NATIVE_QUEUE=y

CONFIG_XENO_OPT_NATIVE_BUFFER=y

CONFIG_XENO_OPT_NATIVE_HEAP=y

CONFIG_XENO_OPT_NATIVE_ALARM=y

CONFIG_XENO_OPT_NATIVE_MPS=y

CONFIG_XENO_OPT_NATIVE_INTR=y

CONFIG_XENO_SKIN_POSIX=y

CONFIG_XENO_OPT_POSIX_PERIOD=0

# CONFIG_XENO_OPT_POSIX_SHM is not set

# CONFIG_XENO_OPT_POSIX_INTR is not set

# CONFIG_XENO_OPT_POSIX_SELECT is not set

# CONFIG_XENO_OPT_DEBUG_POSIX is not set

# CONFIG_XENO_SKIN_PSOS is not set

# CONFIG_XENO_SKIN_UITRON is not set

# CONFIG_XENO_SKIN_VRTX is not set

# CONFIG_XENO_SKIN_VXWORKS is not set

# CONFIG_XENO_SKIN_RTAI is not set

# CONFIG_XENO_OPT_NOWARN_DEPRECATED is not set

CONFIG_XENO_SKIN_RTDM=y

CONFIG_XENO_OPT_RTDM_PERIOD=0

CONFIG_XENO_OPT_RTDM_FILDES=128

CONFIG_XENO_OPT_RTDM_SELECT=y

 

#

# Drivers

#

 

#

# Serial drivers

#

# CONFIG_XENO_DRIVERS_16550A is not set

 

#

# Testing drivers

#

# CONFIG_XENO_DRIVERS_TESTING_LEGACY_NAMES is not set

CONFIG_XENO_DRIVERS_TIMERBENCH=y

# CONFIG_XENO_DRIVERS_KLATENCY is not set

# CONFIG_XENO_DRIVERS_IRQBENCH is not set

CONFIG_XENO_DRIVERS_SWITCHTEST=y

# CONFIG_XENO_DRIVERS_SIGTEST is not set

# CONFIG_XENO_DRIVERS_RTDMTEST is not set

 

#

# CAN drivers

#

# CONFIG_XENO_DRIVERS_CAN is not set

 

#

# ANALOGY drivers

#

# CONFIG_XENO_DRIVERS_ANALOGY is not set

 

#

# Real-time IPC drivers

#

# CONFIG_XENO_DRIVERS_RTIPC is not set

# CONFIG_PREEMPT_NONE is not set

CONFIG_PREEMPT_VOLUNTARY=y

# CONFIG_PREEMPT is not set

# CONFIG_FREEZER is not set

 

#

# Blackfin Processor Options

#

CONFIG_IPIPE=y

CONFIG_IPIPE_DOMAINS=4

CONFIG_IPIPE_DELAYED_ATOMICSW=y

# CONFIG_IPIPE_UNMASKED_CONTEXT_SWITCH is not set

TranslateQuoteReplyEditDelete

 

 

2011-09-21 02:07:14     Re: dist 2010R1-RC4 and xenomai

Aaron Wu (CHINA)

Message: 103470   

 

Thanks for the information, I will try your test app.

QuoteReplyEditDelete

 

 

2011-09-23 05:05:02     Re: dist 2010R1-RC4 and xenomai

Aaron Wu (CHINA)

Message: 103512   

 

Hi Pohlmann,

 

I managed to compile your main.cpp, and link it against the xenomai libs manually, trying to run on my side, get errors like attached. Do you have a plain Makefile to build you test app other than the elips Proj? I am building and linking it manually, this difference should not be a problem but if we could keep sync that would be the best.

 

Also could you share me your built executable for me to have a try?

 

Xenomai: WARNING, this version of Xenomai kernel is anterior to 2.5.2.

It can cause memory corruption on thread termination.

Upgrade is recommended.

rt_task_shadow failed

QuoteReplyEditDelete

 

 

2011-09-26 03:50:50     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103537   

 

Hi!

 

 

 

Sorry, but i only have the Eclipse project. But there should really be no difference...

 

Attached (hopefully) is my binary.

 

 

 

regards,

 

allestester1.tar.gz

TranslateQuoteReplyEditDelete

 

 

2011-09-26 05:06:34     Re: dist 2010R1-RC4 and xenomai

Aaron Wu (CHINA)

Message: 103538   

 

Thanks for your binary. It's has been running on my board for more than an hour, keep printing "usleep".

QuoteReplyEditDelete

 

 

2011-09-26 05:18:44     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103539   

 

Hm, interesting.

 

It should print "evt" and "usleep" at approx the same rate.. (th2 signaling th1 every 100ms)

 

I dont even get a printout here at all; system is freezing immediatly.

 

I took the blackfin-linux-dist-2010R1-RC5.tar.bz2, a blackfin-toolchain-uclibc-full-RC4.i386.rpm and a blackfin-toolchain-elf-gcc-4.3-2010R1-RC4.i386.rpm, installed it on a plain machine, config like posted, everything compiled, system is booting... And very different behavior?!

TranslateQuoteReplyEditDelete

 

 

2011-09-26 05:21:52     Re: dist 2010R1-RC4 and xenomai

Thorsten Pohlmann (GERMANY)

Message: 103540   

 

blackfin-toolchain-uclibc-full-2010R1-RC4.i386.rpm  of course

 

TranslateQuoteReplyEditDelete

 

 

2011-09-27 01:29:34     Re: dist 2010R1-RC4 and xenomai

Aaron Wu (CHINA)

Message: 103554   

 

Attached is my config for kernel and the uClinux distribution, it's running on a 537-v0.3 CPU on 2010R1 release

 

config_537_xeno_dist

config_537_xenomai

QuoteReplyEditDelete

Outcomes