In general, the *.p files are PRU assembly code and you will need to use them (or the assembled PRU binary file). The *.c files are the HAL driver files used to talk to the PRU, you will likely need to replicate this functionality in Python if you want to talk directly to the PRU from Python. The files in hal/support/pru are the pasm assembler required to assemble the PRU code. There are several versions of pasm floating around, so it was added to the source tree to make sure a version with the required features is available.

The stepgen.bin file mentioned is a *VERY* old reference. The PRU code is now named pru_generic.bin, since it can do more than just generate step pulses. :)

NOTE: You don't mention what you're doing, but if you're OK talking to the PRU via HAL instead of directly using Python, HAL already has pretty great Python bindings. You can load the hal_pru_generic driver, create nets, drive signals, etc. all from Python. If you really want to talk directly to the PRU via Python you'll need to re-create the HAL side driver code in Python.

On 10/8/2018 6:49 PM, Magnus Wiberg wrote:
Hi!
I'm looking to into the source code of hal_pru_generic to modify it to load the pru code using python with py-uio (so it can work on BBX15), but I'm having some trouble understanding the source code of the pru driver/component. My plan is to first make it work with step/dir.

First: the component called hal_pru.c in https://github.com/jadonk/machinekit/blob/master/src/hal/components/hal_pru.c has to do with HAL_PRU_GENERIC. (and also, how are the files in machinekit <https://github.com/jadonk/machinekit>/src <https://github.com/jadonk/machinekit/tree/master/src>/hal <https://github.com/jadonk/machinekit/tree/master/src/hal>/support <https://github.com/jadonk/machinekit/tree/master/src/hal/support>/pru/ used?)

Second: it says in the code that stepgen.bin is loaded onto pru, is this the compiled pru_generic.p compiled? (It cant be stepgen.c uploaded to pru since it is not pru code, right?)  And how is stepgen.c code used in HAL_PRU_GENERIC?

Maybe you could tell me what parts of the code I might want to keep? I guess I can keep the .p code and have to tinker a bit with the memory sharing, and make the c-code run python program to load the pru code onto the pru.

(Excuse me if these are stupid questions, but I'm new to programming in C, especially in larger projects. :) )

Best,
Magnus

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: https://github.com/machinekit
---
You received this message because you are subscribed to the Google Groups "Machinekit" group. To unsubscribe from this group and stop receiving emails from it, send an email to machinekit+unsubscr...@googlegroups.com <mailto:machinekit+unsubscr...@googlegroups.com>.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

--
Charles Steinkuehler
char...@steinkuehler.net

--
website: http://www.machinekit.io blog: http://blog.machinekit.io github: 
https://github.com/machinekit
--- You received this message because you are subscribed to the Google Groups "Machinekit" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to machinekit+unsubscr...@googlegroups.com.
Visit this group at https://groups.google.com/group/machinekit.
For more options, visit https://groups.google.com/d/optout.

Reply via email to