This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

User defined hook function for get_fattime() in TI-RTOS

Other Parts Discussed in Thread: SYSBIOS

When trying to use an user defined function to return the time from a RTC for the FAT filesystem under TI-RTOS, a problem occurs:

First, we add the pointer to our function as described in fatFS help:(http://127.0.0.1:52715/help/topic/com.ti.rtsc.SYSBIOS.product.ui/cdoc/ti/sysbios/fatfs/package.html):

  var FatFS = xdc.useModule('ti.sysbios.fatfs.FatFS");
  FatFS.getFatTimeHook = '&my_fattime';

But when building, we get this warning: missing return statement at end of non-void function "ti_sysbios_fatfs_getFatTime".

Because it is translated like this to code (return value from our function is lost);

Int32 ti_sysbios_fatfs_getFatTime(Void)

{
/* call user defined get_fattime() hook */
extern Int32 my_fattime();
my_fattime();
}

To solve this we had to add a 'return' statement in the the related function of FatFS.xdt file (located in C:\ti\tirtos_x_x_x_x\products\bios_x_x_x_x\packages\ti\sysbios\fatfs):

Int32 ti_sysbios_fatfs_getFatTime(Void)
{
%
% if (this.getFatTimeHook == null) {
%
return (0x23556622);
%
% }
% else {
% var getFatTimeHookName = this.getFatTimeHook.$name;
% getFatTimeHookName = getFatTimeHookName.replace(/\./g,'_');
%
/* call user defined get_fattime() hook */
extern Int32 `getFatTimeHookName`();
return `getFatTimeHookName`();
%
% }
%
}

Is this a bug on FatFS.xdt file that could be solved for next versions?

Thanks