Modselect2

Rebased version of #818, with extmod/modselect.c removed (and put in stmhal/modselect.c).