From: Michel Pollet Date: Sun, 4 Apr 2010 11:18:31 +0000 (+0100) Subject: Fixed multiple warnings for -Wall X-Git-Tag: v1.0a2~20 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=a66d8340ffef8679d66c438f4e92a6a8b3de5404;p=sx%2Fsimavr.git Fixed multiple warnings for -Wall Twasn't that bad really. Signed-off-by: Michel Pollet --- diff --git a/simavr/Makefile b/simavr/Makefile index 9542753..0d21100 100644 --- a/simavr/Makefile +++ b/simavr/Makefile @@ -18,7 +18,7 @@ target = run_avr -CFLAGS += -O3 -mfpmath=sse -msse2 +CFLAGS += -O3 -mfpmath=sse -msse2 -Wall #CFLAGS += -DCONFIG_SIMAVR_TRACE=1 cores = ${wildcard cores/*.c} diff --git a/simavr/sim/avr_flash.c b/simavr/sim/avr_flash.c index fd0609a..3f3a12a 100644 --- a/simavr/sim/avr_flash.c +++ b/simavr/sim/avr_flash.c @@ -32,13 +32,6 @@ static avr_cycle_count_t avr_progen_clear(struct avr_t * avr, avr_cycle_count_t return 0; } -static uint8_t avr_flash_read(struct avr_t * avr, avr_io_addr_t addr, void * param) -{ - avr_flash_t * p = (avr_flash_t *)param; - uint8_t v = avr_core_watch_read(avr, addr); - printf("avr_flash_read %02x\n", v); - return v; -} static void avr_flash_write(avr_t * avr, avr_io_addr_t addr, uint8_t v, void * param) { diff --git a/simavr/sim/avr_watchdog.c b/simavr/sim/avr_watchdog.c index 99ab395..763a762 100644 --- a/simavr/sim/avr_watchdog.c +++ b/simavr/sim/avr_watchdog.c @@ -50,7 +50,7 @@ static void avr_watchdog_write(avr_t * avr, avr_io_addr_t addr, uint8_t v, void { avr_watchdog_t * p = (avr_watchdog_t *)param; // backup the registers - uint8_t wd = avr->data[p->wdce.reg]; + // uint8_t wd = avr->data[p->wdce.reg]; uint8_t wdce_o = avr_regbit_get(avr, p->wdce); // old uint8_t wde_o = avr_regbit_get(avr, p->wde); uint8_t wdp_o[4]; @@ -106,7 +106,7 @@ static int avr_watchdog_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_pa static void avr_watchdog_reset(avr_io_t * port) { - avr_watchdog_t * p = (avr_watchdog_t *)port; +// avr_watchdog_t * p = (avr_watchdog_t *)port; } diff --git a/simavr/sim/run_avr.c b/simavr/sim/run_avr.c index 84c5760..79879b9 100644 --- a/simavr/sim/run_avr.c +++ b/simavr/sim/run_avr.c @@ -50,7 +50,7 @@ void display_usage(char * app) int main(int argc, char *argv[]) { - elf_firmware_t f = {0}; + elf_firmware_t f = {{0}}; long f_cpu = 0; int trace = 0; int gdb = 0; diff --git a/simavr/sim/sim_elf.c b/simavr/sim/sim_elf.c index 723cda9..92b9724 100644 --- a/simavr/sim/sim_elf.c +++ b/simavr/sim/sim_elf.c @@ -105,19 +105,19 @@ static void elf_parse_mmcu_section(elf_firmware_t * firmware, uint8_t * src, uin uint8_t tag = *src++; uint8_t ts = *src++; int next = size > 2 + ts ? 2 + ts : size; - printf("elf_parse_mmcu_section %d, %d / %d\n", tag, ts, size); + // printf("elf_parse_mmcu_section %d, %d / %d\n", tag, ts, size); switch (tag) { case AVR_MMCU_TAG_FREQUENCY: firmware->frequency = src[0] | (src[1] << 8) | (src[2] << 16) | (src[3] << 24); break; case AVR_MMCU_TAG_NAME: - strcpy(firmware->mmcu, src); + strcpy(firmware->mmcu, (char*)src); break; case AVR_MMCU_TAG_VCD_TRACE: { uint8_t mask = src[0]; uint16_t addr = src[1] | (src[2] << 8); - char * name = src + 3; + char * name = (char*)src + 3; printf("AVR_MMCU_TAG_VCD_TRACE %04x:%02x - %s\n", addr, mask, name); firmware->trace[firmware->tracecount].mask = mask; firmware->trace[firmware->tracecount].addr = addr; @@ -126,7 +126,7 @@ static void elf_parse_mmcu_section(elf_firmware_t * firmware, uint8_t * src, uin firmware->tracecount++; } break; case AVR_MMCU_TAG_VCD_FILENAME: { - strcpy(firmware->tracename, src); + strcpy(firmware->tracename, (char*)src); } break; case AVR_MMCU_TAG_VCD_PERIOD: { firmware->traceperiod = diff --git a/simavr/sim/sim_hex.c b/simavr/sim/sim_hex.c index 0a8b10f..ba18754 100644 --- a/simavr/sim/sim_hex.c +++ b/simavr/sim/sim_hex.c @@ -182,7 +182,7 @@ int read_ihex_chunks(const char * fname, struct ihex_chunk_t * chunks, int max_c uint32_t addr = 0; switch (bline[3]) { case 0: // normal data - addr = segment + (bline[1] << 8) | bline[2]; + addr = segment | (bline[1] << 8) | bline[2]; break; case 1: // end of file continue; diff --git a/simavr/sim/sim_vcd_file.c b/simavr/sim/sim_vcd_file.c index 612be56..f17e2af 100644 --- a/simavr/sim/sim_vcd_file.c +++ b/simavr/sim/sim_vcd_file.c @@ -108,7 +108,7 @@ static void avr_vcd_flush_log(avr_vcd_t * vcd) if (base > oldbase || li == 0) { seen = 0; - fprintf(vcd->output, "#%ld\n", base); + fprintf(vcd->output, "#%uld\n", base); oldbase = base; } seen |= (1 << l->signal->irq.irq); // mark this trace as seen for this timestamp @@ -136,6 +136,7 @@ int avr_vcd_add_signal(avr_vcd_t * vcd, s->size = signal_bit_size; s->alias = ' ' + vcd->signal_count ; avr_connect_irq(signal_irq, &s->irq); + return 0; } @@ -169,6 +170,7 @@ int avr_vcd_start(avr_vcd_t * vcd) fprintf(vcd->output, "$end\n"); vcd->start = vcd->avr->cycle; avr_cycle_timer_register(vcd->avr, vcd->period, _avr_vcd_timer, vcd); + return 0; } int avr_vcd_stop(avr_vcd_t * vcd) @@ -180,6 +182,7 @@ int avr_vcd_stop(avr_vcd_t * vcd) if (vcd->output) fclose(vcd->output); vcd->output = NULL; + return 0; }