X-Git-Url: http://cloudbase.mooo.com/gitweb/z180-stamp.git/blobdiff_plain/13e88ed59974b6940815b6a392266ad34a9ee410..122660398b4c99ebad726a80a76e281cb55fe5dc:/avr/debug.c?ds=sidebyside diff --git a/avr/debug.c b/avr/debug.c index e38ccb2..1b4ecc2 100644 --- a/avr/debug.c +++ b/avr/debug.c @@ -1,18 +1,19 @@ /* - * (C) Copyright 2014 Leo C. + * (C) Copyright 2014,2016 Leo C. * * SPDX-License-Identifier: GPL-2.0 */ #include "debug.h" #include "common.h" -#include +#include /* __malloc_margin */ #include #include #include #include "command.h" #include "cli_readline.h" +#include "eval_arg.h" #include "print-utils.h" /* @@ -65,11 +66,11 @@ command_ret_t do_dump_mem(cmd_tbl_t *cmdtp, int flag, int argc, char * const arg } /* Address is specified since argc > 1 */ - addr = strtoul(argv[1], NULL, 16); + addr = eval_arg(argv[1], NULL); /* If another parameter, it is the length to display. */ if (argc > 2) - length = (uint16_t) strtoul(argv[2], NULL, 16); + length = (uint16_t) eval_arg(argv[2], NULL); /* Print the lines. */ dump_mem(addr, addr, length, readwhat, NULL); @@ -88,9 +89,9 @@ command_ret_t do_eep_cp(cmd_tbl_t *cmdtp, int flag, int argc, char * const argv[ if (argc != 4) return CMD_RET_USAGE; - src = (size_t) strtoul(argv[1], NULL, 16); - dest = (size_t) strtoul(argv[2], NULL, 16); - count = (size_t) strtoul(argv[3], NULL, 16); + src = (size_t) eval_arg(argv[1], NULL); + dest = (size_t) eval_arg(argv[2], NULL); + count = (size_t) eval_arg(argv[3], NULL); if (src > E2END) { debug("src > EEPROM size: 0x%04x\n", src); @@ -160,7 +161,7 @@ mod_mem_avr(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg /* Address is specified since argc > 1 */ - addr = (uint8_t *) (size_t) strtoul(argv[1], NULL, 16); + addr = (uint8_t *) (size_t) eval_arg(argv[1], NULL); } /* Print the address, followed by value. Then accept input for @@ -181,7 +182,7 @@ mod_mem_avr(cmd_tbl_t *cmdtp, int incrflag, int flag, int argc, char * const arg } else { char *endp; - data = strtoul(console_buffer, &endp, 16); + data = eval_arg(console_buffer, &endp); nbytes = endp - console_buffer; if (nbytes) { *addr = data;