Commit a66d8340ffef8679d66c438f4e92a6a8b3de5404
authorMichel Pollet <buserror@gmail.com>
Sun, 4 Apr 2010 11:18:31 +0000 (12:18 +0100)
committerMichel Pollet <buserror@gmail.com>
Sun, 4 Apr 2010 11:18:31 +0000 (12:18 +0100)
Twasn't that bad really.

Signed-off-by: Michel Pollet <buserror@gmail.com>
7 files changed:
simavr/Makefile
simavr/sim/avr_flash.c
simavr/sim/avr_watchdog.c
simavr/sim/run_avr.c
simavr/sim/sim_elf.c
simavr/sim/sim_hex.c
simavr/sim/sim_vcd_file.c

index 954275398a4aeeac4082300e53d88856ad064d4f..0d21100ef35e8cea7574fcd2ccf2c1a0481f56cc 100644 (file)
@@ -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}
index fd0609ae59a1a7df0826ef8f0ea69da400967b55..3f3a12a11248b3aed96efc9d914c27b2eab81d98 100644 (file)
@@ -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)
 {
index 99ab395655b51214dbffd5c9e044dda240ea9092..763a7625357bf41664caedce72fc3d0a4a98ad42 100644 (file)
@@ -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;
 
 }
 
index 84c5760bf2fac9336538c2b8b8da57dfad44e8b2..79879b9a1ed43c9c2485b2599f27ddba9456ba1c 100644 (file)
@@ -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;
index 723cda9b38acf013bdc59f3bba677999ea4682bf..92b972499dd7fc0e35313192c781cd0337a19076 100644 (file)
@@ -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 =
index 0a8b10fd96b51104925cc2329e601699168d7688..ba187543f8ba142c33ccd30baaebab896e9267ee 100644 (file)
@@ -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;
index 612be5630e828601c93057335e60a2e2a43505cf..f17e2af8a30992dd1e02130ae41f42bf1f662a5f 100644 (file)
@@ -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;
 }