fabriceo / SCoop

Simple Cooperative Scheduler for Arduino and Teensy ARM and AVR
126 stars 82 forks source link

prevents compiler to fail in Arduino 1.6.10+ and platformIO #5

Closed soif closed 7 years ago

soif commented 7 years ago

Hi Fabrice. Thank you for this great Library that I often use to implement pseudo multi tasking in my Arduino projects.

As stated in issue #4 , the latest Arduino IDEs (as well as PlatformIO) are unable to compil the Scoop Library due to the fact that they ignore the timer0_overflow_count declaration, because it is only used in the next asm volatile declaration...

While my c++ skills are really limited, this very simple hack, force the compiler to use the timer0_overflow_count variable, and thus fixes the compilation issue.

I hope you will merge it and/or replace it with a more elegant fix.

Best regards,

fabriceo commented 7 years ago

Hi there :) this is a long time I dint put my hand on git and C++ :) so I m afraid I dont know anymore how to do this ... ! maybe I have a look tomorw morning with fresh head ! happy that some guys enjoy it, honestly I dont know how the other does without it !!!

cheers

2017-04-21 12:49 GMT+02:00 soif notifications@github.com:

Hi Fabrice. Thank you for this great Library that I often use to implement pseudo multi tasking in my Arduino projects.

As stated in issue #4 https://github.com/fabriceo/SCoop/issues/4 , the latest Arduino IDEs (as well as PlatformIO) are unable to compil the Scoop Library due to the fact that they ignore the timer0_overflow_count declaration, because it is only used in the next asm volatile declaration...

While my c++ skills are really limited, this very simple hack, force the compiler to use the timer0_overflow_count variable, and thus fixes the compilation issue.

I hope you will merge it and/or replace it with a more elegant fix.

Best regards,

You can view, comment on, or merge this pull request online at:

https://github.com/fabriceo/SCoop/pull/5 Commit Summary

  • prevents compiler to fail in Arduino 1.6.10+ and platformIO

File Changes

Patch Links:

— You are receiving this because you are subscribed to this thread. Reply to this email directly, view it on GitHub https://github.com/fabriceo/SCoop/pull/5, or mute the thread https://github.com/notifications/unsubscribe-auth/ADF-tpwIRbX7VluGFf3xTrit_N8IuThWks5ryInQgaJpZM4NEJwr .

--

Envoyé depuis mon compte Gmail personnelSent from my Gmail personnal account

soif commented 7 years ago

Hi 🍺

BTW, if you are no longer used with Git, but if you'd review my commit (just one line) and found it to be useful (or not harmful), you can just automatically merge this PR into the master branch, by just clicking in this Github page, on the merge button/link.

HTH

fuwenchao2426 commented 5 years ago

Hi,soif use your method, it has been easy to use before, but on arduino 1.87, this problem has appeared again, can you fix it again?

fuwenchao2426 commented 5 years ago

void loop() { if (Serial.available()) { String XX=Serial.readString(); SCpln(XX); } mySCoop.yield(); } [error]

C:\Users\ADMINI~1\AppData\Local\Temp\ccHTfIzR.ltrans0.ltrans.o: In function `SCoopTask::yieldSwitch()':

:(.text+0x3be): undefined reference to `timer0_overflow_count' C:\Users\ADMINI~1\AppData\Local\Temp\ccHTfIzR.ltrans0.ltrans.o: In function `SCoopTask::launch()': :(.text+0x44e): undefined reference to `timer0_overflow_count' C:\Users\ADMINI~1\AppData\Local\Temp\ccHTfIzR.ltrans0.ltrans.o: In function `SCoopTask::start()': :(.text+0x812): undefined reference to `timer0_overflow_count' :(.text+0x8ac): undefined reference to `timer0_overflow_count' C:\Users\ADMINI~1\AppData\Local\Temp\ccHTfIzR.ltrans0.ltrans.o: In function `main': :(.text.startup+0x282): undefined reference to `timer0_overflow_count' C:\Users\ADMINI~1\AppData\Local\Temp\ccHTfIzR.ltrans0.ltrans.o::(.text.startup+0x318): more undefined references to `timer0_overflow_count' follow collect2.exe: error: ld returned 1 exit status void loop() { if (Serial.available()) { String XX=Serial.readString(); SCpln(XX); } mySCoop.yield(); } [ok ]
fabriceo commented 5 years ago

Hi! Someone found the reason, this is because the variable "timer0_overflow_count" is no more defined as extern in the standard Arduino library... you could solve this by editing the Arduino standard library, I m not sure which file. Someone posted a comment on GitHub about that. Hope this helps you. Cheers

Le jeu. 3 janv. 2019 à 13:46, fuwenchao2426 notifications@github.com a écrit :

你好

顺便说一句,如果你不再使用Git,但如果你查看我的提交(只有一行)并发现它有用(或无害),你可以自动将这个PR合并到主分支中,只需单击此Github页面,在合并按钮/链接上。

HTH

Hey, use your method, it has been easy to use before, but on arduino 1.87, this problem has appeared again, can you fix it again?

— You are receiving this because you modified the open/close state. Reply to this email directly, view it on GitHub https://github.com/fabriceo/SCoop/pull/5#issuecomment-451133524, or mute the thread https://github.com/notifications/unsubscribe-auth/ADF-ti-xUE8rngnGRls_YCiNfHbz1EjZks5u_fu8gaJpZM4NEJwr .

--

Envoyé depuis mon compte Gmail personnelSent from my Gmail personnal account