From: Jakob Gruber Date: Thu, 2 Aug 2012 09:07:21 +0000 (+0200) Subject: core: Convert logging to AVR_LOG() X-Git-Tag: v1.0~20 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=5d754099ddf36ab1f24838988f700a0777b73268;p=sx%2Fsimavr.git core: Convert logging to AVR_LOG() --- diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index 757ed66..e62938f 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -101,12 +101,12 @@ int donttrace = 0; void avr_core_watch_write(avr_t *avr, uint16_t addr, uint8_t v) { if (addr > avr->ramend) { - printf("*** Invalid write address PC=%04x SP=%04x O=%04x Address %04x=%02x out of ram\n", + AVR_LOG(avr, LOG_ERROR, "CORE: *** Invalid write address PC=%04x SP=%04x O=%04x Address %04x=%02x out of ram\n", avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, v); CRASH(); } if (addr < 32) { - printf("*** Invalid write address PC=%04x SP=%04x O=%04x Address %04x=%02x low registers\n", + AVR_LOG(avr, LOG_ERROR, "CORE: *** Invalid write address PC=%04x SP=%04x O=%04x Address %04x=%02x low registers\n", avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, v); CRASH(); } @@ -131,7 +131,7 @@ void avr_core_watch_write(avr_t *avr, uint16_t addr, uint8_t v) uint8_t avr_core_watch_read(avr_t *avr, uint16_t addr) { if (addr > avr->ramend) { - printf( FONT_RED "*** Invalid read address PC=%04x SP=%04x O=%04x Address %04x out of ram (%04x)\n" FONT_DEFAULT, + AVR_LOG(avr, LOG_ERROR, FONT_RED "CORE: *** Invalid read address PC=%04x SP=%04x O=%04x Address %04x out of ram (%04x)\n" FONT_DEFAULT, avr->pc, _avr_sp_get(avr), avr->flash[avr->pc + 1] | (avr->flash[avr->pc]<<8), addr, avr->ramend); CRASH(); } @@ -291,7 +291,7 @@ static void _avr_invalid_opcode(avr_t * avr) printf( FONT_RED "*** %04x: %-25s Invalid Opcode SP=%04x O=%04x \n" FONT_DEFAULT, avr->pc, avr->trace_data->codeline[avr->pc>>1]->symbol, _avr_sp_get(avr), avr->flash[avr->pc] | (avr->flash[avr->pc+1]<<8)); #else - printf( FONT_RED "*** %04x: Invalid Opcode SP=%04x O=%04x \n" FONT_DEFAULT, + AVR_LOG(avr, LOG_ERROR, FONT_RED "CORE: *** %04x: Invalid Opcode SP=%04x O=%04x \n" FONT_DEFAULT, avr->pc, _avr_sp_get(avr), avr->flash[avr->pc] | (avr->flash[avr->pc+1]<<8)); #endif }