While writing code for an ATTINY806 chip, I ran across this error:
(base) epoulsen@strawberry:~/workspaces/dragonfly-can-expander/firmware$ PLATFORMIO_BUILD_FLAGS="-DMCP2515_NO_CONTEXT -DMCP2515_CLOCK_XTAL_FREQ_MHZ=16 -DMCP2515_CLOCK_BAUDRATE_KBPS=1000" pio run
Processing attinyx06 (platform: atmelmegaavr; board: ATtiny806)
-----------------------------------------------------------------------------------------------------------------------------------------
Verbose mode can be enabled via `-v, --verbose` option
CONFIGURATION: https://docs.platformio.org/page/boards/atmelmegaavr/ATtiny806.html
PLATFORM: Atmel megaAVR (1.7.0) > ATtiny806
HARDWARE: ATTINY806 16MHz, 512B RAM, 8KB Flash
PACKAGES:
- tool-avrdude @ 1.70100.0 (7.1.0)
- toolchain-atmelavr @ 1.70300.191015 (7.3.0)
LDF: Library Dependency Finder -> https://bit.ly/configure-pio-ldf
LDF Modes: Finder ~ chain, Compatibility ~ soft
Found 0 compatible libraries
Scanning dependencies...
No dependencies
Building in release mode
Compiling .pio/build/attinyx06/src/can_config.o
Compiling .pio/build/attinyx06/src/command_process.o
Compiling .pio/build/attinyx06/src/common.o
Compiling .pio/build/attinyx06/src/hal_attinyx06.o
Compiling .pio/build/attinyx06/src/main.o
Compiling .pio/build/attinyx06/src/mcp2515.o
Compiling .pio/build/attinyx06/src/mcp2515_hal.o
Linking .pio/build/attinyx06/firmware.elf
/tmp/ccJnIG2N.ltrans0.ltrans.o: In function `main':
<artificial>:(.text.startup+0x698): relocation truncated to fit: R_AVR_13_PCREL against `no symbol'
collect2: error: ld returned 1 exit status
*** [.pio/build/attinyx06/firmware.elf] Error 1
====================================================== [FAILED] Took 0.41 seconds ======================================================
This happened after deleting a single like from a function; putting that line back makes it go away; It's clear there doing this simply moves code around in a way that causes the linking to fail.
Doing -O3 instead of -Os "fixes" the issue, but the cost of 50% larger code.
There's a long answer here that has a lot of information that unfortunately is not working
for me. I tried removing -mshort-calls (looks like it was never there in the first place), and adding -mrelax to no avail. Note that that answer states it could happen on devices with >8K of flash; my device has 8K.
I googled it a bit, and I tried all the usual stuff of wrt -mrelax, removing `-m
While writing code for an ATTINY806 chip, I ran across this error:
This happened after deleting a single like from a function; putting that line back makes it go away; It's clear there doing this simply moves code around in a way that causes the linking to fail.
Doing
-O3
instead of-Os
"fixes" the issue, but the cost of 50% larger code.There's a long answer here that has a lot of information that unfortunately is not working for me. I tried removing
-mshort-calls
(looks like it was never there in the first place), and adding-mrelax
to no avail. Note that that answer states it could happen on devices with >8K of flash; my device has 8K.I googled it a bit, and I tried all the usual stuff of wrt
-mrelax
, removing `-m