simulavr-devel
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[Simulavr-devel] ATmega8 patch (and other patches)


From: Tuukka Pasanen
Subject: [Simulavr-devel] ATmega8 patch (and other patches)
Date: Fri, 01 Aug 2003 04:41:26 -0400

hi,
There is two patches. First one: simulavr-atmega8-31072003.diff is ATMega8 
stuff (hopefully i made everything right). Biggest problem was that ATmega8 
doesn't seem to have portA so i made ditry hack. That should be made more 
nicely. Patch two simulavr-bootstrap_sh-31072003.diff makes bootstrap.sh work 
with newer autoconf and automake (boostrap.sh does well. I use SuSE 8.2 no 
error occurred). 
ATmega8 patch is not much tested but it should work. I'll test it more and make 
patch better.

Tuukka

ps. they are made against yesterdays CVS


____________________________________________________________
Get advanced SPAM filtering on Webmail or POP Mail ... Get Lycos Mail!
http://login.mail.lycos.com/r/referral?aid=27005
diff -urN simulavr/src/devsupp.c simulavr-patch/src/devsupp.c
--- simulavr/src/devsupp.c      2003-04-06 22:26:08.000000000 +0300
+++ simulavr-patch/src/devsupp.c        2003-07-31 13:18:11.000000000 +0300
@@ -71,6 +71,7 @@
     VTAB_AT90S1200  = 0,
     VTAB_AT90S2313,
     VTAB_AT90S4414,
+    VTAB_ATMEGA8,
     VTAB_ATMEGA16,
     VTAB_ATMEGA103,
     VTAB_ATMEGA128,
@@ -222,6 +223,32 @@
   }
 };
 
+static DevSuppDefn defn_atmega8 = {
+  /* name         */  "atmega8",
+  /* stack_type   */  STACK_MEMORY,
+  /* sram_base    */  SRAM_BASE,
+  /* irq_vect_idx */  VTAB_ATMEGA16,
+
+  /* ports        */  "a0b8c7d8",
+
+  {
+  /* size.pc      */  2, /* 13 bits */
+  /* size.stack   */  0,
+  /* size.flash   */  8*1024,
+  /* size.sram    */  1*1024,
+  /* size.eeprom  */  512
+  },
+  {
+  /* mask.eecr    */  (mask_EERE | mask_EEWE | mask_EEMWE),
+  /* mask.mcucr   */  (mask_SRE | mask_SRW | mask_SE | mask_SM |
+                       mask_ISC11 | mask_ISC10 | mask_ISC01 | mask_ISC00),
+  /* mask.acsr    */  (mask_ACD | mask_ACO | mask_ACI | mask_ACIE |
+                       mask_ACIC | mask_ACIS1 | mask_ACIS0),
+  /* mask.wdtcr   */  (mask_WDTOE | mask_WDE | mask_WDP2 | mask_WDP1 | 
mask_WDP0),
+  /* mask.timsk   */  (mask_TOIE1 | mask_OCIE1A | mask_OCIE1B | mask_TICIE1 | 
mask_TOIE0)
+  }
+};
+
 
 static DevSuppDefn defn_atmega16 = {
   /* name         */  "atmega16",
@@ -311,6 +338,7 @@
     &defn_at90s2313,
     &defn_at90s4414,
     &defn_at90s8515,
+    &defn_atmega8,
     &defn_atmega16,
     &defn_atmega103,
     &defn_atmega128,
@@ -430,6 +458,9 @@
             /* Get the width of the port */
             switch (pp[1])
             {
+                case '0':
+                    width = PORT_0_BIT;
+                    break;
                 case '7':
                     width = PORT_7_BIT;
                     break;
@@ -437,7 +468,7 @@
                     width = PORT_8_BIT;
                     break;
                 default:
-                    avr_error( "Invalid port width: 0x%02x", pp[1] );
+                    avr_error( "Invalid port width: 0x%02x (%d b)", pp[1], 
(pp[1] - 0x30) );
             }
 
             /* Create the port VDevice */
@@ -460,7 +491,7 @@
                     port = (VDevice *)portd_new(width);
                     break;
                 default:
-                    avr_error( "Invalid port id: 0x%02x", pp[0] );
+                    avr_error( "Invalid port id: 0x%02x (port: %c) ", pp[0], 
pp[0] );
             }
             avr_core_attach_vdev( core, port );
             pp += 2;
diff -urN simulavr/src/intvects.c simulavr-patch/src/intvects.c
--- simulavr/src/intvects.c     2003-04-06 22:26:08.000000000 +0300
+++ simulavr-patch/src/intvects.c       2003-07-31 13:37:33.000000000 +0300
@@ -210,6 +210,65 @@
     { NULL /* "IRQ_SPM_READY" */,    0x00,    0x00 },
 };
 
+/*
+ * Vector Table for devices:
+ *   atmega16
+ */
+
+static IntVect vtab_atmega8[] = {
+    { "IRQ_RESET",        0x00,    0x00 },
+
+    { "IRQ_INT0",         0x01,    0x00 },
+    { "IRQ_INT1",         0x02,    0x00 },
+    { NULL /* "IRQ_INT2" */,         0x00,    0x00 },
+    { NULL /* "IRQ_INT3" */,         0x00,    0x00 },
+    { NULL /* "IRQ_INT4" */,         0x00,    0x00 },
+    { NULL /* "IRQ_INT5" */,         0x00,    0x00 },
+    { NULL /* "IRQ_INT6",*/,         0x00,    0x00 },
+    { NULL /* "IRQ_INT7",*/,         0x00,    0x00 },
+
+    { NULL /* "IRQ_TIMER0_COMP"*/,  0x00,    0x00 },
+    { "IRQ_TIMER0_OVF",   0x09,    0x00 },
+
+    { "IRQ_TIMER1_CAPT",  0x05,    0x00 },
+    { "IRQ_TIMER1_COMPA", 0x06,    0x00 },
+    { "IRQ_TIMER1_COMPB", 0x07,    0x00 },
+    { NULL /* "IRQ_TIMER1_COMPC" */, 0x00,    0x00 },
+    { "IRQ_TIMER1_OVF",   0x08,    0x00 },
+
+    { "IRQ_TIMER2_COMP",  0x03,    0x00 },
+    { "IRQ_TIMER2_OVF",   0x04,    0x00 },
+
+    { NULL /* "IRQ_TIMER3_CAPT" */,  0x00,    0x00 },
+    { NULL /* "IRQ_TIMER3_COMPA" */, 0x00,    0x00 },
+    { NULL /* "IRQ_TIMER3_COMPB" */, 0x00,    0x00 },
+    { NULL /* "IRQ_TIMER3_COMPC" */, 0x00,    0x00 },
+    { NULL /* "IRQ_TIMER3_OVF" */,   0x00,    0x00 },
+
+    { "IRQ_SPI_STC",      0x0a,    0x00 },
+    { "IRQ_TWI",          0x11,    0x00 },
+
+    { "IRQ_UART_RX",      0x0b,    0x00 },
+    { "IRQ_UART_UDRE",    0x0c,    0x00 },
+    { "IRQ_UART_TX",      0x0d,    0x00 },
+
+
+    { NULL /* "IRQ_USART0_RX" */,    0x00,    0x00 },
+    { NULL /* "IRQ_USART0_UDRE" */,  0x00,    0x00 },
+    { NULL /* "IRQ_USART0_TX" */,    0x00,    0x00 },
+
+    { NULL /* "IRQ_USART1_RX" */,    0x00,    0x00 },
+    { NULL /* "IRQ_USART1_UDRE" */,  0x00,    0x00 },
+    { NULL /* "IRQ_USART1_TX" */,    0x00,    0x00 },
+
+    { "IRQ_ADC",          0x0e,    0x00 },
+    { "IRQ_ANA_COMP",     0x10,    0x00 },
+
+    { "IRQ_EE_READY",     0x0f,    0x00 },
+    { "IRQ_SPM_READY",    0x11,    0x00 },
+};
+
+
 
 /*
  * Vector Table for devices:
@@ -401,6 +460,7 @@
     vtab_at90s1200,
     vtab_at90s2313,
     vtab_at90s4414,
+    vtab_atmega8,
     vtab_atmega16,
     vtab_atmega103,
     vtab_atmega128,
diff -urN simulavr/src/ports.h simulavr-patch/src/ports.h
--- simulavr/src/ports.h        2002-03-19 01:48:23.000000000 +0200
+++ simulavr-patch/src/ports.h  2003-07-31 13:16:10.000000000 +0300
@@ -54,6 +54,7 @@
 
     PORT_SIZE   = 3,            /* All ports use 3 registers: PINx, DDRx, 
PORTx */
 
+    PORT_0_BIT  = 0,            /* Some ports are 7 bits wide */
     PORT_7_BIT  = 7,            /* Some ports are 7 bits wide */
     PORT_8_BIT  = 8,            /* Most ports are 8 bits wide */
 };
diff -urN simulavr/bootstrap simulavr-patch/bootstrap
--- simulavr/bootstrap  2002-10-21 06:24:59.000000000 +0300
+++ simulavr-patch/bootstrap    2003-07-31 13:09:29.000000000 +0300
@@ -15,17 +15,25 @@
        then
                continue
        fi
+
+
        if [ "$AUTOMAKE_VER" = "1.4" ]
        then
                status=""
                ACLOCAL=aclocal`expr "$AUTOMAKE" : 'automake\(.*\)'`
                break
        fi
+        if [ "$AUTOMAKE_VER" = "1.7" ]
+        then
+                status=""
+                ACLOCAL=aclocal`expr "$AUTOMAKE" : 'automake\(.*\)'`
+                break
+        fi
 done
 
 if [ -n "$status" ]
 then
-       echo "You need to use automake version 1.4 (preferrable 1.4-p5)."
+       echo "You need to use automake version 1.4 (preferrable 1.4-p5) or 
automake 1.7.x version"
        echo "You are using `automake --version | head -n 1`."
        echo
        exit 1
@@ -46,11 +54,24 @@
                AUTOHEADER=autoheader`expr "$AUTOCONF" : 'autoconf\(.*\)'`
                break
        fi
+
+       if [ "$AUTOCONF_VER" = "Auto" ]
+       then
+               AUTOCONF_VER=`(${AUTOCONF} --version 2>/dev/null | head -n 1 | 
cut -d ' ' -f 4 | cut -c -3) 2>/dev/null`
+       fi
+
+        if [ "$AUTOCONF_VER" = "2.5" ]
+        then
+                status=""
+                AUTOHEADER=autoheader`expr "$AUTOCONF" : 'autoconf\(.*\)'`
+                break
+        fi
+
 done
 
 if [ -n "$status" ]
 then
-       echo "You need to use autoconf version 2.13."
+       echo "You need to use autoconf version 2.13 or 2.5x version to make 
this work"
        echo "You are using `autoconf --version | head -n 1`."
        echo
        exit 1

reply via email to

[Prev in Thread] Current Thread [Next in Thread]