Servo library compiling error with Adafruit Metro M4 Grand Central

I am getting following error while compiling servo library on Adafruit Metro M4 Grand Central

/home/Downloads/arduino-1.8.9/libraries/Servo/src/samd/Servo.cpp: In function 'void Servo_Handler(timer16_Sequence_t, Tc*, uint8_t, uint8_t)':
/home/Downloads/arduino-1.8.9/libraries/Servo/src/samd/Servo.cpp:44:60: error: 'volatile struct TC_STATUS_Type::<anonymous>' has no member named 'SYNCBUSY'
 #define WAIT_TC16_REGS_SYNC(x) while(x->COUNT16.STATUS.bit.SYNCBUSY);
                                                            ^
/home/Downloads/arduino-1.8.9/libraries/Servo/src/samd/Servo.cpp:64:9: note: in expansion of macro 'WAIT_TC16_REGS_SYNC'
         WAIT_TC16_REGS_SYNC(tc)
         ^
/home/Downloads/arduino-1.8.9/libraries/Servo/src/samd/Servo.cpp: In function 'void _initISR(Tc*, uint8_t, uint32_t, IRQn_Type, uint8_t, uint8_t)':
/home/Downloads/arduino-1.8.9/libraries/Servo/src/samd/Servo.cpp:123:11: error: 'struct Gclk' has no member named 'CLKCTRL'
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));
           ^
/home/Downloads/arduino-1.8.9/libraries/Servo/src/samd/Servo.cpp:123:37: error: 'GCLK_CLKCTRL_CLKEN' was not declared in this scope
     GCLK->CLKCTRL.reg = (uint16_t) (GCLK_CLKCTRL_CLKEN | GCLK_CLKCTRL_GEN_GCLK0 | GCLK_CLKCTRL_ID(gcmForTimer));

I think that board suggests a different servo control method.

Edit: @pert points out that this is not accurate. See his comments on reply #4

This is a known bug:

Adafruit submitted a pull request a few days ago to add support for the Grand Central to the library, but it hasn't been merged yet:

You can give it a try by following the following instructions:

  • Download the Adafruit version of the library: https://github.com/adafruit/Servo/archive/adafruit_samd51.zip
  • Unzip the downloaded file.
  • Rename the unzipped folder from Servo-adafruit_samd51 to Servo.
  • (In the Arduino IDE) Sketch > Include Library > Add .ZIP Library
  • Select the Servo folder you just renamed. Note: don't select the Servo-adafruit_samd51.zip file. Despite the name, "Add .ZIP Library" also works to install from folders and the folder must have the right name for this to work.
  • Click the "Open" button.
  • Wait until the status bar on the Arduino IDE shows a message that the library was installed.

After that, you should be able to now use the Servo library with your Grand Central.

vinceherman:
CircuitPython Servo | Introducing the Adafruit Grand Central M4 Express | Adafruit Learning System

I think that board suggests a different servo control method.

That tutorial is for if you're using CircuitPython (Adafruit's porting of the Python programming language for microcontrollers like the SAMD51). mlre is using Arduino, not CircuitPython so that tutorial is not relevant here.