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.

Time function not working at sys/bios on M3 processor

Other Parts Discussed in Thread: SYSBIOS, SEGGER, 4460

Hi guys,

I'm experiencing an issue that the time function is now working as I expect on M3 processor.

Souce code is C and all dependencies to compile my code are xdctools 3.22, ipc 1.23 and bios 6.32.

Source code is simple like below.

time_t start,end;
double
dif;

time (&start); 
//do something...
time (&end);
dif = difftime (end,start);

printf ("%.2lf %d %d seconds\n", dif, (int)end, (int)start );

And the result I got is like below.

0.0 -117901064 -117901064

0.0 -117901064 -117901064

0.0 -117901064 -117901064

I'm pretty sure the time between start and end is enough (about a second) but I don't understand why this code is not working while exactly same codes are working on on linux compiled by GNU gcc.

Do you guys have any idea?

Thanks,

Jaeyeon 

  • Hi Jaeyeon,

    Couple things.

    1. Did you change the System.extendedFormats from the default of "%$L%$S%$F"?

    2. What are the values when you look at them in the debugger?

    3. Can you look Timer and Clock in Tools->RTOS Object View (ROV)? In Clock->Module, is the ticks increasing? Is there a Timer entry?

    Todd

  • Hi Todd,

    Thanks for the questions at first.

    1. I do not modify the value by myself. I don't use CCS but make in shell so I don't know how to modify it. However I tried to search System.extendedFormats for directories of bios, xdctools and ipc so the two lines below seems the most relavant.

    /home/nexuter/ti/xdctools_3_22_03_41/packages/xdc/runtime/Log.xdc: * System.extendedFormats = "%f";
    /home/nexuter/ti/ipc_1_23_01_26/eclipse/plugins/com.ti.rtsc.IPC.product.ui_1.23.1.26/resources/benchmarks/bench_common.cfg.xs:System.extendedFormats = "%f";

    2. As I wrote before this was the result of the source code below the result.

    <result>

    0.0 -117901064 -117901064

    0.0 -117901064 -117901064

    0.0 -117901064 -117901064

    <source code>

    time_t start,end;

    double dif;

    time (&start); 
    //do something...
    time (&end);
    dif = difftime (end,start);

    printf ("%.2lf %d %d seconds\n", dif, (int)end, (int)start );
    
    
    3. Again, I don't use CCS for my source code compiling. Is there any other way that I can check those?
    
    
    Thanks,
    Jaeyeon
  • Jaeyeon,

    Just to confirm, are you using SYS/BIOS? If so, can you attach your application's .cfg file.

    Todd

  • Hi Todd,

    Here's the DucatiCore0.cfg file 4073.DucatiCore0.cfgfor the core I'm using. Just in case, I attached other cfg files under the same directory for you information. 7658.DucatiAmmu.cfg  8357.DucatiCore1.cfg

    Thanks,

    Jaeyeon

  • It looks like the RTS time() is calling HOSTtime(). It is trying to get time from the host (e.g. your PC). If you don't have an emulation connection, this is not going to work.

    Do you want clock time (e.g. RTC) or wanting to get deltas for benchmarking. You can use the xdc.runtime.Timestamp module instead.

    Todd

  • Thanks Todd,

    I tried to use xdc.runtime.Timestamp by following steps but there's no luck.

    1. add this to .cfg file.

    //for timestamp

    var Timestamp = xdc.useModule("xdc.runtime.Timestamp");

    Timestamp.SupportProxy = xdc.useModule("xdc.runtime.TimestampStd");

    //for sleep function

    var Thread = xdc.useModule('xdc.runtime.knl.Thread');

    Thread.Proxy = xdc.useModule('ti.sysbios.xdcruntime.ThreadSupport');

    2. add this to c file

    #include <xdc/runtime/Timestamp.h>
    #include <xdc/runtime/knl/Thread.h>

    UInt32 time1, time2, delta;

    time1 = Timestamp_get32();
    Thread_sleep(2000, NULL);
    time2 = Timestamp_get32();
    delta = time2 - time1;

    I expected this source code should return 2 seconds different but actually the result is like below.

    diff     time2      time1

    0 4193909241 4193909241

    Do you find any problems in this source code?

    here's the reference

    http://rtsc.eclipse.org/docs-tip/Using_xdc.runtime_Timestamps

    http://rtsc.eclipse.org/cdoc-tip/xdc/runtime/knl/Thread.html#sleep

    Thanks,

    Jaeyeon

  • Jaeyeon,

    Are you including ti.sysbios.BIOS in for configuration? This will setup your TimestampProvider for you. TimestampStd uses clock(), which has the same issues as time().

    Is there a reason why you are not using Task_sleep?

    Todd

  • Hi Todd,

    > Are you including ti.sysbios.BIOS in for configuration?

    I think so because

    this is the cfg file for my xem3 image file for M3. 4718.test_omx_core0.cfg

    xdc.loadCapsule("ti/configs/omap4430/IpcCommon.cfg.xs");
    xdc.includeFile("ti/configs/omap4430/DucatiCore0.cfg");
    xdc.includeFile("ti/configs/omap4430/DucatiAmmu.cfg");

    and among them IpcCommon.cfg.xs includes ti.systios.BIOS like this.

    /* Modules used in the virtqueue/MessageQCopy/ServiceMgr libraries: */
    var Semaphore = xdc.useModule('ti.sysbios.knl.Semaphore');
    var BIOS = xdc.useModule('ti.sysbios.BIOS');
    BIOS.heapSize = 0x20000;

    FYI, I attach all three cfg file again.

    0601.DucatiAmmu.cfg

    2630.DucatiCore0.cfg

    > This will setup your TimestampProvider for you. TimestampStd uses clock(), which has the same issues as time().

    Can I restate it? So you mean if I included ti.sysbios.BIOS in cfg file, I could technically use clock() function since the included line will setup TimestampProvide which has the related source code of clock()?

    In the other words, since ti.sysbios.BIOS is included in one of three cfg files shown above, technically I can use clock() properly? So then why I don't get just same time stamp for both start and end? Do you have any other things to check?

    Is there a reason why you are not using Task_sleep?

    Hmm.. I don't get his question. I just put this sleep function in order to make sure time stamp function works properly. In previous source code, the diff value should be at least more than 2000 microseconds.

    Again, I'd like to make sure that what I want to do is to get current time stamp to measure how long the running time of a function on sysbios. I don't know why the time stamps from both start and end are same in my case. If you want, I'm happy to send you git address of the whole source tree.

    Thanks again,

    Jaeyeon

  • Jaeyeon,

    Can you please create a SYS/BIOS example for your board. You can do this in CCS by doing Project->New CCS Project. Give the project a name and select Family and device. Select "Memory Example" in the SYS/BIOS->Generic Examples. After you hit "Next", make sure you select the correct Platform. For more details about creating SYS/BIOS examples refer to the SYS/BIOS Getting Started Guide.

    Replace the .cfg and .c files contents with the attached files. Build, load and run. This will use Timestamp_get32 around a Task_sleep(2000). It then prints out the time delta in Timestamp units and in seconds.

    3288.memory.cfg

    8117.memory.c

    Todd

  • Hi Todd,

    I can't actually run this SYS/BIOS example using CCS project since I don't have any emulator but just a  JTAG debugger (http://www.segger.com/jlink.html). I couldn't find an connection option for this debugger when I make a new CCS project.

    Since my platform is OMAP 4460 on Pandaboard which embedded M3 in the same die with other cores such as A9 and Tesla. I my sys/bios app is triggered by remoterpoc (the syslink driver on Linux). And the M3 app is going to work to help A9 app. This is actually what I want to do. My sys/bios app is compiled by makefile on shell rather than using CCS. Actually now this collaboration is implemented successfully. So now I want to measure how long M3 app is running to help A9 app.

    I tried to put all things on your cfg file and put c code in your c file but still it doesn't work. Is it really necessary for me to run your code using CCS as a independent M3 app in order to make sure? Does the way I started M3 app would affect to make the clock function working abnormally? Is there other way I can test a SYS/BIOS example on M3 on OMAP4460 without emulator?

    Actually I do not develop this code and dev environments from scratch but modify to inject my functions on it.
    FYI, the raw project(http://omappedia.org/wiki/Syslink_3) has m3 app git here (git://github.com/ohadbc/sysbios-rpmsg.git) and the A9 side kernel including rpmsg drivers here(git://github.com/omarrmz/upstream-wip.git)

    Thanks,

    Jaeyeon

  • Jaeyeon,

    You do not need CCS if you have a way to get the delta value other than System_printf. Note: I have the code in a Task because interrupts are not enabled in main until BIOS_start is called. What is the value of delta you are getting.

    Todd