# Maping a pointer at a particular address.

**URL:** <https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957>\
**Category:** Kernel\
**Created:** [July 8, 2019, 5:28am UTC](https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957 "2019-07-08T05:28:11Z")\
**Posts on this page:** 5\
**Page:** 1

<div class="post-metadata">

**Author:** ![system](https://d2v6vdsk2p900z.cloudfront.net/original/1X/7fc8fdb729c645aab5b20282bbe34e57cb407be6.jpeg) [@system](https://forums.freertos.org/u/system)\
**Post date:** [July 8, 2019, 5:28am UTC](https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957/1 "2019-07-08T05:28:11Z")

</div>

**[mparikshit](https://sourceforge.net/u/mparikshit/)** wrote on [Monday, July 08, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/584ba80e4f/#33c0):

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.

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [July 8, 2019, 2:59pm UTC](https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957/2 "2019-07-08T14:59:24Z")

</div>

**[rtel](https://sourceforge.net/u/rtel/)** wrote on [Monday, July 08, 2019](https://sourceforge.net/p/freertos/discussion/382005/thread/584ba80e4f/#7de5):

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

---

<div class="post-metadata">

**Author:** ![pdavis0](https://avatars.discourse-cdn.com/v4/letter/p/bbce88/32.png) [@pdavis0](https://forums.freertos.org/u/pdavis0)\
**Post date:** [April 6, 2021, 12:53am UTC](https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957/3 "2021-04-06T00:53:47Z")

</div>

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?

---

<div class="post-metadata">

**Author:** ![rtel](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/rtel/32/31_2.png) [@rtel](https://forums.freertos.org/u/rtel)\
**Post date:** [April 6, 2021, 1:14am UTC](https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957/4 "2021-04-06T01:14:31Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![richard-damon](https://d3iykfbgfh8zhg.cloudfront.net/user_avatar/forums.freertos.org/richard-damon/32/38_2.png) [@richard-damon](https://forums.freertos.org/u/richard-damon)\
**Post date:** [April 6, 2021, 1:40am UTC](https://forums.freertos.org/t/maping-a-pointer-at-a-particular-address/7957/5 "2021-04-06T01:40:31Z")

</div>

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.
