dinuxbg / pru-gcc-examples

Simple example projects for PRU-GCC
49 stars 12 forks source link

Use of __R30 and __R31 gives syntax error #9

Closed VedantParanjape closed 4 years ago

VedantParanjape commented 4 years ago

code

#include "resource_table_0.h"
#include <pru/io.h>
volatile register uint32_t __R30;

int main(void)
{
    write_r30(0xffff);
    __R30 = 0x0000;
    int test = 4;
    int add = test + 5;

   return 0;
}

This code fails on compilation with pru-gcc command: pru-gcc test.c -o test.pru0 -mmcu=am335x.pru0

output

test.c:3:28: error: register name not specified for '__R30'
    3 | volatile register uint32_t __R30;
      |                            ^~~~~

GCC version

debian@beaglebone:~/test-pru$ pru-gcc -v
Using built-in specs.
COLLECT_GCC=pru-gcc
COLLECT_LTO_WRAPPER=/home/debian/pru-gcc-arm32/bin/../libexec/gcc/pru/10.1.0/lto-wrapper
Target: pru
Configured with: /home/gnupru/src/gcc/configure --target=pru --prefix=/home/arm-gcc-pru-toolchain --disable-nls --with-newlib --with-bugurl=https://github.com/dinuxbg/gnupru/issues --without-headers --enable-languages=c : (reconfigured) /home/gnupru/src/gcc/configure --target=pru --prefix=/home/arm-gcc-pru-toolchain --disable-nls --with-newlib --with-bugurl=https://github.com/dinuxbg/gnupru/issues --enable-languages=c,c++
Thread model: single
Supported LTO compression algorithms: zlib
gcc version 10.1.0 (GCC) 
dinuxbg commented 4 years ago

Sorry, this is not supported in GCC C.

There are predefined R30 and R31 if you use C++, though: https://github.com/dinuxbg/pru-gcc-examples/blob/master/blinking-led%2B%2B/main.cpp

VedantParanjape commented 4 years ago

Thanks for the help :)