Hello all.
The following issue code(as sample code) couldn’t call the native method of RLP.
This program abort at where calling initialize method in StartTask function.
Please teach method that to deal with it.
※ Development board: Fez Raptor
※ Version information >>> BootLoader=4.3.6 Firmware=4.3.5
※ I have thought that Rlp is impalpable.
※ I am not good at English.
Best regards!
-------------------- issue code (C Language)--------------------
RLP_Task task;
void TaskCallback(void* arg)
{
unsigned int* count = (unsigned int*)arg;
RLP->PostManagedEvent(*count);
if (*count > 0)
{
*count -= 1;
RLP->Task.ScheduleTimeOffset(&task, 1000000);
}
else
{
RLP->Task.Abort(&task);
}
}
int StartTask(void** args)
{
RLP->Task.Initialize(&task, TaskCallback, args[0], RLP_FALSE);
RLP->Task.Schedule(&task);
return 1;
}
-------------------- issue code (C# Language)--------------------
public static void Main()
{
byte[] elfBuffer = Resources.GetBytes(Resources.BinaryResources.G400RLP); //Make sure to add an ELF file as a resource
RuntimeLoadableProcedures.NativeEvent += RuntimeLoadableProcedures_NativeEvent;
var elfImage = new RuntimeLoadableProcedures.ElfImage(elfBuffer);
var yourFunction = elfImage.FindFunction(“YourFunc”);
var byteArray = new byte[] { 25, 5, 0 };
int anInteger = 5;
var yourFuncResult = yourFunction.Invoke(anInteger, byteArray, byteArray.Length, true);
Debug.Print("YourFunc returned " + yourFuncResult.ToString()); //Should be 5
Debug.Print("The third element of the byte array is " + byteArray[2].ToString()); //Should be 30
var startTask = elfImage.FindFunction(“StartTask”);
startTask.Invoke(5);
Thread.Sleep(-1);
}
private static void RuntimeLoadableProcedures_NativeEvent(object sender, RuntimeLoadableProcedures.NativeEventEventArgs e)
{
Debug.Print(“We’ve received " + e.Data.ToString() + " from the native side.”); //Should be 5 to 0
}