Hi All,
I have 2 questions:
Q1: I have several critical data (floats, uint16 & uint32) types that I want to make sure can not be corrupted during task switching. Since the Tiva data bus is 32 bits wide, is it reasonable to assume that any data that is 32 bits or less will be treated as an atomic value and hence there is no opportunity for the data to be corrupted during multi thread access?
Q2: If protection is required for 32 bit data, is a semaphore the best mechanism?
Discussion:
I believe that data transfer of variables in TIVA processors is always 32 bits wide. That a single 32 bits or less read or write in "C code is an atomic operation. If the code is only intended to run on a TIVA processor, access by multiple TI-RTOS tasks to single 32 bit or smaller variable in a TIVA processor does not require semaphores or other locking mechanism to protect against corruption. The assembly code I have reviewed seems to confirm this.
In many discussions on the forums I did not recognize any examples stating otherwise for access to a single variable. I normally would use a semaphore as a protection mechanism but question the need. However, I am not at all certain that I understand all the issues, i.e., optimization, need for volatile type.
Summary of question: Is a semaphore necessary assuming code only executing on the TIVA, a TI only compiler, and only single variables?
CCS 6.1, TI RTOS 2.14, Tiva 129XNCZAD MCU
I am asking about basics again and appreciate all the help I can get,
Randy