Cannot build firmware for Arduino Uno

Hey, I’ve been trying to compile Klipper for my Arduino Uno and for some reason Klipper (installed with KIAUH on my Raspberry pi 4 running 64bit Raspbian Buster) doesn’t build the firmware. I get this error

Version: v0.11.0-122-ge6ef48cd
  Linking out/klipper.elf
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: out/klipper.elf section `.text' will not fit in region `text'
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x800b6e of out/klipper.elf section `.data' is not within region `data'
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x800cda of out/klipper.elf section `.bss' is not within region `data'
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x800b6e of out/klipper.elf section `.data' is not within region `data'
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: address 0x800cda of out/klipper.elf section `.bss' is not within region `data'
/usr/lib/gcc/avr/5.4.0/../../../avr/bin/ld: region `text' overflowed by 4358 bytes
collect2: error: ld returned 1 exit status
make: *** [Makefile:72: out/klipper.elf] Error 1

Anyone know how to fix this?

I looked there but none of the solutions worked for me since I’m running Buster (which is the version that doesn’t have the problematic version of gcc)

Could be an issue of the 64bit OS. Sorry, I do not know any other solution

Same problem here. I was able to flash an Arduino uno on the last February 22th. So it is definitely related with the latest commit. I’m trying to flash from a Raspberry pi zero 2 and from a Lubuntu virtual machine on my PC. Same problem on both.

Using a docker with Debian: buster worked (docker run -it --rm debian:buster) , so this workaround should work also: Firmware no longer builds for Atmega 328p · Issue #4938 · Klipper3d/klipper · GitHub

1 Like

None of the other solutions worked for me to configure my Uno for the adxl345. I’m using Ubuntu, and klich3’s Buster fix just kept giving me errors when trying to sudo apt-get update. These steps are what I found worked for me, which I could not find anywhere else, so I will post them here in hopes that it helps someone save hours trying to get theirs to work. This is all done from a terminal window on the computer (or pi) with klipper:

cd ~/klipper
make menuconfig

-configure for the uno (atmega328p in my case), no changes to defaults for this chip. Exit and save

nano .config

-change anything you don’t need from y to n. For me this was:

CONFIG_WANT_GPIO_BITBANGING=n
CONFIG_WANT_DISPLAYS=n
CONFIG_WANT_SOFTWARE_I2C=n
CONFIG_HAVE_GPIO_ADC=n
CONFIG_HAVE_GPIO_I2C=n
CONFIG_HAVE_GPIO_HARD_PWM=n
CONFIG_INLINE_STEPPER_HACK=n

ctrl+s and ctrl+x to save and close

Some people have said that this is enough to get it to work for them, so try to compile again here:

make clean
make

This still gave me errors when trying to compile, so I had to do the next steps:

nano src/Makefile

Find the line that says:

sensors-src-$(CONFIG_HAVE_GPIO_SPI) := thermocouple.c sensor_adxl345.c \
    sensor_angle.c

and change it so that it only has sensor_adxl345.c, with the rest commented out.
You will want to change this back after, or other compilations will not have the other sensors (this may not be a problem depending on your printer)

sensors-src-$(CONFIG_HAVE_GPIO_SPI) := sensor_adxl345.c #thermocouple.c sensor_adxl345.c \
    #sensor_angle.c

after this, ctrl+s ctrl+x, and run

make clean
make

and it should compile with no memory/flash size related errors

edit for formatting

3 Likes

Thanks a lot for this, I don’t even know what I disabled but most importantly my Nano + MPU-6050 works like a charm again. Flash file is now around 2800 from previous 3210 bytes