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.

_______________________________________________
Xenomai-help mailing list
[email protected]
https://mail.gna.org/listinfo/xenomai-help

Reply via email to