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.

volatile question

Other Parts Discussed in Thread: SYSBIOS

Hi,

I know that volatile is used when I have hw involved,

Is there any another case without interrupts or hw involved that could I need to use volatile using optimization level 3 in C6678 in one core?

If yes, please, could you give me an example?

Thanks.

C. Garcia

  • Anytime that a memory is going to be changed by something other than the function that's calling it.

    This could be because of other cores, IPs (DMA, PCI, ...) or in the case of Memory Mapped Registers (Registers of IP that are mapped in memory) that change due to state changing.

    Best Regards,

    Chad

  • Hi Chad

     If I'm using only one core of the Shannon (meanwhile, the another seven cores are not in use), and the routine is running in L2 neither using hw or interrupts ,  with level 3 optimization, should be something that will change memory and therefore will be necessary to use volatile?

    Thanks again.

    C. Garcia.

  • If it's just a memory location that's not being accessed by anything else (i.e. No other IPs, no HW Changing MMR's, no interrupt updating the memory) then you should not require the use of Volatile.

    Are you having specific issues, or just asking the question in general?

    Best Regards,

    Chad

  • C. Garcia

     

    I wonder why do you ask

    Did you encounter a problem with your code?

    Do you disagree with some document?

    If you use multi-thread (multi-task) operating system, like TI RTOS (or Sysbios) I can see how one task modify global variable that is read by another task

    Does it make sense?

     

    Ran

  • Hi Chad,

    I saw this problem yesterday, really I'm using two cores. One of them uses srio with the buffers in DDR3 and the another core uses L2 for running the routine that I asked you. When I saw this problem I was debugging only the second core, but from system reset and until the first breakpoint, both cores were running.

    I'll thank you for any idea.

    C. Garcia

  • Please provide the full details of the problem you are seeing.  Addresses, what's accessing it, etc.

    Also, check the memory window to see if it's changed unexpectedly.

    Best Regards,

    Chad