[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 483: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/bbcode.php on line 112: preg_replace(): The /e modifier is no longer supported, use preg_replace_callback instead
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4688: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4690: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4691: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
[phpBB Debug] PHP Warning: in file [ROOT]/includes/functions.php on line 4692: Cannot modify header information - headers already sent by (output started at [ROOT]/includes/functions.php:3823)
Parallella Community • View topic - Confusion about the use of the memory

Confusion about the use of the memory

Discussion about Parallella (and Epiphany) Software Development

Moderators: amylaar, jeremybennett, simoncook

Confusion about the use of the memory

Postby aihaike » Tue Aug 19, 2014 7:48 am

User avatar
aihaike
 
Posts: 31
Joined: Wed Aug 06, 2014 5:41 am
Location: Shanghai, China

Re: Confusion about the use of the memory

Postby sebraa » Tue Aug 19, 2014 3:55 pm

sebraa
 
Posts: 495
Joined: Mon Jul 21, 2014 7:54 pm

Re: Confusion about the use of the memory

Postby aihaike » Wed Aug 20, 2014 7:11 am

User avatar
aihaike
 
Posts: 31
Joined: Wed Aug 06, 2014 5:41 am
Location: Shanghai, China

Re: Confusion about the use of the memory

Postby notzed » Wed Aug 20, 2014 11:56 am

Sections are just labelled blocks used by the linker to identify pieces of code and data. The linker script can assign these blocks of code and data to different addresses. Because the epiphany has no virtual memory capability (memory management unit) all addresses must be hard-coded at link time to the physical hardware addresses of the machine. This is what the linker script is for. The section names can be pretty much anything but the "esdk" uses a few and you need to take that into account in your linker script.

(most of the above is just basic "how a c compiler works" for the last 40 years, it's just that normally the defaults are fine for most development).

Different banks are used because it can lead to greater performance in certain circumstances and is also a simple way (i.e. a hack) to assign a known address to a buffer so it can be accessed from another core.

e_alloc() is poorly named as it doesn't allocate anything at all. It just maps blocks of the shared memory area into the process address space of the current program: allowing the ARM core to read/write to areas of memory accessible by the epiphany core. The "base" argument is relative to the base location of the shared memory area.

i.e. mapping offset "0" size "4096" will equate to the epiphany address $e8000000 to $e8001000.

The hard part with the current sdk (or when I used it, although it doesn't appear to have changed) is determining what that offset is from the ARM side. And you have to take into account anything the linker script or elib or ehal might want to use.

Look in the linker script to see where the shared dram block is, it's probably $e9000000 as the first half is 'reserved' for libc. The *first* variable you put into that section will be accessible from the arm core if you use e_"alloc" with an offset of $01000000. You'll have to check those addresses in the linker script YOU are using, as they could be anywhere in the 32MB block.

The linker script should always be for a specific project/program so you need to link in EACH project's Makefile to see exactly which linker script is used by each compiled binary, ... and then you can cross reference that with the section names used in the program, ... and then after all that all you know is the base address of the section. You actually have to use e-objdump -t to dump the symbol table of linked binary to find the actual address of any variable if you have more than one defined in a section. And it could change every time you recompile the program.
notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Confusion about the use of the memory

Postby aihaike » Thu Aug 21, 2014 7:45 am

Thanks notzed for the explanations, this is very clear and helpful.
Now, if you take a look at the hello_world example.
On the host side we map blocks of the shared memory by defining the beginning and the size. (Am I right here?)
On the device side we just write to a buffer by specifying only the size.
So I'm wondering how from the device side we write on the right place since we say were to start.
Do the different sections correspond to different address space ?
User avatar
aihaike
 
Posts: 31
Joined: Wed Aug 06, 2014 5:41 am
Location: Shanghai, China

Re: Confusion about the use of the memory

Postby notzed » Thu Aug 21, 2014 11:59 pm

notzed
 
Posts: 331
Joined: Mon Dec 17, 2012 12:28 am
Location: Australia

Re: Confusion about the use of the memory

Postby aihaike » Fri Aug 22, 2014 12:47 am

I see, got it!
Thank you notzed so munch for your help!
Highly appreciate it.
User avatar
aihaike
 
Posts: 31
Joined: Wed Aug 06, 2014 5:41 am
Location: Shanghai, China


Return to Programming Q & A

Who is online

Users browsing this forum: No registered users and 3 guests