Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Archived » DSDP - Real-Time Software Components (RTSC) » Configuration of function pointer fails(solved)
Configuration of function pointer fails [message #534837] Thu, 20 May 2010 13:30 Go to next message
Brian Cruickshank is currently offline Brian CruickshankFriend
Messages: 19
Registered: September 2009
Junior Member
Configuring a function pointer with the address of a function only seems to work if the function signature does not contain any UInt16 arguments.

If the function signature contains one or more UInt16 arguments, the following error is reported:


package/cfg/log_xem3.c", line 3455:
error: declaration is incompatible with "void ti_uia_stm_LoggerSTM_writeMemoryRange__E(ti_uia_stm_LoggerST M_Handle, xdc_runtime_Types_Event, xdc_UInt32, xdc_IArg, xdc_IArg, xdc_IArg, xdc_IArg, xdc_UInt16)" (declared at line 408 of "C:/UIA_work/ti/uia/stm/LoggerSTM.h")

1 error detected in the compilation of "package/cfg/log_xem3.c


Changing the last argument type to either UInt32 or IArg allows the project to compile without errors.

Here's how the function pointer is declared:

in ti/uia/runtime/LoggerTypes.xdc:
typedef Void (*LogMemoryRangeFxn)(Ptr, Types.Event, UInt32, IArg, IArg, IArg, IArg, UInt16);

in the .xdc file of the module to be configured:
config ti.uia.runtime.LoggerTypes.LogMemoryRangeFxn loggerMemoryRangeFxn = null;

in the .xdc file of the module that contains the implementation of the function:
instance:
@DirectCall
Void writeMemoryRange(xdc.runtime.Types.Event evt, UInt32 snapshotId, IArg fileName, IArg LineNum, IArg fmt, IArg startAdrs, UInt16 lengthInMAUs);


in the .xs file that assigns the function address to the function pointer:
var cn = mod.common$.logger.$orig.$module.$name.replace(/\./g, '_');
...
mod.loggerMemoryRangeFxn = $externFxn(cn + '_writeMemoryRange__E');


or in the .cfg file that assigns the function address to the function pointer:
LogSnapshot.loggerMemoryRangeFxn = $externFxn(ti_uia_stm_LoggerSTM_writeMemoryRange__E);


Is this a known problem? Should I file a problem report on this?

Regards,
Brian

[Updated on: Wed, 16 June 2010 17:48]

Report message to a moderator

Re: Configuration of function pointer fails [message #536546 is a reply to message #534837] Fri, 28 May 2010 15:59 Go to previous messageGo to next message
Brian Cruickshank is currently offline Brian CruickshankFriend
Messages: 19
Registered: September 2009
Junior Member
Filed as Bug 314902

Regards,
Brian
Re: Configuration of function pointer fails (solved) [message #540620 is a reply to message #534837] Wed, 16 June 2010 17:45 Go to previous message
Brian Cruickshank is currently offline Brian CruickshankFriend
Messages: 19
Registered: September 2009
Junior Member
Found the problem. The line
mod.loggerMemoryRangeFxn = $externFxn(cn + '_writeMemoryRange__E');

should have been
mod.loggerMemoryRangeFxn = $externModFxn(cn + '_writeMemoryRange__E');

From Sasha:
When you are assigning a function to a parameter, that function could be declared in a module or it could be a non-RTSC function. In the first case, you use $externModFxn to signal to the config that the function is already declared and that it doesn't have to be declared again in the big C file. In the second case, the declaration in the big C file is required and you should use $externFxn.

The whole point of that is type checking. The type of the config parameter and the function assigned to it must match.


Thanks to Todd and Sasha for the help.

Regards,
Brian

[Updated on: Wed, 16 June 2010 17:47]

Report message to a moderator

Previous Topic:Directing a section to multiple segments
Next Topic:Release notification for XDCtools 3.16.04
Goto Forum:
  


Current Time: Fri Apr 26 12:38:11 GMT 2024

Powered by FUDForum. Page generated in 0.04685 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top