Accessing physical memory on ARM

Adit Sahasrabudhe asahasra at fb.com
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.

Adit


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



On Wed, Nov 11, 2015 at 10:46 AM, Adit Sahasrabudhe <asahasra at fb.com<mailto:asahasra at fb.com>> 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.

--joel

Thanks,
Adit

_______________________________________________
users mailing list
users at rtems.org<mailto:users at rtems.org>
http://lists.rtems.org/mailman/listinfo/users<https://urldefense.proofpoint.com/v2/url?u=http-3A__lists.rtems.org_mailman_listinfo_users&d=CwMFaQ&c=5VD0RTtNlTh3ycd41b3MUw&r=NQi5ZDATEqAUQ7YuH-e3LQ&m=HgIW5CVcOkOfJKh7s_GASS9nb-2qbJG5sT2xEmj1Ne0&s=Ecyd8uRJrlr69b_Araok7pTR1j8qoM-4JObJEpRIIB8&e=>

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.rtems.org/pipermail/users/attachments/20151111/de13eda7/attachment-0002.html>


More information about the users mailing list