Thursday, January 18, 2018

Access mmio register under Linux / Android


Simple program to read & write to a pci device from userspace :

https://github.com/billfarrow/pcimem


Need to turn on CONFIG_DEV_MEM :
CONFIG_DEVMEM=y

And if mmap fail to /dev/mem, make sure strict devmem turned off :
# CONFIG_STRICT_DEVMEM is not set

Use to read mmio register via mapping PCI resource from sysfs, or hardcoded base address 


Config to use multiple gcc under Ubuntu


update-alternatives --remove-all gcc
update-alternatives --remove-all g++

update-alternatives --install /usr/bin/gcc gcc /usr/bin/gcc-4.9 60 --slave /usr/bin/g++ g++ /usr/bin/g++-4.9