[Gambas-user] Shared WiringPi library for RasPi

CJ lists at ...2828...
Sat May 25 18:32:51 CEST 2013


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

-------------- next part --------------
A non-text attachment was scrubbed...
Name: libwiringPi_irq.tar.gz
Type: application/x-gzip
Size: 19249 bytes
Desc: not available
URL: <http://lists.gambas-basic.org/pipermail/user/attachments/20130525/c5cf6194/attachment.bin>


More information about the User mailing list