From 7956fbc3612e81b21d330e702a9e86401d1b6099 Mon Sep 17 00:00:00 2001 From: Uwe Bonnes Date: Wed, 29 Apr 2020 15:24:54 +0200 Subject: [PATCH] cl-utils: Print memory map when test is specified. --- src/platforms/pc/cl_utils.c | 40 +++++++++++++++++++++++++++++++++++-- 1 file changed, 38 insertions(+), 2 deletions(-) diff --git a/src/platforms/pc/cl_utils.c b/src/platforms/pc/cl_utils.c index 57af8d30..45f6373d 100644 --- a/src/platforms/pc/cl_utils.c +++ b/src/platforms/pc/cl_utils.c @@ -285,8 +285,6 @@ int cl_execute(BMP_CL_OPTIONS_t *opt) } else { target_foreach(display_target, NULL); } - if (opt->opt_mode == BMP_MODE_TEST) - return 0; if (opt->opt_target_dev > num_targets) { DEBUG("Given target nummer %d not available\n", opt->opt_target_dev); return res; @@ -296,6 +294,44 @@ int cl_execute(BMP_CL_OPTIONS_t *opt) DEBUG("Can not attach to target %d\n", opt->opt_target_dev); goto target_detach; } + if (opt->opt_mode == BMP_MODE_TEST) { + char map [1024], *p = map; + if (target_mem_map(t, map, sizeof(map))) { + while (*p && (*p == '<')) { + unsigned int start, size; + char *res; + int match; + match = strncmp(p, "", strlen("")); + if (!match) { + p += strlen(""); + continue; + } + match = strncmp(p, "" + "%x", + &start, &size, &blocksize)) + printf("Flash Start: 0x%08x, length %#9x, blocksize %#8x\n", + start, size, blocksize); + res = strstr(p, ""); + p = res + strlen(""); + continue; + } + match = strncmp(p, ""); + p = res + strlen("/>"); + continue; + } + break; + } + } + goto target_detach; + } int read_file = -1; if ((opt->opt_mode == BMP_MODE_FLASH_WRITE) || (opt->opt_mode == BMP_MODE_FLASH_VERIFY)) {