Hello NXP and forum members,
we are working with the i.MX93 and want to use the shared memory to interact between the M33 and the A55 core(s), using a shared ringbuffer structure in this memory area.
The M33 can access the shared memory without problems, which does basically work on the A55 side, too, BUT: As soon as a connected GDB client tries to print the content of this shared memory, the program crashes with a segmentation fault:
Unable to handle kernel read from unreadable memory at virtual address ffff8000822e7000.
Which is strange, as the base of the shared memory block starts at 0x8F600000 and is mapped to virtual memory at FFFFF73E0000.
A bit more in detail:
We wanted to avoid to write a complete kernel driver for our needs, handling the memory access on user-space using the UIO drivers.
For this, we created two according entries in the device tree, defining the memory areas and assigning them to the UIO driver.
After mapping the memory area to a user-space area using mmap(), we can read and write the shared area without problems from both sides when not debugging/printing the memory areas using GDB.
Most IDEs and debugging frontends print local/function-local variables as soon as a breakpoint gets hit, leading to a quite unusable debugger for us, completely blocking our project at the moment
As described here https://stackoverflow.com/questions/654393/examining-mmaped-addresses-using-gdb , this problem was solved by adding a .access member to the vm_operations_struct in the according (custom) kernel driver.
But as far as I can tell, the according method seems to be implemented in the UIO driver used by us (CONFIG_HAVE_IOREMAP_PROT is enabled): https://github.com/phytec/linux-phytec-imx/blob/v6.6.52-2.2.0-phy/drivers/uio/uio.c
We are using a SOM board by PHYTEC and are currently using their carrier board hardware "PhyBOARD Nash" until our own hardware is finished. Hence, we mostly use patches as "quick and dirty" in our yocto layer for the moment.
Attached to this post is a archive containing a minimal working app example, and a down-stripped version of our current yocto meta-layer.
What is pretty strange in my opinion, is that there are not much search results on the web about problems with UIO, mmap and gdb, but this seems to be a rather common way for accessing raw memory from user-space.
Do you have an idea, why the GDB seems to access wrong, unmapped/unaccessible memory areas or what could be causing our problems here?
Thanks in advance & best regards
Markus