Ok, it’s no secret I want to handle CAN myself. After two wasted man-days, I’ll be happy to just see anyone installing any interrupt using G400 and RLPExt. Has anyone tried that or am I the first? I just can’t get it working.
So, here’s what I got. The native program:
#include "RLP.h"
void Handler(void * arg)
{
//Handles nothing
}
int InstallInterrupt(void *generalArray, void **args, unsigned int argsCount, unsigned int *argSize)
{
//"18" is PWM IRQ for G400 and EINT for G120, but that matters not
if (!RLPext->Interrupt.Install(18, Handler, ((void *)0)))
{
return -1;
}
return 1;
}
int RlpTest(void *generalArray, void **args, unsigned int argsCount, unsigned int *argSize)
{
return 12;
}
The managed program:
private static RLP.Procedure _rlpTestFunction;
private static RLP.Procedure _rlpInstallFunction;
public static void Main() {
Thread.Sleep(10000);
//Loading RLP
var gaga = Resources.GetBytes(Resources.BinaryResources.G400Rlp);
RLP.LoadELF(gaga);
RLP.InitializeBSSRegion(gaga);
_rlpTestFunction = RLP.GetProcedure(gaga, "RlpTest");
_rlpInstallFunction = RLP.GetProcedure(gaga, "InstallInterrupt");
Debug.Print("So far so good");
var gogo = _rlpTestFunction.InvokeEx(new byte[4], 12, 12, 12, 12, 12);
Debug.Print("We are still alive, test function returns " + gogo);
var gugu = _rlpInstallFunction.InvokeEx(new byte[4]);
Debug.Print("G400 is dead already, this print never happens.");
while (true) {
Thread.Sleep(5000);
}
}
Invoking “RlpTest” works fine, it returns 12, as expected (so I assume the compile compiles correctly). Invoking “InstallInterrupt” crashes G400 immediately, no matter what I try.
Am I missing something? Maybe it’s just some compiler settings I forgot to set?..
P.S. I’m using emIDE and gcc.