This makes it a bit of a pain to use as memory locations must be calculated manually via offsets on at least one end.
With the current parallella-16 the shared block is accessible on the epiphany via 0x8e000000, and I was wondering if that could just be mapped to the same location on the ARM side. It's been a while since I looked at the memory map of linux and i wasn't sure if there was anything there - and it turns out there isn't. Using cat /proc/pid/maps I found that it's somewhere between and a long way away from both the heap and the stack.
So ... if instead of calling e_alloc() you can just use mmap directly to create a shared area that can be used to pass complex linked data structures without having to perform any address remapping by hand - which is error prone and simply a big pita.
e.g. to map 8K at the start of this block on the parallella-16 I have:
// parallella-16: physical 3e000000 on arm == physical 8e000000 on epiphany int fd = open("/dev/mem", O_RDWR | O_SYNC); void *pmem = mmap((void *)0x8e000000, 8192, PROT_READ|PROT_WRITE, MAP_SHARED, fd, 0x3e000000);
The specific numbers may vary on a given platform or configuration and can be determined at runtime.
This makes using the shared DRAM a lot easier including features like dynamic memory management (aka malloc).
No comments:
Post a Comment