Memory allocation

Tasks can only allocate memory blocks (including for new messages with non-zero size) from the allowed memory classes mentioned below. In addition, all blocks utilized within functions such as PxMcInsertBlk, PxMcTakeBlk and PxMcReturnBlk must comply with MPU size and alignment specifications.

Allowed memory classes

Buddy Memory class

Messages and memory blocks with variable sizes must exclusively be allocated from a memory class of type PXMcBuddyMemory. This memory class is designed to serve only size-aligned blocks, where the block size adheres to a power of 2.

Fix-sized memory class

For messages and memory blocks with a predetermined (fixed) size, allocation is possible from a memory class of type PXMcFixsized. All blocks allocated from the fix-sized memory class must fulfil the size and alignment requirements of the MPU.

Not allowed memory classes

Var-sized memory class

Due to the MPU requirements, messages or memory blocks cannot be allocated from var-sized memory classes in the ARM version of PXROS-HR. It is not allowed to create a var-sized memory class or request memory blocks or messages from this class. If attempted to do so, the error code PXERR_UNSUPPORTED_MCTYPE is returned.

Further constraints due to MPU restrictions

  • Every memory range assigned to a task in the extended memory regions table is bound by MPU size and alignment constraints.

  • The PxMsgSetData and PxMsgSetSize API functions do not modify the protection bounds according to the new data pointer and size but just change the values that are returned by the respective Get-functions.