I am here trying to make project where i create some different tasks are intersecting with different peripherals and isolate those tasks for memory usage using MPU in freeRTOS on LPC 1769, when i open a peripheral say UART or I2C there a structure object is been generated related to that peripheralcontrolt as it is done by FreeRTOS+IO framework.
Now my object is been created and the address is returned by FreeRTOS_open api now i want to use those address in creating a ristrected task using xTaskCreateRestricted, As i use this handler as in starting point of any region it gives me error like its not constant.
how do i solve this problem ? how can i pass memory space generated at run time as this FreeRTOS_open api is been called at starting of main() and then give them in such restricted tasks are been created after that.
I am bit confused over here.
I can't recall without checking the code, which I can't do right now, but you might find that the structure is not allocated in one go. For example, if a structure is allocated, but that structure contains a semaphore, then the semaphore will have been allocated separately and therefore not necessarily be in the region you are defining for the MPU. If that were the case then you may be able to access the containing structure without a problem, but get a memory fault when the semaphore is allocated inside the structure.
Also the MPU does not allow fine grained memory regions to be defined, I think they have to be a power of two (can't quite remember) so you could not define one just for the allocated structure with including a lot of unused RAM in the region allocated to the MPU.