From: Jakob Gruber Date: Thu, 2 Aug 2012 07:41:05 +0000 (+0200) Subject: run_avr: Add -v argument to raise verbosity level X-Git-Tag: v1.0~32 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=33cb87d48ecd68f2000d02659bb3752a329274c8;p=sx%2Fsimavr.git run_avr: Add -v argument to raise verbosity level Pass it more than once to raise it further. This works better with the standard conventions, which would allow passing -vvv (instead of -v -v -v). Unfortunately, this does not work here. The type of avr->log has been altered to accomodate values up to 3. --- diff --git a/simavr/sim/run_avr.c b/simavr/sim/run_avr.c index f1f04c3..e18f1cd 100644 --- a/simavr/sim/run_avr.c +++ b/simavr/sim/run_avr.c @@ -34,11 +34,12 @@ void display_usage(char * app) { - printf("usage: %s [-t] [-g] [-m ] [-f ] firmware\n", app); - printf(" -t: run full scale decoder trace\n" - " -g: listen for gdb connection on port 1234\n" - " -ff: Loads next .hex file as flash\n" - " -ee: Loads next .hex file as eeprom\n" + printf("Usage: %s [-t] [-g] [-v] [-m ] [-f ] firmware\n", app); + printf(" -t: Run full scale decoder trace\n" + " -g: Listen for gdb connection on port 1234\n" + " -ff: Load next .hex file as flash\n" + " -ee: Load next .hex file as eeprom\n" + " -v: Raise verbosity level (can be passed more than once)\n" " Supported AVR cores:\n"); for (int i = 0; avr_kind[i]; i++) { printf(" "); @@ -67,6 +68,7 @@ int main(int argc, char *argv[]) long f_cpu = 0; int trace = 0; int gdb = 0; + int log = 1; char name[16] = ""; uint32_t loadBase = AVR_SEGMENT_OFFSET_FLASH; int trace_vectors[8] = {0}; @@ -95,6 +97,8 @@ int main(int argc, char *argv[]) trace_vectors[trace_vectors_count++] = atoi(argv[++pi]); } else if (!strcmp(argv[pi], "-g") || !strcmp(argv[pi], "-gdb")) { gdb++; + } else if (!strcmp(argv[pi], "-v")) { + log++; } else if (!strcmp(argv[pi], "-ee")) { loadBase = AVR_SEGMENT_OFFSET_EEPROM; } else if (!strcmp(argv[pi], "-ff")) { @@ -155,6 +159,7 @@ int main(int argc, char *argv[]) printf("Attempted to load a bootloader at %04x\n", f.flashbase); avr->pc = f.flashbase; } + avr->log = (log > LOG_TRACE ? LOG_TRACE : log); avr->trace = trace; for (int ti = 0; ti < trace_vectors_count; ti++) if (avr->interrupts.vector[trace_vectors[ti]]) diff --git a/simavr/sim/sim_avr.h b/simavr/sim/sim_avr.h index 6f6cc34..737b3ce 100644 --- a/simavr/sim/sim_avr.h +++ b/simavr/sim/sim_avr.h @@ -245,7 +245,7 @@ typedef struct avr_t { avr_int_table_t interrupts; // DEBUG ONLY -- value ignored if CONFIG_SIMAVR_TRACE = 0 - int trace : 1, + uint8_t trace : 1, log : 2; // log level, default to 1 // Only used if CONFIG_SIMAVR_TRACE is defined