UPGRADE YOUR BROWSER

We have detected your current browser version is not the latest one. Xilinx.com uses the latest web technologies to bring you the best online experience possible. Please upgrade to a Xilinx.com supported browser:Chrome, Firefox, Internet Explorer 11, Safari. Thank you!

cancel
Showing results for 
Search instead for 
Did you mean: 
Highlighted
Participant rankeney
Participant
3,201 Views
Registered: ‎11-26-2014

Accessing bare metal application memory from Linux

Jump to solution

I have an AMP system based on XAPP1078 with Linux in the first 768M and the bare-metal application running in the remaining 256M. I want the Linux application to access some of the memory in the bare-metal application range, but am having problems. For example, I can create a variable in bare metal and print it's address and fill it with some value. When I try to peek that address (300198A8), I see 0. I even wrote a program to scan all 1G of memory for the pattern written by the bare-metal application but cannot find it. Linux clearly sees some memory at 0x30000000-0x3fffffff, but it isn't what the bare-metal application sees. Any idea what's going on?

 

FWIW, I'm using Petalinux 2014.4.

 

Kernel command line: console=ttyPS1,115200 earlyprintk maxcpus=1 mem=768M

 

In my system-conf.dtsi I have:

        memory {

               device_type = "memory";

               reg = <0x0 0x30000000>;

        };

 

With reg = <0x0 0x40000000>; I saw the same result.

Do I need some additional device tree addition?

 

Thanks!

 

 

0 Kudos
1 Solution

Accepted Solutions
Participant rankeney
Participant
5,682 Views
Registered: ‎11-26-2014

Re: Accessing bare metal application memory from Linux

Jump to solution

FWIW, Xil_SetTlbAttributes(addr, 0x04de2); seems to do the trick for each page with a size of 0x00100000.

This is similar to what you do with OCM memory.

0 Kudos
3 Replies
Participant rankeney
Participant
3,104 Views
Registered: ‎11-26-2014

Re: Accessing bare metal application memory from Linux

Jump to solution

Looking back at XAPP1078 I suspect that the bsp makes the bare-metal memory non-sharable. Maybe there is some call to Xil_SetTlbAttributes() I can add to the bare-metal application to make some/all of the memory sharable?

0 Kudos
Participant rankeney
Participant
5,683 Views
Registered: ‎11-26-2014

Re: Accessing bare metal application memory from Linux

Jump to solution

FWIW, Xil_SetTlbAttributes(addr, 0x04de2); seems to do the trick for each page with a size of 0x00100000.

This is similar to what you do with OCM memory.

0 Kudos
Moderator
Moderator
3,043 Views
Registered: ‎10-06-2016

Re: Accessing bare metal application memory from Linux

Jump to solution

Hi @rankeney

 

Regarding the linux memory configuration could you check the /proc/iomem file in your target machine? I'm not sure which of the properties DTS memory node or bootargs mem have preference when configuring the system, but definitibelly you need to map the memory addresses in your target to be able to access them.


Ibai
Don’t forget to reply, kudo, and accept as solution.
0 Kudos