Dynamic pointer to DRAM

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Dynamic pointer to DRAM

Postby MiguelTasende » Tue Aug 18, 2015 5:02 pm

Hi!
I have a question that may (or may not) be very simple...
It has to do with the communication through shared DRAM, between the Epiphany and the ARM.

- I have been able to read/write internal Epiphany memory from the ARM, if there is a common predefined address.
- I have been able to read/write external shared memory by the Epiphany and the ARM in a coordinated way, if there is a static predefined address (a constant defined at compile time "0x0100_0000" for the ARM, "SECTION("shared_ram")" in the Epiphany).

Now, I have a pointer to DRAM in the ARM (it was passed to me at runtime) and I want the Epiphany to write exactly on that address. By now, I couldn't do it. I tried to pass a **float, with e_write to a known location, then substract 0x0100_0000 in the Epiphany and write there, but it didn't work...
I obviously can write on a shared static buffer and then copy in the ARM to the dynamic one, but on this case it is important to save those extra microseconds, so I don't want to.
MiguelTasende
 
Posts: 51
Joined: Tue Jun 30, 2015 12:44 pm

Re: Dynamic pointer to DRAM

Postby tnt » Wed Aug 19, 2015 11:49 am

Where does that pointer come from ? If it points to a zone in the shared memory, you can just take your pointer, substract the address at which the shared memory is mapped in your process, then add the base address at which it's mapped inside the epiphany.

But if it's just a random pointer (like if it comes from a malloc or something) then you just can't do it ...
tnt
 
Posts: 408
Joined: Mon Dec 17, 2012 3:21 am

Re: Dynamic pointer to DRAM

Postby piotr5 » Thu Aug 20, 2015 11:58 am

have you tried actually reading on epiphany from the address outside of shared memory on arm? i.e. you have the pointer you got from arm, what do you get from *(int*)ptr? does it really give you the value you wanted or does epiphany crash or what? does the result depend on that value's position? what if the value is located at an address <64M and >4M?

but tnt is correct, if you write to a location on arm, this memory will not appear in the cpu's cache, and therefore the cpu will never get that value till the cache is re-read. parallella's shared memory simply is never stored in cache, therefore access to it is slower than access to any other memory, polling shared memory is much slower than constantly polling some cached area. therefore you'd better create a dma-transfer from shared memory to some cached location regularily (timer interrupt or inside your loop), copying all the flags/pointers your eCores are writing to, and continue with execution after checking the state of the previous transfer...
piotr5
 
Posts: 230
Joined: Sun Dec 23, 2012 2:48 pm


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 13 guests

cron