Verify right after programming
This commit is contained in:
parent
2982888b66
commit
739941dc5f
@ -433,7 +433,8 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
|
|||||||
goto target_detach;
|
goto target_detach;
|
||||||
int read_file = -1;
|
int read_file = -1;
|
||||||
if ((opt->opt_mode == BMP_MODE_FLASH_WRITE) ||
|
if ((opt->opt_mode == BMP_MODE_FLASH_WRITE) ||
|
||||||
(opt->opt_mode == BMP_MODE_FLASH_VERIFY)) {
|
(opt->opt_mode == BMP_MODE_FLASH_VERIFY) ||
|
||||||
|
(opt->opt_mode == BMP_MODE_FLASH_WRITE_VERIFY)) {
|
||||||
int mmap_res = bmp_mmap(opt->opt_flash_file, &map);
|
int mmap_res = bmp_mmap(opt->opt_flash_file, &map);
|
||||||
if (mmap_res) {
|
if (mmap_res) {
|
||||||
DEBUG_WARN("Can not map file: %s. Aborting!\n", strerror(errno));
|
DEBUG_WARN("Can not map file: %s. Aborting!\n", strerror(errno));
|
||||||
@ -464,7 +465,8 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
|
|||||||
goto free_map;
|
goto free_map;
|
||||||
}
|
}
|
||||||
target_reset(t);
|
target_reset(t);
|
||||||
} else if (opt->opt_mode == BMP_MODE_FLASH_WRITE) {
|
} else if ((opt->opt_mode == BMP_MODE_FLASH_WRITE) ||
|
||||||
|
(opt->opt_mode == BMP_MODE_FLASH_WRITE_VERIFY)) {
|
||||||
DEBUG_INFO("Erase %zu bytes at 0x%08" PRIx32 "\n", map.size,
|
DEBUG_INFO("Erase %zu bytes at 0x%08" PRIx32 "\n", map.size,
|
||||||
opt->opt_flash_start);
|
opt->opt_flash_start);
|
||||||
uint32_t start_time = platform_time_ms();
|
uint32_t start_time = platform_time_ms();
|
||||||
@ -487,11 +489,17 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
|
|||||||
}
|
}
|
||||||
}
|
}
|
||||||
target_flash_done(t);
|
target_flash_done(t);
|
||||||
target_reset(t);
|
|
||||||
uint32_t end_time = platform_time_ms();
|
uint32_t end_time = platform_time_ms();
|
||||||
DEBUG_WARN("Flash Write succeeded for %d bytes, %8.3f kiB/s\n",
|
DEBUG_WARN("Flash Write succeeded for %d bytes, %8.3f kiB/s\n",
|
||||||
(int)map.size, (((map.size * 1.0)/(end_time - start_time))));
|
(int)map.size, (((map.size * 1.0)/(end_time - start_time))));
|
||||||
} else {
|
if (opt->opt_mode != BMP_MODE_FLASH_WRITE_VERIFY) {
|
||||||
|
target_reset(t);
|
||||||
|
goto free_map;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
if ((opt->opt_mode == BMP_MODE_FLASH_READ) ||
|
||||||
|
(opt->opt_mode == BMP_MODE_FLASH_VERIFY) ||
|
||||||
|
(opt->opt_mode == BMP_MODE_FLASH_WRITE_VERIFY)) {
|
||||||
#define WORKSIZE 1024
|
#define WORKSIZE 1024
|
||||||
uint8_t *data = alloca(WORKSIZE);
|
uint8_t *data = alloca(WORKSIZE);
|
||||||
if (!data) {
|
if (!data) {
|
||||||
@ -525,7 +533,8 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
|
|||||||
} else {
|
} else {
|
||||||
bytes_read += worksize;
|
bytes_read += worksize;
|
||||||
}
|
}
|
||||||
if (opt->opt_mode == BMP_MODE_FLASH_VERIFY) {
|
if ((opt->opt_mode == BMP_MODE_FLASH_VERIFY) ||
|
||||||
|
(opt->opt_mode == BMP_MODE_FLASH_WRITE_VERIFY)) {
|
||||||
int difference = memcmp(data, flash, worksize);
|
int difference = memcmp(data, flash, worksize);
|
||||||
if (difference){
|
if (difference){
|
||||||
DEBUG_WARN("Verify failed at flash region 0x%08"
|
DEBUG_WARN("Verify failed at flash region 0x%08"
|
||||||
@ -549,11 +558,11 @@ int cl_execute(BMP_CL_OPTIONS_t *opt)
|
|||||||
uint32_t end_time = platform_time_ms();
|
uint32_t end_time = platform_time_ms();
|
||||||
if (read_file != -1)
|
if (read_file != -1)
|
||||||
close(read_file);
|
close(read_file);
|
||||||
if ((opt->opt_mode == BMP_MODE_FLASH_VERIFY) ||
|
DEBUG_WARN("Read/Verify succeeded for %d bytes, %8.3f kiB/s\n",
|
||||||
(opt->opt_mode == BMP_MODE_FLASH_READ))
|
bytes_read,
|
||||||
DEBUG_WARN("Read/Verify succeeded for %d bytes, %8.3f kiB/s\n",
|
(((bytes_read * 1.0)/(end_time - start_time))));
|
||||||
bytes_read,
|
if (opt->opt_mode == BMP_MODE_FLASH_WRITE_VERIFY)
|
||||||
(((bytes_read * 1.0)/(end_time - start_time))));
|
target_reset(t);
|
||||||
}
|
}
|
||||||
free_map:
|
free_map:
|
||||||
if (map.size)
|
if (map.size)
|
||||||
|
Loading…
x
Reference in New Issue
Block a user