Hi. I managed to compile a PRU binary and get it running.
I created a simple web app to start at bootup, with a simple script to configure the pins before starting the server. It turned out that the file `/sys/class/remoteproc/remoteproc2/state` was not present for the first ~20 seconds after boot, causing the configuration script to fail. I created the following script to overcome this:
```
$ cat configure_pru.sh
#/bin/sh
while [ ! -e /sys/class/remoteproc/remoteproc2/state ]
do
echo "waiting for remoteproc to start"
sleep 1
done
config-pin 8.45 pruout
config-pin 8.46 pruin
config-pin 8.39 pruout
config-pin 8.40 pruin
config-pin 8.27 pruout
config-pin 8.29 pruin
config-pin 8.28 pruout
config-pin 8.30 pruin
echo -n start > /sys/class/remoteproc/remoteproc2/state
```
This worked well as a kludge until I upgraded my kernel. Now at kernel `4.14.108-ti-r124` this no longer works, as the file will be present immediately after boot.
Right now, the PRU code will not run correctly if I start the web service just after boot. It I wait half a minute before configuring the PRU, everything works well. I expect that I need to wait for some service to start up after boot, before initializing the PRU, but I have not found any documentation mention of how to do this.
So my question is: how could I detect that the PRU is ready for use after boot. Just now I am using a `sleep`, but this is not a robust solution.
Extra question: Is there a way to boot the PRU code automatically at boot without having to echo `start` to the `state`file?
Thx