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.

pointer to struct not initiate with a non-null value

Other Parts Discussed in Thread: SYSBIOS

Dear all,

I am using Sysbios 6.40 and when I declare a pointer to struct it does not always initiate with NULL value. I could the next to solve it:

struct my_struct *data = NULL;

But I would like to avoid it. By the way, I am wondering if this problem could be because memory is not inatiating properly. Does anyone has an idea of why it happens?

Thanks in advance,

Aitor

  • Aitor,

    Please indicate the device and “target” you are building for.  If you are using CCS, right click on the project, select “Properties” and click on Build->XDCtools->Basic Options.  If you are not using CCS, please provide more information about your setup and build environment…

    Thanks,
    Scott

  • Hello Scott,

    I am using CCS so here is the info you have requested me.


    Best regards,

    Aitor

  • Aitor,

    OK, thanks.  

    The C28 compiler does not automatically zero uninitialized variables.  There is mention of this in the “language implementation” chapter of the compiler user’s guide (http://www.ti.com/lit/ug/spru514g/spru514g.pdf):

    Best regards,
    Scott

  • Scott,

    thanks for you answer.

    I am porting a quite large code and I would like to avoid changing all the global variables definitions to ensure they are 0. It also will make more difficult to update the code with new version if every time I need to change that.

    So now I am wondering it is possible to set to 0 the allocated program memory for the .ebbs section in an elegant way. It only occurs to me using somehow memset() but not quite sure how to do it.

    Best regards,

    Aitor

  • Please see this thread.  In your case, you will probably favor changing the c_int00 boot routine to init all of .ebss to zero before it is initialized with values from the .cinit section.  I'm not aware of any example code which shows the details.

    Thanks and regards,

    -George