You are not logged in.

#1 2022-06-15 16:15:17

ajgae
Member
Registered: 2022-06-15
Posts: 3

Arduino Uno: archlinux board causes internal compiler error

Hi, I'm using the official Arduino IDE (v 1.8.19-1) installed via Pacman to compile and update code onto my new Arduino Uno. In the IDE > Tools > Boards, there are two submenus: "Arch Linux Arduino AVR Boards" and "Arduino AVR Boards". Both contain a "Arduino Uno" item.

If I select the item in the "Arduino AVR Boards" submenu, everything compiles and updates fine. However, if I select it in "Arch Linux Arduino AVR Boards", I get an internal compiler error from gcc-avr.

Here is the successful compilation log (using the item in the "Arduino AVR Boards" submenu) for reference.

Additionally, the error seems to only appear if I include a Serial.print(variable) with some variable. Serial prints of simple string do not cause the issue. Here is my sketch for reference:

const int PIN_LED_GREEN = 9;
const int PIN_LED_RED = 10;
const int PIN_LED_BLUE = 11;

const int PIN_SENSOR_RED = A0;
const int PIN_SENSOR_GREEN = A1;
const int PIN_SENSOR_BLUE = A2;

int led_red = 0;
int led_green = 0;
int led_blue = 0;

int sensor_red = 0;
int sensor_green = 0;
int sensor_blue = 0;

void setup() {
  // put your setup code here, to run once:
  Serial.begin(9600);

  pinMode(PIN_LED_GREEN, OUTPUT);
  pinMode(PIN_LED_RED, OUTPUT);
  pinMode(PIN_LED_BLUE, OUTPUT);
}

void loop() {
  // put your main code here, to run repeatedly:
  sensor_red = analogRead(PIN_SENSOR_RED);
  delay(5); // delay for the ADC
  sensor_green = analogRead(PIN_SENSOR_GREEN);
  delay(5);
  sensor_blue = analogRead(PIN_SENSOR_BLUE);

  //Serial.print("Raw sensor values\n\tred: ");
  Serial.println(sensor_red);
  //Serial.print("\tgreen: ");
  //Serial.println(sensor_green);
  //Serial.print("\tblue: ");
  //Serial.println(sensor_blue);

  // map sensor values to range 0-255
  led_red = sensor_red / 4;
  led_green = sensor_green / 4;
  led_blue = sensor_blue / 4;

  //Serial.print("Raw LED values\n\tred: ");
  //Serial.println(led_red);
  //Serial.print("\tgreen: ");
  //Serial.println(led_green);
  //Serial.print("\tblue: ");
  //Serial.println(led_blue);

  analogWrite(PIN_LED_RED, led_red);
  analogWrite(PIN_LED_GREEN, led_green);
  analogWrite(PIN_LED_BLUE, led_blue);
}

The one uncommented Serial.print() line causes the issue. If I comment it out, it compiles fine with either board selected.

Has anyone got ideas as to what could be causing this? Is this a bug in avr-gcc or are the Arduino libraries provided by Pacman incorrect, or both?

EDIT: The reason this is an issue is mostly because I'd like to use Emacs as my editor, and Arduino.mk to build and upload sketches to the arduino. The steps provided on the Arch Linux Wiki assume that you want to use the core provided by the Arch Linux package -- which causes the error. If someone can show me how to use the default core with Arduino.mk that'd also help.

Last edited by ajgae (2022-06-15 16:41:11)

Offline

#2 2022-06-15 16:34:36

ajgae
Member
Registered: 2022-06-15
Posts: 3

Re: Arduino Uno: archlinux board causes internal compiler error

Found this post on the Arduino forums that refers to the exact same problem, but the fix is to just not use the Arch Linux board. I figure it may still be worth it to report the issue given that it seems to be with (out of date? or the opposite?) arch linux packages.

Offline

#3 2022-06-15 16:39:04

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: Arduino Uno: archlinux board causes internal compiler error

arch linux has version 1.8.3 of arduino-avr-core (07/2020). Maybe you can try to update the package to 1.8.5 . The package has been flagged out of date already.

The archlinux boards use the avr-gcc package, while the boards without the prefix probably use gcc provided by the arduiono project.
I'd guess there is a regression/bug in avr-gcc but you can try if the newer arduino-avr-core works.

Last edited by progandy (2022-06-15 16:53:20)


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

#4 2022-06-15 16:48:19

ajgae
Member
Registered: 2022-06-15
Posts: 3

Re: Arduino Uno: archlinux board causes internal compiler error

progandy wrote:

arch linux has version 1.8.3 of arduino-avr-core (07/2020). Maybe you can try to update the package to 1.8.5 . The package has been flagged out of date already.

Hi, thanks for your quick answer. What do you mean by updating the package to 1.8.5? Like should I uninstall it and build the newer version for myself, or are you suggesting that I could contribute to the package repository by somehow updating the package that is on it? (Sorry, I'm not the most knowledgeable about how Arch manages packages)

Offline

#5 2022-06-15 16:53:08

progandy
Member
Registered: 2012-05-17
Posts: 5,190

Re: Arduino Uno: archlinux board causes internal compiler error

You could fetch the PKGBUILD, change the version and build the package for yourself. The official package has to be updated by the maintainer, but it looks like he is busy (the flag is from march).

It won't help you though, I found the bugreport for gcc: https://gcc.gnu.org/bugzilla/show_bug.cgi?id=105753


| alias CUTF='LANG=en_XX.UTF-8@POSIX ' |

Offline

Board footer

Powered by FluxBB