Using peripherals / accessing registers in PRU C


I'm working on a relatively simple PRU project where I want to use the IEP peripheral. I'd prefer to develop this in C, but I can't find any way of accessing the IEP or other peripherals without using inline assembly,and this is what I've done. It seems like a big compromise though and I'm wondering if there's a way round this - it kind of defeats the point of using C in the first place.

Also using inline assembly I have a few issues, e.g.
1) the inline assembly doesn't recognise #define-d C constants
2) I'm having issues with the C compiler complaining about assembly labels if they're not at the beginning of the __asm__... block. I know the C compiler documentation advises against using labels, but again I can't see a way around this - I need to poll an IEP status flag in a loop to check for an overflow.

Anyway, I can give more concrete examples if that's helpful, but I just wanted to get some general advice on how to approach this first.

Thanks very much,


Clone the above and look in the examples/am335x directory.
There is an example C file for IEP.
I’ve never run it myself, but seems to be what you are looking for. Perhaps a good place to start.