Use the phase-locked soft PWM from the Arduino core to implement the
same PWM phase management as ESP32s are using. The soft PWM code is
vendored in, as it was previously, to add the NMI workaround from #4035.
Completes #4034
Vendor in the ESP8266 Arduino core PWM library, with a fix for a nasty
NMI crash bug. Sometimes the NMI return instruction seems to fail,
resulting in an infinite loop as the PC gets stuck. Work around this
by backing up and restoring the PC if needed.