Developing GPIO Code on the M1
Posted: Fri Jun 17, 2016 9:04 pm
For the NanoPi M1 (and others) there is a downloadable directory called MATRIX which according to FriendlyArm you should cross-compile on a PC and then send the executable files to your M1. My interest is GPIO - and there is an example C program for controlling GPIO ports.
Running this on a cross- compiler is messy and I'd much rather keep the whole lot on the M1. I noted that GEANY is installed on the M1 - and having installed my usual programs on the M1 (Apache, Node-Red etc) I noted that as part of all that - the GNU C compiler environment is in there (might have been in Debian already).
So - I grabbed the MATRIX folder, dumped it into the M1 and LO - I could COMPILE the program from the GEANY environment.
Sadly when I tried MAKE - it fell over - a couple of includes needed ../../lib/include adding to the header. Clearly I'm missing some PATH info. Once I'd sorted that out - I noted the MAKE failed because the actual C programs referred to in the headers were ALSO missing. I pulled 2 C files into the main file - compiled and ran MAKE. VOILA - a working compiled program - granted it needs ROOT user which is not much use but better than nothing.
So my question is - being a tad on the novice side on Linux - where should I be looking to modify the path - the GEANY editor? The MAKE file? Somewhere else. If someone familiar with this library could help, it would certainly make programming these boards easier.
Running this on a cross- compiler is messy and I'd much rather keep the whole lot on the M1. I noted that GEANY is installed on the M1 - and having installed my usual programs on the M1 (Apache, Node-Red etc) I noted that as part of all that - the GNU C compiler environment is in there (might have been in Debian already).
So - I grabbed the MATRIX folder, dumped it into the M1 and LO - I could COMPILE the program from the GEANY environment.
Sadly when I tried MAKE - it fell over - a couple of includes needed ../../lib/include adding to the header. Clearly I'm missing some PATH info. Once I'd sorted that out - I noted the MAKE failed because the actual C programs referred to in the headers were ALSO missing. I pulled 2 C files into the main file - compiled and ran MAKE. VOILA - a working compiled program - granted it needs ROOT user which is not much use but better than nothing.
So my question is - being a tad on the novice side on Linux - where should I be looking to modify the path - the GEANY editor? The MAKE file? Somewhere else. If someone familiar with this library could help, it would certainly make programming these boards easier.