Skip to content

Commit 40eed1d

Browse files
authored
Merge pull request #281 from dgeelen/dgeelen/log_improvements
Improve logging
2 parents 1b2dd11 + 4e1fd7f commit 40eed1d

File tree

2 files changed

+12
-4
lines changed

2 files changed

+12
-4
lines changed

simavr/sim/run_avr.c

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -183,13 +183,13 @@ main(
183183
exit(1);
184184
}
185185
avr_init(avr);
186+
avr->log = (log > LOG_TRACE ? LOG_TRACE : log);
187+
avr->trace = trace;
186188
avr_load_firmware(avr, &f);
187189
if (f.flashbase) {
188190
printf("Attempted to load a bootloader at %04x\n", f.flashbase);
189191
avr->pc = f.flashbase;
190192
}
191-
avr->log = (log > LOG_TRACE ? LOG_TRACE : log);
192-
avr->trace = trace;
193193
for (int ti = 0; ti < trace_vectors_count; ti++) {
194194
for (int vi = 0; vi < avr->interrupts.vector_count; vi++)
195195
if (avr->interrupts.vector[vi]->vector == trace_vectors[ti])

simavr/sim/sim_vcd_file.c

Lines changed: 10 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -450,8 +450,12 @@ _avr_vcd_notify(
450450
{
451451
avr_vcd_t * vcd = (avr_vcd_t *)param;
452452

453-
if (!vcd->output)
453+
if (!vcd->output) {
454+
AVR_LOG(vcd->avr, LOG_WARNING,
455+
"%s: no output\n",
456+
__FUNCTION__);
454457
return;
458+
}
455459

456460
avr_vcd_signal_t * s = (avr_vcd_signal_t*)irq;
457461
avr_vcd_log_t l = {
@@ -478,8 +482,12 @@ avr_vcd_add_signal(
478482
int signal_bit_size,
479483
const char * name )
480484
{
481-
if (vcd->signal_count == AVR_VCD_MAX_SIGNALS)
485+
if (vcd->signal_count == AVR_VCD_MAX_SIGNALS) {
486+
AVR_LOG(vcd->avr, LOG_ERROR,
487+
" %s: unable add signal '%s'\n",
488+
__FUNCTION__, name);
482489
return -1;
490+
}
483491
int index = vcd->signal_count++;
484492
avr_vcd_signal_t * s = &vcd->signal[index];
485493
strncpy(s->name, name, sizeof(s->name));

0 commit comments

Comments
 (0)