December 12, 2013

Accessing the PRU from node - first attempt

Incomplete This totally blew up on me because I tried to rush ahead without attending to the prerequisites. I hope to get back to this someday.

I have been working with node and bonescript, so a reasonable first thing to try would seem to be to try out the node "pru" package, as described here:

The first thing I do is to set the time, since I have learned that otherwise, NPM will complain about supposedly bogus certificates.
su
ntpdate -b -s -u pool.ntp.org
date
I really should considering enabling ntp when the beagle boots up. Then I try something naive, namely just install the npm package. This is doomed without doing a number of other things first, as I soon learn.
cd /usr/lib
npm install pru
This pulls in pru-0.1.3 and tries to build some python thing using node-gyp rebuild and then blows up with:
Error: Python executable "python" is v2.7.3, which is not supported by gyp
This is a bug in the file (part of the opkg python-compiler package?) /usr/lib/node_modules/npm/node_modules/node-gyp/lib/configure.js that is strictly checking python versions -- several people advise just commenting out the check (it is some kind of bug in semver.lt); the code should look like this when fixed:
	// if (semver.gte(version, '2.5.0') && semver.lt(version, '3.0.0')) {
	    getNodeDir()
	//      } else {
	//        failPythonVersion(version)
	//      }
It gets further now, but ultimately blows up with:
../src/pru.cpp:11:22: fatal error: prussdrv.h: No such file or directory

PRU related files

My beagle has the file:
/lib/modules/3.8.13/kernel/drivers/uio/uio_pruss.ko
And my copy of the 3.8.13 kernel source has:
kernel/kernel/drivers/uio/uio_pruss.c
kernel/kernel/include/linux/platform_data/uio_pruss.h


Feedback? Questions? Drop me a line!

Tom's Computer Info / tom@mmto.org