08-31-2017 06:03 AM
Hello,
I need to read the global timer register of CPU1 inside a Linux application. I see that something similar is done in bare-metal applications through the headers xparameters_ps.h and xtime_l.h which read 4 bytes from address 0xF8F00200. If I were to do the same in a Lunux application:
- Would the SCU stop me and/or do I need to do some special configuration from the Zynq processing system panel?
- Can I just mmap to read the register or do I need to include some xilinx libraries and headers inside the PetaLinux rootfs
- Is there something equivalen to XPAR_CPU_CORTEXA9_1_CPU_CLK_FREQ_HZ that I can refer to inside my code? (i.e. the cpu configured frequency, with cpu_freq disabled I think it is constant)
Thank you for your help!
08-31-2017 07:18 AM
Hey @pogccfe,
Would the SCU stop me and/or do I need to do some special configuration from the Zynq processing system panel?
let's see ...
# devmem2 0xF8F00200 w /dev/mem opened. Memory mapped at address 0xa6f83000. Value at address 0xF8F00200 (0xa6f83200): 0x59E84E25 # devmem2 0xF8F00200 w /dev/mem opened. Memory mapped at address 0xa6f71000. Value at address 0xF8F00200 (0xa6f71200): 0x7552AF7B
... seems to work fine.
Can I just mmap to read the register or do I need to include some xilinx libraries and headers inside the PetaLinux rootfs
You need to map the physical address to a virtual to access it.
This can, for example, be done with mmap on /dev/mem.
Hope this helps,
Herbert
08-31-2017 07:18 AM
Hey @pogccfe,
Would the SCU stop me and/or do I need to do some special configuration from the Zynq processing system panel?
let's see ...
# devmem2 0xF8F00200 w /dev/mem opened. Memory mapped at address 0xa6f83000. Value at address 0xF8F00200 (0xa6f83200): 0x59E84E25 # devmem2 0xF8F00200 w /dev/mem opened. Memory mapped at address 0xa6f71000. Value at address 0xF8F00200 (0xa6f71200): 0x7552AF7B
... seems to work fine.
Can I just mmap to read the register or do I need to include some xilinx libraries and headers inside the PetaLinux rootfs
You need to map the physical address to a virtual to access it.
This can, for example, be done with mmap on /dev/mem.
Hope this helps,
Herbert
10-18-2018 02:50 AM
Hi,
I'm using petalinux 2018.
devmem is used instead of devmem2. Do you know some differences?
If I try to execute
devmem 0xF8F00200
the board faults and I have to reboot it.