Git Product home page Git Product logo

embecosm / avr-gcc Goto Github PK

View Code? Open in Web Editor NEW
16.0 16.0 3.0 612.54 MB

A fork of the GCC mainline for work on the AVR tool chain

License: GNU General Public License v2.0

Emacs Lisp 0.01% C 50.48% C++ 19.97% Assembly 1.23% Shell 0.76% Objective-C 0.44% Awk 0.05% Perl 0.09% Python 0.09% Ada 18.02% OCaml 0.05% TeX 0.28% Scilab 0.12% PHP 0.01% Haskell 0.01% Fortran 2.35% Go 5.85% Objective-C++ 0.20% MATLAB 0.01% CSS 0.01%

avr-gcc's People

Contributors

amylaar avatar iains avatar jeremybennett avatar pitchumani avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

avr-gcc's Issues

Edge case optimization produces incorrect machine code

volatile register gbf asm("18");
enum gbf_Flags {
	MONITOR,
	NEST,
	MINE,
	EOM,
	CMD,
	WHO
};

#define set_flag(flag) asm volatile("sbr %0, %1" :"+r"(gbf):"I"(flag))
#define clear_flag(flag) asm volatile("cbr %0, %1" :"+r"(gbf):"I"(flag))

void main() {
	set_flag(NEST);
	clear_flag(NEST);
}

Compiles to:

main:
	ori 18, 0x01 ; Incorrect behavior!!
	andi 18, 0xFE

Should be:

main:
	sbr 18, 1
	cbr 18, 1

Or:

main:
	ori 18, 0x02
	andi 18, 0xFD

avr-gcc --version: avr-gcc (GCC) 5.4.0
avr-objdump --version: GNU objdump (GNU Binutils) 2.26.20160125
uname -a: Linux Darkmatter 4.15.0-88-generic #88-Ubuntu SMP Tue Feb 11 20:11:34 UTC 2020 x86_64 x86_64 x86_64 GNU/Linux
Architecture: ATtiny10 (avr1)
Compiled with: avr-gcc -ffreestanding -mmcu attiny10 main.c -o main.o
Read with: avr-objdump -m avr1 -D main.o

This workaround can be used instead with no change in code size:

#define set_flag(flag) asm volatile("ori %0, 1<<%1" :"+r"(gbf):"I"(flag))
#define clear_flag(flag) asm volatile("andi %0, ~(1<<%1)" :"+r"(gbf):"I"(flag))

Not sure why, but I can't seem to get the compiler to use the "M" constraint for _BV(flag) without it warning that it doesn't match the constraints, so bit shifting is done in the assembly.

undefined reference to `__gcov_exit'

Hello. Thanks a lot for porting GCC over to AVR 8-bit! Mostly everything's been fine for me, with the exception of avr-gcov/libgcov.a. When linking compiled object files into a final AVR 8-bit binary with sources using gcov flags, I get errors about undefined reference to '__gcov_exit'.

What's the exact state on gcov in this fork? I'd like to instrument coverage collection over gdb/serial. I haven't had much luck finding documentation about it with the recent version. After searching the repositoriy, I can find no reference of a defined __gcov_exit symbol, though it seems to have existed in the past.

Any help would be greatly appreciated, and I thank you very much for your time regardless!

Below are details about my environment.

operating system: Arch Linux, 64-bit
kernel version: 5.9.9
avr-gcc version: 10.2.0 (comes with avr-gcov).

Following is a log of my build process, which ends up with a failed link step due to a missing __gcov_exit.

mkdir -p bin
mkdir -p lib
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/hooks.c -o arduino-avr-core/cores/arduino/hooks.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/WInterrupts.c -o arduino-avr-core/cores/arduino/WInterrupts.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/wiring_analog.c -o arduino-avr-core/cores/arduino/wiring_analog.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/wiring.c -o arduino-avr-core/cores/arduino/wiring.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/wiring_digital.c -o arduino-avr-core/cores/arduino/wiring_digital.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/wiring_pulse.c -o arduino-avr-core/cores/arduino/wiring_pulse.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/wiring_shift.c -o arduino-avr-core/cores/arduino/wiring_shift.c.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/abi.cpp -o arduino-avr-core/cores/arduino/abi.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/CDC.cpp -o arduino-avr-core/cores/arduino/CDC.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/HardwareSerial0.cpp -o arduino-avr-core/cores/arduino/HardwareSerial0.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/HardwareSerial1.cpp -o arduino-avr-core/cores/arduino/HardwareSerial1.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/HardwareSerial2.cpp -o arduino-avr-core/cores/arduino/HardwareSerial2.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/HardwareSerial3.cpp -o arduino-avr-core/cores/arduino/HardwareSerial3.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/HardwareSerial.cpp -o arduino-avr-core/cores/arduino/HardwareSerial.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/IPAddress.cpp -o arduino-avr-core/cores/arduino/IPAddress.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/main.cpp -o arduino-avr-core/cores/arduino/main.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/new.cpp -o arduino-avr-core/cores/arduino/new.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/PluggableUSB.cpp -o arduino-avr-core/cores/arduino/PluggableUSB.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/Print.cpp -o arduino-avr-core/cores/arduino/Print.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/Stream.cpp -o arduino-avr-core/cores/arduino/Stream.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/Tone.cpp -o arduino-avr-core/cores/arduino/Tone.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/USBCore.cpp -o arduino-avr-core/cores/arduino/USBCore.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/WMath.cpp -o arduino-avr-core/cores/arduino/WMath.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/cores/arduino/WString.cpp -o arduino-avr-core/cores/arduino/WString.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c arduino-avr-core/libraries/SoftwareSerial/src/SoftwareSerial.cpp -o arduino-avr-core/libraries/SoftwareSerial/src/SoftwareSerial.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/stubs/CoverageStubs.cpp -o src/stubs/CoverageStubs.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/tests/Main.test.cpp -o src/tests/Main.test.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/GPIO.cpp -o src/GPIO.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/LDR.cpp -o src/LDR.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/Main.cpp -o src/Main.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/Pin.cpp -o src/Pin.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/Stopwatch.cpp -o src/Stopwatch.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/Time.cpp -o src/Time.cpp.o -lm -fprofile-arcs -ftest-coverage
avr-gcc -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib -c src/Printf.c -o src/Printf.c.o -lm -fprofile-arcs -ftest-coverage
avr-gcc-ar rcs lib/libduino-main.a \
	arduino-avr-core/cores/arduino/main.cpp.o
avr-gcc-ar rcs lib/libduino.a \
	arduino-avr-core/cores/arduino/hooks.c.o arduino-avr-core/cores/arduino/WInterrupts.c.o arduino-avr-core/cores/arduino/wiring_analog.c.o arduino-avr-core/cores/arduino/wiring.c.o arduino-avr-core/cores/arduino/wiring_digital.c.o arduino-avr-core/cores/arduino/wiring_pulse.c.o arduino-avr-core/cores/arduino/wiring_shift.c.o arduino-avr-core/cores/arduino/abi.cpp.o arduino-avr-core/cores/arduino/CDC.cpp.o arduino-avr-core/cores/arduino/HardwareSerial0.cpp.o arduino-avr-core/cores/arduino/HardwareSerial1.cpp.o arduino-avr-core/cores/arduino/HardwareSerial2.cpp.o arduino-avr-core/cores/arduino/HardwareSerial3.cpp.o arduino-avr-core/cores/arduino/HardwareSerial.cpp.o arduino-avr-core/cores/arduino/IPAddress.cpp.o arduino-avr-core/cores/arduino/main.cpp.o arduino-avr-core/cores/arduino/new.cpp.o arduino-avr-core/cores/arduino/PluggableUSB.cpp.o arduino-avr-core/cores/arduino/Print.cpp.o arduino-avr-core/cores/arduino/Stream.cpp.o arduino-avr-core/cores/arduino/Tone.cpp.o arduino-avr-core/cores/arduino/USBCore.cpp.o arduino-avr-core/cores/arduino/WMath.cpp.o arduino-avr-core/cores/arduino/WString.cpp.o arduino-avr-core/libraries/SoftwareSerial/src/SoftwareSerial.cpp.o
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib \
	src/Printf.c.o src/GPIO.cpp.o src/LDR.cpp.o src/Main.cpp.o src/Pin.cpp.o src/Stopwatch.cpp.o src/Time.cpp.o  \
	src/tests/Main.test.cpp.o \
	-o bin/Main.test \
	-fprofile-arcs -ftest-coverage -lduino -lm
avr-g++ -std=gnu++11 -g -ggdb -O0 -w -fpermissive -Wno-error=narrowing  -DARDUINO_AVR_MEGA2560 -DARDUINO_ARCH_AVR -DF_CPU=16000000L -mmcu=atmega2560 -I arduino-avr-core/cores/arduino -I arduino-avr-core/variants/standard -I arduino-avr-core/variants/eightanaloginputs -I arduino-avr-core/libraries/SoftwareSerial/src -L ./lib \
	src/GPIO.cpp.o src/LDR.cpp.o src/Main.cpp.o src/Pin.cpp.o src/Stopwatch.cpp.o src/Time.cpp.o src/Printf.c.o  \
	-o bin/avr-cs-sensor \
	-fprofile-arcs -ftest-coverage -lduino -lduino-main -lm
/usr/bin/avr-ld: src/GPIO.cpp.o: in function `_GLOBAL__sub_D__ZN11GPIOLibrary7pinModeEhh':
/home/kevr/dev/avr/src/GPIO.cpp:17: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/LDR.cpp.o: in function `_GLOBAL__sub_I__ZNK3LDR5resetEm':
/home/kevr/dev/avr/src/LDR.cpp:11: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/Main.cpp.o: in function `_GLOBAL__sub_I_setup':
/home/kevr/dev/avr/src/Main.cpp:82: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/Pin.cpp.o: in function `_GLOBAL__sub_D__ZN3PinC2Eh':
/home/kevr/dev/avr/src/Pin.cpp:58: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/Stopwatch.cpp.o: in function `_GLOBAL__sub_I__ZN9Stopwatch5startEv':
/home/kevr/dev/avr/src/Stopwatch.cpp:19: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/Time.cpp.o:/home/kevr/dev/avr/src/Time.cpp:23: more undefined references to `__gcov_exit' follow
collect2: error: ld returned 1 exit status
/usr/bin/avr-ld: src/Printf.c.o: in function `uartPutchar':
/home/kevr/dev/avr/src/Printf.c:16: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/GPIO.cpp.o: in function `_GLOBAL__sub_D__ZN11GPIOLibrary7pinModeEhh':
/home/kevr/dev/avr/src/GPIO.cpp:17: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/LDR.cpp.o: in function `_GLOBAL__sub_I__ZNK3LDR5resetEm':
/home/kevr/dev/avr/src/LDR.cpp:11: undefined reference to `__gcov_exit'
make: *** [Makefile:78: avr-cs-sensor] Error 1
make: *** Waiting for unfinished jobs....
/usr/bin/avr-ld: src/Main.cpp.o: in function `_GLOBAL__sub_I_setup':
/home/kevr/dev/avr/src/Main.cpp:82: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/Pin.cpp.o: in function `_GLOBAL__sub_D__ZN3PinC2Eh':
/home/kevr/dev/avr/src/Pin.cpp:58: undefined reference to `__gcov_exit'
/usr/bin/avr-ld: src/Stopwatch.cpp.o:/home/kevr/dev/avr/src/Stopwatch.cpp:19: more undefined references to `__gcov_exit' follow
collect2: error: ld returned 1 exit status
make: *** [Makefile:87: Main.test] Error 1

If there are any other details that may be important, please let me know.

Valid register is over written by postreload pass

AVR target built with specs:

Using built-in specs.
COLLECT_GCC=/home/vishnu.k_s/build-linux_x86_64/bldcc/gcc/xgcc
Target: avr
Configured with: ../gcc-trunk/configure --prefix=/home/vishnu.k_s/build-linux_x86_64//install --target=avr --enable-languages=c,c++ --disable-nls --with-gmp=/proj/install/gmp-4.3.2/ --with-mpfr=/proj/install/mpfr-2.4.2/ --with-mpc=/proj/install/mpc-0.8.2/
Thread model: single
gcc version 4.9.0 20130326 (experimental) (GCC)

Above compiler generate wrong code for testcase present in gcc.c-torture/execute/simd-1.c.
gcc options : -O1 -mmcu=atmega1280

(snip of assembly)

ldi r30,lo8(res) ; r30/r31 is loaded with address of res
ldi r31,hi8(res) ;
st Z,r24

ldd r31,Y+1 ; Modifying r31 register

sts res+1,r31
sts res+2,r27
sts res+3,r26
sts res+4,r23
...
lds r22,res+4+2
lds r23,res+4+3

ld r24,Z ; regsiter pair r30/r31 is used to load from res
ldd r25,Z+1
ldd r26,Z+2
ldd r27,Z+3

(snip of assembly)

It looks like r31 is corrupted after reload pass.

gcc bugzilla entry: http://gcc.gnu.org/bugzilla/show_bug.cgi?id=56833

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.