Jump to content
  • 0

Interacting with mutliple UIO AXI IPs with C program in petalinux


DMoore

Question

Hello all,

I have two custom IPs one for SPI communication and another to control an audio transmitter. These devices are both controlled through AXI registers, and are connected to the AXI interconnect as slave 0 and 1. I have the device tree configured so that the IPs are "general-uio", and see them in /dev/uio* when inside of petalinux.

Individually, I can interact with them inside a petalinux build with just their respective IP included in the device tree and block diagram. I do this by mapping the memory of /dev/uioX, and then casting the void pointer attained from this to a volatile uint32_t pointer.

When I have the two IPs together I am able to memory map successfully, and I can even access the memory within the function I map it in. But when I leave that function I get a segmentation fault.

I have tried making the address global, which didn't work. I tried returning the void pointer from the function into the main file and passing it to other functions like that: this does work, but when I exit the function it was passed to I get the same segmentation fault.

If anyone has had similar issues to this please let me know how to resolve them.

Thanks,

D

Link to comment
Share on other sites

1 answer to this question

Recommended Posts

  • 1

A void* pointer is just a reference to a byte in memory (in this case a mapped memory) and dose not add any constraints on how to use the memory that follows.
Anything that escape the memory segment/page or incorrect access leads to a segmentation fault.

In addition if your pointer refers something on stack, know that the referred memory will be freed on a function exit/return. And next use of the pointer will lead to of course segmentation fault.
Maybe using the heap in this case.

This is all that can be said without any explicit situation (source code). For example without knowing how and when the mapping/unmapping is performed.

Link to comment
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now
×
×
  • Create New...