Can I add new member in tskTaskControlBlock struct?

I want add some members in tskTaskControlBlock struct. But I am not sure whether It will cause some potential problems. As far as I know, some assembler instructions can access the member of the struct by offset.

If the answer is “yes”, Could you please tell me which rules I should follow If I will add new members?

thanks a lot.

assuming that you know what you are doing, the only rules I can think of are 1. only add members to the end of the existing definition, 2. observe target MCU’s alignment requirements and 3. do not expose the structure to application tasks.

1 Like

We use a C++ wrapper around the FreeRTOS API. In it we declare a C++ Task class that inherits StaticTask_t. That allows us to add our extra fields, without having to modify FreeRTOS.

1 Like

I think there is also a tag value in the structure you can use for any purpose, like pointing to your own structure, and the ability to add thread local storage.

1 Like

thanks for your help. the member pvThreadLocalStoragePointers is what I want .