Hello everyone, thanks in advance for reading my question on how to access OCM in a userspace Linux app. Please excuse any ignorance derived questions. I am having problem writing to OCM.
My kernel creates the OCM driver during bootup, as I see this line in dmesg:
zynq-ocm f800c000.ps7-ocmc: ZYNQ OCM pool: 256 KiB @ 0xe0880000
The OCM controller registers are at f800c000, but the OCM itself will be either at either 0x0 or 0xFFFC0000 (physical address mapping) depending on whether OCM_CFG[RAM_HI] is 0 or 1 (0 on PoR according to Zynq TRM chapter 29 and OCM_CFG register detail). The Xilinx driver dmesg output is a bit confusing because 0xe0880000 is the kernel virtual address (result of ioremap). I am opening /dev/mem and then mmap() the whole 256 KB, but I don't know what address I should pass to mmap.
I tried 0x0: program hangs. I would guess that I have overwritten ISR vectors!?
I tried 0xe0880000, and the program prints:
Unhandled fault: external abort on non-linefetch (0x818) at 0xb6c06000
Bus error
I tried 0xFFFC0000, and the program usually succeeds (what I read matches what I wrote).
I somehow doubt that the OCM is at 0xFFFC000 (but I can check tomorrow by modifying the OCM driver verbosity). But even if it is at that address, how can I actually check that what I wrote wound up at the OCM? I was thinking about reading the memory in the JTAG debugger, but how do I really know that it is the OCM?