You would needs to program C code in the tool board firmware. You can find the code in the Duet3D github in project Duet3Expansion. The dev version uses project CoreN2G for most of the hardware interface, and that project provides a UART class.