[Gambas-user] Shared WiringPi library for RasPi

Benoît Minisini gambas at ...1...
Sat May 25 19:33:14 CEST 2013


Le 25/05/2013 18:32, CJ a écrit :
>
> After compiling and updating to latest stable 3.4.1 version I retested
> the HW interrupt code I had problems with when running 3.3.4 and have the
> same error when testing on the RaspberryPi...
>
> Code compiles OK but when I pull GPIO18 pin low (i.e generating the
> interrupt)
> it crashes with a "Stack overflow" error message.
>
>    root at ...3122...:/home/Projekt/libwiringPi_irq# ./libwiringPi_irq.gambas
>    wiringPi Init OK...
>    IRQ setup OK...
>    Waiting....
>    Waiting....
>    Waiting....
>    Waiting....
>    Waiting....
>    Waiting....
>    Waiting....
>    Waiting....
>    Waiting....
>    MMain.Main.110: #3: Stack overflow
>    1: MMain.Main.110
>    Segmentation fault
>
> Below is the output from gdb...
>
>    ...
>    (gdb) bt
>    #0  THROW (code=0) at gb_error.c:465
>    #1  0x0004a9e4 in THROW_STACK () at gb_error.c:489
>    #2  0x0004a9e4 in THROW_STACK () at gb_error.c:489
>    Backtrace stopped: previous frame identical to this frame (corrupt stack?)
>    (gdb)
>
> A informed by Benoît this is how to declare it in Gambas3 to use the
> interrupt
> function in wiringPi library...
>
>> Extern wiringPiIsr(iPin As Integer, iEdgeType As Integer, pFunction As
> Pointer) In "lib..."
>>
>> ...
>>
>> And then you use the name of a static function as 'pFunction' argument
>> when calling wiringPiIsr.
>>
>> Gambas will automatically create a internal callback that will execute
>> the Gambas function through the interpreter as if it would be called
>> directly like a C function.
>
> As mentioned before problem may very well be in my code when setting up the
> interrupt handler, attached is the source code and wonder if I'm doing it
> correctly by placing the interrupt handler in a separate classfile so any
> pointer
> appreciated...
>
> /CJ
>

What happens if there is no code at all inside the interrupt handler?

Do you know in which context the interrupt handler is run? (signal 
handler context? Something else?)

And I don't understand why you get an error on line #110, whereas there 
is only 58 lines in your MMain.module file...

Regards,

-- 
Benoît Minisini




More information about the User mailing list