0
votes

I am trying to cross compile a program for an AVR using avr-gcc that I installed through macports. In the terminal:

avr-gcc -O1   -DF_CPU=1000000UL -DBAUD=9600 -I.  -I/opt/local/avr/include/ -Wl,-Map,main.map -mmcu=atmega328p main.c -c

which results in the errors:

clang: error: unknown argument: '-mgcc-isr'
clang: error: unknown argument: '-mno-skip-bug'

The above cross compile used to work but after updating to Catalina and reinstalling avr-gcc something has gotten messed up. Searching google I have found that, with newer versions of Clang, if Clang doesn't recognize the command line argument then it raises an error. The suggestions said to use something like -Wno-error=gcc-isr. So my command becomes:

avr-gcc -O1  -Wno-error=gcc-isr -DF_CPU=1000000UL -DBAUD=9600 -I.  -I/opt/local/avr/include/ -Wl,-Map,main.map -mmcu=atmega328p main.c -c

which results in:

cc1: error: ‘-Werror=gcc-isr’: no option -Wgcc-isr

It looks like something is getting messed up between Clang and avr-gcc. Although I'm not sure why Clang gets called when I am using avr-gcc. Does anyone have any idea what's going on here?

1

1 Answers

0
votes

Ok, I'm not sure why clang gets called with avr-gcc but I did manage to get the code to compile by uninstalling: (1) avr-gcc and (2) avr-binutils through macports using:

sudo port uninstall avr-binutils
sudo port uninstall avr-libc (I uninstalled this because it depends on avr-gcc)
sudo port uninstall avr-gcc

then I reinstalled it using

sudo port install avr-gcc

which asked if I wanted install avr-binutils. I then reinstalled avr-libc. These are the direct steps. I made a mistake by hitting 'N' when it asked me if I wanted to install avr-binutils. So I had add:

sudo port clean avr-binutils

to clear that error. Once that was cleared I could follow the above steps. Again, this cleared the error by just reinstalling the cross compiling software but I still think there is some underlying misunderstanding of the original problem.