I found this modbus arduino library from:
https://www.cooking-hacks.com/documentation/tutorials/modbus-module-shield-tutorial-for-arduino-raspberry-pi-intel-galileo/

Then, I made a small modification to the library so that it is compatible with my mbed enabled Nucleo F401RE by using MODSERIAL:
https://developer.mbed.org/users/Sissors/code/MODSERIAL/

and Millis library:
https://developer.mbed.org/users/lisper/code/millis/

All of the modification were labeled with "afdhal".

Special thanks to:
jpmzometa
sammarcoarmengol
Andy Kirkham 
Erik Olieman
Lee Yaping
and all others that I missed

Feel free to use it as you like. ;)