In a converted project I am running into an issue where the arguments passed to a task don't get passed properly. I have a work-around, but I'd like to know the root-cause for the issue.
I pass 2 pointers in a C++ module like so:
TSK_Attrs tsk_attrs = TSK_ATTRS;
tsk_attrs.stacksize = 4096;
tsk_attrs.priority = 15;
tsk_attrs.name = "MyClass::SomeFunction";
TSK_create((Fxn)(&MyClass::ThreadStarter), &tsk_attrs, this, (&MyClass::SomeFunction));
The C++ portion is not strictly necessary, but for convenience member pointers are used to start the "actual" thread from the function "ThreadStarter":
typedef void (MyClass::* ThreadFunc)(void);
int MyClass::ThreadStarter(MyClass* pthis, ThreadFunc pfunc) {
(pthis->*pfunc)();
return 0;
}
This works fine in the current DSP/BIOS implementation, but in the SYSBIOS conversion project, there's an issue: When the arguments get pushed to the stack, a size of 8 bytes per pointer seems to be assumed. However, when the ThreadStarter() function is called later on by the function "dynamicGlue()" (in tsk.c), the arguments are assumed to be individual 4 byte values. This of course fails miserably....
My main question is: what is the reason for this mechanism breaking? I am using the same cgtools for both the old DSP/BIOS project and the new SYSBIOS conversion.
Here's another thread which has some information regarding the functions used:
These are the tools I am using (the processor is a C6474):
cgtools 7.4.8 (ELF)
C64x+ PDK: 1.0.0.06
DSPLIB C64x+ 3.4.0.0
EDMA3 LLD: 2.11.5
IPC: 1.24.3.32
MCSDK 1.0.0.08
NDK: 2.24.1.18
SYSBIOS: 6.35.4.50
XDCtools 3.25.4.88
Thanks,
Dirk