Accessing physical memory on ARM

Adit Sahasrabudhe asahasra at
Wed Nov 11 22:32:21 UTC 2015

Thanks Joel, that is what I thought, but then we saw some behavior that didn't quite make sense. We were not able to read the values from our code, the shell, or eclipse, unless we put the “NP:” prefix on the address in eclipse.

It turns out it’s a cache issue. Our application has the FPGA on the SoC writing data to the SDRAM. We ran another test where we made sure the test buffer would create a cache miss and sure enough, the data is read just fine.

So one last question then, since this data is only written by the FPGA, it seems like I have two options:

  1.  Create a new section in my linker script and configure the MMU for that section to not use cache (using startup/mmu_config.c in the BSP)
  2.  Or, I can invalidate the cache whenever we want to read this buffer (not too often). Is there an API available to do cache invalidations? We tried the inline routines in arm-cp15.h, but it causes a fatal exception.


From: Joel Sherrill <joel.sherrill at<mailto:joel.sherrill at>>
Date: Wednesday, November 11, 2015 at 10:01 AM
To: Adit Sahasrabudhe <asahasra at<mailto:asahasra at>>
Cc: "users at<mailto:users at>" <users at<mailto:users at>>
Subject: Re: Accessing physical memory on ARM

On Wed, Nov 11, 2015 at 10:46 AM, Adit Sahasrabudhe <asahasra at<mailto:asahasra at>> wrote:
Hi all,

We’re using RTEMS on an ARM Cortex A9 (Altera SoC), and we need to be able to access some physical memory locations in the SDRAM. The BSP has the MMU enabled by default and rather than messing around with trying to disable it, I was hoping there was another way to access physical memory locations. It looks like mmap() capability is supported by this BSP, but I believe that requires the /dev/mem I/O device to be present. We are using the IMFS, which does not have that I/O device mapped.

Any thoughts on this? I’m sure (at least I hope) someone has tried to do this before.

RTEMS does not have virtual memory. The MMU is used just to access physical memory
in 1:1 fashion. If you can't access a location via a simple pointer, then it isn't mapped and
the MMU initialization needs tweaking to include the addresses it missed.



users mailing list
users at<mailto:users at><>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the users mailing list