I'm working on an embedded system project using altera cyclone 5 fpga-soc. On the real processor (ARM) I will use Linux and the script for FPGA communication will be implemented in Python 2.
I need a memory map to send and receive data to and from FPGA via /dev/mem
.
To develop the script i use a Lubuntu system on a virtual machine. Below is my code tested in PyCharm on Lubuntu VM:
def open(self):
file = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
self.map = mmap.mmap(file,
self.CONST_mapLength,
mmap.MAP_SHARED,
prot = mmap.PROT_READ | mmap.PROT_WRITE,
offset = self.CONST_offset)
return
My problem is that i cant open \dev\mem. The script ended with this text:
file = os.open("/dev/mem", os.O_RDWR | os.O_SYNC)
OSError: [Errno 13] Permission denied: '/dev/mem'
Process finished with exit code 1
What is the problem and how do I fix it?