3.19.39 PRU Options

These command-line options are defined for PRU target:

-minrt

Link with a minimum runtime environment. This can significantly reduce the size of the final ELF binary, but some standard C runtime features are removed.

This option disables support for static initializers and constructors. Beware that the compiler could still generate code with static initializers and constructors. It is up to the programmer to ensure that the source program will not use those features.

The minimal startup code would not pass argc and argv arguments to main, so the latter must be declared as int main (void). This is already the norm for most firmware projects.

-mmcu=mcu

Specify the PRU hardware variant to use. A correspondingly named spec file would be loaded, passing the memory region sizes to the linker and defining hardware-specific C macros.

Newlib provides only the sim spec, intended for running regression tests using a simulator. Specs for real hardware can be obtained by installing the GnuPruMcu package.

-mno-relax

Make GCC pass the --no-relax command-line option to the linker instead of the --relax option.

-mloop

Allow (or do not allow) GCC to use the LOOP instruction.

-mabi=variant

Specify the ABI variant to output code for. -mabi=ti selects the unmodified TI ABI while -mabi=gnu selects a GNU variant that copes more naturally with certain GCC assumptions. These are the differences:

Function Pointer Size

TI ABI specifies that function (code) pointers are 16-bit, whereas GNU supports only 32-bit data and code pointers.

Optional Return Value Pointer

Function return values larger than 64 bits are passed by using a hidden pointer as the first argument of the function. TI ABI, though, mandates that the pointer can be NULL in case the caller is not using the returned value. GNU always passes and expects a valid return value pointer.

The current -mabi=ti implementation simply raises a compile error when any of the above code constructs is detected. As a consequence the standard C library cannot be built and it is omitted when linking with -mabi=ti.

Relaxation is a GNU feature and for safety reasons is disabled when using -mabi=ti. The TI toolchain does not emit relocations for QBBx instructions, so the GNU linker cannot adjust them when shortening adjacent LDI32 pseudo instructions.