diff --git a/src/target/s32k3xx.c b/src/target/s32k3xx.c index f79fac94ee6..395cb87018b 100644 --- a/src/target/s32k3xx.c +++ b/src/target/s32k3xx.c @@ -23,8 +23,6 @@ * the XML memory map and Flash memory programming. */ -#include - #include "command.h" #include "general.h" #include "target.h" @@ -250,7 +248,11 @@ static bool s32k3xx_flash_erase(target_flash_s *const flash, target_addr_t addr, static bool s32k3xx_flash_write(target_flash_s *flash, target_addr_t dest, const void *src, size_t len) { - assert(len == flash->writesize); + if (len != flash->writesize) { + DEBUG_ERROR("%s: len %" PRIu32 " does not match writesize %" PRIu32 "!\n", __func__, (uint32_t)len, + (uint32_t)flash->writesize); + return false; + } const uint32_t *const s_data = src; s32k3xx_flash_prepare(flash);