Skip to content

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

Open

Description

@engeen-nl

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 terjeio/grblHAL#224

Activity

  1. transferred this issue fromgrblHAL/coreon Oct 2, 2024
  2. terjeio commented on Oct 3, 2024

    @terjeio
    Contributor

    See the readme IMPORTANT notice.

  3. engeen-nl commented on Oct 3, 2024

    @engeen-nl
    Author

    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.

  4. Santi24Yt commented on Nov 4, 2025

    @Santi24Yt

    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.

    What dependencies could you be referring to?

    I've changed the property name and it works for me but I have a very basic usage so it might not work for everyone else, I'm willing to make a pull request of what you suggest and other fixes if they are needed, it would be of great help if you could explain what do you mean by dependencies, you mean the git submodules?

  5. Santi24Yt commented on Nov 4, 2025

    @Santi24Yt

    I've changed the property name and it works for me

    I forgot to mention, I did change it but also in all the submodules, hence my question if there might be other dependencies I might not be aware of

  6. leouzz commented on Mar 29, 2026

    @leouzz

    Confirmed resolved without changing either grblHAL or the SAMD core source.

    The issue was a naming conflict on synchronized with Arduino SAMD 1.8.14 (macro defined in the core).
    I fixed it by using Arduino SAMD 1.8.9; with that version, compile/upload works correctly.

  7. Santi24Yt commented on Mar 31, 2026

    @Santi24Yt

    Confirmed resolved without changing either grblHAL or the SAMD core source.

    The issue was a naming conflict on synchronized with Arduino SAMD 1.8.14 (macro defined in the core). I fixed it by using Arduino SAMD 1.8.9; with that version, compile/upload works correctly.

    Yes, it can be solved reverting to an old version, but it would be better to fix the core, supposedly it is a really simple fix

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions