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}
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);
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);
#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;
#endif
}
-
// handle a data write, after a (re)start
static int twi_slave_write(struct twi_slave_t* p, uint8_t v)
{
{
return 0;
}
-
+#endif
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);
}
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);
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);
#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];
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);
}