From: Michel Pollet Date: Tue, 22 Feb 2011 17:21:54 +0000 (+0000) Subject: simavr: Added -Werror and fixed warnings X-Git-Tag: v1.0a7~25 X-Git-Url: https://git.htl-mechatronik.at/public/?a=commitdiff_plain;h=91bf258f46d9903a1cd253cab9e7f7dfcfb151ef;p=sx%2Fsimavr.git simavr: Added -Werror and fixed warnings Added -Werror to compilation to make sure the next wave of changes can't easily break things Signed-off-by: Michel Pollet --- diff --git a/simavr/Makefile b/simavr/Makefile index c147f2b..25bba60 100644 --- a/simavr/Makefile +++ b/simavr/Makefile @@ -18,7 +18,7 @@ target = run_avr -CFLAGS += -O3 -mfpmath=sse -msse2 -Wall +CFLAGS += -O3 -mfpmath=sse -msse2 -Wall -Werror #CFLAGS += -DCONFIG_SIMAVR_TRACE=1 cores = ${wildcard cores/*.c} diff --git a/simavr/sim/avr_twi.c b/simavr/sim/avr_twi.c index 668070a..589e18e 100644 --- a/simavr/sim/avr_twi.c +++ b/simavr/sim/avr_twi.c @@ -24,7 +24,7 @@ static uint8_t avr_twi_read(struct avr_t * avr, avr_io_addr_t addr, void * param) { - avr_twi_t * p = (avr_twi_t *)param; +// avr_twi_t * p = (avr_twi_t *)param; // uint8_t v = p->input_data_register; // p->input_data_register = 0; // printf("avr_twi_read = %02x\n", v); @@ -33,8 +33,8 @@ static uint8_t avr_twi_read(struct avr_t * avr, avr_io_addr_t addr, void * param static void avr_twi_write(struct avr_t * avr, avr_io_addr_t addr, uint8_t v, void * param) { - avr_twi_t * p = (avr_twi_t *)param; #if 0 + avr_twi_t * p = (avr_twi_t *)param; if (addr == p->r_spdr) { // printf("avr_twi_write = %02x\n", v); avr_core_watch_write(avr, addr, v); @@ -49,6 +49,7 @@ static void avr_twi_write(struct avr_t * avr, avr_io_addr_t addr, uint8_t v, voi #endif } +#if 0 static void avr_twi_irq_input(struct avr_irq_t * irq, uint32_t value, void * param) { avr_twi_t * p = (avr_twi_t *)param; @@ -70,7 +71,6 @@ static void avr_twi_irq_input(struct avr_irq_t * irq, uint32_t value, void * par #endif } - // handle a data write, after a (re)start static int twi_slave_write(struct twi_slave_t* p, uint8_t v) { @@ -82,7 +82,7 @@ static uint8_t twi_slave_read(struct twi_slave_t* p) { return 0; } - +#endif static int avr_twi_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_param) { @@ -100,7 +100,7 @@ static int avr_twi_ioctl(struct avr_io_t * port, uint32_t ctl, void * io_param) void avr_twi_reset(struct avr_io_t *io) { - avr_twi_t * p = (avr_twi_t *)io; +// avr_twi_t * p = (avr_twi_t *)io; //avr_irq_register_notify(p->io.irq + TWI_IRQ_INPUT, avr_twi_irq_input, p); } diff --git a/simavr/sim/sim_core.c b/simavr/sim/sim_core.c index b400ca1..9cbccd3 100644 --- a/simavr/sim/sim_core.c +++ b/simavr/sim/sim_core.c @@ -320,6 +320,10 @@ void avr_dump_state(avr_t * avr) const uint8_t r = ((o >> 5) & 0x10) | (o & 0xf); \ const uint8_t d = (o >> 4) & 0x1f;\ const uint8_t vd = avr->data[d], vr = avr->data[r]; +#define get_r_dd_10(o) \ + const uint8_t r = ((o >> 5) & 0x10) | (o & 0xf); \ + const uint8_t d = (o >> 4) & 0x1f;\ + const uint8_t vr = avr->data[r]; #define get_k_r16(o) \ const uint8_t r = 16 + ((o >> 4) & 0xf); \ const uint8_t k = ((o & 0x0f00) >> 4) | (o & 0xf); @@ -682,7 +686,7 @@ uint16_t avr_run_one(avr_t * avr) SREG(); } break; case 0x2c00: { // MOV 0010 11rd dddd rrrr - get_r_d_10(opcode); + get_r_dd_10(opcode); uint8_t res = vr; STATE("mov %s[%02x], %s[%02x] = %02x\n", avr_regname(d), vd, avr_regname(r), vr, res); _avr_set_r(avr, d, res); diff --git a/simavr/sim/sim_hex.c b/simavr/sim/sim_hex.c index ba18754..05c6e9c 100644 --- a/simavr/sim/sim_hex.c +++ b/simavr/sim/sim_hex.c @@ -213,8 +213,8 @@ int read_ihex_chunks(const char * fname, struct ihex_chunk_t * chunks, int max_c #ifdef IHEX_TEST -// gcc -std=gnu99 -Isimavr/sim simavr/sim/sim_hex.c -o sim_hex -DIHEX_TEST -int main(int argc, char * argv[]) +// gcc -std=gnu99 -Isimavr/sim simavr/sim/sim_hex.c -o sim_hex -DIHEX_TEST -Dtest_main=main +int test_main(int argc, char * argv[]) { struct ihex_chunk_t chunk[4]; diff --git a/simavr/sim/sim_twi.c b/simavr/sim/sim_twi.c index 7434fd6..16bfa97 100644 --- a/simavr/sim/sim_twi.c +++ b/simavr/sim/sim_twi.c @@ -99,7 +99,7 @@ static void twi_slave_irq_notify(struct avr_irq_t * irq, uint32_t value, void * void twi_bus_init(twi_bus_t * bus) { memset(bus, 0, sizeof(twi_bus_t)); - avr_init_irq(bus->irq, 0, TWI_MASTER_STATE_COUNT); + //avr_init_irq(bus->irq, 0, TWI_MASTER_STATE_COUNT); for (int i = 0; i < TWI_MASTER_STATE_COUNT; i++) avr_irq_register_notify(bus->irq + i, twi_bus_master_irq_notify, bus); }