Kinetis: give a reasonable default for max_flash_prog_size 58/2958/4
authorTomas Vanek <vanekt@fbl.cz>
Thu, 24 Sep 2015 08:29:12 +0000 (10:29 +0200)
committerPaul Fertser <fercerpav@gmail.com>
Fri, 9 Oct 2015 12:44:05 +0000 (13:44 +0100)
commit087ce864f4543459053148a1b080ee04fe154665
treee88b9edb6e68013b53bc30356ae79364cd5c7180
parent37e2fdcc95d136c5e6e0dfcd18ac9f450d0c17f2
Kinetis: give a reasonable default for max_flash_prog_size

max_flash_prog_size euals to pflash_sector_size_bytes for most of devices.
There is no point setting max_flash_prog_size for devices without
FS_PROGRAM_SECTOR capability.
Check for zero sector_size to avoid div by zero exception in case of
device has FlexNVM but the driver does not define nvm_sector_size_bytes

Change-Id: Iaf4e007fb1ec3d24c373350410e4bebe504a4c3e
Signed-off-by: Tomas Vanek <vanekt@fbl.cz>
Reviewed-on: http://openocd.zylin.com/2958
Tested-by: jenkins
Reviewed-by: Thomas Schmid <thomas@rfranging.com>
Reviewed-by: Paul Fertser <fercerpav@gmail.com>
Reviewed-by: Patrick Stewart <patstew@gmail.com>
src/flash/nor/kinetis.c