This is a collection of documentation and build scripts for the GNU toolchain targeting the PRU I/O CPU. PRU cores present in TI Sitara AM33xx and later SoCs are supported.
Support for older PRU core versions is not planned.
A simulator is used to execute the GCC C regression test suite. Results are posted daily to https://gcc.gnu.org/pipermail/gcc-testresults/ .
Bug reports should be filed in https://github.com/dinuxbg/gnupru/issues . For general questions please use https://forum.beagleboard.org/ .
This project has no relation to the TI PRU C compiler. ABI differences between GCC PRU and TI PRU C are tracked in https://github.com/dinuxbg/gnupru/wiki
There are several examples to get started:
- Assorted small examples: https://github.com/dinuxbg/pru-gcc-examples
- BeagleMic PDM microphone array: https://gitlab.com/dinuxbg/beaglemic
- GCC port of the TI PRU training: https://github.com/dinuxbg/pru-software-support-package . Make sure to read ReadMe-GCC.txt.
Several methods to acquire the PRU cross toolchain are listed below, ordered by most convenient first.
If you are running an arm64 Debian (for example Beagleboard Debian Image), then installation is simple:
sudo sh -c "echo 'deb [trusted=yes] https://beagleboard.beagleboard.io/debian-'`lsb_release --release --short`'-gnupru stable main' > /etc/apt/sources.list.d/gnupru.list"
sudo apt update
sudo apt install gcc-pru gnuprumcu
Latest releases provide prebuilt tarballs for several hosts: amd64
Linux, armhf
Linux, Windows. Simply download, untar and use them when:
- You want to cross-compile PRU firmware from
amd64
Linux or Windows host. - You are using an
armhf
distribution other than Beagleboard Debian Image.
Note for maintainers: These prebuilt release tarballs are prepared using the build-crosstool-ng.sh
script.
Recently crosstool-ng acquired pru support. Provided you build top-of-tree crosstool-ng
, you should be able to:
$ ct-ng pru
$ ct-ng build
$ PATH=$HOME/x-tools/pru-elf/bin:$PATH
The custom build scripts are should work on any recent Linux distro. They are intended to be simple enough, so that they can act as a documentation how to cross-compile a toolchain. They intentionally lack some features:
- Downloaded source tarballs are not verified.
- Host binaries are not stripped, leading to bigger host executables sizes. Target firmware size is not affected, though!
- Code complexity is kept at only about 100 lines of simple
BASH
statements.
Users may find that Beagleboard Debian Packages, or prebuilt releases or crosstool-ng are instead more suitable for production.
You'll need some prerequisites. For a Debian host:
sudo apt-get install build-essential libmpfr-dev libgmp-dev libmpc-dev texinfo libncurses5-dev bison flex texinfo
Alternatively, for a Fedora host:
sudo dnf install @development-tools g++ mpfr-devel gmp-devel libmpc-devel texinfo texinfo-tex texlive-cm-super* texlive-ec ncurses-devel bison flex
Then it should be a simple matter of:
export PREFIX=$HOME/bin/pru-gcc # Define where to install the toolchain
./download-and-prepare.sh # Download and prepare the sources
./build.sh # Build
- GCC/Binutils Nios2 port was taken as a base for the PRU port.