Twasn't that bad really.
Signed-off-by: Michel Pollet <buserror@gmail.com>
target = run_avr
-CFLAGS += -O3 -mfpmath=sse -msse2
+CFLAGS += -O3 -mfpmath=sse -msse2 -Wall
#CFLAGS += -DCONFIG_SIMAVR_TRACE=1
cores = ${wildcard cores/*.c}
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)
{
{
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];
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;
}
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;
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;
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 =
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;
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
s->size = signal_bit_size;
s->alias = ' ' + vcd->signal_count ;
avr_connect_irq(signal_irq, &s->irq);
+ return 0;
}
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)
if (vcd->output)
fclose(vcd->output);
vcd->output = NULL;
+ return 0;
}