stm32_i2c: fixed timeout handling

thanks to hxxnrx@gmail.com for noticing this
stm32_i2c: ensure we don't change priv-> after semaphore is released

this prevents a race condition where a subsequent I2C transfer could
be lost

Many thanks to hxxnrx@gmail.com for reporting this bug
mtd driver: add missing SPI header
Fix for sed "permission denied" error in Windows build

Cygwin sed in-place edit (option -i) broken, will mess up permissions.
Changed to work without in-place edit.
Fixed FS command IO buffer
Corrected pinmaps for stm32f40xxx processor
Declared log2l() in ARM math.h
Disable -Wshadow warnings for system headers - alternatively we could use #pragma GCC system_header in those
include/cxx: Fix some bad idempotence defintions in header files
Fixed include guard in cstdio. Broken include guard was preventing cstdio to compile if cctype was included first (and vice versa); as a result, the code that needed both cctype and cstdio was failing to compile.
stm32_i2c: check for msgc underflow in I2C ISR

a spurious I2C interrupt could cause priv->msgc to underflow, leading
to memory being overwritten. This seems to have been the cause of at
least some of lockups we have seen
Merge remote-tracking branch 'diydrones/master'