I'm working at getting some PRU code running to drive the PRU-ICSS UART0 on the BeagleBone Black.
I've made some simple test code running that can TX "Hello" periodically, and also loopback any RX bytes to TX. However, I'm finding that there are many seemingly trivial changes that I can make to the code that cause it to crash, which is to say, the PC gets stuck at 0x148 (according to /sys/kernel/debug/remoteproc/remoteproc1/regs) which is a location past the end of my program code.
See the attached code. See in particular the TODO comment in ir-pru-uart-test.c. I would really appreciate if someone could check over my code and give any suggestions as to why the code runs properly when the code without the 'tx' variable is used, but crashes when the code using the 'tx' variable is used.
For building the PRU code, I'm using the TI PRU compiler 2.1.0 under CCS 6.0.1.
For building Linux, I'm using the meta-ti layer and the linux-ti-staging 3.14.31 kernel in Yocto.
I'm loading the code using the pruss_remoteproc driver, since that seems the way of the future. That is, I copy the build output ir-pru-uart-test-2.out to the target /lib/firmware/rproc-pru0-fw. Then I start the pruss_remoteproc driver with the following commands:
insmod /lib/modules/3.14.31/kernel/drivers/rpmsg/virtio_rpmsg_bus.ko insmod /lib/modules/3.14.31/kernel/drivers/remoteproc/pruss_remoteproc.ko
I have to say that the documentation for the pruss_remoteproc driver is sparse, so there are a few things I'm not sure about, such as the "Resource Table". Also whether the program execution has to start at 0 (which I'm doing by putting .text:_c_int00* > 0x0, PAGE 0 in the linker command file).
.text:_c_int00* > 0x0, PAGE 0