Open marklieberman opened 8 years ago
Hi @marklieberman .
After a long fight against this bug, I think that I've finally understood what is happening. The compiler in newest Arduino IDE, is no longer keeping the 'timer0_overflow_count' variable, despite the "extern" statement, because it can't see the symbol inside the following asm code. while this worked fine in previous Arduino IDE versions.
I've made this ugly hack in this commit from my fix_scoop_compil branch in my fork. This fixed the compilation issue on PlatformIO, and should also work in Arduino ide 1.6.10+, but I did not made extensive checks. Would you please, verify if this ALSO works in your Arduino IDE, and if yes, I will send a PR for this fix.
thank you
Hi @marklieberman .
After a long fight against this bug, I think that I've finally understood what is happening. The compiler in newest Arduino IDE, is no longer keeping the 'timer0_overflow_count' variable, despite the "extern" statement, because it can't see the symbol inside the following asm code. while this worked fine in previous Arduino IDE versions.
I've made this ugly hack in this commit from my fix_scoop_compil branch in my fork. This fixed the compilation issue on PlatformIO, and should also work in Arduino ide 1.6.10+, but I did not made extensive checks. Would you please, verify if this ALSO works in your Arduino IDE, and if yes, I will send a PR for this fix.
thank you
Hi soif,
I used your library instead, but it still not work
D:\mixly\Mixly0.999Beta_WIN(1.25)\arduino-1.8.8\portable\sketchbook\libraries\SCoop/SCoop.cpp:225: undefined reference to
timer0_overflow_count'
collect2.exe: error: ld returned 1 exit status
`
My Arduino core version is 1.8.8. So how did you fix this problem? Can you give me some advice?
Hi! Not sure. i undestood from other users that since rev 1.8 or so, the timer0 overflow variable is not any more exposed as a public variable... seems you need to go in the arduino core library and make it public... Sory I left this code some years ago and I m not able to help more. Hope you can fix it and continue enjoy this lib!
Fabrice Envoyé de mon iPhone 6!
Le 21 avr. 2019 à 11:40, zyctinker notifications@github.com a écrit :
Hi @marklieberman .
After a long fight against this bug, I think that I've finally understood what is happening. The compiler in newest Arduino IDE, is no longer keeping the 'timer0_overflow_count' variable, despite the "extern" statement, because it can't see the symbol inside the following asm code. while this worked fine in previous Arduino IDE versions.
I've made this ugly hack in this commit from my fix_scoop_compil branch in my fork. This fixed the compilation issue on PlatformIO, and should also work in Arduino ide 1.6.10+, but I did not made extensive checks. Would you please, verify if this ALSO works in your Arduino IDE, and if yes, I will send a PR for this fix.
thank you
Hi soif, I used your library instead, but it still not work D:\mixly\Mixly0.999Beta_WIN(1.25)\arduino-1.8.8\portable\sketchbook\libraries\SCoop/SCoop.cpp:225: undefined reference to timer0_overflow_count' collect2.exe: error: ld returned 1 exit status ` My Arduino core version is 1.8.8. So how did you fix this problem? Can you give me some advice?
— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub, or mute the thread.
Hi,
edit SCoop.cpp, under line 184:
extern volatile unsigned long timer0_overflow_count; // use this variable which is incremented at each overflow
static unsigned long tell_compiler_that_i_really_need_this = timer0_overflow_count; // ADD THIS LINE - ugly hack to force the compiler to REALLY keep timer0_overflow_count
static inline micros_t SCoopMicros16(void) __attribute__((always_inline));
ENJOY.
Hi,
I have editted SCoop.cpp, under line 184 as you said,but this problem is still here.
extern volatile unsigned long timer0_overflow_count; // use this variable which is incremented at each overflow static unsigned long tell_compiler_that_i_really_need_this = timer0_overflow_count; // ADD THIS LINE - ugly hack to force the compiler to REALLY keep timer0_overflow_count static inline micros_t SCoopMicros16(void) attribute((always_inline));
problem: Archiving built core (caching) in: C:\Users\ARNOLD~1\AppData\Local\Temp\arduino_cache_580023\core\core_arduino_avr_uno_f2151d765ac6d8806a73f952b8f45225.a C:\Users\ARNOLD~1\AppData\Local\Temp\ccGjuNgC.ltrans0.ltrans.o: In function `SCoopMicros16':
C:\Users\Arnold Jiang\Documents\Arduino\libraries\SCoop/SCoop.cpp:226: undefined reference to `timer0_overflow_count'
C:\Users\Arnold Jiang\Documents\Arduino\libraries\SCoop/SCoop.cpp:226: undefined reference to `timer0_overflow_count'
C:\Users\Arnold Jiang\Documents\Arduino\libraries\SCoop/SCoop.cpp:226: undefined reference to `timer0_overflow_count'
collect2.exe: error: ld returned 1 exit status
My Arduino core version is 1.8.5. So how did you fix this problem? Can you give me some advice?
My Arduino core version is 1.8.5. So how did you fix this problem? Can you give me some advice?
Can you clarify what version of the Arduino AVR board you have installed in Boards Manager? The latest seems to be 1.8.3 and I can compile my application using the hack from flymorn.
Can you clarify what version of the Arduino AVR board you have installed in Boards Manager? The latest seems to be 1.8.3 and I can compile my application using the hack from flymorn.
Hi, the Arduino AVR board I have installed in Boards Manager is "Arduino/Genuino Uno". The problem is still here.
problem: Archiving built core (caching) in: C:\Users\ARNOLD1\AppData\Local\Temp\arduino_cache_580023\core\core_arduino_avr_uno_f2151d765ac6d8806a73f952b8f45225.a C:\Users\ARNOLD1\AppData\Local\Temp\ccGjuNgC.ltrans0.ltrans.o: In function `SCoopMicros16':
C:\Users\Arnold Jiang\Documents\Arduino\libraries\SCoop/SCoop.cpp:226: undefined reference to `timer0_overflow_count'
C:\Users\Arnold Jiang\Documents\Arduino\libraries\SCoop/SCoop.cpp:226: undefined reference to `timer0_overflow_count'
C:\Users\Arnold Jiang\Documents\Arduino\libraries\SCoop/SCoop.cpp:226: undefined reference to `timer0_overflow_count'
collect2.exe: error: ld returned 1 exit status
The fix is already in the v1.21 branch, and IMHO should be merged in the Master branch. see:
https://github.com/fabriceo/SCoop/issues/6#issuecomment-695929493
I'm getting this error on Arduino IDE 1.6.12 with version 1.2 of SCoop. It compiles fine on Arduino IDE 1.6.3.
I've tried adding
__attribute__((used))
to timer0_overflow_count in SCoop.cpp, but it didn't help. Google suggests that this issue is caused by Link-Time Optimization (LTO) which was enabled in recent versions of Arduino IDE.