avr-gcc-list
[Top][All Lists]
Advanced

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

Re: [avr-gcc-list] AVR-GCC help


From: ks_347
Subject: Re: [avr-gcc-list] AVR-GCC help
Date: Thu, 29 Jan 2004 16:00:31 -0800 (PST)

I am attaching the disassembler file herewith. This might help. I see there is 
one "error" mentioned in that. 
 
Thanks

ks_347 <address@hidden> wrote:
Hello,

I have declared an interrupt routine in my program using 
INTERRUPT(SIG_UART0_DATA). When I was looking at the disassembler code using 
AVRSTUDIO, in the interrupt vector table on the location 0x02A, there was no 
proper address of my interrupt routine.My understanding is that the avr-gcc 
compiler should take care of the address of this routine internally. 
Due to this what is happening is everytime it receives an interrupt, it will go 
to address 0x02A and there it only finds out the default address, which will 
transfer the program control to the reset address, so my program is in infinite 
loop. Any suggestions or idea on whats going on here?
I hope I am describing this well, so that you people can understand.
I have included all the files and my program is compiled fine. 

Thanks




---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
_______________________________________________
avr-gcc-list mailing list
address@hidden
http://www.avr1.org/mailman/listinfo/avr-gcc-list




---------------------------------
Do you Yahoo!?
Yahoo! SiteBuilder - Free web site building tool. Try it!
+00000000:   940C0038    JMP     0x00000038       Jump
+00000002:   940C0053    JMP     0x00000053       Jump
+00000004:   940C0053    JMP     0x00000053       Jump
+00000006:   940C0053    JMP     0x00000053       Jump
+00000008:   940C0053    JMP     0x00000053       Jump
+0000000A:   940C0053    JMP     0x00000053       Jump
+0000000C:   940C0053    JMP     0x00000053       Jump
+0000000E:   940C0053    JMP     0x00000053       Jump
+00000010:   940C0053    JMP     0x00000053       Jump
+00000012:   940C0053    JMP     0x00000053       Jump
+00000014:   940C0000    JMP     0x00000000       Jump
+00000016:   940C0053    JMP     0x00000053       Jump
+00000018:   940C0053    JMP     0x00000053       Jump
+0000001A:   940C0053    JMP     0x00000053       Jump
+0000001C:   940C0053    JMP     0x00000053       Jump
+0000001E:   940C0053    JMP     0x00000053       Jump
+00000020:   940C0053    JMP     0x00000053       Jump
+00000022:   940C0053    JMP     0x00000053       Jump
+00000024:   940C0053    JMP     0x00000053       Jump
+00000026:   940C0053    JMP     0x00000053       Jump
+00000028:   940C0053    JMP     0x00000053       Jump
+0000002A:   940C0053    JMP     0x00000053       Jump
+0000002C:   940C0053    JMP     0x00000053       Jump
+0000002E:   940C0053    JMP     0x00000053       Jump
+00000030:   940C0053    JMP     0x00000053       Jump
+00000032:   940C0053    JMP     0x00000053       Jump
+00000034:   940C0053    JMP     0x00000053       Jump
+00000036:   940C0053    JMP     0x00000053       Jump
+00000038:   2411        CLR     R1               Exclusive OR
+00000039:   BE1F        OUT     0x3F,R1          Out to I/O location
+0000003A:   EFCF        SER     R28              Load immediate
+0000003B:   E0D4        LDI     R29,0x04         Load immediate
+0000003C:   BFDE        OUT     0x3E,R29         Out to I/O location
+0000003D:   BFCD        OUT     0x3D,R28         Out to I/O location
+0000003E:   E011        LDI     R17,0x01         Load immediate
+0000003F:   E0A0        LDI     R26,0x00         Load immediate
+00000040:   E0B1        LDI     R27,0x01         Load immediate
+00000041:   E8E4        LDI     R30,0x84         Load immediate
+00000042:   E0F1        LDI     R31,0x01         Load immediate
+00000043:   C002        RJMP    +0x0002          Relative jump
+00000044:   9005        LPM     R0,Z+            Load program memory and 
postincrement
+00000045:   920D        ST      X+,R0            Store indirect and 
postincrement
+00000046:   30AC        CPI     R26,0x0C         Compare with immediate
+00000047:   07B1        CPC     R27,R17          Compare with carry
+00000048:   F7D9        BRNE    -0x05            Branch if status flag cleared
+00000049:   E011        LDI     R17,0x01         Load immediate
+0000004A:   E0AC        LDI     R26,0x0C         Load immediate
+0000004B:   E0B1        LDI     R27,0x01         Load immediate
+0000004C:   C001        RJMP    +0x0001          Relative jump
+0000004D:   921D        ST      X+,R1            Store indirect and 
postincrement
+0000004E:   38AF        CPI     R26,0x8F         Compare with immediate
+0000004F:   07B1        CPC     R27,R17          Compare with carry
+00000050:   F7E1        BRNE    -0x04            Branch if status flag cleared
+00000051:   940C0055    JMP     0x00000055       Jump
+00000053:   940C0000    JMP     0x00000000       Jump
@00000055: main
---- main.c 
---------------------------------------------------------------------------------------
28:       void main( void )
29:       {
+00000055:   EFCF        SER     R28              Load immediate
+00000056:   E0D4        LDI     R29,0x04         Load immediate
+00000057:   BFDE        OUT     0x3E,R29         Out to I/O location
+00000058:   BFCD        OUT     0x3D,R28         Out to I/O location
31:       
+00000059:   9478        SEI                      Flag set
32:       SerialInit(); /* Set the baudrate to 9600 bps using a 3.69MHz crystal 
*/
+0000005A:   940E0062    CALL    0x00000062       Call subroutine
36:           
+0000005C:   E080        LDI     R24,0x00         Load immediate
+0000005D:   E091        LDI     R25,0x01         Load immediate
+0000005E:   940E00B2    CALL    0x000000B2       Call subroutine
40: Error: Invalid line
+00000060:   940C00C1    JMP     0x000000C1       Jump
@00000062: SerialInit
---- serial.c 
-------------------------------------------------------------------------------------
48:       m_USART_TxTail = 0;
+00000062:   9210018D    STS     0x018D,R1        Store direct to data space
49:       m_USART_TxHead = 0;
+00000064:   9210018C    STS     0x018C,R1        Store direct to data space
50:       m_USART_Txcount= 0;
+00000066:   9210018E    STS     0x018E,R1        Store direct to data space
54:       UBRR0H = (U8)(baud>>8);
+00000068:   BC10        OUT     0x20,R1          Out to I/O location
55:       UBRR0L = (U8) baud;
+00000069:   E187        LDI     R24,0x17         Load immediate
+0000006A:   E090        LDI     R25,0x00         Load immediate
+0000006B:   E0A0        LDI     R26,0x00         Load immediate
+0000006C:   E0B0        LDI     R27,0x00         Load immediate
+0000006D:   B989        OUT     0x09,R24         Out to I/O location
59:       UCSR0B = ( ( 1 << UDRIE0 ) | ( 1 << RXEN0 ) | ( 1 << TXEN0 ) ); 
+0000006E:   E388        LDI     R24,0x38         Load immediate
+0000006F:   B98A        OUT     0x0A,R24         Out to I/O location
60:       UCSR0C = (1<<URSEL0)|(1<<UCSZ00)|(1<<UCSZ01);
+00000070:   E886        LDI     R24,0x86         Load immediate
+00000071:   BD80        OUT     0x20,R24         Out to I/O location
64:       }
+00000072:   9508        RET                      Subroutine return
@00000073: SerialPutc
93:       void SerialPutc( U8 data )
94:       {
+00000073:   2F28        MOV     R18,R24          Copy register
99:       if(   m_USART_Txcount < USART_TX_BUFFER_SIZE)
+00000074:   9190018E    LDS     R25,0x018E       Load direct from data space
+00000076:   FD97        SBRC    R25,7            Skip if bit in register 
cleared
+00000077:   C00F        RJMP    +0x000F          Relative jump
101:      m_USART_TxBuf[m_USART_TxTail++] = data;           /* Store data in 
buffer */
+00000078:   9180018D    LDS     R24,0x018D       Load direct from data space
+0000007A:   2FE8        MOV     R30,R24          Copy register
+0000007B:   27FF        CLR     R31              Exclusive OR
+0000007C:   5FE4        SUBI    R30,0xF4         Subtract immediate
+0000007D:   4FFE        SBCI    R31,0xFE         Subtract immediate with carry
+0000007E:   8320        STD     Z+0,R18          Store indirect with 
displacement
+0000007F:   5F8F        SUBI    R24,0xFF         Subtract immediate
+00000080:   9380018D    STS     0x018D,R24       Store direct to data space
102:      UCSR0B &= ~(1<<UDRIE0);         /* Disable UDRE interrupt */
+00000082:   9855        CBI     0x0A,5           Clear bit in I/O register
103:      m_USART_Txcount++;
+00000083:   5F9F        SUBI    R25,0xFF         Subtract immediate
+00000084:   9390018E    STS     0x018E,R25       Store direct to data space
@00000086: m_USART_TxBuf
104:      UCSR0B |= (1<<UDRIE0);                    /* Enable UDRE interrupt */
+00000086:   9A55        SBI     0x0A,5           Set bit in I/O register
107:      } /* end SerialPutc() */
+00000087:   9508        RET                      Subroutine return
---- No Source 
------------------------------------------------------------------------------------
+00000088:   9508        RET                      Subroutine return
@00000089: SIG_UART0_DATA
---- serial.c 
-------------------------------------------------------------------------------------
109:      INTERRUPT(__vector_default)
110:      {
+00000089:   921F        PUSH    R1               Push register on stack
+0000008A:   920F        PUSH    R0               Push register on stack
+0000008B:   B60F        IN      R0,0x3F          In from I/O location
+0000008C:   920F        PUSH    R0               Push register on stack
+0000008D:   2411        CLR     R1               Exclusive OR
+0000008E:   932F        PUSH    R18              Push register on stack
+0000008F:   938F        PUSH    R24              Push register on stack
+00000090:   939F        PUSH    R25              Push register on stack
+00000091:   93EF        PUSH    R30              Push register on stack
+00000092:   93FF        PUSH    R31              Push register on stack
113:          }
+00000093:   9120018E    LDS     R18,0x018E       Load direct from data space
+00000095:   2322        TST     R18              Logical AND
+00000096:   F081        BREQ    +0x10            Branch if status flag set
115:      
+00000097:   9180018C    LDS     R24,0x018C       Load direct from data space
+00000099:   2FE8        MOV     R30,R24          Copy register
+0000009A:   27FF        CLR     R31              Exclusive OR
+0000009B:   5FE4        SUBI    R30,0xF4         Subtract immediate
+0000009C:   4FFE        SBCI    R31,0xFE         Subtract immediate with carry
+0000009D:   8190        LDD     R25,Z+0          Load indirect with 
displacement
+0000009E:   B99C        OUT     0x0C,R25         Out to I/O location
+0000009F:   5F8F        SUBI    R24,0xFF         Subtract immediate
+000000A0:   9380018C    STS     0x018C,R24       Store direct to data space
116:      INTERRUPT(SIG_UART1_DATA)
+000000A2:   5021        SUBI    R18,0x01         Subtract immediate
+000000A3:   9320018E    STS     0x018E,R18       Store direct to data space
117:      {
+000000A5:   9A55        SBI     0x0A,5           Set bit in I/O register
+000000A6:   C001        RJMP    +0x0001          Relative jump
121:      {
+000000A7:   9855        CBI     0x0A,5           Clear bit in I/O register
124:      UCSR0B |= (1<<UDRIE0);  /* Enable UDRE interrupt */
+000000A8:   91FF        POP     R31              Pop register from stack
---- No Source 
------------------------------------------------------------------------------------
+000000A9:   91EF        POP     R30              Pop register from stack
+000000AA:   919F        POP     R25              Pop register from stack
+000000AB:   918F        POP     R24              Pop register from stack
+000000AC:   912F        POP     R18              Pop register from stack
+000000AD:   900F        POP     R0               Pop register from stack
+000000AE:   BE0F        OUT     0x3F,R0          Out to I/O location
+000000AF:   900F        POP     R0               Pop register from stack
+000000B0:   901F        POP     R1               Pop register from stack
+000000B1:   9518        RETI                     Interrupt return
@000000B2: SerialPuts
---- serial.c 
-------------------------------------------------------------------------------------
154:       *                
155:       * Author:        KSG
+000000B2:   93CF        PUSH    R28              Push register on stack
+000000B3:   93DF        PUSH    R29              Push register on stack
+000000B4:   01EC        MOVW    R28,R24          Copy register pair
157:       * Revision Log:  01-27-2004   KSG
+000000B5:   8188        LDD     R24,Y+0          Load indirect with 
displacement
+000000B6:   2388        TST     R24              Logical AND
+000000B7:   F031        BREQ    +0x06            Branch if status flag set
159:      
/*#RE#***********************************************************************/
+000000B8:   9189        LD      R24,Y+           Load indirect and 
postincrement
+000000B9:   940E0073    CALL    0x00000073       Call subroutine
+000000BB:   8188        LDD     R24,Y+0          Load indirect with 
displacement
+000000BC:   2388        TST     R24              Logical AND
+000000BD:   F7D1        BRNE    -0x06            Branch if status flag cleared
162:      {
+000000BE:   91DF        POP     R29              Pop register from stack
---- No Source 
------------------------------------------------------------------------------------
+000000BF:   91CF        POP     R28              Pop register from stack
+000000C0:   9508        RET                      Subroutine return
+000000C1:   CFFF        RJMP    -0x0001          Relative jump
+000000C2:   6548        ORI     R20,0x58         Logical OR with immediate
+000000C3:   6C6C        ORI     R22,0xCC         Logical OR with immediate
+000000C4:   206F        AND     R6,R15           Logical AND
+000000C5:   6F57        ORI     R21,0xF7         Logical OR with immediate
+000000C6:   6C72        ORI     R23,0xC2         Logical OR with immediate
+000000C7:   0064        ???                      Data or unknown opcode
+000000C8:   FFFF        ???                      Data or unknown opcode
+000000C9:   FFFF        ???                      Data or unknown opcode
+000000CA:   FFFF        ???                      Data or unknown opcode
+000000CB:   FFFF        ???                      Data or unknown opcode
+000000CC:   FFFF        ???                      Data or unknown opcode
+000000CD:   FFFF        ???                      Data or unknown opcode
+000000CE:   FFFF        ???                      Data or unknown opcode
+000000CF:   FFFF        ???                      Data or unknown opcode
+000000D0:   FFFF        ???                      Data or unknown opcode
+000000D1:   FFFF        ???                      Data or unknown opcode
+000000D2:   FFFF        ???                      Data or unknown opcode
+000000D3:   FFFF        ???                      Data or unknown opcode
+000000D4:   FFFF        ???                      Data or unknown opcode

reply via email to

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