简体   繁体   中英

using Cortex-M MPU

We start a new software, and we think about using the MPU. We ar based our new software on FreeRTOS (with the MPU port).

We understand correctly all the segmentation about the intertask communication with the MPU. What we have difficulties, is what to do with dynamic allocation protection. By default, all the ram should be protect in user mode. Is there any documentation online that explain how we should handle the dynamic allocation ?

We would like to protect the memory as much since we will design a big software > 500K compiled code.

Regards

Jonathan

Basically FreeRTOS offers 4 different memory allocation strategies, implemented in the heap_1.c , heap_2.c ... files in the portable/MemMang directory.

heap_1.c offers a simple alloc only implementation
heap_2.c offers a simple alloc/free implementation

The other 2 implement more advanced strategies of alloc/free. FreeRTOS will need that you at least choose one of them, because it needs this interface to do it's own resource allocation (tasks, mutexes, semaphores, etc.). For MCU that provide a memory protection unit FreeRTOS also has appropriate support .

Note that using the MPU will force you to allocate the memory using a minimum chunk size (eg 1KB). This can be very expensive, if you need to allocate a lot of small objects (eg using a std::list<int> or std::map<int,int> with many elements). You might consider to provide your own specialized allocators for such cases.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM