1

I am learning FreeRTOS from scratch. In order to do that,first, i start to investigate Task.c file. In that file there are macros, functions and declarations.

But I am confused about the declaration meaning and i cant figure it out why? In task.c the PRIVILEGED_DATA is used like this

PRIVILEGED_DATA static List_t pxReadyTasksLists[ configMAX_PRIORITIES ];/*< Prioritised ready tasks.*/

In the above ,static List_t type array declaration is made that is okey, but what is the meaning of the macro identifier in the beginning of the declaration and how it is possible a macro identifier is used in a declaration as a specifier?

Thanks.

In Mpu_Wrappers.h

#define PRIVILEGED_DATA

In FreeRTOSConfig.h

#define configMAX_PRIORITIES                    5
Nazim
  • 406
  • 1
  • 6
  • 20

1 Answers1

2

If this was just simple C code the macro would just be kind of documentation. When the code passes from the preposessor the macro is expanded to nothing.

However in freertos this macro is there to help the MPU. You can read more here: https://www.freertos.org/FreeRTOS-MPU-memory-protection-unit.html

MaanooAk
  • 2,418
  • 17
  • 28
  • 2
    Apparently, it [forces the variable into RTOS kernel's privileged data area](http://asf.atmel.com/docs/latest/samg/html/group__x_task_create_restricted_static.html). Perhaps there is a different include path which replaces this macro with something more meaningful though. – vgru Feb 02 '20 at 10:37