stmhal: Improve flash storage cache management.

Internal flash used for the filesystem is now written (from the cache)
only after a 5s delay, or when a file is closed, or when the drive is
unmounted from the host.  This delay means that multiple writes can
accumulate in the cache, and leads to less writes to the flash, making
it last longer.

It's implemented by a high-priority interrupt that takes care of flash
erase and write, and flushing the cache.

This is still only an interim solution for the flash filesystem.  It
eventually needs to be replaced with something that uses less RAM for
the cache, something that can use more of the flash, and something that
does proper wear levelling.
Merge branch 'master' of github.com:micropython/micropython
stmhal: Replace magic number 3 with CDC_IN_EP define.
stmhal: Fix 64-byte USB packet bug properly.

A 64-byte packet is now followed by a 0-byte packet if there is nothing
more to send.  This flushes the USB endpoint.
stmhal: Add more math functions.

Taken straight from musl and newlib.  License seems compatible with MIT.
tests: Remove print('flush') from 2 tests, since stmhal now works.

Fixing the USB problem on stmhal now gets these 2 tests working.