I believe this should be possible although some changes need to be made to the code to make it M5Stack compatible.
Also perhaps not all functions are available yet for the ESP32 chip itself (& thus also the M5Stack).
For example, re. Arduino core for ESP32, analogWrite is not available yet but is being worked on.
However apparently most of that framework is available. See:
Perhaps someone else can add more to this....
Check the link below to visit the EXCELLENT "macsbug" blog for an example of changes made to esp32 code to make it run on M5Stack...... ( esp32-spaceshooter ) . Most changes are minor.
Use Chrome if you need it translated from Japanese, otherwise it may be hard to read. : >