grblHAL / SAMD21

grblHAL for Atmel SAMD21 (MKRZERO)
Other
5 stars 0 forks source link

Conflict with the latest arduino toolset for SAMD21 'synchronized' keyword #4

Open engeen-nl opened 1 month ago

engeen-nl commented 1 month ago

Conflict with the latest arduino toolset for SAMD21 'synchronized' keyword:

c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c: In function 'driver_init':
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c:1098:20: warning: assignment from incompatible pointer type [-Wincompatible-pointer-types]
     hal.get_micros = micros;
                    ^
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c:1131:5: warning: implicit declaration of function 'my_plugin_init'; did you mean '__lock_init'? [-Wimplicit-function-declaration]
     my_plugin_init();
     ^~~~~~~~~~~~~~
     __lock_init
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c: In function 'STEPPER_IRQHandler':
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c:1143:5: warning: assignment of read-only location '1107308544->COUNT32.INTFLAG.bit.MC0'
     STEPPER_TIMER->COUNT32.INTFLAG.bit.MC0 = 1;
     ^~~~~~~~~~~~~
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c: In function 'STEPPULSE_IRQHandler':
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c:1150:5: warning: assignment of read-only location '1107307520->COUNT16.INTFLAG.bit.MC0'
     STEP_TIMER->COUNT16.INTFLAG.bit.MC0 = 1;
     ^~~~~~~~~~
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c: In function 'STEPPULSE_Delayed_IRQHandler':
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c:1157:5: warning: assignment of read-only location '1107307520->COUNT16.INTFLAG.bit.MC0'
     STEP_TIMER->COUNT16.INTFLAG.bit.MC0 = 1;
     ^~~~~~~~~~
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c: In function 'DEBOUNCE_IRQHandler':
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\driver.c:1172:5: warning: assignment of read-only location '1107305472->INTFLAG.bit.OVF'
     DEBOUNCE_TIMER->INTFLAG.bit.OVF = 1;
     ^~~~~~~~~~~~~~
In file included from C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\cores\arduino/SafeRingBuffer.h:25:0,
                 from C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\cores\arduino/Uart.h:23,
                 from C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\variants\mkrwan1300/variant.h:158,
                 from C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\cores\arduino/Arduino.h:51,
                 from c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\usb_serial.cpp:26:
C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\cores\arduino/sync.h:28:22: error: expected unqualified-id before 'for'
 #define synchronized for (__Guard __guard; __guard.enter(); )
                      ^
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\grbl/spindle_control.h:70:17: note: in expansion of macro 'synchronized'
                 synchronized     :1;
                 ^~~~~~~~~~~~
C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\cores\arduino/sync.h:28:44: error: '__guard' does not name a type; did you mean '__Guard'?
 #define synchronized for (__Guard __guard; __guard.enter(); )
                                            ^
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\grbl/spindle_control.h:70:17: note: in expansion of macro 'synchronized'
                 synchronized     :1;
                 ^~~~~~~~~~~~
C:\Users\Peter\AppData\Local\Arduino15\packages\arduino\hardware\samd\1.8.13\cores\arduino/sync.h:28:61: error: expected unqualified-id before ')' token
 #define synchronized for (__Guard __guard; __guard.enter(); )
                                                             ^
c:\Users\Peter\Nextcloud\Projects\Arduino\libraries\grblHAL_MKRZERO\src\grbl/spindle_control.h:70:17: note: in expansion of macro 'synchronized'
                 synchronized     :1;
                 ^~~~~~~~~~~~

Could we please rename synchronized to issynchronized?

See also https://github.com/terjeio/grblHAL/issues/224

terjeio commented 1 month ago

See the readme IMPORTANT notice.

engeen-nl commented 1 month ago

Noted before, just wanted to provide a workaround for those who want to use the latest build tools. We want to go forward.

As you wrote, the solution is in the core. Would changing the property name to "isSynchronized" break any dependencies?

Alternatively you can use #ifdef ARDUINO to change the name only for arduino builds. But all dependencies still need the same name change too.