Very cool project! That's awesome that you were able to use the rpmsg character device to get the audio data up to user space and play it using the ALSA framework.
There are 4 files needed in order to build a C project for the PRU using TI's C compiler. Each of the examples and labs in the pru-software-support-package include these files:
- yourProgramFile.c
- this is your C program that you are writing for the PRU
- AM335x_PRU.cmd
- this is a command linker file. This is the way that we describe the physical memory map, the constant table entries, and the placement of our code and data sections (into the physical memory described at the top of the file) to the PRU linker. There are some neat things that can be done as far as placing code and data in exact memory locations using this file, but for the majority of projects, this file can remain unchanged.
- resource_table_*.h
- this file will create a header in the elf binary (generated .out file) that is needed by the RemoteProc Linux driver while loading the code into the PRUs. For the examples in the pru-software-support-package, there are two types of resources that the PRU can request using the resource_table_*.h file:
- interrupts - letting RemoteProc configure the PRU INTC interrupts saves code space on the PRUs
- vrings - requesting vrings in the resource_table file is necessary if rpmsg communication is desired (since the ARM/Linux needs to create the vrings in DDR and then notify the PRU where the vrings were placed)
- even if no resources are needed, the RemoteProc Linux driver expects the header to exists. Because of this, many examples in the package contain an empty resource_table header file (resource_table_empty.h)
- Makefile
- Makefile to build your PRU C program either on the target, on your Linux machine, or even on a Windows machine. The comment at the top of the Makefile tries to explain the environment variable needed for a successful build and how to set it on each of the 3 supported build development environments.
Check out the am335x examples in the pru-software-support-package. You can ignore (or even delete) any of the hidden files/folders in the examples as they are only used by CCS (.settings/, .ccsproject, .cproject, .project), which is not needed if you are using the Makefile to build. Once you ignore the hidden files/folders, you'll see that the examples provided include the above referenced 4 files and can be built by setting the PRU_CGT environment variable and typing 'make'.
In the last image that I put on my BBGW (from Robert's site) the PRU C compiler and the pru-software-support-package were all included in the file system out of the box. So, all that is needed to build the examples on the target is to create a symbolic link to the cgt-pru/bin/ folder, export the PRU_CGT variable, and then navigate to the examples folder (somewhere in /usr/share/ I think) and type 'make'. The symbolic link and exporting the PRU_CGT variable are described at the top of the provided Makefiles.
Let me know if any of that is unclear or confusing.
Jason Reeder