Altera_Forum
Honored Contributor
11 years agoLinux access to non-Linux memory
I want to write large amounts of data into DDR using the FPGA. This works, and I can store data at the required rate. I want the ARM on the C5SOC chip to be able to process that data.
I have tried various tacks, but the one that works (but slowly) is to configure Linux to only use 768MB, then use the FPGA to write to the last 256MB of the DDR memory, and get Linux to access it using: mmap(NULL, 0x10000000, (PROT_READ | PROT_WRITE), MAP_SHARED | MAP_LOCKED, fd, 0x30000000); The only problem with this, and it's a big one, is that it would seem access to this memory is painfully slow. If I copy it from there to a malloc'ed buffer in Linux and then process it, it works MUCH faster. This is all within the HPS DDR memory chips, so it's the same chip being accessed in both cases, but going through mmap is slow. I have been advised that there are better ways of doing this, but the person advising wasn't sure how. I've posted this question here, in the hope that some software people/Linux people will be able to advise how to access physical addresses quicker from within Linux. Given that any FPGA memory buffer accessed through the HPS2FPGA busses will necessarily run slowly because the only way I know of accessing them is via MMAP. Is there a better way? Cheers, Simon