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.

CC2642R: CC26XX Task configuration

Part Number: CC2642R

Tool/software:

Hello,

In the simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang exemple of the latest SDK we have the following task declaration

// Task configuration
Task_Struct spTask;
#if defined __TI_COMPILER_VERSION__
#pragma DATA_ALIGN(spTaskStack, 8)
#else
#pragma data_alignment=8
#endif
uint8_t spTaskStack[SP_TASK_STACK_SIZE];
  

If we activate all the compiler warning (-Wall)  we get "Description Resource Path Location Type
unknown pragma ignored [-Wunknown-pragmas] simple_peripheral.c /simple_peripheral_CC26X2R1_LAUNCHXL_tirtos7_ticlang/Application line 257 C/C++ Problem"

So the question is :

- With the new TiRTOS7 and Tiarmclang  environment do we still need to have the 8 byte data alignment on the stack ? (I could not find any recommendation in the doc...)

- If yes why don't you use the clang "__attribute__ ((aligned (8)))" version ?  Or should we use it ?

Thanks for your help.

  • Hi,

    I believe the 8 byte data alignment is still necessary. I am not sure why it is being configured in the way it is currently. I would guess it is because that is how the toolchain expects it to be configured. I would suggest leaving the settings as default to ensure everything works as expected.

    Best Regards,

    Jan

  • Hi,

    Yes but the problem is that the code of the example is not consistent with how the toolchain expect it to be configured. 

    So leaving everything as is means the stack will not be 8 bytes aligned. Unless there is an other option somewhere that force it to be 8 bytes aligned...

  • Hi,

    Got it. In the case, then can you try using the __attribute__ version to see if the behavior in the application is still as expected?

    Best Regards,

    Jan

    1. Yes I can try but I would like to know if TI recommends 8 bytes alignment for TiRTOS7 tasks stacks. I cannot find any information in the documentation.
  • Hi,

    I have looked further into this and within the SYS/BIOS (TI-RTOS Kernel) v7.x User's Guide in section 7.4.3 HeapBuf, it is mentioned that devices with a 32-bit architecture use 8-byte alignment. As specified in the CC2642R datasheet, the device is  32-bit ARM core based, so the byte alignment will be 8 bytes.

    Best Regards,

    Jan

  • Hi Jan,

    I am still in doubt regarding this topic.

    In the SYS/BIOS doc it says "On devices with a 32-bit architecture, the 8-byte alignment is used. The base address of the buffer should also be aligned to this same size" 

    "Is used" does not mean has to be used. Furthermore the chapter talks about the heap and not the task stacks. In the specific CC26XX Technical manuel no mention of alignment for task stack setup.

    Further more the CLANG simple peripheral example for Launchpad does not use the 8 bit alignement. It uses the old SYS/BIOS pragma which is not recognized by TIArmCLang compiler (activate the -Wall to see that)

    So a clear position of Ti Engineers on whether we have to use the clang __attribute__ ((aligned (8))) for task stack declaration would be highly appreciated.

  • Hi,

    Understood, I will discuss internally with other engineers to see if we can dig up some more information. In the meantime, have you tried using the __attribute__ ((aligned(8))) to see what would happen? Is the behavior as expected?

    Best Regards,

    Jan

  • Hi,

    We found the definition of the aligned keyword in the TI Clang documentation:

    https://software-dl.ti.com/codegen/docs/tiarmclang/compiler_tools_user_guide/compiler_manual/c_cpp_language_implementation/attributes/function_attributes.html#aligned

    Taking a step back, can you share why you would like to change to aligned? Is it simply to remove the warning or are you seeing an issue during your application development?

    Best Regards,

    Jan

  • Hello Jan,

    I do not want to change the alignment, I want to do what is recommended by the supplier of the CC2642 regarding TiRTOS7 task's stack alignment..

    I ask this question firstly because it is not documented and secondly because the SDK exemples are not consistent (see my initial question).

    The simple-peripheral exemple uses the old #pragma data_alignment=8 and not the clang __attribute__ ((aligned(8)))       (is it just a mistake ...?)

    The project-zero example uses the the clang __attribute__ ((aligned(8)))

    I tried both, they seem top work so it does not proove anything.

    Hence my question : What is the recommended TiRTOS7/TiArmClang task's stack alignment ?

  • Hi,

    I believe using the older #pragma define is likely a leftover from earlier SDK / RTOS, but it is my understanding that it still should work properly in spite of the warning.

    Best Regards,

    Jan