Modify flash calculation functions to support 2MB devices

This will support devices like the STM32F437VI