Want to PRU binary using prussdrv_exec_program - Can't seem to get .bin file loading on PRU

Wondering if anyone can help. I had the Remote Proc/RpMsg working passing data to and fro. However I liked the functionality of uio_pruss so I have updated my kernel to 4.4.20-ti-r44 following advice from some of the guys on the board. Thanks to all who responded last time, uio_pruss is what I need.

So I have rebuilt my device tree to include am33xx-pruss-io.dtsi. and installed under the kernel directory in /boot/dtbs. I reboot and when I run lsmod I can see the three uio kernel objects. I am sure it is using the rebuilt device tree because I turned off the heartbeat on the USR0 led as a test in the am335x-common.dtsi. It isn’t toggling anymore.

I have built an example PRU program, PRU_LED0. I have setup the hex utility to run the following cmd file


.text: o = 0x0, l = 0x2000, files={text.bin}
.data: o = 0x0, l = 0x2000, files={data.bin}

I have an error, if I use this it complains 'not enough files for “.text” and “.data”. So I removed the files command to make it like what I built for Remotew Proc/RpMsg and it builds a _image.obj. Trouble is that it is the test and data combined. The rp_proc loader I think can split the file and load text and data. However I can’t see a way to split them for using with uio_pruss which calls prussdrv_exec_program and prussdrv_load_datafile.

Is there a utility or macro I could use to find the data and text portions of the image obj and split them ?

I am pretty sure this is the problem. I took portions of the prussdrv_exec_program function into my programm to see where the calls fails. I seem to be able to run prussdrv_pru_disable. It is failing at prussdrv_pru_write_memory, just before it calls prussdrv_pru_enable_at to run the code.

Fustrating… I am sure I am missing something obvious.


Why don’t you use pasm assembler from am335x_pru_package? It’s reliable, fast, has better syntax and the resulting bin files are loading directly by prussdrv functions.


I have the assembly working. I can build assembler and it loads correctly and runs, so I can fall back on that. It is fine and it will work.

However for my work environment it would be easer to program the PRU in C for maintainablity. Some developers not used to assembly. I was wondering if anyone has converted c out files to bin files that the prussdrv can understand.



The “combined” image is actually a standard ELF file. You may load and parse it yourself using libelf. Here is an example for pru-gcc that loads an ELF image, extracts IMEM and DMEM sections, and feeds them to the UIO loader: https://github.com/dinuxbg/pru-gcc-examples/blob/master/blinking-led/host-uio/pload.c

I have not tested it, but in theory it should also work with TI’s toolchain.