COMMAND_HANDLER(handle_dump_image_command)
{
struct fileio fileio;
- uint8_t buffer[560];
+ uint8_t *buffer;
int retval, retvaltemp;
uint32_t address, size;
struct duration bench;
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[1], address);
COMMAND_PARSE_NUMBER(u32, CMD_ARGV[2], size);
+ uint32_t buf_size = (size > 4096) ? 4096 : size;
+ buffer = malloc(buf_size);
+ if (!buffer)
+ return ERROR_FAIL;
+
retval = fileio_open(&fileio, CMD_ARGV[0], FILEIO_WRITE, FILEIO_BINARY);
- if (retval != ERROR_OK)
+ if (retval != ERROR_OK) {
+ free(buffer);
return retval;
+ }
duration_start(&bench);
- retval = ERROR_OK;
while (size > 0)
{
size_t size_written;
- uint32_t this_run_size = (size > 560) ? 560 : size;
+ uint32_t this_run_size = (size > buf_size) ? buf_size : size;
retval = target_read_buffer(target, address, this_run_size, buffer);
if (retval != ERROR_OK)
{
address += this_run_size;
}
+ free(buffer);
+
if ((ERROR_OK == retval) && (duration_measure(&bench) == ERROR_OK))
{
int filesize;
"performance");
}
+COMMAND_HANDLER(handle_ps_command)
+{
+ struct target *target = get_current_target(CMD_CTX);
+ char *display;
+ if (target->state != TARGET_HALTED) {
+ LOG_INFO("target not halted !!");
+ return ERROR_OK;
+ }
+
+ if ((target->rtos) && (target->rtos->type)
+ && (target->rtos->type->ps_command)) {
+ display = target->rtos->type->ps_command(target);
+ command_print(CMD_CTX, "%s", display);
+ free(display);
+ return ERROR_OK;
+ } else {
+ LOG_INFO("failed");
+ return ERROR_TARGET_FAILURE;
+ }
+}
+
static const struct command_registration target_exec_command_handlers[] = {
{
.name = "fast_load_image",
"enabled to improve performance. ",
.usage = "['enable'|'disable']",
},
+ {
+ .name = "ps",
+ .handler = handle_ps_command,
+ .mode = COMMAND_EXEC,
+ .help = "list all tasks ",
+ .usage = " ",
+ },
+
COMMAND_REGISTRATION_DONE
};
static int target_register_user_commands(struct command_context *cmd_ctx)