tools, gendoc: Allow constants at module level; gen module index.

Addresses some issues from #585.
stmhal: Start of documentation for modos and modtime.