Tool/software: Code Composer Studio
Hi,
I am trying to run a simple PRU code to bit-bang P9.27 on the Beaglebone black. I have already achieved this using assembly code, however now I want to move on to doing so using C.
I have both Linux SDK and the CCS installed. There are two approaches that I have tried but none of them worked.
1. My beaglebone is running the linux kernel compiled and loaded with the 'create-sdcard.sh' script provided with linux sdk. I compiled my program by modifying the Makefile given in the example-application and am using AM335X_PRU.cmd file. Copied the *.out file to /lib/firmware/pru and updated the symbolic link (am335x-pru0-fw) to point to the out file. I reboot the board but the program doesn't seem to run.
What am I doing wrong?
2. Using CCSv7, I compile my code and generate the out file. I copy this file to the board (it is running the debian image) and try to generate the bin file using hexpru. I am using the AM335X_PRU.cmd file in this case as well. Here hexpru fails at the onset stating 'invalid option: cr'. I have echo-ed the compiled dts file into the capemgr file which enables P9.27 for output.
How do I use the out file without the TI debugger?
Attaching the C file for reference:
/*
* main.c
*/
#include <stdint.h>
#include <pru_cfg.h>
// Declare r30 register
volatile register uint32_t __R30;
int main(void) {
/* GPI Mode 0, GPO Mode 0 */
CT_CFG.GPCFG0 = 0;
/* Clear GPO pins */
__R30 = 0x0000;
while(1)
{
__R30 ^= (1 << 5);
__delay_cycles(100000000); // half-second delay
}
}
/*end*/
Thanks in advance,
Puneeth