All of lore.kernel.org
 help / color / mirror / Atom feed
* [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
@ 2011-01-25  2:33 at91_enthus
  2011-01-25  2:36 ` Gilles Chanteperdrix
  2011-01-25  2:41 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 21+ messages in thread
From: at91_enthus @ 2011-01-25  2:33 UTC (permalink / raw)
  To: xenomai-help

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

Hi.

I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt the
code found here:
http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
The only difference between my code and theirs was the access to hardware. I
used open("/dev/mem", ...) and mmap().
The program compiles fine and both functions are executed. However,  when I
place values in PIO registers, I get Segmentation Fault.

I tested my code without Xenomai and it does what it is suppose to do.

Here's the configuration of my system:
Processor: AT91SAM9G20
Xenomai version: 2.5.5.2
Kernel: 2.6.33-5
GCC 4.3.2 (I compile the code on the board)

----------------  Code snippet  -------------------
unsigned char *pioa_base, *aic_base;

void open_controller(){


    if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1)
    {
    ....
    }
    printf("/dev/mem opened.\n");

    /* mapping of PIOB */
    aic_base =  mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
AT91C_BASE_PIOB & (~MAP_MASK));
    piob_base = aic_base + AT91C_BASE_PIOB - AT91C_BASE_AIC;

    if( (pioa_base == (void *) -1)) {
        ...
    }

     *((unsigned int *) (piob_base + PIO_IDR ))  = 1<<0; // Segmentation
Fault occurs here
     *((unsigned int *) (piob_base + PIO_PER))  = 1<<0;
     ...
}
---------------------------------------------------------

Thank you,
R.

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  2:33 [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9) at91_enthus
@ 2011-01-25  2:36 ` Gilles Chanteperdrix
  2011-01-25  2:41 ` Gilles Chanteperdrix
  1 sibling, 0 replies; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  2:36 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> Hi.
> 
> I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt the
> code found here:
> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
> The only difference between my code and theirs was the access to hardware. I
> used open("/dev/mem", ...) and mmap().
> The program compiles fine and both functions are executed. However,  when I
> place values in PIO registers, I get Segmentation Fault.
> 
> I tested my code without Xenomai and it does what it is suppose to do.
> 
> Here's the configuration of my system:
> Processor: AT91SAM9G20
> Xenomai version: 2.5.5.2
> Kernel: 2.6.33-5
> GCC 4.3.2 (I compile the code on the board)
> 
> ----------------  Code snippet  -------------------
> unsigned char *pioa_base, *aic_base;
> 
> void open_controller(){
> 
> 
>     if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1)
>     {
>     ....
>     }
>     printf("/dev/mem opened.\n");
> 
>     /* mapping of PIOB */
>     aic_base =  mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd,
> AT91C_BASE_PIOB & (~MAP_MASK));
>     piob_base = aic_base + AT91C_BASE_PIOB - AT91C_BASE_AIC;
> 
>     if( (pioa_base == (void *) -1)) {
>         ...
>     }

Wrong test here. Should be "if (aic_base == MAP_FAILED)"

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  2:33 [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9) at91_enthus
  2011-01-25  2:36 ` Gilles Chanteperdrix
@ 2011-01-25  2:41 ` Gilles Chanteperdrix
  2011-01-25  3:13   ` at91_enthus
  1 sibling, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  2:41 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> Hi.
> 
> I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt the
> code found here:
> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .

By the way, this code is ridiculous. It creates a real-time task to
write to some non real-time device, which makes the real-time task useless.


-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  2:41 ` Gilles Chanteperdrix
@ 2011-01-25  3:13   ` at91_enthus
  2011-01-25  3:25     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  3:13 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > Hi.
> >
> > I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt
> the
> > code found here:
> > http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
>
> By the way, this code is ridiculous. It creates a real-time task to
> write to some non real-time device, which makes the real-time task useless.
>
>
I know. That's why I went to mmap(). (I chose that sample code because, for
now, I am only learning to use basic functions)

>Wrong test here. Should be "if (aic_base == MAP_FAILED)"

Indeed, my program fails miserably when I check the mapping of AIC, not
PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
mmap-ing works  fine.

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  3:13   ` at91_enthus
@ 2011-01-25  3:25     ` Gilles Chanteperdrix
  2011-01-25  4:14       ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  3:25 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> Hi.
>>>
>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt
>> the
>>> code found here:
>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
>> By the way, this code is ridiculous. It creates a real-time task to
>> write to some non real-time device, which makes the real-time task useless.
>>
>>
> I know.

Yes, but this example is bad in many ways:
- first it uses xenomai api to create a real-time task, and uses write
which causes the real-time task to switch to secondary domain;
- the Makefile does not use xeno-config, which have been the recommended
way of getting the compiler flags since day 1;
- it nullifies SIGTERM and SIGINT, which is a dubious decision, and
could lead people to believe that they should do the same when using
Xenomai, whereas there is no such requirement.
- the pointers point to outdated version of the documentation.
- it uses runinfo/xeno-load, which are kind of outdated too, make things
uselessly complicated, and in any case, tell you to type Ctrl-C to
interrupt the program, which is bound to fail if anything goes wrong,
since SIGINT is neutralized in the program.

>
> That's why I went to mmap().

That is not really the right solution either. I admit that for driving
leds, it may be a bit overkill, but anyway, what you should do is write
an RTDM driver for driving the leds. Keeping the driver separated from
the application will allow the same program to run on other platforms
where driving the LEDS is done differently without changing much of the
application code. In other word, the application/driver separation is a
sane one.

Anyway, mmap should work.

 (I chose that sample code because, for
> now, I am only learning to use basic functions)

>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> 
> Indeed, my program fails miserably when I check the mapping of AIC, not
> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
> mmap-ing works  fine.

Well errno might give you a clue. Do you have FCSE enabled?

Regards.

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  3:25     ` Gilles Chanteperdrix
@ 2011-01-25  4:14       ` at91_enthus
  2011-01-25  4:16         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  4:14 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>> Hi.
> >>>
> >>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt
> >> the
> >>> code found here:
> >>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
> >> By the way, this code is ridiculous. It creates a real-time task to
> >> write to some non real-time device, which makes the real-time task
> useless.
> >>
> >>
> > I know.
>
> Yes, but this example is bad in many ways:
> - first it uses xenomai api to create a real-time task, and uses write
> which causes the real-time task to switch to secondary domain;
> - the Makefile does not use xeno-config, which have been the recommended
> way of getting the compiler flags since day 1;
> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
> could lead people to believe that they should do the same when using
> Xenomai, whereas there is no such requirement.
> - the pointers point to outdated version of the documentation.
> - it uses runinfo/xeno-load, which are kind of outdated too, make things
> uselessly complicated, and in any case, tell you to type Ctrl-C to
> interrupt the program, which is bound to fail if anything goes wrong,
> since SIGINT is neutralized in the program.
>
> >
> > That's why I went to mmap().
>
> That is not really the right solution either. I admit that for driving
> leds, it may be a bit overkill, but anyway, what you should do is write
> an RTDM driver for driving the leds. Keeping the driver separated from
> the application will allow the same program to run on other platforms
> where driving the LEDS is done differently without changing much of the
> application code. In other word, the application/driver separation is a
> sane one.
>
> Anyway, mmap should work.
>
>  (I chose that sample code because, for
> > now, I am only learning to use basic functions)
>
> >> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> >
> > Indeed, my program fails miserably when I check the mapping of AIC, not
> > PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
> > mmap-ing works  fine.
>
> Well errno might give you a clue. Do you have FCSE enabled?
>
> Regards.
>
> --
>                                                                 Gilles.
>

FCSE is enabled. errno returns  22 (invalid argument).

Thanks.

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:14       ` at91_enthus
@ 2011-01-25  4:16         ` Gilles Chanteperdrix
  2011-01-25  4:23           ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  4:16 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>
>>>> at91_enthus wrote:
>>>>> Hi.
>>>>>
>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to adapt
>>>> the
>>>>> code found here:
>>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
>>>> By the way, this code is ridiculous. It creates a real-time task to
>>>> write to some non real-time device, which makes the real-time task
>> useless.
>>>>
>>> I know.
>> Yes, but this example is bad in many ways:
>> - first it uses xenomai api to create a real-time task, and uses write
>> which causes the real-time task to switch to secondary domain;
>> - the Makefile does not use xeno-config, which have been the recommended
>> way of getting the compiler flags since day 1;
>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
>> could lead people to believe that they should do the same when using
>> Xenomai, whereas there is no such requirement.
>> - the pointers point to outdated version of the documentation.
>> - it uses runinfo/xeno-load, which are kind of outdated too, make things
>> uselessly complicated, and in any case, tell you to type Ctrl-C to
>> interrupt the program, which is bound to fail if anything goes wrong,
>> since SIGINT is neutralized in the program.
>>
>>> That's why I went to mmap().
>> That is not really the right solution either. I admit that for driving
>> leds, it may be a bit overkill, but anyway, what you should do is write
>> an RTDM driver for driving the leds. Keeping the driver separated from
>> the application will allow the same program to run on other platforms
>> where driving the LEDS is done differently without changing much of the
>> application code. In other word, the application/driver separation is a
>> sane one.
>>
>> Anyway, mmap should work.
>>
>>  (I chose that sample code because, for
>>> now, I am only learning to use basic functions)
>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
>>> Indeed, my program fails miserably when I check the mapping of AIC, not
>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
>>> mmap-ing works  fine.
>> Well errno might give you a clue. Do you have FCSE enabled?
>>
>> Regards.
>>
>> --
>>                                                                 Gilles.
>>
> 
> FCSE is enabled. errno returns  22 (invalid argument).

best effort or guaranteed? Please activate FCSE messages. How big is
MAP_SIZE?

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:16         ` Gilles Chanteperdrix
@ 2011-01-25  4:23           ` at91_enthus
  2011-01-25  4:28             ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  4:23 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> >>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>
> >>>> at91_enthus wrote:
> >>>>> Hi.
> >>>>>
> >>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
> adapt
> >>>> the
> >>>>> code found here:
> >>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
> >>>> By the way, this code is ridiculous. It creates a real-time task to
> >>>> write to some non real-time device, which makes the real-time task
> >> useless.
> >>>>
> >>> I know.
> >> Yes, but this example is bad in many ways:
> >> - first it uses xenomai api to create a real-time task, and uses write
> >> which causes the real-time task to switch to secondary domain;
> >> - the Makefile does not use xeno-config, which have been the recommended
> >> way of getting the compiler flags since day 1;
> >> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
> >> could lead people to believe that they should do the same when using
> >> Xenomai, whereas there is no such requirement.
> >> - the pointers point to outdated version of the documentation.
> >> - it uses runinfo/xeno-load, which are kind of outdated too, make things
> >> uselessly complicated, and in any case, tell you to type Ctrl-C to
> >> interrupt the program, which is bound to fail if anything goes wrong,
> >> since SIGINT is neutralized in the program.
> >>
> >>> That's why I went to mmap().
> >> That is not really the right solution either. I admit that for driving
> >> leds, it may be a bit overkill, but anyway, what you should do is write
> >> an RTDM driver for driving the leds. Keeping the driver separated from
> >> the application will allow the same program to run on other platforms
> >> where driving the LEDS is done differently without changing much of the
> >> application code. In other word, the application/driver separation is a
> >> sane one.
> >>
> >> Anyway, mmap should work.
> >>
> >>  (I chose that sample code because, for
> >>> now, I am only learning to use basic functions)
> >>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> >>> Indeed, my program fails miserably when I check the mapping of AIC, not
> >>> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
> >>> mmap-ing works  fine.
> >> Well errno might give you a clue. Do you have FCSE enabled?
> >>
> >> Regards.
> >>
> >> --
> >>                                                                 Gilles.
> >>
> >
> > FCSE is enabled. errno returns  22 (invalid argument).
>
> best effort or guaranteed?


Best effort


> Please activate FCSE messages.


... compiling new kernel


> How big is
> MAP_SIZE?
>
>
4096

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:23           ` at91_enthus
@ 2011-01-25  4:28             ` Gilles Chanteperdrix
  2011-01-25  4:44               ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  4:28 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>
>>>> at91_enthus wrote:
>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>
>>>>>> at91_enthus wrote:
>>>>>>> Hi.
>>>>>>>
>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
>> adapt
>>>>>> the
>>>>>>> code found here:
>>>>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs .
>>>>>> By the way, this code is ridiculous. It creates a real-time task to
>>>>>> write to some non real-time device, which makes the real-time task
>>>> useless.
>>>>> I know.
>>>> Yes, but this example is bad in many ways:
>>>> - first it uses xenomai api to create a real-time task, and uses write
>>>> which causes the real-time task to switch to secondary domain;
>>>> - the Makefile does not use xeno-config, which have been the recommended
>>>> way of getting the compiler flags since day 1;
>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
>>>> could lead people to believe that they should do the same when using
>>>> Xenomai, whereas there is no such requirement.
>>>> - the pointers point to outdated version of the documentation.
>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make things
>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
>>>> interrupt the program, which is bound to fail if anything goes wrong,
>>>> since SIGINT is neutralized in the program.
>>>>
>>>>> That's why I went to mmap().
>>>> That is not really the right solution either. I admit that for driving
>>>> leds, it may be a bit overkill, but anyway, what you should do is write
>>>> an RTDM driver for driving the leds. Keeping the driver separated from
>>>> the application will allow the same program to run on other platforms
>>>> where driving the LEDS is done differently without changing much of the
>>>> application code. In other word, the application/driver separation is a
>>>> sane one.
>>>>
>>>> Anyway, mmap should work.
>>>>
>>>>  (I chose that sample code because, for
>>>>> now, I am only learning to use basic functions)
>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
>>>>> Indeed, my program fails miserably when I check the mapping of AIC, not
>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
>>>>> mmap-ing works  fine.
>>>> Well errno might give you a clue. Do you have FCSE enabled?
>>>>
>>>> Regards.
>>>>
>>>> --
>>>>                                                                 Gilles.
>>>>
>>> FCSE is enabled. errno returns  22 (invalid argument).
>> best effort or guaranteed?
> 
> 
> Best effort
> 
> 
>> Please activate FCSE messages.
> 
> 
> ... compiling new kernel
> 
> 
>> How big is
>> MAP_SIZE?
>>
>>
> 4096

Ok. Could you post your full kernel configuration, as well as the full
program?
Are you running this program as root?

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:28             ` Gilles Chanteperdrix
@ 2011-01-25  4:44               ` at91_enthus
  2011-01-25  4:49                 ` Gilles Chanteperdrix
  2011-01-25  4:54                 ` Gilles Chanteperdrix
  0 siblings, 2 replies; 21+ messages in thread
From: at91_enthus @ 2011-01-25  4:44 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help


[-- Attachment #1.1: Type: text/plain, Size: 3387 bytes --]

On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
> >>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>
> >>>> at91_enthus wrote:
> >>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> >>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>
> >>>>>> at91_enthus wrote:
> >>>>>>> Hi.
> >>>>>>>
> >>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
> >> adapt
> >>>>>> the
> >>>>>>> code found here:
> >>>>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
> >>>>>> By the way, this code is ridiculous. It creates a real-time task to
> >>>>>> write to some non real-time device, which makes the real-time task
> >>>> useless.
> >>>>> I know.
> >>>> Yes, but this example is bad in many ways:
> >>>> - first it uses xenomai api to create a real-time task, and uses write
> >>>> which causes the real-time task to switch to secondary domain;
> >>>> - the Makefile does not use xeno-config, which have been the
> recommended
> >>>> way of getting the compiler flags since day 1;
> >>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
> >>>> could lead people to believe that they should do the same when using
> >>>> Xenomai, whereas there is no such requirement.
> >>>> - the pointers point to outdated version of the documentation.
> >>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
> things
> >>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
> >>>> interrupt the program, which is bound to fail if anything goes wrong,
> >>>> since SIGINT is neutralized in the program.
> >>>>
> >>>>> That's why I went to mmap().
> >>>> That is not really the right solution either. I admit that for driving
> >>>> leds, it may be a bit overkill, but anyway, what you should do is
> write
> >>>> an RTDM driver for driving the leds. Keeping the driver separated from
> >>>> the application will allow the same program to run on other platforms
> >>>> where driving the LEDS is done differently without changing much of
> the
> >>>> application code. In other word, the application/driver separation is
> a
> >>>> sane one.
> >>>>
> >>>> Anyway, mmap should work.
> >>>>
> >>>>  (I chose that sample code because, for
> >>>>> now, I am only learning to use basic functions)
> >>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> >>>>> Indeed, my program fails miserably when I check the mapping of AIC,
> not
> >>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
> >>>>> mmap-ing works  fine.
> >>>> Well errno might give you a clue. Do you have FCSE enabled?
> >>>>
> >>>> Regards.
> >>>>
> >>>> --
> >>>>
> Gilles.
> >>>>
> >>> FCSE is enabled. errno returns  22 (invalid argument).
> >> best effort or guaranteed?
> >
> >
> > Best effort
> >
> >
> >> Please activate FCSE messages.
> >
> >
> > ... compiling new kernel
> >
> >
> >> How big is
> >> MAP_SIZE?
> >>
> >>
> > 4096
>
> Ok. Could you post your full kernel configuration, as well as the full
> program?
>

I put the .config and the code in the attachments.


> Are you running this program as root?
>
>
I run it with sudo.

[-- Attachment #1.2: Type: text/html, Size: 5381 bytes --]

[-- Attachment #2: .config --]
[-- Type: application/octet-stream, Size: 37768 bytes --]

#
# Automatically generated make config: don't edit
# Linux kernel version: 2.6.33.5
# Mon Jan 24 22:19:38 2011
#
CONFIG_ARM=y
CONFIG_SYS_SUPPORTS_APM_EMULATION=y
CONFIG_GENERIC_GPIO=y
CONFIG_GENERIC_TIME=y
CONFIG_GENERIC_CLOCKEVENTS=y
CONFIG_GENERIC_HARDIRQS=y
CONFIG_STACKTRACE_SUPPORT=y
CONFIG_HAVE_LATENCYTOP_SUPPORT=y
CONFIG_LOCKDEP_SUPPORT=y
CONFIG_TRACE_IRQFLAGS_SUPPORT=y
CONFIG_HARDIRQS_SW_RESEND=y
CONFIG_GENERIC_IRQ_PROBE=y
CONFIG_RWSEM_GENERIC_SPINLOCK=y
CONFIG_GENERIC_HWEIGHT=y
CONFIG_GENERIC_CALIBRATE_DELAY=y
CONFIG_GENERIC_HARDIRQS_NO__DO_IRQ=y
CONFIG_VECTORS_BASE=0xffff0000
CONFIG_DEFCONFIG_LIST="/lib/modules/$UNAME_RELEASE/.config"
CONFIG_CONSTRUCTORS=y

#
# General setup
#
CONFIG_EXPERIMENTAL=y
CONFIG_BROKEN_ON_SMP=y
CONFIG_INIT_ENV_ARG_LIMIT=32
CONFIG_LOCALVERSION="-xen"
CONFIG_LOCALVERSION_AUTO=y
CONFIG_HAVE_KERNEL_GZIP=y
CONFIG_HAVE_KERNEL_LZO=y
CONFIG_KERNEL_GZIP=y
# CONFIG_KERNEL_BZIP2 is not set
# CONFIG_KERNEL_LZMA is not set
# CONFIG_KERNEL_LZO is not set
CONFIG_SWAP=y
CONFIG_SYSVIPC=y
CONFIG_SYSVIPC_SYSCTL=y
# CONFIG_POSIX_MQUEUE is not set
# CONFIG_BSD_PROCESS_ACCT is not set
# CONFIG_TASKSTATS is not set
# CONFIG_AUDIT is not set

#
# RCU Subsystem
#
CONFIG_TREE_RCU=y
# CONFIG_TREE_PREEMPT_RCU is not set
# CONFIG_TINY_RCU is not set
# CONFIG_RCU_TRACE is not set
CONFIG_RCU_FANOUT=32
# CONFIG_RCU_FANOUT_EXACT is not set
# CONFIG_TREE_RCU_TRACE is not set
# CONFIG_IKCONFIG is not set
CONFIG_LOG_BUF_SHIFT=14
# CONFIG_GROUP_SCHED is not set
# CONFIG_CGROUPS is not set
CONFIG_SYSFS_DEPRECATED=y
CONFIG_SYSFS_DEPRECATED_V2=y
# CONFIG_RELAY is not set
CONFIG_NAMESPACES=y
# CONFIG_UTS_NS is not set
# CONFIG_IPC_NS is not set
# CONFIG_USER_NS is not set
# CONFIG_PID_NS is not set
# CONFIG_NET_NS is not set
CONFIG_BLK_DEV_INITRD=y
CONFIG_INITRAMFS_SOURCE=""
CONFIG_RD_GZIP=y
CONFIG_RD_BZIP2=y
CONFIG_RD_LZMA=y
CONFIG_RD_LZO=y
CONFIG_CC_OPTIMIZE_FOR_SIZE=y
CONFIG_SYSCTL=y
CONFIG_ANON_INODES=y
# CONFIG_EMBEDDED is not set
CONFIG_UID16=y
CONFIG_SYSCTL_SYSCALL=y
CONFIG_KALLSYMS=y
# CONFIG_KALLSYMS_EXTRA_PASS is not set
CONFIG_HOTPLUG=y
CONFIG_PRINTK=y
CONFIG_BUG=y
CONFIG_ELF_CORE=y
CONFIG_BASE_FULL=y
CONFIG_FUTEX=y
CONFIG_EPOLL=y
CONFIG_SIGNALFD=y
CONFIG_TIMERFD=y
CONFIG_EVENTFD=y
CONFIG_SHMEM=y
CONFIG_AIO=y

#
# Kernel Performance Events And Counters
#
CONFIG_VM_EVENT_COUNTERS=y
CONFIG_COMPAT_BRK=y
CONFIG_SLAB=y
# CONFIG_SLUB is not set
# CONFIG_SLOB is not set
# CONFIG_PROFILING is not set
CONFIG_HAVE_OPROFILE=y
# CONFIG_KPROBES is not set
CONFIG_HAVE_KPROBES=y
CONFIG_HAVE_KRETPROBES=y
CONFIG_HAVE_CLK=y

#
# GCOV-based kernel profiling
#
# CONFIG_SLOW_WORK is not set
CONFIG_HAVE_GENERIC_DMA_COHERENT=y
CONFIG_SLABINFO=y
CONFIG_RT_MUTEXES=y
CONFIG_BASE_SMALL=0
CONFIG_MODULES=y
# CONFIG_MODULE_FORCE_LOAD is not set
CONFIG_MODULE_UNLOAD=y
# CONFIG_MODULE_FORCE_UNLOAD is not set
# CONFIG_MODVERSIONS is not set
# CONFIG_MODULE_SRCVERSION_ALL is not set
CONFIG_BLOCK=y
CONFIG_LBDAF=y
CONFIG_BLK_DEV_BSG=y
# CONFIG_BLK_DEV_INTEGRITY is not set

#
# IO Schedulers
#
CONFIG_IOSCHED_NOOP=y
# CONFIG_IOSCHED_DEADLINE is not set
# CONFIG_IOSCHED_CFQ is not set
# CONFIG_DEFAULT_DEADLINE is not set
# CONFIG_DEFAULT_CFQ is not set
CONFIG_DEFAULT_NOOP=y
CONFIG_DEFAULT_IOSCHED="noop"
# CONFIG_INLINE_SPIN_TRYLOCK is not set
# CONFIG_INLINE_SPIN_TRYLOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK is not set
# CONFIG_INLINE_SPIN_LOCK_BH is not set
# CONFIG_INLINE_SPIN_LOCK_IRQ is not set
# CONFIG_INLINE_SPIN_LOCK_IRQSAVE is not set
CONFIG_INLINE_SPIN_UNLOCK=y
# CONFIG_INLINE_SPIN_UNLOCK_BH is not set
CONFIG_INLINE_SPIN_UNLOCK_IRQ=y
# CONFIG_INLINE_SPIN_UNLOCK_IRQRESTORE is not set
# CONFIG_INLINE_READ_TRYLOCK is not set
# CONFIG_INLINE_READ_LOCK is not set
# CONFIG_INLINE_READ_LOCK_BH is not set
# CONFIG_INLINE_READ_LOCK_IRQ is not set
# CONFIG_INLINE_READ_LOCK_IRQSAVE is not set
CONFIG_INLINE_READ_UNLOCK=y
# CONFIG_INLINE_READ_UNLOCK_BH is not set
CONFIG_INLINE_READ_UNLOCK_IRQ=y
# CONFIG_INLINE_READ_UNLOCK_IRQRESTORE is not set
# CONFIG_INLINE_WRITE_TRYLOCK is not set
# CONFIG_INLINE_WRITE_LOCK is not set
# CONFIG_INLINE_WRITE_LOCK_BH is not set
# CONFIG_INLINE_WRITE_LOCK_IRQ is not set
# CONFIG_INLINE_WRITE_LOCK_IRQSAVE is not set
CONFIG_INLINE_WRITE_UNLOCK=y
# CONFIG_INLINE_WRITE_UNLOCK_BH is not set
CONFIG_INLINE_WRITE_UNLOCK_IRQ=y
# CONFIG_INLINE_WRITE_UNLOCK_IRQRESTORE is not set
# CONFIG_MUTEX_SPIN_ON_OWNER is not set

#
# Real-time sub-system
#
CONFIG_XENOMAI=y
CONFIG_XENO_GENERIC_STACKPOOL=y
CONFIG_XENO_FASTSYNCH_DEP=y
CONFIG_XENO_FASTSYNCH=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 is not set

#
# 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
#
CONFIG_IPIPE_WANT_PREEMPTIBLE_SWITCH=y
CONFIG_XENO_HW_FPU=y
CONFIG_XENO_HW_UNLOCKED_SWITCH=y

#
# Interfaces
#
CONFIG_XENO_SKIN_NATIVE=y
CONFIG_XENO_OPT_NATIVE_PERIOD=0
CONFIG_XENO_OPT_NATIVE_PIPE=y
CONFIG_XENO_OPT_NATIVE_PIPE_BUFSZ=1024
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 is not set
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 is not set

#
# 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_FREEZER is not set

#
# System Type
#
CONFIG_MMU=y
# CONFIG_ARCH_AAEC2000 is not set
# CONFIG_ARCH_INTEGRATOR is not set
# CONFIG_ARCH_REALVIEW is not set
# CONFIG_ARCH_VERSATILE is not set
CONFIG_ARCH_AT91=y
# CONFIG_ARCH_CLPS711X is not set
# CONFIG_ARCH_GEMINI is not set
# CONFIG_ARCH_EBSA110 is not set
# CONFIG_ARCH_EP93XX is not set
# CONFIG_ARCH_FOOTBRIDGE is not set
# CONFIG_ARCH_MXC is not set
# CONFIG_ARCH_STMP3XXX is not set
# CONFIG_ARCH_NETX is not set
# CONFIG_ARCH_H720X is not set
# CONFIG_ARCH_NOMADIK is not set
# CONFIG_ARCH_IOP13XX is not set
# CONFIG_ARCH_IOP32X is not set
# CONFIG_ARCH_IOP33X is not set
# CONFIG_ARCH_IXP23XX is not set
# CONFIG_ARCH_IXP2000 is not set
# CONFIG_ARCH_IXP4XX is not set
# CONFIG_ARCH_L7200 is not set
# CONFIG_ARCH_DOVE is not set
# CONFIG_ARCH_KIRKWOOD is not set
# CONFIG_ARCH_LOKI is not set
# CONFIG_ARCH_MV78XX0 is not set
# CONFIG_ARCH_ORION5X is not set
# CONFIG_ARCH_MMP is not set
# CONFIG_ARCH_KS8695 is not set
# CONFIG_ARCH_NS9XXX is not set
# CONFIG_ARCH_W90X900 is not set
# CONFIG_ARCH_PNX4008 is not set
# CONFIG_ARCH_PXA is not set
# CONFIG_ARCH_MSM is not set
# CONFIG_ARCH_RPC is not set
# CONFIG_ARCH_SA1100 is not set
# CONFIG_ARCH_S3C2410 is not set
# CONFIG_ARCH_S3C64XX is not set
# CONFIG_ARCH_S5PC1XX is not set
# CONFIG_ARCH_SHARK is not set
# CONFIG_ARCH_LH7A40X is not set
# CONFIG_ARCH_U300 is not set
# CONFIG_ARCH_DAVINCI is not set
# CONFIG_ARCH_OMAP is not set
# CONFIG_ARCH_BCMRING is not set
# CONFIG_ARCH_U8500 is not set
CONFIG_HAVE_AT91_USART3=y
CONFIG_HAVE_AT91_USART4=y
CONFIG_HAVE_AT91_USART5=y

#
# Atmel AT91 System-on-Chip
#
# CONFIG_ARCH_AT91RM9200 is not set
# CONFIG_ARCH_AT91SAM9260 is not set
# CONFIG_ARCH_AT91SAM9261 is not set
# CONFIG_ARCH_AT91SAM9G10 is not set
# CONFIG_ARCH_AT91SAM9263 is not set
# CONFIG_ARCH_AT91SAM9RL is not set
CONFIG_ARCH_AT91SAM9G20=y
# CONFIG_ARCH_AT91SAM9G45 is not set
# CONFIG_ARCH_AT91CAP9 is not set
# CONFIG_ARCH_AT572D940HF is not set
# CONFIG_ARCH_AT91X40 is not set
CONFIG_AT91_PMC_UNIT=y

#
# AT91SAM9G20 Board Type
#
# CONFIG_MACH_AT91SAM9G20EK is not set
# CONFIG_MACH_AT91SAM9G20EK_2MMC is not set
# CONFIG_MACH_CPU9G20 is not set
# CONFIG_MACH_USB_A9G20 is not set
# CONFIG_MACH_QIL_A9G20 is not set
# CONFIG_MACH_SBC35_A9G20 is not set
CONFIG_MACH_ELECTRUM_100=y

#
# Adeos I-pipe Options
#
CONFIG_IPIPE_AT91_TC=0

#
# AT91 Board Options
#

#
# AT91 Feature Selections
#
CONFIG_AT91_PROGRAMMABLE_CLOCKS=y
CONFIG_AT91_TIMER_HZ=1000
# CONFIG_AT91_EARLY_DBGU is not set
CONFIG_AT91_EARLY_USART0=y
# CONFIG_AT91_EARLY_USART1 is not set
# CONFIG_AT91_EARLY_USART2 is not set
# CONFIG_AT91_EARLY_USART3 is not set
# CONFIG_AT91_EARLY_USART4 is not set
# CONFIG_AT91_EARLY_USART5 is not set
CONFIG_IPIPE_ARM_KUSER_TSC=y

#
# Processor Type
#
CONFIG_CPU_ARM926T=y
CONFIG_CPU_32v5=y
CONFIG_CPU_ABRT_EV5TJ=y
CONFIG_CPU_PABRT_LEGACY=y
CONFIG_CPU_CACHE_VIVT=y
CONFIG_CPU_COPY_V4WB=y
CONFIG_CPU_TLB_V4WBI=y
CONFIG_CPU_CP15=y
CONFIG_CPU_CP15_MMU=y

#
# Processor Features
#
# CONFIG_ARM_THUMB is not set
# CONFIG_CPU_ICACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_DISABLE is not set
# CONFIG_CPU_DCACHE_WRITETHROUGH is not set
CONFIG_CPU_CACHE_ROUND_ROBIN=y
CONFIG_ARM_L1_CACHE_SHIFT=5
CONFIG_ARM_FCSE=y
# CONFIG_ARM_FCSE_GUARANTEED is not set
CONFIG_ARM_FCSE_BEST_EFFORT=y
CONFIG_ARM_FCSE_PREEMPT_FLUSH=y
CONFIG_ARM_FCSE_MESSAGES=y
CONFIG_ARM_FCSE_DEBUG=y

#
# Bus support
#
# CONFIG_PCI_SYSCALL is not set
# CONFIG_ARCH_SUPPORTS_MSI is not set
# CONFIG_PCCARD is not set

#
# Kernel Features
#
# CONFIG_NO_HZ is not set
# CONFIG_HIGH_RES_TIMERS is not set
CONFIG_GENERIC_CLOCKEVENTS_BUILD=y
CONFIG_VMSPLIT_3G=y
# CONFIG_VMSPLIT_2G is not set
# CONFIG_VMSPLIT_1G is not set
CONFIG_PAGE_OFFSET=0xC0000000
CONFIG_IPIPE=y
CONFIG_IPIPE_DOMAINS=4
CONFIG_IPIPE_DELAYED_ATOMICSW=y
# CONFIG_IPIPE_UNMASKED_CONTEXT_SWITCH is not set
CONFIG_PREEMPT_NONE=y
# CONFIG_PREEMPT_VOLUNTARY is not set
# CONFIG_PREEMPT is not set
CONFIG_HZ=1000
CONFIG_AEABI=y
CONFIG_OABI_COMPAT=y
# CONFIG_ARCH_SPARSEMEM_DEFAULT is not set
# CONFIG_ARCH_SELECT_MEMORY_MODEL is not set
# CONFIG_HIGHMEM is not set
CONFIG_SELECT_MEMORY_MODEL=y
CONFIG_FLATMEM_MANUAL=y
# CONFIG_DISCONTIGMEM_MANUAL is not set
# CONFIG_SPARSEMEM_MANUAL is not set
CONFIG_FLATMEM=y
CONFIG_FLAT_NODE_MEM_MAP=y
CONFIG_PAGEFLAGS_EXTENDED=y
CONFIG_SPLIT_PTLOCK_CPUS=999999
# CONFIG_PHYS_ADDR_T_64BIT is not set
CONFIG_ZONE_DMA_FLAG=0
CONFIG_VIRT_TO_BUS=y
# CONFIG_KSM is not set
CONFIG_DEFAULT_MMAP_MIN_ADDR=4096
# CONFIG_LEDS is not set
CONFIG_ALIGNMENT_TRAP=y
# CONFIG_UACCESS_WITH_MEMCPY is not set

#
# Boot options
#
CONFIG_ZBOOT_ROM_TEXT=0x0
CONFIG_ZBOOT_ROM_BSS=0x0
CONFIG_CMDLINE="mem=64M console=ttyS0,115200"
# CONFIG_XIP_KERNEL is not set
# CONFIG_KEXEC is not set

#
# CPU Power Management
#
# CONFIG_CPU_IDLE is not set

#
# Floating point emulation
#

#
# At least one emulation must be selected
#
CONFIG_FPE_NWFPE=y
# CONFIG_FPE_NWFPE_XP is not set
# CONFIG_FPE_FASTFPE is not set
# CONFIG_VFP is not set

#
# Userspace binary formats
#
CONFIG_BINFMT_ELF=y
# CONFIG_CORE_DUMP_DEFAULT_ELF_HEADERS is not set
CONFIG_HAVE_AOUT=y
# CONFIG_BINFMT_AOUT is not set
# CONFIG_BINFMT_MISC is not set

#
# Power management options
#
# CONFIG_PM is not set
CONFIG_ARCH_SUSPEND_POSSIBLE=y
CONFIG_NET=y

#
# Networking options
#
CONFIG_PACKET=y
# CONFIG_PACKET_MMAP is not set
CONFIG_UNIX=y
# CONFIG_NET_KEY is not set
CONFIG_INET=y
# CONFIG_IP_MULTICAST is not set
# CONFIG_IP_ADVANCED_ROUTER is not set
CONFIG_IP_FIB_HASH=y
CONFIG_IP_PNP=y
# CONFIG_IP_PNP_DHCP is not set
CONFIG_IP_PNP_BOOTP=y
# CONFIG_IP_PNP_RARP is not set
# CONFIG_NET_IPIP is not set
# CONFIG_NET_IPGRE is not set
# CONFIG_ARPD is not set
# CONFIG_SYN_COOKIES is not set
# CONFIG_INET_AH is not set
# CONFIG_INET_ESP is not set
# CONFIG_INET_IPCOMP is not set
# CONFIG_INET_XFRM_TUNNEL is not set
# CONFIG_INET_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_TRANSPORT is not set
# CONFIG_INET_XFRM_MODE_TUNNEL is not set
# CONFIG_INET_XFRM_MODE_BEET is not set
# CONFIG_INET_LRO is not set
CONFIG_INET_DIAG=y
CONFIG_INET_TCP_DIAG=y
# CONFIG_TCP_CONG_ADVANCED is not set
CONFIG_TCP_CONG_CUBIC=y
CONFIG_DEFAULT_TCP_CONG="cubic"
# CONFIG_TCP_MD5SIG is not set
# CONFIG_IPV6 is not set
# CONFIG_NETWORK_SECMARK is not set
# CONFIG_NETFILTER is not set
# CONFIG_IP_DCCP is not set
# CONFIG_IP_SCTP is not set
# CONFIG_RDS is not set
# CONFIG_TIPC is not set
# CONFIG_ATM is not set
# CONFIG_BRIDGE is not set
# CONFIG_NET_DSA is not set
# CONFIG_VLAN_8021Q is not set
# CONFIG_DECNET is not set
# CONFIG_LLC2 is not set
# CONFIG_IPX is not set
# CONFIG_ATALK is not set
# CONFIG_X25 is not set
# CONFIG_LAPB is not set
# CONFIG_ECONET is not set
# CONFIG_WAN_ROUTER is not set
# CONFIG_PHONET is not set
# CONFIG_IEEE802154 is not set
# CONFIG_NET_SCHED is not set
# CONFIG_DCB is not set

#
# Network testing
#
# CONFIG_NET_PKTGEN is not set
# CONFIG_HAMRADIO is not set
# CONFIG_CAN is not set
# CONFIG_IRDA is not set
# CONFIG_BT is not set
# CONFIG_AF_RXRPC is not set
# CONFIG_WIRELESS is not set
# CONFIG_WIMAX is not set
# CONFIG_RFKILL is not set
# CONFIG_NET_9P is not set

#
# Device Drivers
#

#
# Generic Driver Options
#
CONFIG_UEVENT_HELPER_PATH="/sbin/hotplug"
# CONFIG_DEVTMPFS is not set
CONFIG_STANDALONE=y
CONFIG_PREVENT_FIRMWARE_BUILD=y
CONFIG_FW_LOADER=y
CONFIG_FIRMWARE_IN_KERNEL=y
CONFIG_EXTRA_FIRMWARE=""
# CONFIG_SYS_HYPERVISOR is not set
# CONFIG_CONNECTOR is not set
CONFIG_MTD=y
# CONFIG_MTD_DEBUG is not set
# CONFIG_MTD_TESTS is not set
CONFIG_MTD_CONCAT=y
CONFIG_MTD_PARTITIONS=y
# CONFIG_MTD_REDBOOT_PARTS is not set
CONFIG_MTD_CMDLINE_PARTS=y
# CONFIG_MTD_AFS_PARTS is not set
# CONFIG_MTD_AR7_PARTS is not set

#
# User Modules And Translation Layers
#
CONFIG_MTD_CHAR=y
CONFIG_MTD_BLKDEVS=y
CONFIG_MTD_BLOCK=y
# CONFIG_FTL is not set
# CONFIG_NFTL is not set
# CONFIG_INFTL is not set
# CONFIG_RFD_FTL is not set
# CONFIG_SSFDC is not set
# CONFIG_MTD_OOPS is not set

#
# RAM/ROM/Flash chip drivers
#
# CONFIG_MTD_CFI is not set
# CONFIG_MTD_JEDECPROBE is not set
CONFIG_MTD_MAP_BANK_WIDTH_1=y
CONFIG_MTD_MAP_BANK_WIDTH_2=y
CONFIG_MTD_MAP_BANK_WIDTH_4=y
# CONFIG_MTD_MAP_BANK_WIDTH_8 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_16 is not set
# CONFIG_MTD_MAP_BANK_WIDTH_32 is not set
CONFIG_MTD_CFI_I1=y
CONFIG_MTD_CFI_I2=y
# CONFIG_MTD_CFI_I4 is not set
# CONFIG_MTD_CFI_I8 is not set
# CONFIG_MTD_RAM is not set
# CONFIG_MTD_ROM is not set
# CONFIG_MTD_ABSENT is not set

#
# Mapping drivers for chip access
#
# CONFIG_MTD_COMPLEX_MAPPINGS is not set
# CONFIG_MTD_PLATRAM is not set

#
# Self-contained MTD device drivers
#
CONFIG_MTD_DATAFLASH=y
# CONFIG_MTD_DATAFLASH_WRITE_VERIFY is not set
# CONFIG_MTD_DATAFLASH_OTP is not set
# CONFIG_MTD_M25P80 is not set
# CONFIG_MTD_SST25L is not set
# CONFIG_MTD_SLRAM is not set
# CONFIG_MTD_PHRAM is not set
# CONFIG_MTD_MTDRAM is not set
# CONFIG_MTD_BLOCK2MTD is not set

#
# Disk-On-Chip Device Drivers
#
# CONFIG_MTD_DOC2000 is not set
# CONFIG_MTD_DOC2001 is not set
# CONFIG_MTD_DOC2001PLUS is not set
CONFIG_MTD_NAND=y
# CONFIG_MTD_NAND_VERIFY_WRITE is not set
# CONFIG_MTD_NAND_ECC_SMC is not set
# CONFIG_MTD_NAND_MUSEUM_IDS is not set
# CONFIG_MTD_NAND_GPIO is not set
CONFIG_MTD_NAND_IDS=y
# CONFIG_MTD_NAND_DISKONCHIP is not set
CONFIG_MTD_NAND_ATMEL=y
CONFIG_MTD_NAND_ATMEL_ECC_SOFT=y
# CONFIG_MTD_NAND_ATMEL_ECC_HW is not set
# CONFIG_MTD_NAND_ATMEL_ECC_NONE is not set
# CONFIG_MTD_NAND_NANDSIM is not set
# CONFIG_MTD_NAND_PLATFORM is not set
# CONFIG_MTD_ALAUDA is not set
# CONFIG_MTD_ONENAND is not set

#
# LPDDR flash memory drivers
#
# CONFIG_MTD_LPDDR is not set

#
# UBI - Unsorted block images
#
# CONFIG_MTD_UBI is not set
# CONFIG_PARPORT is not set
CONFIG_BLK_DEV=y
# CONFIG_BLK_DEV_COW_COMMON is not set
CONFIG_BLK_DEV_LOOP=y
# CONFIG_BLK_DEV_CRYPTOLOOP is not set

#
# DRBD disabled because PROC_FS, INET or CONNECTOR not selected
#
# CONFIG_BLK_DEV_NBD is not set
# CONFIG_BLK_DEV_UB is not set
CONFIG_BLK_DEV_RAM=y
CONFIG_BLK_DEV_RAM_COUNT=16
CONFIG_BLK_DEV_RAM_SIZE=8192
# CONFIG_BLK_DEV_XIP is not set
# CONFIG_CDROM_PKTCDVD is not set
# CONFIG_ATA_OVER_ETH is not set
# CONFIG_MG_DISK is not set
CONFIG_MISC_DEVICES=y
# CONFIG_AD525X_DPOT is not set
CONFIG_ATMEL_TCLIB=y
# CONFIG_ICS932S401 is not set
# CONFIG_ATMEL_SSC is not set
# CONFIG_ENCLOSURE_SERVICES is not set
# CONFIG_ISL29003 is not set
# CONFIG_DS1682 is not set
# CONFIG_TI_DAC7512 is not set
# CONFIG_C2PORT is not set

#
# EEPROM support
#
# CONFIG_EEPROM_AT24 is not set
# CONFIG_EEPROM_AT25 is not set
# CONFIG_EEPROM_LEGACY is not set
# CONFIG_EEPROM_MAX6875 is not set
# CONFIG_EEPROM_93CX6 is not set
# CONFIG_IWMC3200TOP is not set
CONFIG_HAVE_IDE=y
# CONFIG_IDE is not set

#
# SCSI device support
#
# CONFIG_RAID_ATTRS is not set
CONFIG_SCSI=y
CONFIG_SCSI_DMA=y
# CONFIG_SCSI_TGT is not set
# CONFIG_SCSI_NETLINK is not set
CONFIG_SCSI_PROC_FS=y

#
# SCSI support type (disk, tape, CD-ROM)
#
CONFIG_BLK_DEV_SD=y
# CONFIG_CHR_DEV_ST is not set
# CONFIG_CHR_DEV_OSST is not set
# CONFIG_BLK_DEV_SR is not set
# CONFIG_CHR_DEV_SG is not set
# CONFIG_CHR_DEV_SCH is not set
CONFIG_SCSI_MULTI_LUN=y
# CONFIG_SCSI_CONSTANTS is not set
# CONFIG_SCSI_LOGGING is not set
# CONFIG_SCSI_SCAN_ASYNC is not set
CONFIG_SCSI_WAIT_SCAN=m

#
# SCSI Transports
#
# CONFIG_SCSI_SPI_ATTRS is not set
# CONFIG_SCSI_FC_ATTRS is not set
# CONFIG_SCSI_ISCSI_ATTRS is not set
# CONFIG_SCSI_SAS_ATTRS is not set
# CONFIG_SCSI_SAS_LIBSAS is not set
# CONFIG_SCSI_SRP_ATTRS is not set
# CONFIG_SCSI_LOWLEVEL is not set
# CONFIG_SCSI_DH is not set
# CONFIG_SCSI_OSD_INITIATOR is not set
# CONFIG_ATA is not set
# CONFIG_MD is not set
CONFIG_NETDEVICES=y
# CONFIG_DUMMY is not set
# CONFIG_BONDING is not set
# CONFIG_MACVLAN is not set
# CONFIG_EQUALIZER is not set
# CONFIG_TUN is not set
# CONFIG_VETH is not set
CONFIG_PHYLIB=y

#
# MII PHY device drivers
#
# CONFIG_MARVELL_PHY is not set
# CONFIG_DAVICOM_PHY is not set
# CONFIG_QSEMI_PHY is not set
# CONFIG_LXT_PHY is not set
# CONFIG_CICADA_PHY is not set
# CONFIG_VITESSE_PHY is not set
# CONFIG_SMSC_PHY is not set
# CONFIG_BROADCOM_PHY is not set
# CONFIG_ICPLUS_PHY is not set
# CONFIG_REALTEK_PHY is not set
# CONFIG_NATIONAL_PHY is not set
# CONFIG_STE10XP is not set
# CONFIG_LSI_ET1011C_PHY is not set
# CONFIG_FIXED_PHY is not set
# CONFIG_MDIO_BITBANG is not set
CONFIG_NET_ETHERNET=y
CONFIG_MII=y
CONFIG_MACB=y
# CONFIG_AX88796 is not set
# CONFIG_SMC91X is not set
# CONFIG_DM9000 is not set
# CONFIG_ENC28J60 is not set
# CONFIG_ETHOC is not set
# CONFIG_SMC911X is not set
# CONFIG_SMSC911X is not set
# CONFIG_DNET is not set
# CONFIG_IBM_NEW_EMAC_ZMII is not set
# CONFIG_IBM_NEW_EMAC_RGMII is not set
# CONFIG_IBM_NEW_EMAC_TAH is not set
# CONFIG_IBM_NEW_EMAC_EMAC4 is not set
# CONFIG_IBM_NEW_EMAC_NO_FLOW_CTRL is not set
# CONFIG_IBM_NEW_EMAC_MAL_CLR_ICINTSTAT is not set
# CONFIG_IBM_NEW_EMAC_MAL_COMMON_ERR is not set
# CONFIG_B44 is not set
# CONFIG_KS8842 is not set
# CONFIG_KS8851 is not set
# CONFIG_KS8851_MLL is not set
# CONFIG_NETDEV_1000 is not set
# CONFIG_NETDEV_10000 is not set
# CONFIG_WLAN is not set

#
# Enable WiMAX (Networking options) to see the WiMAX drivers
#

#
# USB Network Adapters
#
# CONFIG_USB_CATC is not set
# CONFIG_USB_KAWETH is not set
# CONFIG_USB_PEGASUS is not set
# CONFIG_USB_RTL8150 is not set
# CONFIG_USB_USBNET is not set
# CONFIG_WAN is not set
# CONFIG_PPP is not set
# CONFIG_SLIP is not set
# CONFIG_NETCONSOLE is not set
# CONFIG_NETPOLL is not set
# CONFIG_NET_POLL_CONTROLLER is not set
# CONFIG_ISDN is not set
# CONFIG_PHONE is not set

#
# Input device support
#
CONFIG_INPUT=y
# CONFIG_INPUT_FF_MEMLESS is not set
# CONFIG_INPUT_POLLDEV is not set
# CONFIG_INPUT_SPARSEKMAP is not set

#
# Userland interfaces
#
CONFIG_INPUT_MOUSEDEV=y
# CONFIG_INPUT_MOUSEDEV_PSAUX is not set
CONFIG_INPUT_MOUSEDEV_SCREEN_X=320
CONFIG_INPUT_MOUSEDEV_SCREEN_Y=240
# CONFIG_INPUT_JOYDEV is not set
CONFIG_INPUT_EVDEV=y
# CONFIG_INPUT_EVBUG is not set

#
# Input Device Drivers
#
CONFIG_INPUT_KEYBOARD=y
# CONFIG_KEYBOARD_ADP5588 is not set
# CONFIG_KEYBOARD_ATKBD is not set
# CONFIG_QT2160 is not set
# CONFIG_KEYBOARD_LKKBD is not set
CONFIG_KEYBOARD_GPIO=y
# CONFIG_KEYBOARD_MATRIX is not set
# CONFIG_KEYBOARD_LM8323 is not set
# CONFIG_KEYBOARD_MAX7359 is not set
# CONFIG_KEYBOARD_NEWTON is not set
# CONFIG_KEYBOARD_OPENCORES is not set
# CONFIG_KEYBOARD_STOWAWAY is not set
# CONFIG_KEYBOARD_SUNKBD is not set
# CONFIG_KEYBOARD_XTKBD is not set
# CONFIG_INPUT_MOUSE is not set
# CONFIG_INPUT_JOYSTICK is not set
# CONFIG_INPUT_TABLET is not set
# CONFIG_INPUT_TOUCHSCREEN is not set
# CONFIG_INPUT_MISC is not set

#
# Hardware I/O ports
#
CONFIG_SERIO=y
CONFIG_SERIO_SERPORT=y
# CONFIG_SERIO_RAW is not set
# CONFIG_SERIO_ALTERA_PS2 is not set
# CONFIG_GAMEPORT is not set

#
# Character devices
#
CONFIG_VT=y
CONFIG_CONSOLE_TRANSLATIONS=y
CONFIG_VT_CONSOLE=y
CONFIG_HW_CONSOLE=y
# CONFIG_VT_HW_CONSOLE_BINDING is not set
CONFIG_DEVKMEM=y
# CONFIG_SERIAL_NONSTANDARD is not set

#
# Serial drivers
#
# CONFIG_SERIAL_8250 is not set

#
# Non-8250 serial port support
#
CONFIG_SERIAL_ATMEL=y
CONFIG_SERIAL_ATMEL_CONSOLE=y
CONFIG_SERIAL_ATMEL_PDC=y
# CONFIG_SERIAL_ATMEL_TTYAT is not set
# CONFIG_SERIAL_MAX3100 is not set
CONFIG_SERIAL_CORE=y
CONFIG_SERIAL_CORE_CONSOLE=y
CONFIG_UNIX98_PTYS=y
# CONFIG_DEVPTS_MULTIPLE_INSTANCES is not set
CONFIG_LEGACY_PTYS=y
CONFIG_LEGACY_PTY_COUNT=16
# CONFIG_IPMI_HANDLER is not set
CONFIG_HW_RANDOM=y
# CONFIG_HW_RANDOM_TIMERIOMEM is not set
# CONFIG_R3964 is not set
# CONFIG_RAW_DRIVER is not set
# CONFIG_TCG_TPM is not set
CONFIG_I2C=y
CONFIG_I2C_BOARDINFO=y
CONFIG_I2C_COMPAT=y
CONFIG_I2C_CHARDEV=y
CONFIG_I2C_HELPER_AUTO=y

#
# I2C Hardware Bus support
#

#
# I2C system bus drivers (mostly embedded / system-on-chip)
#
# CONFIG_I2C_DESIGNWARE is not set
# CONFIG_I2C_GPIO is not set
# CONFIG_I2C_OCORES is not set
# CONFIG_I2C_SIMTEC is not set

#
# External I2C/SMBus adapter drivers
#
# CONFIG_I2C_PARPORT_LIGHT is not set
# CONFIG_I2C_TAOS_EVM is not set
# CONFIG_I2C_TINY_USB is not set

#
# Other I2C/SMBus bus drivers
#
# CONFIG_I2C_PCA_PLATFORM is not set
# CONFIG_I2C_STUB is not set

#
# Miscellaneous I2C Chip support
#
# CONFIG_SENSORS_TSL2550 is not set
# CONFIG_I2C_DEBUG_CORE is not set
# CONFIG_I2C_DEBUG_ALGO is not set
# CONFIG_I2C_DEBUG_BUS is not set
# CONFIG_I2C_DEBUG_CHIP is not set
CONFIG_SPI=y
CONFIG_SPI_MASTER=y

#
# SPI Master Controller Drivers
#
CONFIG_SPI_ATMEL=y
# CONFIG_SPI_BITBANG is not set
# CONFIG_SPI_GPIO is not set
# CONFIG_SPI_XILINX is not set
# CONFIG_SPI_DESIGNWARE is not set

#
# SPI Protocol Masters
#
CONFIG_SPI_SPIDEV=y
# CONFIG_SPI_TLE62X0 is not set

#
# PPS support
#
# CONFIG_PPS is not set
CONFIG_ARCH_REQUIRE_GPIOLIB=y
CONFIG_GPIOLIB=y
# CONFIG_GPIO_SYSFS is not set

#
# Memory mapped GPIO expanders:
#

#
# I2C GPIO expanders:
#
# CONFIG_GPIO_MAX732X is not set
# CONFIG_GPIO_PCA953X is not set
# CONFIG_GPIO_PCF857X is not set
# CONFIG_GPIO_ADP5588 is not set

#
# PCI GPIO expanders:
#

#
# SPI GPIO expanders:
#
# CONFIG_GPIO_MAX7301 is not set
# CONFIG_GPIO_MCP23S08 is not set
# CONFIG_GPIO_MC33880 is not set

#
# AC97 GPIO expanders:
#
# CONFIG_W1 is not set
# CONFIG_POWER_SUPPLY is not set
# CONFIG_HWMON is not set
# CONFIG_THERMAL is not set
# CONFIG_WATCHDOG is not set
CONFIG_SSB_POSSIBLE=y

#
# Sonics Silicon Backplane
#
CONFIG_SSB=y
CONFIG_SSB_SDIOHOST_POSSIBLE=y
# CONFIG_SSB_SDIOHOST is not set
# CONFIG_SSB_DEBUG is not set

#
# Multifunction device drivers
#
# CONFIG_MFD_CORE is not set
# CONFIG_MFD_SM501 is not set
# CONFIG_MFD_ASIC3 is not set
# CONFIG_HTC_EGPIO is not set
# CONFIG_HTC_PASIC3 is not set
# CONFIG_TPS65010 is not set
# CONFIG_TWL4030_CORE is not set
# CONFIG_MFD_TMIO is not set
# CONFIG_MFD_T7L66XB is not set
# CONFIG_MFD_TC6387XB is not set
# CONFIG_MFD_TC6393XB is not set
# CONFIG_PMIC_DA903X is not set
# CONFIG_PMIC_ADP5520 is not set
# CONFIG_MFD_WM8400 is not set
# CONFIG_MFD_WM831X is not set
# CONFIG_MFD_WM8350_I2C is not set
# CONFIG_MFD_PCF50633 is not set
# CONFIG_MFD_MC13783 is not set
# CONFIG_AB3100_CORE is not set
# CONFIG_EZX_PCAP is not set
# CONFIG_MFD_88PM8607 is not set
# CONFIG_AB4500_CORE is not set
# CONFIG_REGULATOR is not set
# CONFIG_MEDIA_SUPPORT is not set

#
# Graphics support
#
# CONFIG_VGASTATE is not set
# CONFIG_VIDEO_OUTPUT_CONTROL is not set
# CONFIG_FB is not set
# CONFIG_BACKLIGHT_LCD_SUPPORT is not set

#
# Display device support
#
# CONFIG_DISPLAY_SUPPORT is not set

#
# Console display driver support
#
# CONFIG_VGA_CONSOLE is not set
CONFIG_DUMMY_CONSOLE=y
CONFIG_SOUND=y
CONFIG_SOUND_OSS_CORE=y
CONFIG_SOUND_OSS_CORE_PRECLAIM=y
CONFIG_SND=y
CONFIG_SND_TIMER=y
CONFIG_SND_PCM=y
CONFIG_SND_HWDEP=y
CONFIG_SND_RAWMIDI=y
# CONFIG_SND_SEQUENCER is not set
CONFIG_SND_OSSEMUL=y
CONFIG_SND_MIXER_OSS=y
CONFIG_SND_PCM_OSS=y
CONFIG_SND_PCM_OSS_PLUGINS=y
CONFIG_SND_DYNAMIC_MINORS=y
CONFIG_SND_SUPPORT_OLD_API=y
CONFIG_SND_VERBOSE_PROCFS=y
# CONFIG_SND_VERBOSE_PRINTK is not set
# CONFIG_SND_DEBUG is not set
# CONFIG_SND_RAWMIDI_SEQ is not set
# CONFIG_SND_OPL3_LIB_SEQ is not set
# CONFIG_SND_OPL4_LIB_SEQ is not set
# CONFIG_SND_SBAWE_SEQ is not set
# CONFIG_SND_EMU10K1_SEQ is not set
# CONFIG_SND_DRIVERS is not set
# CONFIG_SND_ARM is not set

#
# Atmel devices (AVR32 and AT91)
#
# CONFIG_SND_SPI is not set
CONFIG_SND_USB=y
CONFIG_SND_USB_AUDIO=y
CONFIG_SND_USB_CAIAQ=y
CONFIG_SND_USB_CAIAQ_INPUT=y
# CONFIG_SND_SOC is not set
CONFIG_SOUND_PRIME=y
# CONFIG_HID_SUPPORT is not set
CONFIG_USB_SUPPORT=y
CONFIG_USB_ARCH_HAS_HCD=y
CONFIG_USB_ARCH_HAS_OHCI=y
# CONFIG_USB_ARCH_HAS_EHCI is not set
CONFIG_USB=y
# CONFIG_USB_DEBUG is not set
# CONFIG_USB_ANNOUNCE_NEW_DEVICES is not set

#
# Miscellaneous USB options
#
CONFIG_USB_DEVICEFS=y
# CONFIG_USB_DEVICE_CLASS is not set
# CONFIG_USB_DYNAMIC_MINORS is not set
# CONFIG_USB_OTG is not set
# CONFIG_USB_MON is not set
# CONFIG_USB_WUSB is not set
# CONFIG_USB_WUSB_CBAF is not set

#
# USB Host Controller Drivers
#
# CONFIG_USB_C67X00_HCD is not set
# CONFIG_USB_OXU210HP_HCD is not set
# CONFIG_USB_ISP116X_HCD is not set
# CONFIG_USB_ISP1760_HCD is not set
# CONFIG_USB_ISP1362_HCD is not set
CONFIG_USB_OHCI_HCD=y
# CONFIG_USB_OHCI_HCD_SSB is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_DESC is not set
# CONFIG_USB_OHCI_BIG_ENDIAN_MMIO is not set
CONFIG_USB_OHCI_LITTLE_ENDIAN=y
# CONFIG_USB_SL811_HCD is not set
# CONFIG_USB_R8A66597_HCD is not set
# CONFIG_USB_HWA_HCD is not set
# CONFIG_USB_MUSB_HDRC is not set
# CONFIG_USB_GADGET_MUSB_HDRC is not set

#
# USB Device Class drivers
#
CONFIG_USB_ACM=m
# CONFIG_USB_PRINTER is not set
# CONFIG_USB_WDM is not set
# CONFIG_USB_TMC is not set

#
# NOTE: USB_STORAGE depends on SCSI but BLK_DEV_SD may
#

#
# also be needed; see USB_STORAGE Help for more info
#
CONFIG_USB_STORAGE=y
# CONFIG_USB_STORAGE_DEBUG is not set
# CONFIG_USB_STORAGE_DATAFAB is not set
# CONFIG_USB_STORAGE_FREECOM is not set
# CONFIG_USB_STORAGE_ISD200 is not set
# CONFIG_USB_STORAGE_USBAT is not set
# CONFIG_USB_STORAGE_SDDR09 is not set
# CONFIG_USB_STORAGE_SDDR55 is not set
# CONFIG_USB_STORAGE_JUMPSHOT is not set
# CONFIG_USB_STORAGE_ALAUDA is not set
# CONFIG_USB_STORAGE_ONETOUCH is not set
# CONFIG_USB_STORAGE_KARMA is not set
# CONFIG_USB_STORAGE_CYPRESS_ATACB is not set
# CONFIG_USB_LIBUSUAL is not set

#
# USB Imaging devices
#
# CONFIG_USB_MDC800 is not set
# CONFIG_USB_MICROTEK is not set

#
# USB port drivers
#
# CONFIG_USB_SERIAL is not set

#
# USB Miscellaneous drivers
#
# CONFIG_USB_EMI62 is not set
# CONFIG_USB_EMI26 is not set
# CONFIG_USB_ADUTUX is not set
# CONFIG_USB_SEVSEG is not set
# CONFIG_USB_RIO500 is not set
# CONFIG_USB_LEGOTOWER is not set
# CONFIG_USB_LCD is not set
# CONFIG_USB_BERRY_CHARGE is not set
# CONFIG_USB_LED is not set
# CONFIG_USB_CYPRESS_CY7C63 is not set
# CONFIG_USB_CYTHERM is not set
# CONFIG_USB_IDMOUSE is not set
# CONFIG_USB_FTDI_ELAN is not set
# CONFIG_USB_APPLEDISPLAY is not set
# CONFIG_USB_LD is not set
# CONFIG_USB_TRANCEVIBRATOR is not set
# CONFIG_USB_IOWARRIOR is not set
# CONFIG_USB_TEST is not set
# CONFIG_USB_ISIGHTFW is not set
# CONFIG_USB_VST is not set
CONFIG_USB_GADGET=y
# CONFIG_USB_GADGET_DEBUG_FILES is not set
CONFIG_USB_GADGET_VBUS_DRAW=2
CONFIG_USB_GADGET_SELECTED=y
CONFIG_USB_GADGET_AT91=y
CONFIG_USB_AT91=y
# CONFIG_USB_GADGET_ATMEL_USBA is not set
# CONFIG_USB_GADGET_FSL_USB2 is not set
# CONFIG_USB_GADGET_LH7A40X is not set
# CONFIG_USB_GADGET_OMAP is not set
# CONFIG_USB_GADGET_PXA25X is not set
# CONFIG_USB_GADGET_R8A66597 is not set
# CONFIG_USB_GADGET_PXA27X is not set
# CONFIG_USB_GADGET_S3C_HSOTG is not set
# CONFIG_USB_GADGET_IMX is not set
# CONFIG_USB_GADGET_S3C2410 is not set
# CONFIG_USB_GADGET_M66592 is not set
# CONFIG_USB_GADGET_AMD5536UDC is not set
# CONFIG_USB_GADGET_FSL_QE is not set
# CONFIG_USB_GADGET_CI13XXX is not set
# CONFIG_USB_GADGET_NET2280 is not set
# CONFIG_USB_GADGET_GOKU is not set
# CONFIG_USB_GADGET_LANGWELL is not set
# CONFIG_USB_GADGET_DUMMY_HCD is not set
# CONFIG_USB_GADGET_DUALSPEED is not set
CONFIG_USB_ZERO=m
# CONFIG_USB_AUDIO is not set
CONFIG_USB_ETH=m
CONFIG_USB_ETH_RNDIS=y
# CONFIG_USB_ETH_EEM is not set
CONFIG_USB_GADGETFS=m
CONFIG_USB_FILE_STORAGE=m
# CONFIG_USB_FILE_STORAGE_TEST is not set
# CONFIG_USB_MASS_STORAGE is not set
CONFIG_USB_G_SERIAL=m
# CONFIG_USB_MIDI_GADGET is not set
# CONFIG_USB_G_PRINTER is not set
# CONFIG_USB_CDC_COMPOSITE is not set
# CONFIG_USB_G_MULTI is not set

#
# OTG and related infrastructure
#
# CONFIG_USB_GPIO_VBUS is not set
# CONFIG_USB_ULPI is not set
# CONFIG_NOP_USB_XCEIV is not set
CONFIG_MMC=y
# CONFIG_MMC_DEBUG is not set
# CONFIG_MMC_UNSAFE_RESUME is not set

#
# MMC/SD/SDIO Card Drivers
#
CONFIG_MMC_BLOCK=y
CONFIG_MMC_BLOCK_BOUNCE=y
# CONFIG_SDIO_UART is not set
CONFIG_MMC_TEST=y

#
# MMC/SD/SDIO Host Controller Drivers
#
# CONFIG_MMC_SDHCI is not set
CONFIG_MMC_AT91=y
# CONFIG_MMC_ATMELMCI is not set
# CONFIG_MMC_SPI is not set
# CONFIG_MEMSTICK is not set
CONFIG_NEW_LEDS=y
CONFIG_LEDS_CLASS=y

#
# LED drivers
#
# CONFIG_LEDS_PCA9532 is not set
CONFIG_LEDS_GPIO=y
CONFIG_LEDS_GPIO_PLATFORM=y
# CONFIG_LEDS_LP3944 is not set
# CONFIG_LEDS_PCA955X is not set
# CONFIG_LEDS_DAC124S085 is not set
# CONFIG_LEDS_BD2802 is not set
# CONFIG_LEDS_LT3593 is not set

#
# LED Triggers
#
CONFIG_LEDS_TRIGGERS=y
CONFIG_LEDS_TRIGGER_TIMER=y
CONFIG_LEDS_TRIGGER_HEARTBEAT=y
# CONFIG_LEDS_TRIGGER_BACKLIGHT is not set
# CONFIG_LEDS_TRIGGER_GPIO is not set
# CONFIG_LEDS_TRIGGER_DEFAULT_ON is not set

#
# iptables trigger is under Netfilter config (LED target)
#
# CONFIG_ACCESSIBILITY is not set
CONFIG_RTC_LIB=y
CONFIG_RTC_CLASS=y
CONFIG_RTC_HCTOSYS=y
CONFIG_RTC_HCTOSYS_DEVICE="rtc0"
# CONFIG_RTC_DEBUG is not set

#
# RTC interfaces
#
CONFIG_RTC_INTF_SYSFS=y
CONFIG_RTC_INTF_PROC=y
CONFIG_RTC_INTF_DEV=y
# CONFIG_RTC_INTF_DEV_UIE_EMUL is not set
# CONFIG_RTC_DRV_TEST is not set

#
# I2C RTC drivers
#
# CONFIG_RTC_DRV_DS1307 is not set
# CONFIG_RTC_DRV_DS1374 is not set
# CONFIG_RTC_DRV_DS1672 is not set
# CONFIG_RTC_DRV_MAX6900 is not set
# CONFIG_RTC_DRV_RS5C372 is not set
# CONFIG_RTC_DRV_ISL1208 is not set
# CONFIG_RTC_DRV_X1205 is not set
# CONFIG_RTC_DRV_PCF8563 is not set
# CONFIG_RTC_DRV_PCF8583 is not set
# CONFIG_RTC_DRV_M41T80 is not set
# CONFIG_RTC_DRV_BQ32K is not set
# CONFIG_RTC_DRV_S35390A is not set
# CONFIG_RTC_DRV_FM3130 is not set
# CONFIG_RTC_DRV_RX8581 is not set
# CONFIG_RTC_DRV_RX8025 is not set

#
# SPI RTC drivers
#
# CONFIG_RTC_DRV_M41T94 is not set
# CONFIG_RTC_DRV_DS1305 is not set
# CONFIG_RTC_DRV_DS1390 is not set
# CONFIG_RTC_DRV_MAX6902 is not set
# CONFIG_RTC_DRV_R9701 is not set
# CONFIG_RTC_DRV_RS5C348 is not set
# CONFIG_RTC_DRV_DS3234 is not set
# CONFIG_RTC_DRV_PCF2123 is not set

#
# Platform RTC drivers
#
# CONFIG_RTC_DRV_CMOS is not set
# CONFIG_RTC_DRV_DS1286 is not set
# CONFIG_RTC_DRV_DS1511 is not set
# CONFIG_RTC_DRV_DS1553 is not set
# CONFIG_RTC_DRV_DS1742 is not set
# CONFIG_RTC_DRV_STK17TA8 is not set
# CONFIG_RTC_DRV_M48T86 is not set
# CONFIG_RTC_DRV_M48T35 is not set
# CONFIG_RTC_DRV_M48T59 is not set
# CONFIG_RTC_DRV_MSM6242 is not set
# CONFIG_RTC_DRV_BQ4802 is not set
# CONFIG_RTC_DRV_RP5C01 is not set
# CONFIG_RTC_DRV_V3020 is not set

#
# on-CPU RTC drivers
#
CONFIG_RTC_DRV_AT91SAM9=y
CONFIG_RTC_DRV_AT91SAM9_RTT=0
CONFIG_RTC_DRV_AT91SAM9_GPBR=0
# CONFIG_DMADEVICES is not set
# CONFIG_AUXDISPLAY is not set
# CONFIG_UIO is not set

#
# TI VLYNQ
#
# CONFIG_STAGING is not set

#
# File systems
#
# CONFIG_EXT2_FS is not set
# CONFIG_EXT3_FS is not set
CONFIG_EXT4_FS=y
CONFIG_EXT4_USE_FOR_EXT23=y
# CONFIG_EXT4_FS_XATTR is not set
# CONFIG_EXT4_DEBUG is not set
CONFIG_JBD2=y
# CONFIG_REISERFS_FS is not set
# CONFIG_JFS_FS is not set
# CONFIG_FS_POSIX_ACL is not set
# CONFIG_XFS_FS is not set
# CONFIG_GFS2_FS is not set
# CONFIG_OCFS2_FS is not set
# CONFIG_BTRFS_FS is not set
# CONFIG_NILFS2_FS is not set
CONFIG_FILE_LOCKING=y
CONFIG_FSNOTIFY=y
CONFIG_DNOTIFY=y
CONFIG_INOTIFY=y
CONFIG_INOTIFY_USER=y
# CONFIG_QUOTA is not set
# CONFIG_AUTOFS_FS is not set
# CONFIG_AUTOFS4_FS is not set
# CONFIG_FUSE_FS is not set

#
# Caches
#
# CONFIG_FSCACHE is not set

#
# CD-ROM/DVD Filesystems
#
# CONFIG_ISO9660_FS is not set
# CONFIG_UDF_FS is not set

#
# DOS/FAT/NT Filesystems
#
CONFIG_FAT_FS=y
CONFIG_MSDOS_FS=y
CONFIG_VFAT_FS=y
CONFIG_FAT_DEFAULT_CODEPAGE=437
CONFIG_FAT_DEFAULT_IOCHARSET="iso8859-1"
# CONFIG_NTFS_FS is not set

#
# Pseudo filesystems
#
CONFIG_PROC_FS=y
CONFIG_PROC_SYSCTL=y
CONFIG_PROC_PAGE_MONITOR=y
CONFIG_SYSFS=y
CONFIG_TMPFS=y
# CONFIG_TMPFS_POSIX_ACL is not set
# CONFIG_HUGETLB_PAGE is not set
# CONFIG_CONFIGFS_FS is not set
# CONFIG_MISC_FILESYSTEMS is not set
# CONFIG_NETWORK_FILESYSTEMS is not set

#
# Partition Types
#
# CONFIG_PARTITION_ADVANCED is not set
CONFIG_MSDOS_PARTITION=y
CONFIG_NLS=y
CONFIG_NLS_DEFAULT="iso8859-1"
CONFIG_NLS_CODEPAGE_437=y
# CONFIG_NLS_CODEPAGE_737 is not set
# CONFIG_NLS_CODEPAGE_775 is not set
CONFIG_NLS_CODEPAGE_850=y
# CONFIG_NLS_CODEPAGE_852 is not set
# CONFIG_NLS_CODEPAGE_855 is not set
# CONFIG_NLS_CODEPAGE_857 is not set
# CONFIG_NLS_CODEPAGE_860 is not set
# CONFIG_NLS_CODEPAGE_861 is not set
# CONFIG_NLS_CODEPAGE_862 is not set
# CONFIG_NLS_CODEPAGE_863 is not set
# CONFIG_NLS_CODEPAGE_864 is not set
# CONFIG_NLS_CODEPAGE_865 is not set
# CONFIG_NLS_CODEPAGE_866 is not set
# CONFIG_NLS_CODEPAGE_869 is not set
# CONFIG_NLS_CODEPAGE_936 is not set
# CONFIG_NLS_CODEPAGE_950 is not set
# CONFIG_NLS_CODEPAGE_932 is not set
# CONFIG_NLS_CODEPAGE_949 is not set
# CONFIG_NLS_CODEPAGE_874 is not set
# CONFIG_NLS_ISO8859_8 is not set
# CONFIG_NLS_CODEPAGE_1250 is not set
# CONFIG_NLS_CODEPAGE_1251 is not set
# CONFIG_NLS_ASCII is not set
CONFIG_NLS_ISO8859_1=y
# CONFIG_NLS_ISO8859_2 is not set
# CONFIG_NLS_ISO8859_3 is not set
# CONFIG_NLS_ISO8859_4 is not set
# CONFIG_NLS_ISO8859_5 is not set
# CONFIG_NLS_ISO8859_6 is not set
# CONFIG_NLS_ISO8859_7 is not set
# CONFIG_NLS_ISO8859_9 is not set
# CONFIG_NLS_ISO8859_13 is not set
# CONFIG_NLS_ISO8859_14 is not set
CONFIG_NLS_ISO8859_15=y
# CONFIG_NLS_KOI8_R is not set
# CONFIG_NLS_KOI8_U is not set
CONFIG_NLS_UTF8=y
# CONFIG_DLM is not set

#
# Kernel hacking
#
# CONFIG_PRINTK_TIME is not set
# CONFIG_ENABLE_WARN_DEPRECATED is not set
CONFIG_ENABLE_MUST_CHECK=y
CONFIG_FRAME_WARN=1024
# CONFIG_MAGIC_SYSRQ is not set
# CONFIG_STRIP_ASM_SYMS is not set
# CONFIG_UNUSED_SYMBOLS is not set
# CONFIG_DEBUG_FS is not set
# CONFIG_HEADERS_CHECK is not set
# CONFIG_IPIPE_DEBUG is not set
# CONFIG_DEBUG_KERNEL is not set
CONFIG_DEBUG_BUGVERBOSE=y
CONFIG_DEBUG_MEMORY_INIT=y
# CONFIG_RCU_CPU_STALL_DETECTOR is not set
# CONFIG_LATENCYTOP is not set
# CONFIG_SYSCTL_SYSCALL_CHECK is not set
CONFIG_HAVE_FUNCTION_TRACER=y
CONFIG_TRACING_SUPPORT=y
# CONFIG_FTRACE is not set
# CONFIG_SAMPLES is not set
CONFIG_HAVE_ARCH_KGDB=y
CONFIG_ARM_UNWIND=y
# CONFIG_DEBUG_USER is not set
# CONFIG_OC_ETM is not set

#
# Security options
#
# CONFIG_KEYS is not set
# CONFIG_SECURITY is not set
# CONFIG_SECURITYFS is not set
# CONFIG_DEFAULT_SECURITY_SELINUX is not set
# CONFIG_DEFAULT_SECURITY_SMACK is not set
# CONFIG_DEFAULT_SECURITY_TOMOYO is not set
CONFIG_DEFAULT_SECURITY_DAC=y
CONFIG_DEFAULT_SECURITY=""
# CONFIG_CRYPTO is not set
# CONFIG_BINARY_PRINTF is not set

#
# Library routines
#
CONFIG_BITREVERSE=y
CONFIG_GENERIC_FIND_LAST_BIT=y
# CONFIG_CRC_CCITT is not set
CONFIG_CRC16=y
# CONFIG_CRC_T10DIF is not set
CONFIG_CRC_ITU_T=m
CONFIG_CRC32=y
# CONFIG_CRC7 is not set
# CONFIG_LIBCRC32C is not set
CONFIG_ZLIB_INFLATE=y
CONFIG_LZO_DECOMPRESS=y
CONFIG_DECOMPRESS_GZIP=y
CONFIG_DECOMPRESS_BZIP2=y
CONFIG_DECOMPRESS_LZMA=y
CONFIG_DECOMPRESS_LZO=y
CONFIG_HAS_IOMEM=y
CONFIG_HAS_IOPORT=y
CONFIG_HAS_DMA=y
CONFIG_NLATTR=y

[-- Attachment #3: simple_xenomai_code.c --]
[-- Type: text/x-csrc, Size: 2154 bytes --]

#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 <string.h>
#include <errno.h>
#include <ctype.h>
#include <termios.h>


#include <native/task.h>
#include <native/timer.h>


#include "definitions.h" // base addresses, offsets

#define MAP_SIZE 4096UL
#define MAP_MASK MAP_SIZE-1
#define TIMESLEEP 1000000000 /* 1 sec */


RT_TASK blink_task;
int fd;
unsigned char *piob_base, *aic_base; 

void open_controller(){


    if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) 
    {
    	printf("Couldn't open /dev/mem. error %s\n", strerror(errno));
	exit(1);
    }

    printf("/dev/mem opened.\n"); 
   
	aic_base =  mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, AT91C_BASE_PIOB & (~MAP_MASK));
	piob_base = aic_base + AT91C_BASE_PIOB - AT91C_BASE_AIC;

    if( (aic_base == MAP_FAILED)) {

    	printf("Couldn't get Map-Address.(errno: %d).\n", errno);		
	exit(1);

	}

// peripheral settings
*((unsigned int *) (piob_base + (PIO_IDR)))  = 1<<0;
*((unsigned int *) (piob_base + (PIO_PER)))  = 1<<0;
*((unsigned int *) (piob_base + (PIO_CODR))) =1<<0;
*((unsigned int *) (piob_base + (PIO_PPUDR)))=1<<0;
*((unsigned int *) (piob_base + (PIO_OER)))  = 1<<0;
*((unsigned int *) (piob_base + (PIO_MDDR))) = 1<<0;
 

}


void blink(void *arg __attribute__((__unused__)))
{
 
    rt_task_set_periodic(NULL, TM_NOW, TIMESLEEP);
 
    while(1) {
        // do some lame stuff, such as pin toggling
	*((unsigned int *) (piob_base + (PIO_CODR))) = 1<<0;
        rt_task_wait_period(NULL);
        *((unsigned int *) (piob_base + (PIO_SODR))) = 1<<0;
    
    }
}


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);
 	
    open_controller();
  
    /* 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] 21+ messages in thread

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:44               ` at91_enthus
@ 2011-01-25  4:49                 ` Gilles Chanteperdrix
  2011-01-25  4:54                 ` Gilles Chanteperdrix
  1 sibling, 0 replies; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  4:49 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>
>>>> at91_enthus wrote:
>>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>
>>>>>> at91_enthus wrote:
>>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>
>>>>>>>> at91_enthus wrote:
>>>>>>>>> Hi.
>>>>>>>>>
>>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
>>>> adapt
>>>>>>>> the
>>>>>>>>> code found here:
>>>>>>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
>>>>>>>> By the way, this code is ridiculous. It creates a real-time task to
>>>>>>>> write to some non real-time device, which makes the real-time task
>>>>>> useless.
>>>>>>> I know.
>>>>>> Yes, but this example is bad in many ways:
>>>>>> - first it uses xenomai api to create a real-time task, and uses write
>>>>>> which causes the real-time task to switch to secondary domain;
>>>>>> - the Makefile does not use xeno-config, which have been the
>> recommended
>>>>>> way of getting the compiler flags since day 1;
>>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
>>>>>> could lead people to believe that they should do the same when using
>>>>>> Xenomai, whereas there is no such requirement.
>>>>>> - the pointers point to outdated version of the documentation.
>>>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
>> things
>>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
>>>>>> interrupt the program, which is bound to fail if anything goes wrong,
>>>>>> since SIGINT is neutralized in the program.
>>>>>>
>>>>>>> That's why I went to mmap().
>>>>>> That is not really the right solution either. I admit that for driving
>>>>>> leds, it may be a bit overkill, but anyway, what you should do is
>> write
>>>>>> an RTDM driver for driving the leds. Keeping the driver separated from
>>>>>> the application will allow the same program to run on other platforms
>>>>>> where driving the LEDS is done differently without changing much of
>> the
>>>>>> application code. In other word, the application/driver separation is
>> a
>>>>>> sane one.
>>>>>>
>>>>>> Anyway, mmap should work.
>>>>>>
>>>>>>  (I chose that sample code because, for
>>>>>>> now, I am only learning to use basic functions)
>>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
>>>>>>> Indeed, my program fails miserably when I check the mapping of AIC,
>> not
>>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
>>>>>>> mmap-ing works  fine.
>>>>>> Well errno might give you a clue. Do you have FCSE enabled?
>>>>>>
>>>>>> Regards.
>>>>>>
>>>>>> --
>>>>>>
>> Gilles.
>>>>> FCSE is enabled. errno returns  22 (invalid argument).
>>>> best effort or guaranteed?
>>>
>>> Best effort
>>>
>>>
>>>> Please activate FCSE messages.
>>>
>>> ... compiling new kernel
>>>
>>>
>>>> How big is
>>>> MAP_SIZE?
>>>>
>>>>
>>> 4096
>> Ok. Could you post your full kernel configuration, as well as the full
>> program?
>>
> 
> I put the .config and the code in the attachments.
> 
> 
>> Are you running this program as root?
>>
>>
> I run it with sudo.

Ok. Please make sure that you are not running with some funky ulimit
settings then, I will try and compile it on at91sam9263.


-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:44               ` at91_enthus
  2011-01-25  4:49                 ` Gilles Chanteperdrix
@ 2011-01-25  4:54                 ` Gilles Chanteperdrix
  2011-01-25  5:00                   ` at91_enthus
  1 sibling, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  4:54 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>
>>>> at91_enthus wrote:
>>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>
>>>>>> at91_enthus wrote:
>>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>
>>>>>>>> at91_enthus wrote:
>>>>>>>>> Hi.
>>>>>>>>>
>>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
>>>> adapt
>>>>>>>> the
>>>>>>>>> code found here:
>>>>>>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
>>>>>>>> By the way, this code is ridiculous. It creates a real-time task to
>>>>>>>> write to some non real-time device, which makes the real-time task
>>>>>> useless.
>>>>>>> I know.
>>>>>> Yes, but this example is bad in many ways:
>>>>>> - first it uses xenomai api to create a real-time task, and uses write
>>>>>> which causes the real-time task to switch to secondary domain;
>>>>>> - the Makefile does not use xeno-config, which have been the
>> recommended
>>>>>> way of getting the compiler flags since day 1;
>>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
>>>>>> could lead people to believe that they should do the same when using
>>>>>> Xenomai, whereas there is no such requirement.
>>>>>> - the pointers point to outdated version of the documentation.
>>>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
>> things
>>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
>>>>>> interrupt the program, which is bound to fail if anything goes wrong,
>>>>>> since SIGINT is neutralized in the program.
>>>>>>
>>>>>>> That's why I went to mmap().
>>>>>> That is not really the right solution either. I admit that for driving
>>>>>> leds, it may be a bit overkill, but anyway, what you should do is
>> write
>>>>>> an RTDM driver for driving the leds. Keeping the driver separated from
>>>>>> the application will allow the same program to run on other platforms
>>>>>> where driving the LEDS is done differently without changing much of
>> the
>>>>>> application code. In other word, the application/driver separation is
>> a
>>>>>> sane one.
>>>>>>
>>>>>> Anyway, mmap should work.
>>>>>>
>>>>>>  (I chose that sample code because, for
>>>>>>> now, I am only learning to use basic functions)
>>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
>>>>>>> Indeed, my program fails miserably when I check the mapping of AIC,
>> not
>>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code, AIC
>>>>>>> mmap-ing works  fine.
>>>>>> Well errno might give you a clue. Do you have FCSE enabled?
>>>>>>
>>>>>> Regards.
>>>>>>
>>>>>> --
>>>>>>
>> Gilles.
>>>>> FCSE is enabled. errno returns  22 (invalid argument).
>>>> best effort or guaranteed?
>>>
>>> Best effort
>>>
>>>
>>>> Please activate FCSE messages.
>>>
>>> ... compiling new kernel
>>>
>>>
>>>> How big is
>>>> MAP_SIZE?
>>>>
>>>>
>>> 4096
>> Ok. Could you post your full kernel configuration, as well as the full
>> program?
>>
> 
> I put the .config and the code in the attachments.

If you remove all the native skin stuff, only keep main and
open_controller, do not link with the native library, you can confirm
that this same program runs without trouble?

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  4:54                 ` Gilles Chanteperdrix
@ 2011-01-25  5:00                   ` at91_enthus
  2011-01-25  5:02                     ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  5:00 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Mon, Jan 24, 2011 at 10:54 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
> >>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>
> >>>> at91_enthus wrote:
> >>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
> >>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>
> >>>>>> at91_enthus wrote:
> >>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> >>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>>>
> >>>>>>>> at91_enthus wrote:
> >>>>>>>>> Hi.
> >>>>>>>>>
> >>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
> >>>> adapt
> >>>>>>>> the
> >>>>>>>>> code found here:
> >>>>>>>>>
> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
> >>>>>>>> By the way, this code is ridiculous. It creates a real-time task
> to
> >>>>>>>> write to some non real-time device, which makes the real-time task
> >>>>>> useless.
> >>>>>>> I know.
> >>>>>> Yes, but this example is bad in many ways:
> >>>>>> - first it uses xenomai api to create a real-time task, and uses
> write
> >>>>>> which causes the real-time task to switch to secondary domain;
> >>>>>> - the Makefile does not use xeno-config, which have been the
> >> recommended
> >>>>>> way of getting the compiler flags since day 1;
> >>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
> >>>>>> could lead people to believe that they should do the same when using
> >>>>>> Xenomai, whereas there is no such requirement.
> >>>>>> - the pointers point to outdated version of the documentation.
> >>>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
> >> things
> >>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
> >>>>>> interrupt the program, which is bound to fail if anything goes
> wrong,
> >>>>>> since SIGINT is neutralized in the program.
> >>>>>>
> >>>>>>> That's why I went to mmap().
> >>>>>> That is not really the right solution either. I admit that for
> driving
> >>>>>> leds, it may be a bit overkill, but anyway, what you should do is
> >> write
> >>>>>> an RTDM driver for driving the leds. Keeping the driver separated
> from
> >>>>>> the application will allow the same program to run on other
> platforms
> >>>>>> where driving the LEDS is done differently without changing much of
> >> the
> >>>>>> application code. In other word, the application/driver separation
> is
> >> a
> >>>>>> sane one.
> >>>>>>
> >>>>>> Anyway, mmap should work.
> >>>>>>
> >>>>>>  (I chose that sample code because, for
> >>>>>>> now, I am only learning to use basic functions)
> >>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> >>>>>>> Indeed, my program fails miserably when I check the mapping of AIC,
> >> not
> >>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code,
> AIC
> >>>>>>> mmap-ing works  fine.
> >>>>>> Well errno might give you a clue. Do you have FCSE enabled?
> >>>>>>
> >>>>>> Regards.
> >>>>>>
> >>>>>> --
> >>>>>>
> >> Gilles.
> >>>>> FCSE is enabled. errno returns  22 (invalid argument).
> >>>> best effort or guaranteed?
> >>>
> >>> Best effort
> >>>
> >>>
> >>>> Please activate FCSE messages.
> >>>
> >>> ... compiling new kernel
> >>>
> >>>
> >>>> How big is
> >>>> MAP_SIZE?
> >>>>
> >>>>
> >>> 4096
> >> Ok. Could you post your full kernel configuration, as well as the full
> >> program?
> >>
> >
> > I put the .config and the code in the attachments.
>
>

> If you remove all the native skin stuff, only keep main and
> open_controller, do not link with the native library, you can confirm
> that this same program runs without trouble?
>

 Without  Xenomai related stuff, it runs  OK.

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  5:00                   ` at91_enthus
@ 2011-01-25  5:02                     ` Gilles Chanteperdrix
  2011-01-25  5:08                       ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  5:02 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 10:54 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>
>>>> at91_enthus wrote:
>>>>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>
>>>>>> at91_enthus wrote:
>>>>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>
>>>>>>>> at91_enthus wrote:
>>>>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
>>>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>>>
>>>>>>>>>> at91_enthus wrote:
>>>>>>>>>>> Hi.
>>>>>>>>>>>
>>>>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried to
>>>>>> adapt
>>>>>>>>>> the
>>>>>>>>>>> code found here:
>>>>>>>>>>>
>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
>>>>>>>>>> By the way, this code is ridiculous. It creates a real-time task
>> to
>>>>>>>>>> write to some non real-time device, which makes the real-time task
>>>>>>>> useless.
>>>>>>>>> I know.
>>>>>>>> Yes, but this example is bad in many ways:
>>>>>>>> - first it uses xenomai api to create a real-time task, and uses
>> write
>>>>>>>> which causes the real-time task to switch to secondary domain;
>>>>>>>> - the Makefile does not use xeno-config, which have been the
>>>> recommended
>>>>>>>> way of getting the compiler flags since day 1;
>>>>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision, and
>>>>>>>> could lead people to believe that they should do the same when using
>>>>>>>> Xenomai, whereas there is no such requirement.
>>>>>>>> - the pointers point to outdated version of the documentation.
>>>>>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
>>>> things
>>>>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
>>>>>>>> interrupt the program, which is bound to fail if anything goes
>> wrong,
>>>>>>>> since SIGINT is neutralized in the program.
>>>>>>>>
>>>>>>>>> That's why I went to mmap().
>>>>>>>> That is not really the right solution either. I admit that for
>> driving
>>>>>>>> leds, it may be a bit overkill, but anyway, what you should do is
>>>> write
>>>>>>>> an RTDM driver for driving the leds. Keeping the driver separated
>> from
>>>>>>>> the application will allow the same program to run on other
>> platforms
>>>>>>>> where driving the LEDS is done differently without changing much of
>>>> the
>>>>>>>> application code. In other word, the application/driver separation
>> is
>>>> a
>>>>>>>> sane one.
>>>>>>>>
>>>>>>>> Anyway, mmap should work.
>>>>>>>>
>>>>>>>>  (I chose that sample code because, for
>>>>>>>>> now, I am only learning to use basic functions)
>>>>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
>>>>>>>>> Indeed, my program fails miserably when I check the mapping of AIC,
>>>> not
>>>>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code,
>> AIC
>>>>>>>>> mmap-ing works  fine.
>>>>>>>> Well errno might give you a clue. Do you have FCSE enabled?
>>>>>>>>
>>>>>>>> Regards.
>>>>>>>>
>>>>>>>> --
>>>>>>>>
>>>> Gilles.
>>>>>>> FCSE is enabled. errno returns  22 (invalid argument).
>>>>>> best effort or guaranteed?
>>>>> Best effort
>>>>>
>>>>>
>>>>>> Please activate FCSE messages.
>>>>> ... compiling new kernel
>>>>>
>>>>>
>>>>>> How big is
>>>>>> MAP_SIZE?
>>>>>>
>>>>>>
>>>>> 4096
>>>> Ok. Could you post your full kernel configuration, as well as the full
>>>> program?
>>>>
>>> I put the .config and the code in the attachments.
>>
> 
>> If you remove all the native skin stuff, only keep main and
>> open_controller, do not link with the native library, you can confirm
>> that this same program runs without trouble?
>>
> 
>  Without  Xenomai related stuff, it runs  OK.

You sure of that?  The exact same code, with the same kernel, with the
mlockall?

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  5:02                     ` Gilles Chanteperdrix
@ 2011-01-25  5:08                       ` at91_enthus
  2011-01-25  5:12                         ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  5:08 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Mon, Jan 24, 2011 at 11:02 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Mon, Jan 24, 2011 at 10:54 PM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>> On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
> >>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>
> >>>> at91_enthus wrote:
> >>>>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
> >>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>
> >>>>>> at91_enthus wrote:
> >>>>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
> >>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>>>
> >>>>>>>> at91_enthus wrote:
> >>>>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> >>>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>>>>>
> >>>>>>>>>> at91_enthus wrote:
> >>>>>>>>>>> Hi.
> >>>>>>>>>>>
> >>>>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried
> to
> >>>>>> adapt
> >>>>>>>>>> the
> >>>>>>>>>>> code found here:
> >>>>>>>>>>>
> >> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
> >>>>>>>>>> By the way, this code is ridiculous. It creates a real-time task
> >> to
> >>>>>>>>>> write to some non real-time device, which makes the real-time
> task
> >>>>>>>> useless.
> >>>>>>>>> I know.
> >>>>>>>> Yes, but this example is bad in many ways:
> >>>>>>>> - first it uses xenomai api to create a real-time task, and uses
> >> write
> >>>>>>>> which causes the real-time task to switch to secondary domain;
> >>>>>>>> - the Makefile does not use xeno-config, which have been the
> >>>> recommended
> >>>>>>>> way of getting the compiler flags since day 1;
> >>>>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision,
> and
> >>>>>>>> could lead people to believe that they should do the same when
> using
> >>>>>>>> Xenomai, whereas there is no such requirement.
> >>>>>>>> - the pointers point to outdated version of the documentation.
> >>>>>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
> >>>> things
> >>>>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
> >>>>>>>> interrupt the program, which is bound to fail if anything goes
> >> wrong,
> >>>>>>>> since SIGINT is neutralized in the program.
> >>>>>>>>
> >>>>>>>>> That's why I went to mmap().
> >>>>>>>> That is not really the right solution either. I admit that for
> >> driving
> >>>>>>>> leds, it may be a bit overkill, but anyway, what you should do is
> >>>> write
> >>>>>>>> an RTDM driver for driving the leds. Keeping the driver separated
> >> from
> >>>>>>>> the application will allow the same program to run on other
> >> platforms
> >>>>>>>> where driving the LEDS is done differently without changing much
> of
> >>>> the
> >>>>>>>> application code. In other word, the application/driver separation
> >> is
> >>>> a
> >>>>>>>> sane one.
> >>>>>>>>
> >>>>>>>> Anyway, mmap should work.
> >>>>>>>>
> >>>>>>>>  (I chose that sample code because, for
> >>>>>>>>> now, I am only learning to use basic functions)
> >>>>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> >>>>>>>>> Indeed, my program fails miserably when I check the mapping of
> AIC,
> >>>> not
> >>>>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code,
> >> AIC
> >>>>>>>>> mmap-ing works  fine.
> >>>>>>>> Well errno might give you a clue. Do you have FCSE enabled?
> >>>>>>>>
> >>>>>>>> Regards.
> >>>>>>>>
> >>>>>>>> --
> >>>>>>>>
> >>>> Gilles.
> >>>>>>> FCSE is enabled. errno returns  22 (invalid argument).
> >>>>>> best effort or guaranteed?
> >>>>> Best effort
> >>>>>
> >>>>>
> >>>>>> Please activate FCSE messages.
> >>>>> ... compiling new kernel
> >>>>>
> >>>>>
> >>>>>> How big is
> >>>>>> MAP_SIZE?
> >>>>>>
> >>>>>>
> >>>>> 4096
> >>>> Ok. Could you post your full kernel configuration, as well as the full
> >>>> program?
> >>>>
> >>> I put the .config and the code in the attachments.
> >>
> >
> >> If you remove all the native skin stuff, only keep main and
> >> open_controller, do not link with the native library, you can confirm
> >> that this same program runs without trouble?
> >>
> >
> >  Without  Xenomai related stuff, it runs  OK.
>
> You sure of that?  The exact same code, with the same kernel, with the
> mlockall?
>
> --
>                                                                 Gilles.
>

Oh. I assumed without mlockall (it wasn't part of my original code).
Now, I placed mlockall in my original code (right before open_controller())
and the pin gets toggled according to my scope.

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  5:08                       ` at91_enthus
@ 2011-01-25  5:12                         ` Gilles Chanteperdrix
  2011-01-25  5:32                           ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  5:12 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Mon, Jan 24, 2011 at 11:02 PM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>> On Mon, Jan 24, 2011 at 10:54 PM, Gilles Chanteperdrix <
>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>
>>>> at91_enthus wrote:
>>>>> On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>
>>>>>> at91_enthus wrote:
>>>>>>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>
>>>>>>>> at91_enthus wrote:
>>>>>>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
>>>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>>>
>>>>>>>>>> at91_enthus wrote:
>>>>>>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
>>>>>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
>>>>>>>>>>>
>>>>>>>>>>>> at91_enthus wrote:
>>>>>>>>>>>>> Hi.
>>>>>>>>>>>>>
>>>>>>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and tried
>> to
>>>>>>>> adapt
>>>>>>>>>>>> the
>>>>>>>>>>>>> code found here:
>>>>>>>>>>>>>
>>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
>>>>>>>>>>>> By the way, this code is ridiculous. It creates a real-time task
>>>> to
>>>>>>>>>>>> write to some non real-time device, which makes the real-time
>> task
>>>>>>>>>> useless.
>>>>>>>>>>> I know.
>>>>>>>>>> Yes, but this example is bad in many ways:
>>>>>>>>>> - first it uses xenomai api to create a real-time task, and uses
>>>> write
>>>>>>>>>> which causes the real-time task to switch to secondary domain;
>>>>>>>>>> - the Makefile does not use xeno-config, which have been the
>>>>>> recommended
>>>>>>>>>> way of getting the compiler flags since day 1;
>>>>>>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision,
>> and
>>>>>>>>>> could lead people to believe that they should do the same when
>> using
>>>>>>>>>> Xenomai, whereas there is no such requirement.
>>>>>>>>>> - the pointers point to outdated version of the documentation.
>>>>>>>>>> - it uses runinfo/xeno-load, which are kind of outdated too, make
>>>>>> things
>>>>>>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C to
>>>>>>>>>> interrupt the program, which is bound to fail if anything goes
>>>> wrong,
>>>>>>>>>> since SIGINT is neutralized in the program.
>>>>>>>>>>
>>>>>>>>>>> That's why I went to mmap().
>>>>>>>>>> That is not really the right solution either. I admit that for
>>>> driving
>>>>>>>>>> leds, it may be a bit overkill, but anyway, what you should do is
>>>>>> write
>>>>>>>>>> an RTDM driver for driving the leds. Keeping the driver separated
>>>> from
>>>>>>>>>> the application will allow the same program to run on other
>>>> platforms
>>>>>>>>>> where driving the LEDS is done differently without changing much
>> of
>>>>>> the
>>>>>>>>>> application code. In other word, the application/driver separation
>>>> is
>>>>>> a
>>>>>>>>>> sane one.
>>>>>>>>>>
>>>>>>>>>> Anyway, mmap should work.
>>>>>>>>>>
>>>>>>>>>>  (I chose that sample code because, for
>>>>>>>>>>> now, I am only learning to use basic functions)
>>>>>>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
>>>>>>>>>>> Indeed, my program fails miserably when I check the mapping of
>> AIC,
>>>>>> not
>>>>>>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai code,
>>>> AIC
>>>>>>>>>>> mmap-ing works  fine.
>>>>>>>>>> Well errno might give you a clue. Do you have FCSE enabled?
>>>>>>>>>>
>>>>>>>>>> Regards.
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>>
>>>>>> Gilles.
>>>>>>>>> FCSE is enabled. errno returns  22 (invalid argument).
>>>>>>>> best effort or guaranteed?
>>>>>>> Best effort
>>>>>>>
>>>>>>>
>>>>>>>> Please activate FCSE messages.
>>>>>>> ... compiling new kernel
>>>>>>>
>>>>>>>
>>>>>>>> How big is
>>>>>>>> MAP_SIZE?
>>>>>>>>
>>>>>>>>
>>>>>>> 4096
>>>>>> Ok. Could you post your full kernel configuration, as well as the full
>>>>>> program?
>>>>>>
>>>>> I put the .config and the code in the attachments.
>>>> If you remove all the native skin stuff, only keep main and
>>>> open_controller, do not link with the native library, you can confirm
>>>> that this same program runs without trouble?
>>>>
>>>  Without  Xenomai related stuff, it runs  OK.
>> You sure of that?  The exact same code, with the same kernel, with the
>> mlockall?
>>
>> --
>>                                                                 Gilles.
>>
> 
> Oh. I assumed without mlockall (it wasn't part of my original code).
> Now, I placed mlockall in my original code (right before open_controller())
> and the pin gets toggled according to my scope.

Ok. Show me the Makefile then. And the code which works. Including the
value of the defines please (not all of them, only those the program
uses for open_controller).


-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  5:12                         ` Gilles Chanteperdrix
@ 2011-01-25  5:32                           ` at91_enthus
  2011-01-25  6:20                             ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  5:32 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help


[-- Attachment #1.1: Type: text/plain, Size: 5947 bytes --]

On Mon, Jan 24, 2011 at 11:12 PM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Mon, Jan 24, 2011 at 11:02 PM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>> On Mon, Jan 24, 2011 at 10:54 PM, Gilles Chanteperdrix <
> >>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>
> >>>> at91_enthus wrote:
> >>>>> On Mon, Jan 24, 2011 at 10:28 PM, Gilles Chanteperdrix <
> >>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>
> >>>>>> at91_enthus wrote:
> >>>>>>> On Mon, Jan 24, 2011 at 10:16 PM, Gilles Chanteperdrix <
> >>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>>>
> >>>>>>>> at91_enthus wrote:
> >>>>>>>>> On Mon, Jan 24, 2011 at 9:25 PM, Gilles Chanteperdrix <
> >>>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>>>>>
> >>>>>>>>>> at91_enthus wrote:
> >>>>>>>>>>> On Mon, Jan 24, 2011 at 8:41 PM, Gilles Chanteperdrix <
> >>>>>>>>>>> gilles.chanteperdrix@xenomai.org> wrote:
> >>>>>>>>>>>
> >>>>>>>>>>>> at91_enthus wrote:
> >>>>>>>>>>>>> Hi.
> >>>>>>>>>>>>>
> >>>>>>>>>>>>> I  was testing Xenomai on my AT91SAM9G20-based board and
> tried
> >> to
> >>>>>>>> adapt
> >>>>>>>>>>>> the
> >>>>>>>>>>>>> code found here:
> >>>>>>>>>>>>>
> >>>> http://www.armadeus.com/wiki/index.php?title=Xenomai:Blinking_LEDs.
> >>>>>>>>>>>> By the way, this code is ridiculous. It creates a real-time
> task
> >>>> to
> >>>>>>>>>>>> write to some non real-time device, which makes the real-time
> >> task
> >>>>>>>>>> useless.
> >>>>>>>>>>> I know.
> >>>>>>>>>> Yes, but this example is bad in many ways:
> >>>>>>>>>> - first it uses xenomai api to create a real-time task, and uses
> >>>> write
> >>>>>>>>>> which causes the real-time task to switch to secondary domain;
> >>>>>>>>>> - the Makefile does not use xeno-config, which have been the
> >>>>>> recommended
> >>>>>>>>>> way of getting the compiler flags since day 1;
> >>>>>>>>>> - it nullifies SIGTERM and SIGINT, which is a dubious decision,
> >> and
> >>>>>>>>>> could lead people to believe that they should do the same when
> >> using
> >>>>>>>>>> Xenomai, whereas there is no such requirement.
> >>>>>>>>>> - the pointers point to outdated version of the documentation.
> >>>>>>>>>> - it uses runinfo/xeno-load, which are kind of outdated too,
> make
> >>>>>> things
> >>>>>>>>>> uselessly complicated, and in any case, tell you to type Ctrl-C
> to
> >>>>>>>>>> interrupt the program, which is bound to fail if anything goes
> >>>> wrong,
> >>>>>>>>>> since SIGINT is neutralized in the program.
> >>>>>>>>>>
> >>>>>>>>>>> That's why I went to mmap().
> >>>>>>>>>> That is not really the right solution either. I admit that for
> >>>> driving
> >>>>>>>>>> leds, it may be a bit overkill, but anyway, what you should do
> is
> >>>>>> write
> >>>>>>>>>> an RTDM driver for driving the leds. Keeping the driver
> separated
> >>>> from
> >>>>>>>>>> the application will allow the same program to run on other
> >>>> platforms
> >>>>>>>>>> where driving the LEDS is done differently without changing much
> >> of
> >>>>>> the
> >>>>>>>>>> application code. In other word, the application/driver
> separation
> >>>> is
> >>>>>> a
> >>>>>>>>>> sane one.
> >>>>>>>>>>
> >>>>>>>>>> Anyway, mmap should work.
> >>>>>>>>>>
> >>>>>>>>>>  (I chose that sample code because, for
> >>>>>>>>>>> now, I am only learning to use basic functions)
> >>>>>>>>>>>> Wrong test here. Should be "if (aic_base == MAP_FAILED)"
> >>>>>>>>>>> Indeed, my program fails miserably when I check the mapping of
> >> AIC,
> >>>>>> not
> >>>>>>>>>>> PIOB's. And yet, I just can't figure why in the non-Xenomai
> code,
> >>>> AIC
> >>>>>>>>>>> mmap-ing works  fine.
> >>>>>>>>>> Well errno might give you a clue. Do you have FCSE enabled?
> >>>>>>>>>>
> >>>>>>>>>> Regards.
> >>>>>>>>>>
> >>>>>>>>>> --
> >>>>>>>>>>
> >>>>>> Gilles.
> >>>>>>>>> FCSE is enabled. errno returns  22 (invalid argument).
> >>>>>>>> best effort or guaranteed?
> >>>>>>> Best effort
> >>>>>>>
> >>>>>>>
> >>>>>>>> Please activate FCSE messages.
> >>>>>>> ... compiling new kernel
> >>>>>>>
> >>>>>>>
> >>>>>>>> How big is
> >>>>>>>> MAP_SIZE?
> >>>>>>>>
> >>>>>>>>
> >>>>>>> 4096
> >>>>>> Ok. Could you post your full kernel configuration, as well as the
> full
> >>>>>> program?
> >>>>>>
> >>>>> I put the .config and the code in the attachments.
> >>>> If you remove all the native skin stuff, only keep main and
> >>>> open_controller, do not link with the native library, you can confirm
> >>>> that this same program runs without trouble?
> >>>>
> >>>  Without  Xenomai related stuff, it runs  OK.
> >> You sure of that?  The exact same code, with the same kernel, with the
> >> mlockall?
> >>
> >> --
> >>                                                                 Gilles.
> >>
> >
> > Oh. I assumed without mlockall (it wasn't part of my original code).
> > Now, I placed mlockall in my original code (right before
> open_controller())
> > and the pin gets toggled according to my scope.
>
> Ok. Show me the Makefile then.

And the code which works.


 see attachment


> Including the
> value of the defines please (not all of them, only those the program
> uses for open_controller).
>
>
>
#define AT91C_BASE_AIC          0xFFFFF000 // (AIC) Base Address
#define AT91C_BASE_PIOB        0xFFFFF600 // (PIOB) Base Address
#define PIO_PER             0x00000000 // (PIO_PER) PIO Enable Register
#define PIO_PDR             0x00000004 // (PIO_PDR) PIO Disable Register
#define PIO_PSR             0x00000008 // (PIO_PSR) PIO Status Register
#define PIO_OER             0x00000010 // (PIO_OER) Output Enable Register
#define PIO_SODR           0x00000030 // (PIO_SODR) Set Output Data Register
#define PIO_CODR           0x00000034 // (PIO_CODR) Clear Output Data
Register
#define PIO_PPUDR         0x00000060 // (PIO_PPUDR) Pull-up Disable Register
#define PIO_MDDR           0x00000054 // (PIO_MDDR) Multi-driver Disable
Register

[-- Attachment #1.2: Type: text/html, Size: 10214 bytes --]

[-- Attachment #2: gpiob_bit0.c --]
[-- Type: text/x-csrc, Size: 1540 bytes --]

/* user-land driver for PIOB (bit 0 - J2) 
Board: Electrum100 - Micromint, AT91SAM9G20
*/

#include <stdio.h>
#include <stdlib.h>
#include <unistd.h>
#include <string.h>
#include <errno.h>
#include <signal.h>
#include <fcntl.h>
#include <ctype.h>
#include <termios.h>
#include <sys/types.h>
#include <sys/mman.h>

#include "definitions.h"


#define MAP_SIZE 4096UL //4k
#define MAP_MASK (MAP_SIZE - 1)


int fd, i;
unsigned char *piob_base, *aic_base; 



void open_controller(){


    if((fd = open("/dev/mem", O_RDWR | O_SYNC)) == -1) 
    {
    	printf("Couldn't open /dev/mem. error %s\n", strerror(errno));
	exit(1);
    }
    printf("/dev/mem opened.\n"); 
    fflush(stdout);
    
    /* mapping of PIOB */
	aic_base =  mmap(0, MAP_SIZE, PROT_READ | PROT_WRITE, MAP_SHARED, fd, AT91C_BASE_PIOB & ~MAP_MASK);
	piob_base = aic_base + AT91C_BASE_PIOB - AT91C_BASE_AIC;
	

    if( (aic_base == MAP_FAILED)) {

    	printf("Couldn't get Map-Address. %d\n", errno);		
	exit(1);

	}


    fflush(stdout);

}

int main() {


 mlockall(MCL_CURRENT|MCL_FUTURE);
 open_controller();
   
*((unsigned int *) (piob_base + PIO_IDR)) = 1<<0;
*((unsigned int *) (piob_base + PIO_PER)) = 1<<0;
*((unsigned int *) (piob_base + PIO_CODR)) =1<<0;
*((unsigned int *) (piob_base + PIO_PPUDR)) =1<<0;

*((unsigned int *) (piob_base + PIO_OER)) = 1<<0;
*((unsigned int *) (piob_base + PIO_MDDR)) = 1<<0;


while(1){

 *((unsigned int *) (piob_base + PIO_SODR)) = 1<<0;

 *((unsigned int *) (piob_base + PIO_CODR)) = 1<<0;

}

    close(fd);
    return 0;
}


[-- Attachment #3: Makefile --]
[-- Type: application/octet-stream, Size: 770 bytes --]

DEST_DIR=./
include 
XENO=/usr/xenomai
EXEC=xen
 
SRC= $(wildcard *.c)
OBJ= $(SRC:.c=.o)
CFLAGS=-g -W -Wall -I$(XENO)/include -I$(XENO)/include/native  -I$(XENO)/include/rtdm   -D_GNU_SOURCE -D_REENTRANT
LDFLAGS=-L$(XENO)/lib -Xlinker -rpath $(XENO)/lib -Xlinker $(XENO)/lib/libnative.a   $(XENO)/lib/librtdm.a -lpthread -lnative -lrtdm -lxenomai
 
$(EXEC): $(OBJ)
	$(CC) -o $@ $^ $(LDFLAGS)
 
$(OBJ): $(SRC)
	$(CC) $(CFLAGS) -o $@ -c $<
 
all: $(EXEC)
 
clean:
	rm -rf $(OBJ)
	rm -rf $(EXEC)
	rm -f *.c~ *.h~ Makefile~
 
install: $(EXEC)
	@mkdir -p $(DEST_DIR)/$(EXEC)
	echo "$(EXEC):native:!./$(EXEC);popall:control_c" > $(DEST_DIR)/$(EXEC)/.runinfo
	cp -f $(EXEC) $(DEST_DIR)/$(EXEC)
 
mrproper: clean
	rm -rf $(DEST_DIR)/$(EXEC)
 
.PHONY: all install clean mrproper

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  5:32                           ` at91_enthus
@ 2011-01-25  6:20                             ` Gilles Chanteperdrix
  2011-01-25  6:45                               ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  6:20 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
>>> Oh. I assumed without mlockall (it wasn't part of my original code).
>>> Now, I placed mlockall in my original code (right before
>> open_controller())
>>> and the pin gets toggled according to my scope.
>> Ok. Show me the Makefile then.
> 
> And the code which works.
> 
> 
>  see attachment
> 
> 
>> Including the
>> value of the defines please (not all of them, only those the program
>> uses for open_controller).
>>
>>
>>
> #define AT91C_BASE_AIC          0xFFFFF000 // (AIC) Base Address
> #define AT91C_BASE_PIOB        0xFFFFF600 // (PIOB) Base Address
> #define PIO_PER             0x00000000 // (PIO_PER) PIO Enable Register
> #define PIO_PDR             0x00000004 // (PIO_PDR) PIO Disable Register
> #define PIO_PSR             0x00000008 // (PIO_PSR) PIO Status Register
> #define PIO_OER             0x00000010 // (PIO_OER) Output Enable Register
> #define PIO_SODR           0x00000030 // (PIO_SODR) Set Output Data Register
> #define PIO_CODR           0x00000034 // (PIO_CODR) Clear Output Data
> Register
> #define PIO_PPUDR         0x00000060 // (PIO_PPUDR) Pull-up Disable Register
> #define PIO_MDDR           0x00000054 // (PIO_MDDR) Multi-driver Disable
> Register
> 
> 

I am unable to reproduce your issue. That said, I am using standard
Makefiles, that is:

XENO_CONFIG = DESTDIR="$(staging)" $(staging)/bin/xeno-config

XENO_NATIVE_CPPFLAGS = $(shell $(XENO_CONFIG) --skin=native --cflags)
XENO_NATIVE_LIBS = $(shell $(XENO_CONFIG) --skin=native --ldflags)

Where staging would be "/" in your case.

If I want static libraries, I prepend -static to XENO_NATIVE_LIBS, I do
not try to link both with static and dynamic libraries. I suspect this
is the cause of your problem, either that or the fact that you have some
ulimit.

Note that my toolchain does not even allow mixing static and dynamic
libraries. I get this warning when linking:
/usr/local/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld:
/usr/local/arm-2010q1/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/libc.a(dl-tsd.o)(.text+0x18):
R_ARM_TLS_LE32 relocation not permitted in shared object

And a segmentation fault when running (though I do not even access the
mmapped area).

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  6:20                             ` Gilles Chanteperdrix
@ 2011-01-25  6:45                               ` at91_enthus
  2011-01-25  6:51                                 ` Gilles Chanteperdrix
  0 siblings, 1 reply; 21+ messages in thread
From: at91_enthus @ 2011-01-25  6:45 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Tue, Jan 25, 2011 at 12:20 AM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> >>> Oh. I assumed without mlockall (it wasn't part of my original code).
> >>> Now, I placed mlockall in my original code (right before
> >> open_controller())
> >>> and the pin gets toggled according to my scope.
> >> Ok. Show me the Makefile then.
> >
> > And the code which works.
> >
> >
> >  see attachment
> >
> >
> >> Including the
> >> value of the defines please (not all of them, only those the program
> >> uses for open_controller).
> >>
> >>
> >>
> > #define AT91C_BASE_AIC          0xFFFFF000 // (AIC) Base Address
> > #define AT91C_BASE_PIOB        0xFFFFF600 // (PIOB) Base Address
> > #define PIO_PER             0x00000000 // (PIO_PER) PIO Enable Register
> > #define PIO_PDR             0x00000004 // (PIO_PDR) PIO Disable Register
> > #define PIO_PSR             0x00000008 // (PIO_PSR) PIO Status Register
> > #define PIO_OER             0x00000010 // (PIO_OER) Output Enable
> Register
> > #define PIO_SODR           0x00000030 // (PIO_SODR) Set Output Data
> Register
> > #define PIO_CODR           0x00000034 // (PIO_CODR) Clear Output Data
> > Register
> > #define PIO_PPUDR         0x00000060 // (PIO_PPUDR) Pull-up Disable
> Register
> > #define PIO_MDDR           0x00000054 // (PIO_MDDR) Multi-driver Disable
> > Register
> >
> >
>
> I am unable to reproduce your issue. That said, I am using standard
> Makefiles, that is:
>
> XENO_CONFIG = DESTDIR="$(staging)" $(staging)/bin/xeno-config
>
> XENO_NATIVE_CPPFLAGS = $(shell $(XENO_CONFIG) --skin=native --cflags)
> XENO_NATIVE_LIBS = $(shell $(XENO_CONFIG) --skin=native --ldflags)
>
> Where staging would be "/" in your case.
>
> If I want static libraries, I prepend -static to XENO_NATIVE_LIBS, I do
> not try to link both with static and dynamic libraries. I suspect this
> is the cause of your problem, either that or the fact that you have some
> ulimit.
>
> Note that my toolchain does not even allow mixing static and dynamic
> libraries. I get this warning when linking:
>
> /usr/local/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld:
>
> /usr/local/arm-2010q1/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/libc.a(dl-tsd.o)(.text+0x18):
> R_ARM_TLS_LE32 relocation not permitted in shared object
>
> And a segmentation fault when running (though I do not even access the
> mmapped area).
>
> --
>                                                                 Gilles.
>


I'll try to fix this issue later today. Thanks a lot for taking the time to
help me.

R.

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

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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  6:45                               ` at91_enthus
@ 2011-01-25  6:51                                 ` Gilles Chanteperdrix
  2011-01-25  9:38                                   ` at91_enthus
  0 siblings, 1 reply; 21+ messages in thread
From: Gilles Chanteperdrix @ 2011-01-25  6:51 UTC (permalink / raw)
  To: at91_enthus; +Cc: xenomai-help

at91_enthus wrote:
> On Tue, Jan 25, 2011 at 12:20 AM, Gilles Chanteperdrix <
> gilles.chanteperdrix@xenomai.org> wrote:
> 
>> at91_enthus wrote:
>>>>> Oh. I assumed without mlockall (it wasn't part of my original code).
>>>>> Now, I placed mlockall in my original code (right before
>>>> open_controller())
>>>>> and the pin gets toggled according to my scope.
>>>> Ok. Show me the Makefile then.
>>> And the code which works.
>>>
>>>
>>>  see attachment
>>>
>>>
>>>> Including the
>>>> value of the defines please (not all of them, only those the program
>>>> uses for open_controller).
>>>>
>>>>
>>>>
>>> #define AT91C_BASE_AIC          0xFFFFF000 // (AIC) Base Address
>>> #define AT91C_BASE_PIOB        0xFFFFF600 // (PIOB) Base Address
>>> #define PIO_PER             0x00000000 // (PIO_PER) PIO Enable Register
>>> #define PIO_PDR             0x00000004 // (PIO_PDR) PIO Disable Register
>>> #define PIO_PSR             0x00000008 // (PIO_PSR) PIO Status Register
>>> #define PIO_OER             0x00000010 // (PIO_OER) Output Enable
>> Register
>>> #define PIO_SODR           0x00000030 // (PIO_SODR) Set Output Data
>> Register
>>> #define PIO_CODR           0x00000034 // (PIO_CODR) Clear Output Data
>>> Register
>>> #define PIO_PPUDR         0x00000060 // (PIO_PPUDR) Pull-up Disable
>> Register
>>> #define PIO_MDDR           0x00000054 // (PIO_MDDR) Multi-driver Disable
>>> Register
>>>
>>>
>> I am unable to reproduce your issue. That said, I am using standard
>> Makefiles, that is:
>>
>> XENO_CONFIG = DESTDIR="$(staging)" $(staging)/bin/xeno-config
>>
>> XENO_NATIVE_CPPFLAGS = $(shell $(XENO_CONFIG) --skin=native --cflags)
>> XENO_NATIVE_LIBS = $(shell $(XENO_CONFIG) --skin=native --ldflags)
>>
>> Where staging would be "/" in your case.
>>
>> If I want static libraries, I prepend -static to XENO_NATIVE_LIBS, I do
>> not try to link both with static and dynamic libraries. I suspect this
>> is the cause of your problem, either that or the fact that you have some
>> ulimit.
>>
>> Note that my toolchain does not even allow mixing static and dynamic
>> libraries. I get this warning when linking:
>>
>> /usr/local/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld:
>>
>> /usr/local/arm-2010q1/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/libc.a(dl-tsd.o)(.text+0x18):
>> R_ARM_TLS_LE32 relocation not permitted in shared object
>>
>> And a segmentation fault when running (though I do not even access the
>> mmapped area).
>>
>> --
>>                                                                 Gilles.
>>
> 
> 
> I'll try to fix this issue later today. Thanks a lot for taking the time to
> help me.

Yes, note that I wasted a lot of time: I knew from the beginning that
the Makefile was broken, and this should have been the first thing I
verified.

Anyway, the "first-hand" examples we provide are those documented here:
http://www.xenomai.org/index.php/Examples

They come with working Makefiles, which you are encouraged to re-use.

Also, xeno-config lacks support for getting the RTDM skin flags, but I
am going to add it to 2.5.6.

-- 
                                                                Gilles.


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

* Re: [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9)
  2011-01-25  6:51                                 ` Gilles Chanteperdrix
@ 2011-01-25  9:38                                   ` at91_enthus
  0 siblings, 0 replies; 21+ messages in thread
From: at91_enthus @ 2011-01-25  9:38 UTC (permalink / raw)
  To: Gilles Chanteperdrix; +Cc: xenomai-help

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

On Tue, Jan 25, 2011 at 12:51 AM, Gilles Chanteperdrix <
gilles.chanteperdrix@xenomai.org> wrote:

> at91_enthus wrote:
> > On Tue, Jan 25, 2011 at 12:20 AM, Gilles Chanteperdrix <
> > gilles.chanteperdrix@xenomai.org> wrote:
> >
> >> at91_enthus wrote:
> >>>>> Oh. I assumed without mlockall (it wasn't part of my original code).
> >>>>> Now, I placed mlockall in my original code (right before
> >>>> open_controller())
> >>>>> and the pin gets toggled according to my scope.
> >>>> Ok. Show me the Makefile then.
> >>> And the code which works.
> >>>
> >>>
> >>>  see attachment
> >>>
> >>>
> >>>> Including the
> >>>> value of the defines please (not all of them, only those the program
> >>>> uses for open_controller).
> >>>>
> >>>>
> >>>>
> >>> #define AT91C_BASE_AIC          0xFFFFF000 // (AIC) Base Address
> >>> #define AT91C_BASE_PIOB        0xFFFFF600 // (PIOB) Base Address
> >>> #define PIO_PER             0x00000000 // (PIO_PER) PIO Enable Register
> >>> #define PIO_PDR             0x00000004 // (PIO_PDR) PIO Disable
> Register
> >>> #define PIO_PSR             0x00000008 // (PIO_PSR) PIO Status Register
> >>> #define PIO_OER             0x00000010 // (PIO_OER) Output Enable
> >> Register
> >>> #define PIO_SODR           0x00000030 // (PIO_SODR) Set Output Data
> >> Register
> >>> #define PIO_CODR           0x00000034 // (PIO_CODR) Clear Output Data
> >>> Register
> >>> #define PIO_PPUDR         0x00000060 // (PIO_PPUDR) Pull-up Disable
> >> Register
> >>> #define PIO_MDDR           0x00000054 // (PIO_MDDR) Multi-driver
> Disable
> >>> Register
> >>>
> >>>
> >> I am unable to reproduce your issue. That said, I am using standard
> >> Makefiles, that is:
> >>
> >> XENO_CONFIG = DESTDIR="$(staging)" $(staging)/bin/xeno-config
> >>
> >> XENO_NATIVE_CPPFLAGS = $(shell $(XENO_CONFIG) --skin=native --cflags)
> >> XENO_NATIVE_LIBS = $(shell $(XENO_CONFIG) --skin=native --ldflags)
> >>
> >> Where staging would be "/" in your case.
> >>
> >> If I want static libraries, I prepend -static to XENO_NATIVE_LIBS, I do
> >> not try to link both with static and dynamic libraries. I suspect this
> >> is the cause of your problem, either that or the fact that you have some
> >> ulimit.
> >>
> >> Note that my toolchain does not even allow mixing static and dynamic
> >> libraries. I get this warning when linking:
> >>
> >>
> /usr/local/arm-2010q1/bin/../lib/gcc/arm-none-linux-gnueabi/4.4.1/../../../../arm-none-linux-gnueabi/bin/ld:
> >>
> >>
> /usr/local/arm-2010q1/bin/../arm-none-linux-gnueabi/libc/armv4t/usr/lib/libc.a(dl-tsd.o)(.text+0x18):
> >> R_ARM_TLS_LE32 relocation not permitted in shared object
> >>
> >> And a segmentation fault when running (though I do not even access the
> >> mmapped area).
> >>
> >> --
> >>                                                                 Gilles.
> >>
> >
> >
> > I'll try to fix this issue later today. Thanks a lot for taking the time
> to
> > help me.
>
> Yes, note that I wasted a lot of time: I knew from the beginning that
> the Makefile was broken, and this should have been the first thing I
> verified.
>
> Anyway, the "first-hand" examples we provide are those documented here:
> http://www.xenomai.org/index.php/Examples
>
> They come with working Makefiles, which you are encouraged to re-use.
>
> Also, xeno-config lacks support for getting the RTDM skin flags, but I
> am going to add it to 2.5.6.
>
> --
>                                                                 Gilles.
>


An out of the box Makefile (from Examples) with minor modifications did the
trick.

Regards,
R.

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

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

end of thread, other threads:[~2011-01-25  9:38 UTC | newest]

Thread overview: 21+ messages (download: mbox.gz / follow: Atom feed)
-- links below jump to the message on this page --
2011-01-25  2:33 [Xenomai-help] Segmentation Fault when writing in registers (AT91SAM - ARM9) at91_enthus
2011-01-25  2:36 ` Gilles Chanteperdrix
2011-01-25  2:41 ` Gilles Chanteperdrix
2011-01-25  3:13   ` at91_enthus
2011-01-25  3:25     ` Gilles Chanteperdrix
2011-01-25  4:14       ` at91_enthus
2011-01-25  4:16         ` Gilles Chanteperdrix
2011-01-25  4:23           ` at91_enthus
2011-01-25  4:28             ` Gilles Chanteperdrix
2011-01-25  4:44               ` at91_enthus
2011-01-25  4:49                 ` Gilles Chanteperdrix
2011-01-25  4:54                 ` Gilles Chanteperdrix
2011-01-25  5:00                   ` at91_enthus
2011-01-25  5:02                     ` Gilles Chanteperdrix
2011-01-25  5:08                       ` at91_enthus
2011-01-25  5:12                         ` Gilles Chanteperdrix
2011-01-25  5:32                           ` at91_enthus
2011-01-25  6:20                             ` Gilles Chanteperdrix
2011-01-25  6:45                               ` at91_enthus
2011-01-25  6:51                                 ` Gilles Chanteperdrix
2011-01-25  9:38                                   ` at91_enthus

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.