Specifics on reserving DDR for PRU/ARM shared use

Added by Andrew Bean over 4 years ago

The note in the wiki article for getting started with PRU mentions the following:

A safe design that wanted to use shared DDR would probably have to either reserve some memory similar to how the DSP does by using mem= in bootargs. Or the application could malloc some memory and pass the physical memory address to the PRU to use.

I'm hoping to get a bit more detail on how this. I've been trying to figure out the specifics of reserving some memory and subsequently accessing it from the PRU and from a normal (userland) C program. I've seen the following kernel parameter mentioned a few places online:

            [KNL,ACPI] Mark specific memory as reserved.
            Region of memory to be reserved is from ss to ss+nn.
            Example: Exclude memory from 0x18690000-0x1869ffff

If this is the correct approach for reserving memory, how do I figure out where I should be reserving the memory (i.e., at what start physical address)? Does the file /proc/iomem give an indication of this? Once I have the section of memory reserved, is accessing it from the ARM as simple as open("/dev/mem") and mmap(physical address), or do I have to write a kernel module or something? If a kernel module is the only way or the right way to do it, any details you could give on that would be great, as I have no experience with kernel stuff.

Replies (2)

RE: Specifics on reserving DDR for PRU/ARM shared use - Added by Bob Duke over 4 years ago

Hi Andrew,

I recommend you review the TI-provided documentation and examples for the PRU available here:


This documentation is compatible with the PRU Module for the 3.2 kernel we currently use on the MitySOM-335x. TI has provided multiple ways to access the PRU over the past few years, so it can be difficult to find consistent documentation.

That git repository has a file 03-AM335x_PRU_Linux_Application_Loader-ug.pdf that describes the interface provided by the PRU kernel driver (including PRU and memory initialization functions). At the end of this file is a brief description of the included example apps. Take a look a the PRU_memAccess_DDR_PRUsharedRAM example to see how you can share data between Linux and the PRU.

I have run the example apps successfully on the MitySOM-335x, so if you have any problems getting them to run, please post here. The git repository also contains a PRU Overview that has some detailed information about using PRU assembly.

RE: Specifics on reserving DDR for PRU/ARM shared use - Added by Bob Duke over 4 years ago

Regarding your specific questions, yes, you could use memmap to set aside a particular chunk of memory. Where you set it up depends on the amount of memory in your module and I expect you could access it from base SDRAM address 0x8000_0000 (as defined in the AM335x memory map). For the memmap command you should be able to use a notation similar to memmap=64M$256M, (64MB at the 256MB boundary, assuming you have 512MB or 1GB of RAM) and then access it at an offset of 0x8000_0000, but I haven't tried it.

The "correct" way would be to use the PRU module interface I previously described or to write a kernel module that requests the memory from the kernel. You can refer to Chapter 15 of the Linux Device Drivers book for further information.

How much of all this you need will depend on your application.

    Add picture from clipboard (Maximum size: 2 GB)