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.

LOG_printf with SysBios 6

Hi

I have legacy DSP/BIOS code for logging that I want to compile with SYS/BIOS 6.

I would like to keep using the LOG_printf function as is (undefined number of variables and a specific log since i have a few in my application)

For example

int x1 = 4;

int x1 = 3;

LOG_printf(&LOG_Struct, "x1 %d y1 %d", x1,y1);

In the cgf I have the following

var loggerBuf1Params = new LoggerBuf.Params();
loggerBuf1Params.instance.name = "LOG_Trace";
loggerBuf1Params.bufSection = "sdram_scratch_mem";
loggerBuf1Params.numEntries = 16;
Program.global.LOG_Trace = LoggerBuf.create(loggerBuf1Params);
Defaults.common$.logger = Program.global.LOG_Trace;
Main.common$.diags_INFO = Diags.ALWAYS_ON;

When I run it, I see in the LoggerBuf section in the ROV the following:

Received exception read failed at address: 0x8e01fe5c, length: 36

This read is at an INVALID address according to the application's section map.

The application is likely either uninitialized or corrupt.

But when I put in the code: Log_info2( "x1 %d y1 %d", x1,y1);

It shows the correct string in the records.

Attached is an example project.

My configuration is:

CCS - Version: 6.0.1.00040

Compiler version 7.4.8

Varient : Generic C66xx Device

XDC: 3.30.3.47_core

Keystone2 PDK - 3.0.4.18

NDK 2.22.2.16 

SYS/BIOS - 6.40.2.27

Thanks

TestLog.zip
  • I searched and didn’t see any similar issues reported.

    When you see the exception reported in the first case, has the CPU run to main() yet?  [If not, some structures that ROV is reading will not have been fully initialized yet, and ROV will probably report errors in some views.]  Or has the program run for a while before being halted?

    Thanks,
    Scott

  • Yes,

    the program has run for a while when the error is seen in the ROV (in the attached example the printf is in a thread that runs after the bios start)

    The error appears exactly after the call to LOG_printf.

    Shiran

  • Shiran,

    Sorry for the delay. 

    Can you try changing:

    LOG_printf(&LOG_Struct,"x1 %d y1 %d",x1,y1);

    to:

    LOG_printf(LOG_Struct,"x1 %d y1 %d",x1,y1);

    I think the “&” is causing an improper reference that results in a memory corruption, which causes ROV to be unhappy.

    Scott

  • Hi

    When doing so the code does not compile.

    The error is

    "../main.c", line 25: error #169: argument of type "LOG_Obj" is incompatible with parameter of type "LOG_Handle"

    The reason is the LOG_printf requires a LOG_Handle and not LOG_Obj.

    Shiran

  • Shiran,

    OK, thanks, I see now that you have this earlier in main.c:

    extern far LOG_Obj LOG_Struct;

    In your app.cfg file, the global named “LOG_Struct” will hold a LoggerBuf_Handle, which is the result of the call to LoggerBuf.create()

    Program.global.LOG_Struct = LoggerBuf.create(loggerBufParams);

    So can you please:

    1) Remove:

    extern far LOG_Obj LOG_Struct;


    2) Add this include in its place (to make the Program.global definitions available to the C code):

    #include <xdc/cfg/global.h>


    3) In your call to LOG_printf(), remove the &.  And you may need to cast LOG_Struct to be a LOG_Handle:

        LOG_printf((LOG_Handle)LOG_Struct,"x1 %d y1 %d",x1,y1);


    I think that should do it.

    Scott

  • Thanks,

    this fixed the problem