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.

TM4C1294 shared memory between threads

Other Parts Discussed in Thread: TM4C1294NCPDT, EK-TM4C1294XL

I need to share a buffer between threads without using queues or IPC. Is that possible in TI-RTOS? In linux I can do this without problem.

  • Yes, it is possible.

    A simple example is to have a global array and multiple threads can access it. Note: a thread can be a interrupt (Hwi), software interrupt (Swi) or Task. Note: you'll need to provide thread-safety if multiple threads are reading/writing to the memory. For example

    int someBuffer[128];

    Void task1(UArg arg0, UArg arg1)
    {
       UInt key
       ...
       key = Hwi_disable()
       //quickly act on someBuffer
       Hwi_restore(key)

    Note: use Hwi_disable/restore if you have a quick action on the shared memory. If you are only having tasks access the memory, you can use GateMutex, Semaphores or Task_disable/restore to guard the memory accesses (each have their pros and cons).

    Todd 

  • Hi Toddy

    Thank you for you quick response.

    After a try, I found that it is necessary to use "volatile" before the shared global variables, otherwise in some instances, the content of variables in some task is NULL.

    I found also that in TM4C1294NCPDT, the EMAC have serious problems in initialization.

    "SDOCM00107378: NDK examples for EK-TM4C1294XL do not work" recommends to place a code ( below) deactivating flash prefetch, but , after several tests, I found that it is a byte alignment problem in object code. Even using the code to deactivate flash prefetch, in some instance the EMAC freezes. If I add an aditional instruction ( see below ), the EMAC works:

    UInt32 ui32FlashConf;

    ui32FlashConf = HWREG(0x400FDFC8); // add to eliminate the EMAC freeze
    ui32FlashConf = HWREG(0x400FDFC8); // repeated
    ui32FlashConf &= ~(0x00020000);
    ui32FlashConf |= 0x00010000;
    HWREG(0x400FDFC8) = ui32FlashConf;

    Thank you.

    Sergio
  • Correct, "volatile" might be needed. It depends on your use case.
    SDOCM00107378 was fixed in the 2.00.02.36 release of TI-RTOS for TivaC. Which version of TI-RTOS are you using?
    fyi...it's better to open a new thread for a separate question. It helps to keep the threads shorter which makes searching more efficient.
  • Todd

    Yes, I did it. There is another thread for EMAC issue.

    I am using TI-RTOS for TivaC version 2.0.1.23. This is what I can see in the CCSV6 configuration window.

    I don't know what happened here, but, I tried to install 2.10.01.38, but this version not install in CCSv6. I am using Windows 8.01.

    Could you indicate a link that can guide me on how to install TI-RTOS 2.10.01.38. It not appears in App Center panel as an option.

    Thank you.

    Sergio
  • Todd

    I tried to activate TI-RTOS 2.10.01.38 into Products of RTSC, but, when I finish the process, a windows pops-up very quickly ( I can't see it ) and nothing happens.

    Windows 8.01 has a lot of issues regarding CCSv6. When I installed the first time CCSv6, I had a lot of problems, mainly about file sharing properties. I don't remember the details, as I did some time ago. What I can remember is that I modified a *.cfg for Java or something .

    Sergio