WRITE and READ memory mapped device registers in Linux on ARM

前端 未结 2 1406
广开言路
广开言路 2021-01-13 05:01

I am trying to read and write registers on my ARM9 (SAM9X25) following those steps : http://infocenter.arm.com/help/index.jsp?topic=/com.arm.doc.faqs/ka3750.html
I ended

2条回答
  •  旧巷少年郎
    2021-01-13 05:41

    You can't access registers directly, because Linux use MMU and this create for your application virtual address space which is different than physical MCU address space and access outside this virtual address space cause segmentation fault.

    Only Way to access these registers in Linux (if you don't want to write kernel drivers) is to open file /dev/mem as file and map it with mmap

    For example I have small python library for access GPIO registers on Atmel SAM MCU gpiosam. You can inspire and port it to C.

提交回复
热议问题