Page 1 of 1
reading from one core to an other
Posted:
Tue Sep 16, 2014 11:53 pm
by aihaike
Dear all,
I'm trying to figure how to read memory from one code to an other.
I suppose I've to use e-read but don't understand how to get the first argument (remote) from a core.
Any hints here?
Thank you,
Éric.
Re: reading from one core to an other
Posted:
Wed Sep 17, 2014 12:26 pm
by sebraa
The e_read/e_write functions are used on the host (ARM) to access the Epiphany cores or shared memory. An Epiphany core can easily access all other cores' memory by generating and using a pointer. Look at the e_get_global_address function.
Re: reading from one core to an other
Posted:
Wed Sep 17, 2014 12:32 pm
by notzed
Remote is the address of the value on the remote core, relative to the remote core's base address. The function will then use the row/col to convert that to the global address required to access the specific core (upper 12-bits of the address select the core).
If the cores are running the same image (binary/file/program) then you just reference the address of the variable locally as the offset from zero will be the same. i.e. "&foo" for a value type, or just "foo" for a reference type. Obviously these need to be global or static values that have a fixed address and not automatic variables.
If the cores are running different images then you need to either hard-code the label (or address) in both programs - either in a header or the linker script - or find some other way to resolve the address. Most of the example programs just hardcode them I think.
It helps if you have a good grasp of the way the memory is seen by each core. If you're not familiar with it section 4.1 of the epiphany arch reference manual has a diagram, but basically the first 32KB of each core is local to the core and the upper 12-bits of the address can be used to select the other cores via banks including a global alias of the current core. There are some functions for forming those upper 12-bits based on data from the sdk (workgroup information) and/or the coreid register but it's up to you to define the lower 16 bits (i.e. the 'remote addr' you queried).
I think there's some other posts about this in the forum but you'll have to search yourself.
Re: reading from one core to an other
Posted:
Thu Sep 18, 2014 12:38 am
by aihaike
Re: reading from one core to an other
Posted:
Thu Sep 18, 2014 12:54 am
by formoon
sebraa is right, e_read/e_write can only used in host program code, can't used in core side.
and also , core side has no OS, so there has no DEV option too. all /dev can only used in host side, there is arm cpu and linux OS.
Re: reading from one core to an other
Posted:
Thu Sep 18, 2014 1:25 am
by aihaike
I see, now ι got the point.
Thanks all for your replies.
Re: reading from one core to an other
Posted:
Thu Sep 18, 2014 12:04 pm
by aolofsson
Re: reading from one core to an other
Posted:
Fri Sep 19, 2014 1:31 am
by notzed
Re: reading from one core to an other
Posted:
Fri Sep 19, 2014 2:36 am
by aihaike
Thanks,
I actually use e_get_global_address function and it works like a charm.
Thanks you all for your replies.