Maping a pointer at a particular address.

mparikshit wrote on Monday, July 08, 2019:

Hii all,

Is FreeRTOS have any implementation like , we use to map a particular address to a pointer or buffer for data storage , like mmap() in Linux.

rtel wrote on Monday, July 08, 2019:

No - and I don’t think it should be necessary in a FreeRTOS application. What is it you are trying to achieve?

This is a question I had too. As the OP stated, under Linux memory mapped I/O uses mmap() and /dev/mem to access the registers.

My past experience with bare metal applications is to cast a volatile pointer to the memory address of interest, and reading (or writing) the data that way.

Under FreeRTOS, is there an OS level interface for memory mapped I/O, or is it more like the bare metal approach above? Or something else?

There is no OS level function - so the original answer still stands - just map to the hardware as before. Make to use a pointer to volatile if the hardware can change the value.

One thing to note, FreeRTOS doesn’t use a MMU (to map address so their physical address != logical address), some ports do use a MPU (to mark pages as protected), and sometimes is will use hardware that can be a MMU just as a MPU.

On ‘Big’ Ones that give you a mmap, that is basically setting up a file as the backing store for a piece of memory instead of the normal swap file. FreeRTOS doesn’t deal with this sort of virtual memory, in part because most processors of this class don’t have the ‘hard disk’ to serve as the backing store for it, and it becomes MUCH harder to talk about hard real-time requirements if you have to deal with swapping.