diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.avr b/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.avr new file mode 100644 index 00000000..79579ca5 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.avr @@ -0,0 +1,40 @@ +;* ******************************************************** * +; ATtiny 13/45/85 Pin map +; +-\/-+ +; /Reset ADC0 PB5 1|o |8 Vcc +; ADC3 PB3 2| |7 PB2 ADC1 SCK +; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 +; GND 4| |5 PB0 OC0A MOSI AIN0 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny13A +; 9.6MHz: +; LFuse: 0x7A; HFuse: 0x1F; +; AVRDude: -U lfuse:w:0x7a:m -U hfuse:w:0x1f:m +; +; ****************************************************************** + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ;Reset + reti ;INT0 - External Int0 Vector + reti ;PCINT0 - Pin Change Interrupt handler + reti ;TIM0_OVF - Timer0 Overflow handler + reti ;EE_RDY - EEPROM Ready Handler + reti ;ANA_COMP - Analog Comparator Handler + reti ;TIM0_COMPA - Timer0 Compare match A Handler + reti ;TIM0_COMPB - Timer0 Compare match B Handler + reti ;WDT - Watchdog Overflow Handler + reti ;ADC - ADC Conversion Handler + +.ORG $000A +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.hex b/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.hex new file mode 100644 index 00000000..b3e04610 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.hex @@ -0,0 +1,4 @@ +:020000020000FC +:1000000009C018951895189518951895189518956C +:0C00100018951895F8940FE90DBFFFCF6C +:00000001FF diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.lst b/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.lst new file mode 100644 index 00000000..349509b9 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny13a/tiny13a.lst @@ -0,0 +1,50 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny13a.avr +Hex file: tiny13a.hex +Eeprom file: tiny13a.eep +Compiled: 23.07.2021, 10:20:30 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 13/45/85 Pin map + 3: ; +-\/-+ + 4: ; /Reset ADC0 PB5 1|o |8 Vcc + 5: ; ADC3 PB3 2| |7 PB2 ADC1 SCK + 6: ; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + 7: ; GND 4| |5 PB0 OC0A MOSI AIN0 + 8: ; +----+ + 9: ;* ******************************************************** */ + 10: + 11: ; Define processor type on top of the source code + 12: ; + 13: .DEVICE ATtiny13A + 14: + 15: ; Int-Vector area + 16: .CSEG + 17: .ORG $0000 + 18: 000000 C009 rjmp Setup ;Reset + 19: 000001 9518 reti ;INT0 - External Int0 Vector + 20: 000002 9518 reti ;PCINT0 - Pin Change Interrupt handler + 21: 000003 9518 reti ;TIM0_OVF - Timer0 Overflow handler + 22: 000004 9518 reti ;EE_RDY - EEPROM Ready Handler + 23: 000005 9518 reti ;ANA_COMP - Analog Comparator Handler + 24: 000006 9518 reti ;TIM0_COMPA - Timer0 Compare match A Handler + 25: 000007 9518 reti ;TIM0_COMPB - Timer0 Compare match B Handler + 26: 000008 9518 reti ;WDT - Watchdog Overflow Handler + 27: 000009 9518 reti ;ADC - ADC Conversion Handler + 28: + 29: .ORG $000A + 30: Setup: + 31: 00000A 94F8 cli ; Disable Interrupts + 32: 00000B E90F ldi r16, low(RAMEND) + 33: 00000C BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 34: Main: + 35: 00000D CFFF rjmp Main ; infinite loop + +Program : 14 words. +Constants : 0 words. +Total program memory: 14 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 23.07.2021, 10:20:30 diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.avr b/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.avr new file mode 100644 index 00000000..bb0b2055 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.avr @@ -0,0 +1,49 @@ +;* ******************************************************** * +; ATtiny 2313/4313 Pin map +; +-\/-+ +; /Reset PA2 1|o |20 Vcc +; RXD PD0 2| |19 PB7 SCK +; TXD PD1 3| |18 PB6 MISO +; PA1 4| |17 PB5 MOSI +; PA0 5| |16 PB4 OC1B +; PD2 6| |15 PB3 OC1A +; PD3 7| |14 PB2 OC0A +; PD4 8| |13 PB1 AIN1 +; OC0B PD5 9| |12 PB0 AIN0 +; GND 10| |11 PD6 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny2313A + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ; for all types + reti ; External Int0 Vector, not used + reti ; External Int1 Vector, not used + reti ; Timer Tim1_Capt, not used + reti ; Timer Tim1_CompA, not used + reti ; Timer Tim1_Ovf, not used + reti ; Timer Tim0_Ovf, used + reti ; Usart_RXC, not used + reti ; Usart_dre, not used + reti ; Usart_TXC, not used + reti ; ANA_COMP ; Analog Comparator Handler + reti ; PCINT ; Pin Change Interrupt + reti ; TIMER1_COMPB ; Timer1 Compare B Handler + reti ; TIMER0_COMPA ; Timer0 Compare A Handler + reti ; TIMER0_COMPB ; Timer0 Compare B Handler + reti ; USI_START ; USI Start Handler + reti ; USI_OVERFLOW ; USI Overflow Handler + reti ; EE_READY ; EEPROM Ready Handler + reti ; WDT_OVERFLOW ; Watchdog Overflow Handler + +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.hex b/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.hex new file mode 100644 index 00000000..d1c0cb27 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.hex @@ -0,0 +1,5 @@ +:020000020000FC +:1000000012C0189518951895189518951895189563 +:100010001895189518951895189518951895189578 +:0E002000189518951895F8940FED0DBFFFCFA9 +:00000001FF diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.lst b/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.lst new file mode 100644 index 00000000..46072c54 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny2313/tiny2313a.lst @@ -0,0 +1,64 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny2313a_primo.avr +Hex file: tiny2313a_primo.hex +Eeprom file: tiny2313a_primo.eep +Compiled: 26.07.2016, 11:35:04 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 2313/4313 Pin map + 3: ; +-\/-+ + 4: ; /Reset PA2 1|o |20 Vcc + 5: ; RXD PD0 2| |19 PB7 SCK + 6: ; TXD PD1 3| |18 PB6 MISO + 7: ; PA1 4| |17 PB5 MOSI + 8: ; PA0 5| |16 PB4 OC1B + 9: ; PD2 6| |15 PB3 OC1A + 10: ; PD3 7| |14 PB2 OC0A + 11: ; PD4 8| |13 PB1 AIN1 + 12: ; OC0B PD5 9| |12 PB0 AIN0 + 13: ; GND 10| |11 PD6 + 14: ; +----+ + 15: ;* ******************************************************** */ + 16: + 17: ; Define processor type on top of the source code + 18: ; + 19: .DEVICE ATtiny2313A + 20: + 21: ; Int-Vector area + 22: .CSEG + 23: .ORG $0000 + 24: 000000 C012 rjmp Setup ; for all types + 25: 000001 9518 reti ; External Int0 Vector, not used + 26: 000002 9518 reti ; External Int1 Vector, not used + 27: 000003 9518 reti ; Timer Tim1_Capt, not used + 28: 000004 9518 reti ; Timer Tim1_CompA, not used + 29: 000005 9518 reti ; Timer Tim1_Ovf, not used + 30: 000006 9518 reti ; Timer Tim0_Ovf, used + 31: 000007 9518 reti ; Usart_RXC, not used + 32: 000008 9518 reti ; Usart_dre, not used + 33: 000009 9518 reti ; Usart_TXC, not used + 34: 00000A 9518 reti ; ANA_COMP ; Analog Comparator Handler + 35: 00000B 9518 reti ; PCINT ; Pin Change Interrupt + 36: 00000C 9518 reti ; TIMER1_COMPB ; Timer1 Compare B Handler + 37: 00000D 9518 reti ; TIMER0_COMPA ; Timer0 Compare A Handler + 38: 00000E 9518 reti ; TIMER0_COMPB ; Timer0 Compare B Handler + 39: 00000F 9518 reti ; USI_START ; USI Start Handler + 40: 000010 9518 reti ; USI_OVERFLOW ; USI Overflow Handler + 41: 000011 9518 reti ; EE_READY ; EEPROM Ready Handler + 42: 000012 9518 reti ; WDT_OVERFLOW ; Watchdog Overflow Handler + 43: + 44: Setup: + 45: 000013 94F8 cli ; Disable Interrupts + 46: 000014 ED0F ldi r16, low(RAMEND) + 47: 000015 BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 48: Main: + 49: 000016 CFFF rjmp Main ; infinite loop + +Program : 23 words. +Constants : 0 words. +Total program memory: 23 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 26.07.2016, 11:35:04 diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.avr b/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.avr new file mode 100644 index 00000000..dc26f917 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.avr @@ -0,0 +1,40 @@ +;* ******************************************************** * +; ATtiny 13/45/85 Pin map +; +-\/-+ +; /Reset ADC0 PB5 1|o |8 Vcc +; ADC3 PB3 2| |7 PB2 ADC1 SCK +; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 +; GND 4| |5 PB0 OC0A MOSI AIN0 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny45 + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ;Reset + reti ;INT0 - External Int0 Vector + reti ;PCINT0 - Pin Change Interrupt handler + reti ;TIM1_COMPA - Timer1 Compare match A Handler + reti ;TIM1_OVF - Timer1 Overflow handler + reti ;TIM0_OVF - Timer0 Overflow handler + reti ;EE_RDY - EEPROM Ready Handler + reti ;ANA_COMP - Analog Comparator Handler + reti ;ADC - ADC Conversion Handler + reti ;TIM1_COMPB - Timer1 Compare match B Handler + reti ;TIM0_COMPA - Timer0 Compare match A Handler + reti ;TIM0_COMPB - Timer0 Compare match B Handler + reti ;WDT - Watchdog Overflow Handler + reti ;USI_START - USI Start + reti ;USI_OVF - USI Overflow + +.ORG $000F +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.hex b/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.hex new file mode 100644 index 00000000..b7212ee5 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.hex @@ -0,0 +1,5 @@ +:020000020000FC +:100000000EC0189518951895189518951895189567 +:100010001895189518951895189518951895F89499 +:060020000FE50DBFFFCF4C +:00000001FF diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.lst b/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.lst new file mode 100644 index 00000000..fb6ad6f4 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny45/tiny45.lst @@ -0,0 +1,55 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny45_primo.avr +Hex file: tiny45_primo.hex +Eeprom file: tiny45_primo.eep +Compiled: 26.07.2016, 11:33:17 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 13/45/85 Pin map + 3: ; +-\/-+ + 4: ; /Reset ADC0 PB5 1|o |8 Vcc + 5: ; ADC3 PB3 2| |7 PB2 ADC1 SCK + 6: ; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + 7: ; GND 4| |5 PB0 OC0A MOSI AIN0 + 8: ; +----+ + 9: ;* ******************************************************** */ + 10: + 11: ; Define processor type on top of the source code + 12: ; + 13: .DEVICE ATtiny45 + 14: + 15: ; Int-Vector area + 16: .CSEG + 17: .ORG $0000 + 18: 000000 C00E rjmp Setup ;Reset + 19: 000001 9518 reti ;INT0 - External Int0 Vector + 20: 000002 9518 reti ;PCINT0 - Pin Change Interrupt handler + 21: 000003 9518 reti ;TIM1_COMPA - Timer1 Compare match A Handler + 22: 000004 9518 reti ;TIM1_OVF - Timer1 Overflow handler + 23: 000005 9518 reti ;TIM0_OVF - Timer0 Overflow handler + 24: 000006 9518 reti ;EE_RDY - EEPROM Ready Handler + 25: 000007 9518 reti ;ANA_COMP - Analog Comparator Handler + 26: 000008 9518 reti ;ADC - ADC Conversion Handler + 27: 000009 9518 reti ;TIM1_COMPB - Timer1 Compare match B Handler + 28: 00000A 9518 reti ;TIM0_COMPA - Timer0 Compare match A Handler + 29: 00000B 9518 reti ;TIM0_COMPB - Timer0 Compare match B Handler + 30: 00000C 9518 reti ;WDT - Watchdog Overflow Handler + 31: 00000D 9518 reti ;USI_START - USI Start + 32: 00000E 9518 reti ;USI_OVF - USI Overflow + 33: + 34: .ORG $000F + 35: Setup: + 36: 00000F 94F8 cli ; Disable Interrupts + 37: 000010 E50F ldi r16, low(RAMEND) + 38: 000011 BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 39: Main: + 40: 000012 CFFF rjmp Main ; infinite loop + +Program : 19 words. +Constants : 0 words. +Total program memory: 19 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 26.07.2016, 11:33:17 diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.avr b/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.avr new file mode 100644 index 00000000..66d1f76d --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.avr @@ -0,0 +1,40 @@ +;* ******************************************************** * +; ATtiny 13/45/85 Pin map +; +-\/-+ +; /Reset ADC0 PB5 1|o |8 Vcc +; ADC3 PB3 2| |7 PB2 ADC1 SCK +; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 +; GND 4| |5 PB0 OC0A MOSI AIN0 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny85 + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ;Reset + reti ;INT0 - External Int0 Vector + reti ;PCINT0 - Pin Change Interrupt handler + reti ;TIM1_COMPA - Timer1 Compare match A Handler + reti ;TIM1_OVF - Timer1 Overflow handler + reti ;TIM0_OVF - Timer0 Overflow handler + reti ;EE_RDY - EEPROM Ready Handler + reti ;ANA_COMP - Analog Comparator Handler + reti ;ADC - ADC Conversion Handler + reti ;TIM1_COMPB - Timer1 Compare match B Handler + reti ;TIM0_COMPA - Timer0 Compare match A Handler + reti ;TIM0_COMPB - Timer0 Compare match B Handler + reti ;WDT - Watchdog Overflow Handler + reti ;USI_START - USI Start + reti ;USI_OVF - USI Overflow + +.ORG $000F +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.hex b/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.hex new file mode 100644 index 00000000..b7212ee5 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.hex @@ -0,0 +1,5 @@ +:020000020000FC +:100000000EC0189518951895189518951895189567 +:100010001895189518951895189518951895F89499 +:060020000FE50DBFFFCF4C +:00000001FF diff --git a/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.lst b/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.lst new file mode 100644 index 00000000..56b2f763 --- /dev/null +++ b/trunk/AVRProjects/00_ASM_Templates/ATTiny85/tiny85.lst @@ -0,0 +1,55 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny85_primo.avr +Hex file: tiny85_primo.hex +Eeprom file: tiny85_primo.eep +Compiled: 26.07.2016, 11:33:50 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 13/45/85 Pin map + 3: ; +-\/-+ + 4: ; /Reset ADC0 PB5 1|o |8 Vcc + 5: ; ADC3 PB3 2| |7 PB2 ADC1 SCK + 6: ; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + 7: ; GND 4| |5 PB0 OC0A MOSI AIN0 + 8: ; +----+ + 9: ;* ******************************************************** */ + 10: + 11: ; Define processor type on top of the source code + 12: ; + 13: .DEVICE ATtiny85 + 14: + 15: ; Int-Vector area + 16: .CSEG + 17: .ORG $0000 + 18: 000000 C00E rjmp Setup ;Reset + 19: 000001 9518 reti ;INT0 - External Int0 Vector + 20: 000002 9518 reti ;PCINT0 - Pin Change Interrupt handler + 21: 000003 9518 reti ;TIM1_COMPA - Timer1 Compare match A Handler + 22: 000004 9518 reti ;TIM1_OVF - Timer1 Overflow handler + 23: 000005 9518 reti ;TIM0_OVF - Timer0 Overflow handler + 24: 000006 9518 reti ;EE_RDY - EEPROM Ready Handler + 25: 000007 9518 reti ;ANA_COMP - Analog Comparator Handler + 26: 000008 9518 reti ;ADC - ADC Conversion Handler + 27: 000009 9518 reti ;TIM1_COMPB - Timer1 Compare match B Handler + 28: 00000A 9518 reti ;TIM0_COMPA - Timer0 Compare match A Handler + 29: 00000B 9518 reti ;TIM0_COMPB - Timer0 Compare match B Handler + 30: 00000C 9518 reti ;WDT - Watchdog Overflow Handler + 31: 00000D 9518 reti ;USI_START - USI Start + 32: 00000E 9518 reti ;USI_OVF - USI Overflow + 33: + 34: .ORG $000F + 35: Setup: + 36: 00000F 94F8 cli ; Disable Interrupts + 37: 000010 E50F ldi r16, low(RAMEND) + 38: 000011 BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 39: Main: + 40: 000012 CFFF rjmp Main ; infinite loop + +Program : 19 words. +Constants : 0 words. +Total program memory: 19 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 26.07.2016, 11:33:50 diff --git a/trunk/AVRProjects/00_C_Templates/ATMega1284/main.c b/trunk/AVRProjects/00_C_Templates/ATMega1284/main.c new file mode 100644 index 00000000..502e9cae --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega1284/main.c @@ -0,0 +1,44 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATmega 1284 Pin map + +-\/-+ + PB0 1|o |40 PA0 ADC0 + PB1 2| |39 PA1 ADC1 + AIN0 PB2 3| |38 PA2 ADC2 + AIN1 OC0A PB3 4| |37 PA3 ADC3 + OC0B PB4 5| |36 PA4 ADC4 + MOSI PB5 6| |35 PA5 ADC5 + MISO PB6 7| |34 PA6 ADC6 + SCK PB7 8| |33 PA7 ADC7 + /Reset 9| |32 AREF + VCC 10| |31 GND + GND 11| |30 AVCC + XTAL1 12| |29 PC7 + XTAL2 13| |28 PC6 + RXD0 PD0 14| |27 PC5 + TXD0 PD1 15| |26 PC4 + RXD1 PD2 16| |25 PC3 + TXD1 PD3 17| |24 PC2 + OC1B PD4 18| |23 PC1 SDA + OC1A PD5 19| |22 PC0 SCL + OC2B PD6 20| |21 PD7 OC2A + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega1284/main.h b/trunk/AVRProjects/00_C_Templates/ATMega1284/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega1284/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATMega1284/makefile b/trunk/AVRProjects/00_C_Templates/ATMega1284/makefile new file mode 100644 index 00000000..261ed4ea --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega1284/makefile @@ -0,0 +1,442 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega1284p + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega168/main.c b/trunk/AVRProjects/00_C_Templates/ATMega168/main.c new file mode 100644 index 00000000..841785e5 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega168/main.c @@ -0,0 +1,38 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega168/main.h b/trunk/AVRProjects/00_C_Templates/ATMega168/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega168/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATMega168/makefile b/trunk/AVRProjects/00_C_Templates/ATMega168/makefile new file mode 100644 index 00000000..bdfdd783 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega168/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega168p + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 8000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega328/main.c b/trunk/AVRProjects/00_C_Templates/ATMega328/main.c new file mode 100644 index 00000000..841785e5 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega328/main.c @@ -0,0 +1,38 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega328/main.h b/trunk/AVRProjects/00_C_Templates/ATMega328/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega328/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATMega328/makefile b/trunk/AVRProjects/00_C_Templates/ATMega328/makefile new file mode 100644 index 00000000..6ca483c7 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega328/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega328 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega48/main.c b/trunk/AVRProjects/00_C_Templates/ATMega48/main.c new file mode 100644 index 00000000..841785e5 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega48/main.c @@ -0,0 +1,38 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATMega48/main.h b/trunk/AVRProjects/00_C_Templates/ATMega48/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega48/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATMega48/makefile b/trunk/AVRProjects/00_C_Templates/ATMega48/makefile new file mode 100644 index 00000000..54f7eefd --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATMega48/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega48v + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 8000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny13/main.c b/trunk/AVRProjects/00_C_Templates/ATTiny13/main.c new file mode 100644 index 00000000..d61dc466 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny13/main.c @@ -0,0 +1,26 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 13/45/85 Pin map + +-\/-+ + /Reset ADC0 PB5 1|o |8 Vcc + ADC3 PB3 2| |7 PB2 ADC1 SCK + ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + GND 4| |5 PB0 OC0A MOSI AIN0 + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } +} diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny13/main.h b/trunk/AVRProjects/00_C_Templates/ATTiny13/main.h new file mode 100644 index 00000000..8c42d94d --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny13/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 9600000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny13/makefile b/trunk/AVRProjects/00_C_Templates/ATTiny13/makefile new file mode 100644 index 00000000..c1ba6d20 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny13/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny13 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +#F_OSC = 9600000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny2313/main.c b/trunk/AVRProjects/00_C_Templates/ATTiny2313/main.c new file mode 100644 index 00000000..1e754d67 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny2313/main.c @@ -0,0 +1,34 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ +/* ******************************************************** * + ATtiny 2313/4313 Pin map + +-\/-+ + /Reset PA2 1|o |20 Vcc + RXD PD0 2| |19 PB7 SCK + TXD PD1 3| |18 PB6 MISO + PA1 4| |17 PB5 MOSI + PA0 5| |16 PB4 OC1B + PD2 6| |15 PB3 OC1A + PD3 7| |14 PB2 OC0A + PD4 8| |13 PB1 AIN1 + OC0B PD5 9| |12 PB0 AIN0 + GND 10| |11 PD6 + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny2313/main.h b/trunk/AVRProjects/00_C_Templates/ATTiny2313/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny2313/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny2313/makefile b/trunk/AVRProjects/00_C_Templates/ATTiny2313/makefile new file mode 100644 index 00000000..d3d8993d --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny2313/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny2313 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 1000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny45/main.c b/trunk/AVRProjects/00_C_Templates/ATTiny45/main.c new file mode 100644 index 00000000..d61dc466 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny45/main.c @@ -0,0 +1,26 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 13/45/85 Pin map + +-\/-+ + /Reset ADC0 PB5 1|o |8 Vcc + ADC3 PB3 2| |7 PB2 ADC1 SCK + ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + GND 4| |5 PB0 OC0A MOSI AIN0 + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } +} diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny45/main.h b/trunk/AVRProjects/00_C_Templates/ATTiny45/main.h new file mode 100644 index 00000000..8c42d94d --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny45/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 9600000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny45/makefile b/trunk/AVRProjects/00_C_Templates/ATTiny45/makefile new file mode 100644 index 00000000..c1d15a4c --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny45/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny45 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +#F_OSC = 9600000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny84/main.c b/trunk/AVRProjects/00_C_Templates/ATTiny84/main.c new file mode 100644 index 00000000..af17c560 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny84/main.c @@ -0,0 +1,31 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 84 Pin map + +-\/-+ + GND 1|o |14 GND + PB0 2| |13 PA0 ADC0 + PB1 3| |12 PA1 ADC1 + /Reset PB3 4| |11 PA2 ADC2 + PB2 5| |10 PA3 ADC3 + ADC7 PA7 6| |9 PA4 ADC4 SCK + MOSI ADC6 PA6 7| |8 PA5 ADC5 MISO + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny84/main.h b/trunk/AVRProjects/00_C_Templates/ATTiny84/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny84/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny84/makefile b/trunk/AVRProjects/00_C_Templates/ATTiny84/makefile new file mode 100644 index 00000000..44d9bf30 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny84/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny84 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +#F_OSC = 9600000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny85/main.c b/trunk/AVRProjects/00_C_Templates/ATTiny85/main.c new file mode 100644 index 00000000..d61dc466 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny85/main.c @@ -0,0 +1,26 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 13/45/85 Pin map + +-\/-+ + /Reset ADC0 PB5 1|o |8 Vcc + ADC3 PB3 2| |7 PB2 ADC1 SCK + ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + GND 4| |5 PB0 OC0A MOSI AIN0 + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } +} diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny85/main.h b/trunk/AVRProjects/00_C_Templates/ATTiny85/main.h new file mode 100644 index 00000000..8c42d94d --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny85/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 9600000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny85/makefile b/trunk/AVRProjects/00_C_Templates/ATTiny85/makefile new file mode 100644 index 00000000..1d887f0c --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny85/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny85 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +#F_OSC = 9600000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny88/main.c b/trunk/AVRProjects/00_C_Templates/ATTiny88/main.c new file mode 100644 index 00000000..841785e5 --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny88/main.c @@ -0,0 +1,38 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include "main.h" + +int main (void) +{ + while(1) + { + // Enter your code here + } + return(0); +} + diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny88/main.h b/trunk/AVRProjects/00_C_Templates/ATTiny88/main.h new file mode 100644 index 00000000..8c42d94d --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny88/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 9600000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/00_C_Templates/ATTiny88/makefile b/trunk/AVRProjects/00_C_Templates/ATTiny88/makefile new file mode 100644 index 00000000..be7d56cf --- /dev/null +++ b/trunk/AVRProjects/00_C_Templates/ATTiny88/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny88 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATMega1284/.dep/main.o.d b/trunk/AVRProjects/ATMega1284/.dep/main.o.d new file mode 100644 index 00000000..9d014f60 --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/.dep/main.o.d @@ -0,0 +1,43 @@ +main.o: main.c \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom1284p.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom1284p.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: diff --git a/trunk/AVRProjects/ATMega1284/main.c b/trunk/AVRProjects/ATMega1284/main.c new file mode 100644 index 00000000..e6fe1733 --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.c @@ -0,0 +1,50 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATmega 1284 Pin map + +-\/-+ + PB0 1|o |40 PA0 ADC0 + PB1 2| |39 PA1 ADC1 + AIN0 PB2 3| |38 PA2 ADC2 + AIN1 OC0A PB3 4| |37 PA3 ADC3 + OC0B PB4 5| |36 PA4 ADC4 + MOSI PB5 6| |35 PA5 ADC5 + MISO PB6 7| |34 PA6 ADC6 + SCK PB7 8| |33 PA7 ADC7 + /Reset 9| |32 AREF + VCC 10| |31 GND + GND 11| |30 AVCC + XTAL1 12| |29 PC7 + XTAL2 13| |28 PC6 + RXD0 PD0 14| |27 PC5 + TXD0 PD1 15| |26 PC4 + RXD1 PD2 16| |25 PC3 + TXD1 PD3 17| |24 PC2 + OC1B PD4 18| |23 PC1 SDA + OC1A PD5 19| |22 PC0 SCL + OC2B PD6 20| |21 PD7 OC2A + +----+ +* ******************************************************** */ + +#include +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000001; + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + PORTB = zwischenspeicher; + _delay_ms(500); + } + return 0; +} + diff --git a/trunk/AVRProjects/ATMega1284/main.eep b/trunk/AVRProjects/ATMega1284/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATMega1284/main.elf b/trunk/AVRProjects/ATMega1284/main.elf new file mode 100644 index 00000000..ba593340 Binary files /dev/null and b/trunk/AVRProjects/ATMega1284/main.elf differ diff --git a/trunk/AVRProjects/ATMega1284/main.hex b/trunk/AVRProjects/ATMega1284/main.hex new file mode 100644 index 00000000..81263dac --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.hex @@ -0,0 +1,14 @@ +:100000000C9446000C9450000C9450000C9450003A +:100010000C9450000C9450000C9450000C94500020 +:100020000C9450000C9450000C9450000C94500010 +:100030000C9450000C9450000C9450000C94500000 +:100040000C9450000C9450000C9450000C945000F0 +:100050000C9450000C9450000C9450000C945000E0 +:100060000C9450000C9450000C9450000C945000D0 +:100070000C9450000C9450000C9450000C945000C0 +:100080000C9450000C9450000C94500011241FBE8E +:10009000CFEFD0E4DEBFCDBF0E9452000C946200CF +:1000A0000C94000081E084B991E085B1892785B97D +:1000B0002FE936E881E0215030408040E1F700C070 +:0800C0000000F3CFF894FFCF1C +:00000001FF diff --git a/trunk/AVRProjects/ATMega1284/main.lss b/trunk/AVRProjects/ATMega1284/main.lss new file mode 100644 index 00000000..dff86297 --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.lss @@ -0,0 +1,127 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 000000c8 0000013c 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 000000c8 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 00000011 00000000 00000000 0000013c 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000020 00000000 00000000 0000014d 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000119 00000000 00000000 0000016d 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 000000d1 00000000 00000000 00000286 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000000d7 00000000 00000000 00000357 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000024 00000000 00000000 00000430 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 00000137 00000000 00000000 00000454 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 0000001f 00000000 00000000 0000058b 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000010 00000000 00000000 000005aa 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 0c 94 46 00 jmp 0x8c ; 0x8c <__ctors_end> + 4: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 8: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 10: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 14: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 18: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 1c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 20: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 24: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 28: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 2c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 30: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 34: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 38: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 3c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 40: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 44: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 48: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 4c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 50: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 54: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 58: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 5c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 60: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 64: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 68: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 6c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 70: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 74: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 78: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 7c: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 80: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 84: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + 88: 0c 94 50 00 jmp 0xa0 ; 0xa0 <__bad_interrupt> + +0000008c <__ctors_end>: + 8c: 11 24 eor r1, r1 + 8e: 1f be out 0x3f, r1 ; 63 + 90: cf ef ldi r28, 0xFF ; 255 + 92: d0 e4 ldi r29, 0x40 ; 64 + 94: de bf out 0x3e, r29 ; 62 + 96: cd bf out 0x3d, r28 ; 61 + 98: 0e 94 52 00 call 0xa4 ; 0xa4
+ 9c: 0c 94 62 00 jmp 0xc4 ; 0xc4 <_exit> + +000000a0 <__bad_interrupt>: + a0: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> + +000000a4
: +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000001; + a4: 81 e0 ldi r24, 0x01 ; 1 + a6: 84 b9 out 0x04, r24 ; 4 + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + a8: 91 e0 ldi r25, 0x01 ; 1 +{ + unsigned char zwischenspeicher; + DDRB = 0b00000001; + while(1) + { + zwischenspeicher = PORTB; + aa: 85 b1 in r24, 0x05 ; 5 + zwischenspeicher = zwischenspeicher ^ 0b00000001; + ac: 89 27 eor r24, r25 + PORTB = zwischenspeicher; + ae: 85 b9 out 0x05, r24 ; 5 + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + b0: 2f e9 ldi r18, 0x9F ; 159 + b2: 36 e8 ldi r19, 0x86 ; 134 + b4: 81 e0 ldi r24, 0x01 ; 1 + b6: 21 50 subi r18, 0x01 ; 1 + b8: 30 40 sbci r19, 0x00 ; 0 + ba: 80 40 sbci r24, 0x00 ; 0 + bc: e1 f7 brne .-8 ; 0xb6 + be: 00 c0 rjmp .+0 ; 0xc0 + c0: 00 00 nop + c2: f3 cf rjmp .-26 ; 0xaa + +000000c4 <_exit>: + c4: f8 94 cli + +000000c6 <__stop_program>: + c6: ff cf rjmp .-2 ; 0xc6 <__stop_program> diff --git a/trunk/AVRProjects/ATMega1284/main.lst b/trunk/AVRProjects/ATMega1284/main.lst new file mode 100644 index 00000000..c687f079 --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.lst @@ -0,0 +1,245 @@ + 1 .file "main.c" + 2 __SP_H__ = 0x3e + 3 __SP_L__ = 0x3d + 4 __SREG__ = 0x3f + 5 __RAMPZ__ = 0x3b + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 8 .text + 9 .Ltext0: + 10 .cfi_sections .debug_frame + 11 .section .text.startup,"ax",@progbits + 12 .global main + 14 main: + 15 .LFB6: + 16 .file 1 "main.c" + 1:main.c **** #include + 2:main.c **** #include + 3:main.c **** + 4:main.c **** int main (void) + 5:main.c **** { + 17 .loc 1 5 0 + 18 .cfi_startproc + 19 /* prologue: function */ + 20 /* frame size = 0 */ + 21 /* stack size = 0 */ + 22 .L__stack_usage = 0 + 6:main.c **** unsigned char zwischenspeicher; + 7:main.c **** DDRB = 0b00000001; + 23 .loc 1 7 0 + 24 0000 81E0 ldi r24,lo8(1) + 25 0002 84B9 out 0x4,r24 + 8:main.c **** while(1) + 9:main.c **** { + 10:main.c **** zwischenspeicher = PORTB; + 11:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000001; + 26 .loc 1 11 0 + 27 0004 91E0 ldi r25,lo8(1) + 28 .L2: + 10:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000001; + 29 .loc 1 10 0 discriminator 1 + 30 0006 85B1 in r24,0x5 + 31 .LVL0: + 32 .loc 1 11 0 discriminator 1 + 33 0008 8927 eor r24,r25 + 34 .LVL1: + 12:main.c **** PORTB = zwischenspeicher; + 35 .loc 1 12 0 discriminator 1 + 36 000a 85B9 out 0x5,r24 + 37 .LVL2: + 38 .LBB4: + 39 .LBB5: + 40 .file 2 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\util\\delay.h" + 1:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz + 2:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch + 3:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2007 Florin-Viorel Petrov + 4:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** All rights reserved. + 5:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 6:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Redistribution and use in source and binary forms, with or without + 7:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** modification, are permitted provided that the following conditions are met: + 8:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 9:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions of source code must retain the above copyright + 10:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer. + 11:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 12:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions in binary form must reproduce the above copyright + 13:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer in + 14:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the documentation and/or other materials provided with the + 15:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** distribution. + 16:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 17:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Neither the name of the copyright holders nor the names of + 18:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** contributors may be used to endorse or promote products derived + 19:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** from this software without specific prior written permission. + 20:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 21:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + 22:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + 23:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + 24:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + 25:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + 26:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + 27:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + 28:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + 29:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 30:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + 31:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** POSSIBILITY OF SUCH DAMAGE. */ + 32:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 33:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* $Id$ */ + 34:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 35:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef _UTIL_DELAY_H_ + 36:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define _UTIL_DELAY_H_ 1 + 37:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 38:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __HAS_DELAY_CYCLES + 39:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define __HAS_DELAY_CYCLES 1 + 40:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 41:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 42:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \file */ + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \code + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define F_CPU 1000000UL // 1 MHz + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //#define F_CPU 14.7456E6 + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \endcode + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note As an alternative method, it is possible to pass the + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU macro down to the compiler from the Makefile. + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Obviously, in that case, no \c \#define statement should be + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** used. + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions in this header file are wrappers around the basic + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** busy-wait functions from . They are meant as + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** convenience functions where actual time values can be specified + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** rather than a number of cycles to wait for. The idea behind is + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** that compile-time constant expressions will be eliminated by + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compiler optimization so floating-point expressions can be used + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to calculate the number of delay cycles needed based on the CPU + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** frequency passed by the macro F_CPU. + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note In order for these functions to work as intended, compiler + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** optimizations must be enabled, and the delay time + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** must be an expression that is a known constant at + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compile-time. If these requirements are not met, the resulting + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delay will be much longer (and basically unpredictable), and + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** applications that otherwise do not use floating-point calculations + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** will experience severe code bloat by the floating-point library + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** routines linked into the application. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions available allow the specification of microsecond, and + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** millisecond delays directly, using the application-supplied macro + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU as the CPU clock frequency (in Hertz). + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if !defined(__DOXYGEN__) + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef F_CPU + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* prevent compiler error by supplying a default */ + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "F_CPU not defined for " + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # define F_CPU 1000000UL + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __OPTIMIZE__ + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # include + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \ingroup util_delay + 106:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 107:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + 108:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 109:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The macro F_CPU is supposed to be defined to a + 110:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** constant defining the CPU clock frequency (in Hertz). + 111:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 112:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. + 113:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 114:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** When the user request delay which exceed the maximum possible one, + 115:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms() provides a decreased resolution functionality. In this + 116:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing + 117:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The + 118:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** user will not be informed about decreased resolution. + 119:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 120:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) + 121:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For + 122:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** values greater than the maximal possible delay, overflows results in + 123:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** no delay i.e., 0ms. + 124:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 125:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Conversion of __us into clock cycles may not always result in integer. + 126:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** By default, the clock cycles rounded up to next integer. This ensures that + 127:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the user gets atleast __us microseconds of delay. + 128:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 129:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ + 130:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to round down and round to closest integer. + 131:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 132:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Note: The new implementation of _delay_ms(double __ms) with + 133:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. + 134:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. + 135:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Also, the backward compatible + 136:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** algorithm will be chosen if the code is compiled in a freestanding + 137:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** environment (GCC option \c -ffreestanding), as the math functions + 138:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** required for rounding are not available to the compiler then. + 139:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 140:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 141:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** void + 142:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms(double __ms) + 143:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 144:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** double __tmp ; + 145:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 146:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 147:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 148:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint32_t __ticks_dc; + 149:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); + 150:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; + 151:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 152:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if defined(__DELAY_ROUND_DOWN__) + 153:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); + 154:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 155:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) + 156:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); + 157:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 158:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 159:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //round up by default + 160:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + 161:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 162:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 163:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(__ticks_dc); + 41 .loc 2 163 0 discriminator 1 + 42 000c 2FE9 ldi r18,lo8(99999) + 43 000e 36E8 ldi r19,hi8(99999) + 44 0010 81E0 ldi r24,hlo8(99999) + 45 0012 2150 1: subi r18,1 + 46 0014 3040 sbci r19,0 + 47 0016 8040 sbci r24,0 + 48 0018 01F4 brne 1b + 49 .LVL3: + 50 001a 00C0 rjmp . + 51 001c 0000 nop + 52 001e 00C0 rjmp .L2 + 53 .LBE5: + 54 .LBE4: + 55 .cfi_endproc + 56 .LFE6: + 58 .text + 59 .Letext0: + 60 .file 3 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\stdint.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:2 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:3 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:4 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:5 *ABS*:0000003b __RAMPZ__ +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:6 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:7 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\ccaDJnRY.s:14 .text.startup:00000000 main + +NO UNDEFINED SYMBOLS diff --git a/trunk/AVRProjects/ATMega1284/main.map b/trunk/AVRProjects/ATMega1284/main.map new file mode 100644 index 00000000..9ed2f402 --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.map @@ -0,0 +1,447 @@ +Archive member included because of file (symbol) + +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00020000 xr +data 0x00800100 0x0000ff00 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +Address of section .data set to 0x800100 +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +LOAD main.o +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51\libm.a +START GROUP +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51\libm.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51\libc.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0xc8 + *(.vectors) + .vectors 0x00000000 0x8c e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + 0x00000000 __vectors + 0x00000000 __vector_default + *(.vectors) + *(.progmem.gcc*) + 0x0000008c . = ALIGN (0x2) + 0x0000008c __trampolines_start = . + *(.trampolines) + .trampolines 0x0000008c 0x0 linker stubs + *(.trampolines*) + 0x0000008c __trampolines_end = . + *(.progmem*) + 0x0000008c . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x0000008c __ctors_start = . + *(.ctors) + 0x0000008c __ctors_end = . + 0x0000008c __dtors_start = . + *(.dtors) + 0x0000008c __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x0000008c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + 0x0000008c __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x0000008c 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x00000098 0x8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + *(.init9) + *(.text) + .text 0x000000a0 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + 0x000000a0 __vector_22 + 0x000000a0 __vector_28 + 0x000000a0 __vector_1 + 0x000000a0 __vector_32 + 0x000000a0 __vector_34 + 0x000000a0 __vector_24 + 0x000000a0 __vector_12 + 0x000000a0 __bad_interrupt + 0x000000a0 __vector_6 + 0x000000a0 __vector_31 + 0x000000a0 __vector_3 + 0x000000a0 __vector_23 + 0x000000a0 __vector_30 + 0x000000a0 __vector_25 + 0x000000a0 __vector_11 + 0x000000a0 __vector_13 + 0x000000a0 __vector_17 + 0x000000a0 __vector_19 + 0x000000a0 __vector_7 + 0x000000a0 __vector_27 + 0x000000a0 __vector_5 + 0x000000a0 __vector_33 + 0x000000a0 __vector_4 + 0x000000a0 __vector_9 + 0x000000a0 __vector_2 + 0x000000a0 __vector_21 + 0x000000a0 __vector_15 + 0x000000a0 __vector_29 + 0x000000a0 __vector_8 + 0x000000a0 __vector_26 + 0x000000a0 __vector_14 + 0x000000a0 __vector_10 + 0x000000a0 __vector_16 + 0x000000a0 __vector_18 + 0x000000a0 __vector_20 + .text 0x000000a4 0x0 main.o + .text 0x000000a4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + 0x000000a4 . = ALIGN (0x2) + *(.text.*) + .text.startup 0x000000a4 0x20 main.o + 0x000000a4 main + .text.libgcc.mul + 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + .text.libgcc.div + 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + .text.libgcc 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + 0x000000c4 . = ALIGN (0x2) + *(.fini9) + .fini9 0x000000c4 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + 0x000000c4 exit + 0x000000c4 _exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x000000c4 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + *(.fini0) + 0x000000c8 _etext = . + +.data 0x00800100 0x0 load address 0x000000c8 + 0x00800100 PROVIDE (__data_start, .) + *(.data) + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + .data 0x00800100 0x0 main.o + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800100 . = ALIGN (0x2) + 0x00800100 _edata = . + 0x00800100 PROVIDE (__data_end, .) + +.bss 0x00800100 0x0 + 0x00800100 PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o + .bss 0x00800100 0x0 main.o + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + 0x00800100 PROVIDE (__bss_end, .) + 0x000000c8 __data_load_start = LOADADDR (.data) + 0x000000c8 __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800100 0x0 + 0x00800100 PROVIDE (__noinit_start, .) + *(.noinit*) + 0x00800100 PROVIDE (__noinit_end, .) + 0x00800100 _end = . + 0x00800100 PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x20 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x119 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x119 main.o + +.debug_abbrev 0x00000000 0xd1 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0xd1 main.o + +.debug_line 0x00000000 0xd7 + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0xd7 main.o + +.debug_frame 0x00000000 0x24 + *(.debug_frame) + .debug_frame 0x00000000 0x24 main.o + +.debug_str 0x00000000 0x137 + *(.debug_str) + .debug_str 0x00000000 0x137 main.o + 0x16b (size before relaxing) + +.debug_loc 0x00000000 0x1f + *(.debug_loc) + .debug_loc 0x00000000 0x1f main.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x10 + *(.debug_ranges) + .debug_ranges 0x00000000 0x10 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +__bad_interrupt e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__heap_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__init e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__stack e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_1 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_10 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_11 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_12 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_13 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_14 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_15 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_17 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_18 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_19 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_20 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_21 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_23 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_24 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_25 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_26 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_27 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_28 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_29 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_30 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_31 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_32 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_33 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_34 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_5 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_7 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_9 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vector_default e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +__vectors e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +_exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) +exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr51\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o +main main.o + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr51/crtm1284p.o diff --git a/trunk/AVRProjects/ATMega1284/main.sym b/trunk/AVRProjects/ATMega1284/main.sym new file mode 100644 index 00000000..4b71a5c7 --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/main.sym @@ -0,0 +1,62 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +0000003b a __RAMPZ__ +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003f a __SREG__ +0000008c T __ctors_end +0000008c T __ctors_start +0000008c T __dtors_end +0000008c T __dtors_start +0000008c W __init +0000008c T __trampolines_end +0000008c T __trampolines_start +000000a0 T __bad_interrupt +000000a0 W __vector_1 +000000a0 W __vector_10 +000000a0 W __vector_11 +000000a0 W __vector_12 +000000a0 W __vector_13 +000000a0 W __vector_14 +000000a0 W __vector_15 +000000a0 W __vector_16 +000000a0 W __vector_17 +000000a0 W __vector_18 +000000a0 W __vector_19 +000000a0 W __vector_2 +000000a0 W __vector_20 +000000a0 W __vector_21 +000000a0 W __vector_22 +000000a0 W __vector_23 +000000a0 W __vector_24 +000000a0 W __vector_25 +000000a0 W __vector_26 +000000a0 W __vector_27 +000000a0 W __vector_28 +000000a0 W __vector_29 +000000a0 W __vector_3 +000000a0 W __vector_30 +000000a0 W __vector_31 +000000a0 W __vector_32 +000000a0 W __vector_33 +000000a0 W __vector_34 +000000a0 W __vector_4 +000000a0 W __vector_5 +000000a0 W __vector_6 +000000a0 W __vector_7 +000000a0 W __vector_8 +000000a0 W __vector_9 +000000a4 T main +000000c4 T _exit +000000c4 W exit +000000c6 t __stop_program +000000c8 A __data_load_end +000000c8 A __data_load_start +000000c8 T _etext +000040ff W __stack +00800100 D _edata +00800100 N _end +00810000 N __eeprom_end diff --git a/trunk/AVRProjects/ATMega1284/makefile b/trunk/AVRProjects/ATMega1284/makefile new file mode 100644 index 00000000..261ed4ea --- /dev/null +++ b/trunk/AVRProjects/ATMega1284/makefile @@ -0,0 +1,442 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega1284p + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATMega168/.dep/main.o.d b/trunk/AVRProjects/ATMega168/.dep/main.o.d new file mode 100644 index 00000000..1a8a825c --- /dev/null +++ b/trunk/AVRProjects/ATMega168/.dep/main.o.d @@ -0,0 +1,46 @@ +main.o: main.c \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom168p.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\setbaud.h + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom168p.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\setbaud.h: diff --git a/trunk/AVRProjects/ATMega168/Example_Serial/Makefile b/trunk/AVRProjects/ATMega168/Example_Serial/Makefile new file mode 100644 index 00000000..3cafdd53 --- /dev/null +++ b/trunk/AVRProjects/ATMega168/Example_Serial/Makefile @@ -0,0 +1,509 @@ +# Hey Emacs, this is a -*- makefile -*- +#---------------------------------------------------------------------------- +# WinAVR Makefile Template written by Eric B. Weddington, Jörg Wunsch, et al. +# +# Released to the Public Domain +# +# Additional material for this makefile was written by: +# Peter Fleury +# Tim Henigan +# Colin O'Flynn +# Reiner Patommel +# Markus Pfaff +# Sander Pool +# Frederik Rouleau +# +#---------------------------------------------------------------------------- +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF. +# +# make extcoff = Convert ELF to AVR Extended COFF. +# +# make program = Download the hex file to the device, using avrdude. +# Please customize the avrdude settings below first! +# +# make debug = Start either simulavr or avarice as specified for debugging, +# with avr-gdb or avr-insight as the front end for debugging. +# +# make filename.s = Just compile filename.c into the assembler code only. +# +# make filename.i = Create a preprocessed source file for use in submitting +# bug reports to the GCC project. +# +# To rebuild project do "make clean" then "make all". +#---------------------------------------------------------------------------- + + +# MCU name +MCU = atmega168 + + +# Processor frequency. +# This will define a symbol, F_CPU, in all source code files equal to the +# processor frequency. You can then use this symbol in your source code to +# calculate timings. Do NOT tack on a 'UL' at the end, this will be done +# automatically to create a 32-bit value in your source code. +F_CPU = 8000000 + + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + + +# Target file name (without extension). +TARGET = basic-in-atmega168 + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + + +# Debugging format. +# Native formats for AVR-GCC's -g are dwarf-2 [default] or stabs. +# AVR Studio 4.10 requires dwarf-2. +# AVR [Extended] COFF format requires stabs, plus an avr-objcopy run. +DEBUG = dwarf-2 + + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +# Use forward slashes for directory separators. +# For a directory that has spaces, enclose it in quotes. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 = "ANSI" C +# gnu89 = c89 plus GCC extensions +# c99 = ISO C99 standard (not yet fully implemented) +# gnu99 = c99 plus GCC extensions +CSTANDARD = -std=gnu99 + + +# Place -D or -U options here +CDEFS = -DF_CPU=$(F_CPU)UL + + +# Place -I options here +CINCS = + + + +#---------------- Compiler Options ---------------- +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) + + +#---------------- Assembler Options ---------------- +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs + + +#---------------- Library Options ---------------- +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +# If this is left blank, then it will use the Standard printf version. +PRINTF_LIB = +#PRINTF_LIB = $(PRINTF_LIB_MIN) +#PRINTF_LIB = $(PRINTF_LIB_FLOAT) + + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +# If this is left blank, then it will use the Standard scanf version. +SCANF_LIB = +#SCANF_LIB = $(SCANF_LIB_MIN) +#SCANF_LIB = $(SCANF_LIB_FLOAT) + + +MATH_LIB = -lm + + + +#---------------- External Memory Options ---------------- + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + + + +#---------------- Linker Options ---------------- +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + +#---------------- Programming Options (avrdude) ---------------- + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +AVRDUDE_PROGRAMMER = stk200 + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = lpt1 + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +#---------------- Debugging Options ---------------- + +# For simulavr only - target MCU frequency. +DEBUG_MFREQ = $(F_CPU) + +# Set the DEBUG_UI to either gdb or insight. +# DEBUG_UI = gdb +DEBUG_UI = insight + +# Set the debugging back-end to either avarice, simulavr. +DEBUG_BACKEND = avarice +#DEBUG_BACKEND = simulavr + +# GDB Init Filename. +GDBINIT_FILE = __avr_gdbinit + +# When using avarice settings for the JTAG +JTAG_DEV = /dev/com1 + +# Debugging port used to communicate between GDB / avarice / simulavr. +DEBUG_PORT = 4242 + +# Debugging host used to communicate between GDB / avarice / simulavr, normally +# just set to localhost unless doing some sort of crazy debugging when +# avarice is running on a different computer. +DEBUG_HOST = localhost + + + +#============================================================================ + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp +WINSHELL = cmd + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(SRC:.c=.lst) $(ASRC:.S=.lst) + + +# Compiler flags to generate dependency files. +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +all: begin gccversion sizebefore build sizeafter end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +AVRMEM = avr-mem.sh $(TARGET).elf $(MCU) + +sizebefore: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); \ + $(AVRMEM) 2>/dev/null; echo; fi + +sizeafter: + @if test -f $(TARGET).elf; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); \ + $(AVRMEM) 2>/dev/null; echo; fi + + + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + +# Generate avr-gdb config/init file which does the following: +# define the reset signal, load the target file, connect to target, and set +# a breakpoint at main(). +gdb-config: + @$(REMOVE) $(GDBINIT_FILE) + @echo define reset >> $(GDBINIT_FILE) + @echo SIGNAL SIGHUP >> $(GDBINIT_FILE) + @echo end >> $(GDBINIT_FILE) + @echo file $(TARGET).elf >> $(GDBINIT_FILE) + @echo target remote $(DEBUG_HOST):$(DEBUG_PORT) >> $(GDBINIT_FILE) +ifeq ($(DEBUG_BACKEND),simulavr) + @echo load >> $(GDBINIT_FILE) +endif + @echo break main >> $(GDBINIT_FILE) + +debug: gdb-config $(TARGET).elf +ifeq ($(DEBUG_BACKEND), avarice) + @echo Starting AVaRICE - Press enter when "waiting to connect" message displays. + @$(WINSHELL) /c start avarice --jtag $(JTAG_DEV) --erase --program --file \ + $(TARGET).elf $(DEBUG_HOST):$(DEBUG_PORT) + @$(WINSHELL) /c pause + +else + @$(WINSHELL) /c start simulavr --gdbserver --device $(MCU) --clock-freq \ + $(DEBUG_MFREQ) --port $(DEBUG_PORT) +endif + @$(WINSHELL) /c start avr-$(DEBUG_UI) --command=$(GDBINIT_FILE) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $^ --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + +# Create preprocessed source for use in sending a bug report. +%.i : %.c + $(CC) -E -mmcu=$(MCU) -I. $(CFLAGS) $< -o $@ + + +# Target: clean project. +clean: begin clean_list end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program debug gdb-config + + + diff --git a/trunk/AVRProjects/ATMega168/Example_Serial/basic-in-atmega168.c b/trunk/AVRProjects/ATMega168/Example_Serial/basic-in-atmega168.c new file mode 100644 index 00000000..c72430ba --- /dev/null +++ b/trunk/AVRProjects/ATMega168/Example_Serial/basic-in-atmega168.c @@ -0,0 +1,97 @@ +/* + 5-10-07 + Copyright Spark Fun Electronics© 2007 + Nathan Seidle + nathan at sparkfun.com + + Example basic printf input/output +*/ + +#include +#include + +#define FOSC 16000000 +#define BAUD 9600 +#define MYUBRR FOSC/16/BAUD-1 + +#define sbi(var, mask) ((var) |= (uint8_t)(1 << mask)) +#define cbi(var, mask) ((var) &= (uint8_t)~(1 << mask)) + +#define STATUS_LED 0 + +//Define functions +//====================== +void ioinit(void); // initializes IO +static int uart_putchar(char c, FILE *stream); +uint8_t uart_getchar(void); + +static FILE mystdout = FDEV_SETUP_STREAM(uart_putchar, NULL, _FDEV_SETUP_WRITE); + +void delay_ms(uint16_t x); // general purpose delay +//====================== + +int main (void) +{ + uint8_t key_press; + + ioinit(); //Setup IO pins and defaults + + printf("Waiting for input:\n"); + + while(1) + { + key_press = uart_getchar(); + + printf("I heard : %c\n", key_press); + + if(key_press == 'g') printf(" GO!\n"); + if(key_press == 'X') printf(" EXIT\n"); + if(key_press == 13) printf(" RETURN\n"); + } + + return(0); +} + +void ioinit (void) +{ + //1 = output, 0 = input + DDRB = 0b11101111; //PB4 = MISO + DDRC = 0b11111111; // + DDRD = 0b11111110; //PORTD (RX on PD0) + + //USART Baud rate: 9600 + UBRR0H = MYUBRR >> 8; + UBRR0L = MYUBRR; + UCSR0B = (1< 0 ; x--){ + for ( y = 0 ; y < 80 ; y++){ + for ( z = 0 ; z < 40 ; z++){ + asm volatile ("nop"); + } + } + } +} \ No newline at end of file diff --git a/trunk/AVRProjects/ATMega168/main.c b/trunk/AVRProjects/ATMega168/main.c new file mode 100644 index 00000000..675b62df --- /dev/null +++ b/trunk/AVRProjects/ATMega168/main.c @@ -0,0 +1,138 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#ifndef F_CPU +#define F_CPU 8000000 +#endif + +#include +#include +#define BAUD 9600 +#define m168p +#include + +/* Definizioni per il m168p */ +#ifdef m168p +#define UCSRA UCSR0A +#define UCSRB UCSR0B +#define UCSRC UCSR0C +#define UBRRH UBRR0H +#define UBRRL UBRR0L +#define U2X U2X0 +#define UDRE UDRE0 +#define UDR UDR0 +#endif +/* fine definizioni per il m168p*/ + +/* Inizializza la porta seriale */ +void uart_init(void) +{ + UBRRH = UBRRH_VALUE; + UBRRL = UBRRL_VALUE; +#if USE_2X0 + UCSRA |= (1 << U2X); +#else + UCSRA &= ~(1 << U2X); +#endif + + UCSRC= _BV(UCSZ01) | _BV(UCSZ00); // 8 N 1 + UCSRB= (1<: + 0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end> + 4: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 8: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 10: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 14: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 18: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 1c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 20: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 24: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 28: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 2c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 30: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 34: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 38: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 3c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 40: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 44: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 48: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 4c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 50: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 54: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 58: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 5c: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 60: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + 64: 0c 94 49 00 jmp 0x92 ; 0x92 <__bad_interrupt> + +00000068 <__ctors_end>: + 68: 11 24 eor r1, r1 + 6a: 1f be out 0x3f, r1 ; 63 + 6c: cf ef ldi r28, 0xFF ; 255 + 6e: d4 e0 ldi r29, 0x04 ; 4 + 70: de bf out 0x3e, r29 ; 62 + 72: cd bf out 0x3d, r28 ; 61 + +00000074 <__do_copy_data>: + 74: 11 e0 ldi r17, 0x01 ; 1 + 76: a0 e0 ldi r26, 0x00 ; 0 + 78: b1 e0 ldi r27, 0x01 ; 1 + 7a: e2 e8 ldi r30, 0x82 ; 130 + 7c: f1 e0 ldi r31, 0x01 ; 1 + 7e: 02 c0 rjmp .+4 ; 0x84 <__do_copy_data+0x10> + 80: 05 90 lpm r0, Z+ + 82: 0d 92 st X+, r0 + 84: a0 32 cpi r26, 0x20 ; 32 + 86: b1 07 cpc r27, r17 + 88: d9 f7 brne .-10 ; 0x80 <__do_copy_data+0xc> + 8a: 0e 94 71 00 call 0xe2 ; 0xe2
+ 8e: 0c 94 bf 00 jmp 0x17e ; 0x17e <_exit> + +00000092 <__bad_interrupt>: + 92: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> + +00000096 : +/* fine definizioni per il m168p*/ + +/* Inizializza la porta seriale */ +void uart_init(void) +{ + UBRRH = UBRRH_VALUE; + 96: 10 92 c5 00 sts 0x00C5, r1 + UBRRL = UBRRL_VALUE; + 9a: 83 e3 ldi r24, 0x33 ; 51 + 9c: 80 93 c4 00 sts 0x00C4, r24 +#if USE_2X0 + UCSRA |= (1 << U2X); +#else + UCSRA &= ~(1 << U2X); + a0: e0 ec ldi r30, 0xC0 ; 192 + a2: f0 e0 ldi r31, 0x00 ; 0 + a4: 80 81 ld r24, Z + a6: 8d 7f andi r24, 0xFD ; 253 + a8: 80 83 st Z, r24 +#endif + + UCSRC= _BV(UCSZ01) | _BV(UCSZ00); // 8 N 1 + aa: 86 e0 ldi r24, 0x06 ; 6 + ac: 80 93 c2 00 sts 0x00C2, r24 + UCSRB= (1<: +} + +/* uart_putc(): scrive un carattere sulla porta seriale*/ +int uart_putc(unsigned char c) +{ + while (!(UCSRA & (1< + } + UDR = c; /* sende Zeichen */ + c0: 80 93 c6 00 sts 0x00C6, r24 + return 0; +} + c4: 80 e0 ldi r24, 0x00 ; 0 + c6: 90 e0 ldi r25, 0x00 ; 0 + c8: 08 95 ret + +000000ca : + +/* uart_puts(): scrive una stringa sulla porta seriale*/ +void uart_puts (char *s) +{ + ca: cf 93 push r28 + cc: df 93 push r29 + ce: ec 01 movw r28, r24 + while (*s) { + d0: 89 91 ld r24, Y+ + d2: 88 23 and r24, r24 + d4: 19 f0 breq .+6 ; 0xdc + uart_putc(*s); + d6: 0e 94 5c 00 call 0xb8 ; 0xb8 + da: fa cf rjmp .-12 ; 0xd0 + s++; + } +} + dc: df 91 pop r29 + de: cf 91 pop r28 + e0: 08 95 ret + +000000e2
: + +/* Main - Programma principale*/ +int main (void) +{ + unsigned char zwischenspeicher; + DDRC = 0b00000001; + e2: 81 e0 ldi r24, 0x01 ; 1 + e4: 87 b9 out 0x07, r24 ; 7 + + uart_init(); + e6: 0e 94 4b 00 call 0x96 ; 0x96 + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + ea: 2f ef ldi r18, 0xFF ; 255 + ec: 3d e3 ldi r19, 0x3D ; 61 + ee: 89 e4 ldi r24, 0x49 ; 73 + f0: 21 50 subi r18, 0x01 ; 1 + f2: 30 40 sbci r19, 0x00 ; 0 + f4: 80 40 sbci r24, 0x00 ; 0 + f6: e1 f7 brne .-8 ; 0xf0 + f8: 00 c0 rjmp .+0 ; 0xfa + fa: 00 00 nop + _delay_ms(3000); + uart_puts("CL"); + fc: 80 e0 ldi r24, 0x00 ; 0 + fe: 91 e0 ldi r25, 0x01 ; 1 + 100: 0e 94 65 00 call 0xca ; 0xca + uart_puts("DSS"); + 104: 83 e0 ldi r24, 0x03 ; 3 + 106: 91 e0 ldi r25, 0x01 ; 1 + 108: 0e 94 65 00 call 0xca ; 0xca + uart_putc(0); + 10c: 80 e0 ldi r24, 0x00 ; 0 + 10e: 0e 94 5c 00 call 0xb8 ; 0xb8 + uart_puts("TT* Love Silvia *\n"); + 112: 87 e0 ldi r24, 0x07 ; 7 + 114: 91 e0 ldi r25, 0x01 ; 1 + 116: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TRT"); + 11a: 8b e1 ldi r24, 0x1B ; 27 + 11c: 91 e0 ldi r25, 0x01 ; 1 + 11e: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TT* Love Silvia *\n"); + 122: 87 e0 ldi r24, 0x07 ; 7 + 124: 91 e0 ldi r25, 0x01 ; 1 + 126: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TRT"); + 12a: 8b e1 ldi r24, 0x1B ; 27 + 12c: 91 e0 ldi r25, 0x01 ; 1 + 12e: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TT* Love Silvia *\n"); + 132: 87 e0 ldi r24, 0x07 ; 7 + 134: 91 e0 ldi r25, 0x01 ; 1 + 136: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TRT"); + 13a: 8b e1 ldi r24, 0x1B ; 27 + 13c: 91 e0 ldi r25, 0x01 ; 1 + 13e: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TT* Love Silvia *\n"); + 142: 87 e0 ldi r24, 0x07 ; 7 + 144: 91 e0 ldi r25, 0x01 ; 1 + 146: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TRT"); + 14a: 8b e1 ldi r24, 0x1B ; 27 + 14c: 91 e0 ldi r25, 0x01 ; 1 + 14e: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TT* Love Silvia *\n"); + 152: 87 e0 ldi r24, 0x07 ; 7 + 154: 91 e0 ldi r25, 0x01 ; 1 + 156: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TRT"); + 15a: 8b e1 ldi r24, 0x1B ; 27 + 15c: 91 e0 ldi r25, 0x01 ; 1 + 15e: 0e 94 65 00 call 0xca ; 0xca + uart_puts("TT12345678901234\n"); + */ + + while(1) { + zwischenspeicher = PORTC; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + 162: 91 e0 ldi r25, 0x01 ; 1 + uart_puts("TRT"); + uart_puts("TT12345678901234\n"); + */ + + while(1) { + zwischenspeicher = PORTC; + 164: 88 b1 in r24, 0x08 ; 8 + zwischenspeicher = zwischenspeicher ^ 0b00000001; + 166: 89 27 eor r24, r25 + PORTC = zwischenspeicher; + 168: 88 b9 out 0x08, r24 ; 8 + 16a: 2f ef ldi r18, 0xFF ; 255 + 16c: 34 e3 ldi r19, 0x34 ; 52 + 16e: 8c e0 ldi r24, 0x0C ; 12 + 170: 21 50 subi r18, 0x01 ; 1 + 172: 30 40 sbci r19, 0x00 ; 0 + 174: 80 40 sbci r24, 0x00 ; 0 + 176: e1 f7 brne .-8 ; 0x170 + 178: 00 c0 rjmp .+0 ; 0x17a + 17a: 00 00 nop + 17c: f3 cf rjmp .-26 ; 0x164 + +0000017e <_exit>: + 17e: f8 94 cli + +00000180 <__stop_program>: + 180: ff cf rjmp .-2 ; 0x180 <__stop_program> diff --git a/trunk/AVRProjects/ATMega168/main.lst b/trunk/AVRProjects/ATMega168/main.lst new file mode 100644 index 00000000..fe8db4ae --- /dev/null +++ b/trunk/AVRProjects/ATMega168/main.lst @@ -0,0 +1,528 @@ + 1 .file "main.c" + 2 __SP_H__ = 0x3e + 3 __SP_L__ = 0x3d + 4 __SREG__ = 0x3f + 5 __tmp_reg__ = 0 + 6 __zero_reg__ = 1 + 7 .text + 8 .Ltext0: + 9 .cfi_sections .debug_frame + 10 .global uart_init + 12 uart_init: + 13 .LFB6: + 14 .file 1 "main.c" + 1:main.c **** #ifndef F_CPU + 2:main.c **** #define F_CPU 8000000 + 3:main.c **** #endif + 4:main.c **** + 5:main.c **** #include + 6:main.c **** #include + 7:main.c **** #define BAUD 9600 + 8:main.c **** #define m168p + 9:main.c **** #include + 10:main.c **** + 11:main.c **** /* Definizioni per il m168p */ + 12:main.c **** #ifdef m168p + 13:main.c **** #define UCSRA UCSR0A + 14:main.c **** #define UCSRB UCSR0B + 15:main.c **** #define UCSRC UCSR0C + 16:main.c **** #define UBRRH UBRR0H + 17:main.c **** #define UBRRL UBRR0L + 18:main.c **** #define U2X U2X0 + 19:main.c **** #define UDRE UDRE0 + 20:main.c **** #define UDR UDR0 + 21:main.c **** #endif + 22:main.c **** /* fine definizioni per il m168p*/ + 23:main.c **** + 24:main.c **** /* Inizializza la porta seriale */ + 25:main.c **** void uart_init(void) + 26:main.c **** { + 15 .loc 1 26 0 + 16 .cfi_startproc + 17 /* prologue: function */ + 18 /* frame size = 0 */ + 19 /* stack size = 0 */ + 20 .L__stack_usage = 0 + 27:main.c **** UBRRH = UBRRH_VALUE; + 21 .loc 1 27 0 + 22 0000 1092 C500 sts 197,__zero_reg__ + 28:main.c **** UBRRL = UBRRL_VALUE; + 23 .loc 1 28 0 + 24 0004 83E3 ldi r24,lo8(51) + 25 0006 8093 C400 sts 196,r24 + 29:main.c **** #if USE_2X0 + 30:main.c **** UCSRA |= (1 << U2X); + 31:main.c **** #else + 32:main.c **** UCSRA &= ~(1 << U2X); + 26 .loc 1 32 0 + 27 000a E0EC ldi r30,lo8(-64) + 28 000c F0E0 ldi r31,0 + 29 000e 8081 ld r24,Z + 30 0010 8D7F andi r24,lo8(-3) + 31 0012 8083 st Z,r24 + 33:main.c **** #endif + 34:main.c **** + 35:main.c **** UCSRC= _BV(UCSZ01) | _BV(UCSZ00); // 8 N 1 + 32 .loc 1 35 0 + 33 0014 86E0 ldi r24,lo8(6) + 34 0016 8093 C200 sts 194,r24 + 36:main.c **** UCSRB= (1< + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \file */ + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \code + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define F_CPU 1000000UL // 1 MHz + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //#define F_CPU 14.7456E6 + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \endcode + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note As an alternative method, it is possible to pass the + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU macro down to the compiler from the Makefile. + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Obviously, in that case, no \c \#define statement should be + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** used. + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions in this header file are wrappers around the basic + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** busy-wait functions from . They are meant as + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** convenience functions where actual time values can be specified + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** rather than a number of cycles to wait for. The idea behind is + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** that compile-time constant expressions will be eliminated by + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compiler optimization so floating-point expressions can be used + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to calculate the number of delay cycles needed based on the CPU + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** frequency passed by the macro F_CPU. + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note In order for these functions to work as intended, compiler + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** optimizations must be enabled, and the delay time + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** must be an expression that is a known constant at + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compile-time. If these requirements are not met, the resulting + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delay will be much longer (and basically unpredictable), and + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** applications that otherwise do not use floating-point calculations + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** will experience severe code bloat by the floating-point library + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** routines linked into the application. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions available allow the specification of microsecond, and + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** millisecond delays directly, using the application-supplied macro + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU as the CPU clock frequency (in Hertz). + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if !defined(__DOXYGEN__) + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef F_CPU + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* prevent compiler error by supplying a default */ + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "F_CPU not defined for " + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # define F_CPU 1000000UL + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __OPTIMIZE__ + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # include + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \ingroup util_delay + 106:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 107:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + 108:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 109:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The macro F_CPU is supposed to be defined to a + 110:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** constant defining the CPU clock frequency (in Hertz). + 111:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 112:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. + 113:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 114:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** When the user request delay which exceed the maximum possible one, + 115:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms() provides a decreased resolution functionality. In this + 116:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing + 117:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The + 118:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** user will not be informed about decreased resolution. + 119:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 120:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) + 121:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For + 122:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** values greater than the maximal possible delay, overflows results in + 123:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** no delay i.e., 0ms. + 124:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 125:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Conversion of __us into clock cycles may not always result in integer. + 126:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** By default, the clock cycles rounded up to next integer. This ensures that + 127:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the user gets atleast __us microseconds of delay. + 128:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 129:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ + 130:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to round down and round to closest integer. + 131:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 132:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Note: The new implementation of _delay_ms(double __ms) with + 133:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. + 134:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. + 135:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Also, the backward compatible + 136:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** algorithm will be chosen if the code is compiled in a freestanding + 137:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** environment (GCC option \c -ffreestanding), as the math functions + 138:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** required for rounding are not available to the compiler then. + 139:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 140:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 141:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** void + 142:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms(double __ms) + 143:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 144:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** double __tmp ; + 145:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 146:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 147:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 148:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint32_t __ticks_dc; + 149:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); + 150:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; + 151:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 152:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if defined(__DELAY_ROUND_DOWN__) + 153:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); + 154:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 155:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) + 156:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); + 157:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 158:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 159:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //round up by default + 160:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + 161:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 162:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 163:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(__ticks_dc); + 139 .loc 2 163 0 + 140 0008 2FEF ldi r18,lo8(4799999) + 141 000a 3DE3 ldi r19,hi8(4799999) + 142 000c 89E4 ldi r24,hlo8(4799999) + 143 000e 2150 1: subi r18,1 + 144 0010 3040 sbci r19,0 + 145 0012 8040 sbci r24,0 + 146 0014 01F4 brne 1b + 147 0016 00C0 rjmp . + 148 0018 0000 nop + 149 .LBE7: + 150 .LBE6: + 67:main.c **** _delay_ms(3000); + 68:main.c **** uart_puts("CL"); + 151 .loc 1 68 0 + 152 001a 80E0 ldi r24,lo8(.LC0) + 153 001c 90E0 ldi r25,hi8(.LC0) + 154 001e 0E94 0000 call uart_puts + 155 .LVL9: + 69:main.c **** uart_puts("DSS"); + 156 .loc 1 69 0 + 157 0022 80E0 ldi r24,lo8(.LC1) + 158 0024 90E0 ldi r25,hi8(.LC1) + 159 0026 0E94 0000 call uart_puts + 160 .LVL10: + 70:main.c **** uart_putc(0); + 161 .loc 1 70 0 + 162 002a 80E0 ldi r24,0 + 163 002c 0E94 0000 call uart_putc + 164 .LVL11: + 71:main.c **** uart_puts("TT* Love Silvia *\n"); + 165 .loc 1 71 0 + 166 0030 80E0 ldi r24,lo8(.LC2) + 167 0032 90E0 ldi r25,hi8(.LC2) + 168 0034 0E94 0000 call uart_puts + 169 .LVL12: + 72:main.c **** uart_puts("TRT"); + 170 .loc 1 72 0 + 171 0038 80E0 ldi r24,lo8(.LC3) + 172 003a 90E0 ldi r25,hi8(.LC3) + 173 003c 0E94 0000 call uart_puts + 174 .LVL13: + 73:main.c **** uart_puts("TT* Love Silvia *\n"); + 175 .loc 1 73 0 + 176 0040 80E0 ldi r24,lo8(.LC2) + 177 0042 90E0 ldi r25,hi8(.LC2) + 178 0044 0E94 0000 call uart_puts + 179 .LVL14: + 74:main.c **** uart_puts("TRT"); + 180 .loc 1 74 0 + 181 0048 80E0 ldi r24,lo8(.LC3) + 182 004a 90E0 ldi r25,hi8(.LC3) + 183 004c 0E94 0000 call uart_puts + 184 .LVL15: + 75:main.c **** uart_puts("TT* Love Silvia *\n"); + 185 .loc 1 75 0 + 186 0050 80E0 ldi r24,lo8(.LC2) + 187 0052 90E0 ldi r25,hi8(.LC2) + 188 0054 0E94 0000 call uart_puts + 189 .LVL16: + 76:main.c **** uart_puts("TRT"); + 190 .loc 1 76 0 + 191 0058 80E0 ldi r24,lo8(.LC3) + 192 005a 90E0 ldi r25,hi8(.LC3) + 193 005c 0E94 0000 call uart_puts + 194 .LVL17: + 77:main.c **** uart_puts("TT* Love Silvia *\n"); + 195 .loc 1 77 0 + 196 0060 80E0 ldi r24,lo8(.LC2) + 197 0062 90E0 ldi r25,hi8(.LC2) + 198 0064 0E94 0000 call uart_puts + 199 .LVL18: + 78:main.c **** uart_puts("TRT"); + 200 .loc 1 78 0 + 201 0068 80E0 ldi r24,lo8(.LC3) + 202 006a 90E0 ldi r25,hi8(.LC3) + 203 006c 0E94 0000 call uart_puts + 204 .LVL19: + 79:main.c **** uart_puts("TT* Love Silvia *\n"); + 205 .loc 1 79 0 + 206 0070 80E0 ldi r24,lo8(.LC2) + 207 0072 90E0 ldi r25,hi8(.LC2) + 208 0074 0E94 0000 call uart_puts + 209 .LVL20: + 80:main.c **** uart_puts("TRT"); + 210 .loc 1 80 0 + 211 0078 80E0 ldi r24,lo8(.LC3) + 212 007a 90E0 ldi r25,hi8(.LC3) + 213 007c 0E94 0000 call uart_puts + 214 .LVL21: + 81:main.c **** + 82:main.c **** /* + 83:main.c **** uart_puts("SF"); + 84:main.c **** uart_putc(6); + 85:main.c **** uart_puts("TT12345678901234567890123456789012\n"); + 86:main.c **** + 87:main.c **** uart_puts("SF"); + 88:main.c **** uart_putc(10); + 89:main.c **** uart_puts("TRT"); + 90:main.c **** uart_puts("TT123456789012345678901\n"); + 91:main.c **** + 92:main.c **** uart_puts("SF"); + 93:main.c **** uart_putc(0); + 94:main.c **** uart_puts("TRT"); + 95:main.c **** uart_puts("TT1234567890123456\n"); + 96:main.c **** + 97:main.c **** uart_puts("SF"); + 98:main.c **** uart_putc(18); + 99:main.c **** uart_puts("TRT"); + 100:main.c **** uart_puts("TT12345678901234\n"); + 101:main.c **** */ + 102:main.c **** + 103:main.c **** while(1) { + 104:main.c **** zwischenspeicher = PORTC; + 105:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000001; + 215 .loc 1 105 0 + 216 0080 91E0 ldi r25,lo8(1) + 217 .L11: + 104:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000001; + 218 .loc 1 104 0 discriminator 1 + 219 0082 88B1 in r24,0x8 + 220 .LVL22: + 221 .loc 1 105 0 discriminator 1 + 222 0084 8927 eor r24,r25 + 223 .LVL23: + 106:main.c **** PORTC = zwischenspeicher; + 224 .loc 1 106 0 discriminator 1 + 225 0086 88B9 out 0x8,r24 + 226 .LVL24: + 227 .LBB8: + 228 .LBB9: + 229 .loc 2 163 0 discriminator 1 + 230 0088 2FEF ldi r18,lo8(799999) + 231 008a 34E3 ldi r19,hi8(799999) + 232 008c 8CE0 ldi r24,hlo8(799999) + 233 008e 2150 1: subi r18,1 + 234 0090 3040 sbci r19,0 + 235 0092 8040 sbci r24,0 + 236 0094 01F4 brne 1b + 237 .LVL25: + 238 0096 00C0 rjmp . + 239 0098 0000 nop + 240 009a 00C0 rjmp .L11 + 241 .LBE9: + 242 .LBE8: + 243 .cfi_endproc + 244 .LFE9: + 246 .text + 247 .Letext0: + 248 .file 3 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\stdint.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:2 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:3 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:4 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:5 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:6 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:12 .text:00000000 uart_init +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:44 .text:00000022 uart_putc +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:70 .text:00000034 uart_puts +C:\Users\q242695\AppData\Local\Temp\cc4MGEr5.s:122 .text.startup:00000000 main + +UNDEFINED SYMBOLS +__do_copy_data diff --git a/trunk/AVRProjects/ATMega168/main.map b/trunk/AVRProjects/ATMega168/main.map new file mode 100644 index 00000000..4570ca14 --- /dev/null +++ b/trunk/AVRProjects/ATMega168/main.map @@ -0,0 +1,463 @@ +Archive member included to satisfy reference by file (symbol) + +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o (exit) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + main.o (__do_copy_data) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00020000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +Address of section .data set to 0x800100 +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +LOAD main.o +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5\libm.a +START GROUP +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5\libm.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5\libc.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x182 + *(.vectors) + .vectors 0x00000000 0x68 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x00000068 . = ALIGN (0x2) + 0x00000068 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000068 0x0 linker stubs + *(.trampolines*) + 0x00000068 __trampolines_end = . + *(.progmem*) + 0x00000068 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000068 __ctors_start = . + *(.ctors) + 0x00000068 __ctors_end = . + 0x00000068 __dtors_start = . + *(.dtors) + 0x00000068 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000068 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + 0x00000068 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000068 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + .init4 0x00000074 0x16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + 0x00000074 __do_copy_data + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x0000008a 0x8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + *(.init9) + *(.text) + .text 0x00000092 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + 0x00000092 __vector_22 + 0x00000092 __vector_1 + 0x00000092 __vector_24 + 0x00000092 __vector_12 + 0x00000092 __bad_interrupt + 0x00000092 __vector_6 + 0x00000092 __vector_3 + 0x00000092 __vector_23 + 0x00000092 __vector_25 + 0x00000092 __vector_11 + 0x00000092 __vector_13 + 0x00000092 __vector_17 + 0x00000092 __vector_19 + 0x00000092 __vector_7 + 0x00000092 __vector_5 + 0x00000092 __vector_4 + 0x00000092 __vector_9 + 0x00000092 __vector_2 + 0x00000092 __vector_21 + 0x00000092 __vector_15 + 0x00000092 __vector_8 + 0x00000092 __vector_14 + 0x00000092 __vector_10 + 0x00000092 __vector_16 + 0x00000092 __vector_18 + 0x00000092 __vector_20 + .text 0x00000096 0x4c main.o + 0x00000096 uart_init + 0x000000b8 uart_putc + 0x000000ca uart_puts + .text 0x000000e2 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text 0x000000e2 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + 0x000000e2 . = ALIGN (0x2) + *(.text.*) + .text.startup 0x000000e2 0x9c main.o + 0x000000e2 main + .text.libgcc.mul + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.div + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.mul + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + .text.libgcc.div + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + .text.libgcc 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + .text.libgcc.prologue + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + .text.libgcc.builtins + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + .text.libgcc.fmul + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + .text.libgcc.fixed + 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + 0x0000017e . = ALIGN (0x2) + *(.fini9) + .fini9 0x0000017e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + 0x0000017e _exit + 0x0000017e exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x0000017e 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + *(.fini0) + 0x00000182 _etext = . + +.data 0x00800100 0x20 load address 0x00000182 + 0x00800100 PROVIDE (__data_start, .) + *(.data) + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + .data 0x00800100 0x0 main.o + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + *(.data*) + *(.rodata) + *(.rodata*) + .rodata.str1.1 + 0x00800100 0x1f main.o + *(.gnu.linkonce.d*) + 0x00800120 . = ALIGN (0x2) + *fill* 0x0080011f 0x1 + 0x00800120 _edata = . + 0x00800120 PROVIDE (__data_end, .) + +.bss 0x00800120 0x0 + 0x00800120 PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800120 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o + .bss 0x00800120 0x0 main.o + .bss 0x00800120 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .bss 0x00800120 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + *(.bss*) + *(COMMON) + 0x00800120 PROVIDE (__bss_end, .) + 0x00000182 __data_load_start = LOADADDR (.data) + 0x000001a2 __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800120 0x0 + 0x00800120 PROVIDE (__noinit_start, .) + *(.noinit*) + 0x00800120 PROVIDE (__noinit_end, .) + 0x00800120 _end = . + 0x00800120 PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x28 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x28 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x340 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x340 main.o + +.debug_abbrev 0x00000000 0x168 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0x168 main.o + +.debug_line 0x00000000 0x117 + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0x117 main.o + +.debug_frame 0x00000000 0x60 + *(.debug_frame) + .debug_frame 0x00000000 0x60 main.o + +.debug_str 0x00000000 0x153 + *(.debug_str) + .debug_str 0x00000000 0x153 main.o + 0x18c (size before relaxing) + +.debug_loc 0x00000000 0xbf + *(.debug_loc) + .debug_loc 0x00000000 0xbf main.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x18 + *(.debug_ranges) + .debug_ranges 0x00000000 0x18 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +__bad_interrupt e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__data_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) +__data_load_start e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) +__data_start e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) +__do_copy_data e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_copy_data.o) + main.o +__heap_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__init e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__stack e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_1 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_10 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_11 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_12 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_13 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_14 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_15 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_17 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_18 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_19 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_20 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_21 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_23 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_24 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_25 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_5 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_7 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_9 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vector_default e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +__vectors e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +_exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) +exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +main main.o + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm168p.o +uart_init main.o +uart_putc main.o +uart_puts main.o diff --git a/trunk/AVRProjects/ATMega168/main.sym b/trunk/AVRProjects/ATMega168/main.sym new file mode 100644 index 00000000..2f4691d7 --- /dev/null +++ b/trunk/AVRProjects/ATMega168/main.sym @@ -0,0 +1,58 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003f a __SREG__ +00000068 T __ctors_end +00000068 T __ctors_start +00000068 T __dtors_end +00000068 T __dtors_start +00000068 W __init +00000068 T __trampolines_end +00000068 T __trampolines_start +00000074 T __do_copy_data +00000092 T __bad_interrupt +00000092 W __vector_1 +00000092 W __vector_10 +00000092 W __vector_11 +00000092 W __vector_12 +00000092 W __vector_13 +00000092 W __vector_14 +00000092 W __vector_15 +00000092 W __vector_16 +00000092 W __vector_17 +00000092 W __vector_18 +00000092 W __vector_19 +00000092 W __vector_2 +00000092 W __vector_20 +00000092 W __vector_21 +00000092 W __vector_22 +00000092 W __vector_23 +00000092 W __vector_24 +00000092 W __vector_25 +00000092 W __vector_3 +00000092 W __vector_4 +00000092 W __vector_5 +00000092 W __vector_6 +00000092 W __vector_7 +00000092 W __vector_8 +00000092 W __vector_9 +00000096 T uart_init +000000b8 T uart_putc +000000ca T uart_puts +000000e2 T main +0000017e T _exit +0000017e W exit +00000180 t __stop_program +00000182 A __data_load_start +00000182 T _etext +000001a2 A __data_load_end +000004ff W __stack +00800100 D __data_start +00800120 D __data_end +00800120 D _edata +00800120 T _end +00810000 T __eeprom_end diff --git a/trunk/AVRProjects/ATMega168/makefile b/trunk/AVRProjects/ATMega168/makefile new file mode 100644 index 00000000..bdfdd783 --- /dev/null +++ b/trunk/AVRProjects/ATMega168/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega168p + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 8000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATMega328/.dep/main.o.d b/trunk/AVRProjects/ATMega328/.dep/main.o.d new file mode 100644 index 00000000..531adca1 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/.dep/main.o.d @@ -0,0 +1,46 @@ +main.o: main.c \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom328.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom328p.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom328.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom328p.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: diff --git a/trunk/AVRProjects/ATMega328/main.c b/trunk/AVRProjects/ATMega328/main.c new file mode 100644 index 00000000..9d1b2c72 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.c @@ -0,0 +1,44 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000100; + PORTB = zwischenspeicher; + _delay_ms(500); + } + return 0; +} + diff --git a/trunk/AVRProjects/ATMega328/main.eep b/trunk/AVRProjects/ATMega328/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATMega328/main.elf b/trunk/AVRProjects/ATMega328/main.elf new file mode 100644 index 00000000..f74f8837 Binary files /dev/null and b/trunk/AVRProjects/ATMega328/main.elf differ diff --git a/trunk/AVRProjects/ATMega328/main.hex b/trunk/AVRProjects/ATMega328/main.hex new file mode 100644 index 00000000..a2364de1 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.hex @@ -0,0 +1,12 @@ +:100000000C9434000C943E000C943E000C943E0082 +:100010000C943E000C943E000C943E000C943E0068 +:100020000C943E000C943E000C943E000C943E0058 +:100030000C943E000C943E000C943E000C943E0048 +:100040000C943E000C943E000C943E000C943E0038 +:100050000C943E000C943E000C943E000C943E0028 +:100060000C943E000C943E0011241FBECFEFD8E04C +:10007000DEBFCDBF0E9440000C9450000C940000E5 +:1000800084E084B994E085B1892785B92FE936E801 +:1000900081E0215030408040E1F700C00000F3CF04 +:0400A000F894FFCF02 +:00000001FF diff --git a/trunk/AVRProjects/ATMega328/main.lss b/trunk/AVRProjects/ATMega328/main.lss new file mode 100644 index 00000000..c90bd2ba --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.lss @@ -0,0 +1,118 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 000000a4 00000118 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 000000a4 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 00000011 00000000 00000000 00000118 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000020 00000000 00000000 00000129 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000119 00000000 00000000 00000149 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 000000d1 00000000 00000000 00000262 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000000d7 00000000 00000000 00000333 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000024 00000000 00000000 0000040c 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 00000134 00000000 00000000 00000430 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 0000001f 00000000 00000000 00000564 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000010 00000000 00000000 00000583 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 0c 94 34 00 jmp 0x68 ; 0x68 <__ctors_end> + 4: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 8: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 10: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 14: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 18: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 1c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 20: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 24: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 28: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 2c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 30: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 34: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 38: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 3c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 40: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 44: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 48: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 4c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 50: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 54: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 58: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 5c: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 60: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + 64: 0c 94 3e 00 jmp 0x7c ; 0x7c <__bad_interrupt> + +00000068 <__ctors_end>: + 68: 11 24 eor r1, r1 + 6a: 1f be out 0x3f, r1 ; 63 + 6c: cf ef ldi r28, 0xFF ; 255 + 6e: d8 e0 ldi r29, 0x08 ; 8 + 70: de bf out 0x3e, r29 ; 62 + 72: cd bf out 0x3d, r28 ; 61 + 74: 0e 94 40 00 call 0x80 ; 0x80
+ 78: 0c 94 50 00 jmp 0xa0 ; 0xa0 <_exit> + +0000007c <__bad_interrupt>: + 7c: 0c 94 00 00 jmp 0 ; 0x0 <__vectors> + +00000080
: +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + 80: 84 e0 ldi r24, 0x04 ; 4 + 82: 84 b9 out 0x04, r24 ; 4 + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000100; + 84: 94 e0 ldi r25, 0x04 ; 4 +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + while(1) + { + zwischenspeicher = PORTB; + 86: 85 b1 in r24, 0x05 ; 5 + zwischenspeicher = zwischenspeicher ^ 0b00000100; + 88: 89 27 eor r24, r25 + PORTB = zwischenspeicher; + 8a: 85 b9 out 0x05, r24 ; 5 + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + 8c: 2f e9 ldi r18, 0x9F ; 159 + 8e: 36 e8 ldi r19, 0x86 ; 134 + 90: 81 e0 ldi r24, 0x01 ; 1 + 92: 21 50 subi r18, 0x01 ; 1 + 94: 30 40 sbci r19, 0x00 ; 0 + 96: 80 40 sbci r24, 0x00 ; 0 + 98: e1 f7 brne .-8 ; 0x92 + 9a: 00 c0 rjmp .+0 ; 0x9c + 9c: 00 00 nop + 9e: f3 cf rjmp .-26 ; 0x86 + +000000a0 <_exit>: + a0: f8 94 cli + +000000a2 <__stop_program>: + a2: ff cf rjmp .-2 ; 0xa2 <__stop_program> diff --git a/trunk/AVRProjects/ATMega328/main.lst b/trunk/AVRProjects/ATMega328/main.lst new file mode 100644 index 00000000..e1e72484 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.lst @@ -0,0 +1,243 @@ + 1 .file "main.c" + 2 __SP_H__ = 0x3e + 3 __SP_L__ = 0x3d + 4 __SREG__ = 0x3f + 5 __tmp_reg__ = 0 + 6 __zero_reg__ = 1 + 7 .text + 8 .Ltext0: + 9 .cfi_sections .debug_frame + 10 .section .text.startup,"ax",@progbits + 11 .global main + 13 main: + 14 .LFB6: + 15 .file 1 "main.c" + 1:main.c **** #include + 2:main.c **** #include + 3:main.c **** + 4:main.c **** int main (void) + 5:main.c **** { + 16 .loc 1 5 0 + 17 .cfi_startproc + 18 /* prologue: function */ + 19 /* frame size = 0 */ + 20 /* stack size = 0 */ + 21 .L__stack_usage = 0 + 6:main.c **** unsigned char zwischenspeicher; + 7:main.c **** DDRB = 0b00000100; + 22 .loc 1 7 0 + 23 0000 84E0 ldi r24,lo8(4) + 24 0002 84B9 out 0x4,r24 + 8:main.c **** while(1) + 9:main.c **** { + 10:main.c **** zwischenspeicher = PORTB; + 11:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000100; + 25 .loc 1 11 0 + 26 0004 94E0 ldi r25,lo8(4) + 27 .L2: + 10:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000100; + 28 .loc 1 10 0 discriminator 1 + 29 0006 85B1 in r24,0x5 + 30 .LVL0: + 31 .loc 1 11 0 discriminator 1 + 32 0008 8927 eor r24,r25 + 33 .LVL1: + 12:main.c **** PORTB = zwischenspeicher; + 34 .loc 1 12 0 discriminator 1 + 35 000a 85B9 out 0x5,r24 + 36 .LVL2: + 37 .LBB4: + 38 .LBB5: + 39 .file 2 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\util\\delay.h" + 1:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz + 2:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch + 3:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2007 Florin-Viorel Petrov + 4:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** All rights reserved. + 5:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 6:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Redistribution and use in source and binary forms, with or without + 7:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** modification, are permitted provided that the following conditions are met: + 8:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 9:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions of source code must retain the above copyright + 10:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer. + 11:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 12:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions in binary form must reproduce the above copyright + 13:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer in + 14:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the documentation and/or other materials provided with the + 15:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** distribution. + 16:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 17:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Neither the name of the copyright holders nor the names of + 18:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** contributors may be used to endorse or promote products derived + 19:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** from this software without specific prior written permission. + 20:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 21:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + 22:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + 23:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + 24:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + 25:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + 26:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + 27:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + 28:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + 29:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 30:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + 31:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** POSSIBILITY OF SUCH DAMAGE. */ + 32:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 33:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* $Id$ */ + 34:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 35:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef _UTIL_DELAY_H_ + 36:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define _UTIL_DELAY_H_ 1 + 37:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 38:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __HAS_DELAY_CYCLES + 39:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define __HAS_DELAY_CYCLES 1 + 40:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 41:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 42:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \file */ + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \code + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define F_CPU 1000000UL // 1 MHz + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //#define F_CPU 14.7456E6 + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \endcode + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note As an alternative method, it is possible to pass the + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU macro down to the compiler from the Makefile. + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Obviously, in that case, no \c \#define statement should be + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** used. + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions in this header file are wrappers around the basic + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** busy-wait functions from . They are meant as + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** convenience functions where actual time values can be specified + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** rather than a number of cycles to wait for. The idea behind is + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** that compile-time constant expressions will be eliminated by + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compiler optimization so floating-point expressions can be used + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to calculate the number of delay cycles needed based on the CPU + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** frequency passed by the macro F_CPU. + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note In order for these functions to work as intended, compiler + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** optimizations must be enabled, and the delay time + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** must be an expression that is a known constant at + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compile-time. If these requirements are not met, the resulting + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delay will be much longer (and basically unpredictable), and + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** applications that otherwise do not use floating-point calculations + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** will experience severe code bloat by the floating-point library + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** routines linked into the application. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions available allow the specification of microsecond, and + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** millisecond delays directly, using the application-supplied macro + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU as the CPU clock frequency (in Hertz). + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if !defined(__DOXYGEN__) + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef F_CPU + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* prevent compiler error by supplying a default */ + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "F_CPU not defined for " + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # define F_CPU 1000000UL + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __OPTIMIZE__ + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # include + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \ingroup util_delay + 106:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 107:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + 108:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 109:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The macro F_CPU is supposed to be defined to a + 110:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** constant defining the CPU clock frequency (in Hertz). + 111:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 112:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. + 113:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 114:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** When the user request delay which exceed the maximum possible one, + 115:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms() provides a decreased resolution functionality. In this + 116:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing + 117:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The + 118:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** user will not be informed about decreased resolution. + 119:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 120:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) + 121:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For + 122:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** values greater than the maximal possible delay, overflows results in + 123:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** no delay i.e., 0ms. + 124:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 125:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Conversion of __us into clock cycles may not always result in integer. + 126:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** By default, the clock cycles rounded up to next integer. This ensures that + 127:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the user gets atleast __us microseconds of delay. + 128:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 129:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ + 130:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to round down and round to closest integer. + 131:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 132:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Note: The new implementation of _delay_ms(double __ms) with + 133:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. + 134:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. + 135:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Also, the backward compatible + 136:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** algorithm will be chosen if the code is compiled in a freestanding + 137:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** environment (GCC option \c -ffreestanding), as the math functions + 138:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** required for rounding are not available to the compiler then. + 139:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 140:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 141:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** void + 142:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms(double __ms) + 143:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 144:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** double __tmp ; + 145:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 146:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 147:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 148:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint32_t __ticks_dc; + 149:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); + 150:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; + 151:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 152:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if defined(__DELAY_ROUND_DOWN__) + 153:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); + 154:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 155:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) + 156:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); + 157:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 158:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 159:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //round up by default + 160:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + 161:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 162:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 163:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(__ticks_dc); + 40 .loc 2 163 0 discriminator 1 + 41 000c 2FE9 ldi r18,lo8(99999) + 42 000e 36E8 ldi r19,hi8(99999) + 43 0010 81E0 ldi r24,hlo8(99999) + 44 0012 2150 1: subi r18,1 + 45 0014 3040 sbci r19,0 + 46 0016 8040 sbci r24,0 + 47 0018 01F4 brne 1b + 48 .LVL3: + 49 001a 00C0 rjmp . + 50 001c 0000 nop + 51 001e 00C0 rjmp .L2 + 52 .LBE5: + 53 .LBE4: + 54 .cfi_endproc + 55 .LFE6: + 57 .text + 58 .Letext0: + 59 .file 3 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\stdint.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\cc6uM2d3.s:2 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp\cc6uM2d3.s:3 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\cc6uM2d3.s:4 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\cc6uM2d3.s:5 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\cc6uM2d3.s:6 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\cc6uM2d3.s:13 .text.startup:00000000 main + +NO UNDEFINED SYMBOLS diff --git a/trunk/AVRProjects/ATMega328/main.map b/trunk/AVRProjects/ATMega328/main.map new file mode 100644 index 00000000..d68730d3 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.map @@ -0,0 +1,429 @@ +Archive member included to satisfy reference by file (symbol) + +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00020000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +Address of section .data set to 0x800100 +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +LOAD main.o +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5\libm.a +START GROUP +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5\libm.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5\libc.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0xa4 + *(.vectors) + .vectors 0x00000000 0x68 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x00000068 . = ALIGN (0x2) + 0x00000068 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000068 0x0 linker stubs + *(.trampolines*) + 0x00000068 __trampolines_end = . + *(.progmem*) + 0x00000068 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000068 __ctors_start = . + *(.ctors) + 0x00000068 __ctors_end = . + 0x00000068 __dtors_start = . + *(.dtors) + 0x00000068 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000068 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + 0x00000068 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000068 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x00000074 0x8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + *(.init9) + *(.text) + .text 0x0000007c 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + 0x0000007c __vector_22 + 0x0000007c __vector_1 + 0x0000007c __vector_24 + 0x0000007c __vector_12 + 0x0000007c __bad_interrupt + 0x0000007c __vector_6 + 0x0000007c __vector_3 + 0x0000007c __vector_23 + 0x0000007c __vector_25 + 0x0000007c __vector_11 + 0x0000007c __vector_13 + 0x0000007c __vector_17 + 0x0000007c __vector_19 + 0x0000007c __vector_7 + 0x0000007c __vector_5 + 0x0000007c __vector_4 + 0x0000007c __vector_9 + 0x0000007c __vector_2 + 0x0000007c __vector_21 + 0x0000007c __vector_15 + 0x0000007c __vector_8 + 0x0000007c __vector_14 + 0x0000007c __vector_10 + 0x0000007c __vector_16 + 0x0000007c __vector_18 + 0x0000007c __vector_20 + .text 0x00000080 0x0 main.o + .text 0x00000080 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + 0x00000080 . = ALIGN (0x2) + *(.text.*) + .text.startup 0x00000080 0x20 main.o + 0x00000080 main + .text.libgcc.mul + 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.div + 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + 0x000000a0 . = ALIGN (0x2) + *(.fini9) + .fini9 0x000000a0 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + 0x000000a0 _exit + 0x000000a0 exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x000000a0 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + *(.fini0) + 0x000000a4 _etext = . + +.data 0x00800100 0x0 load address 0x000000a4 + 0x00800100 PROVIDE (__data_start, .) + *(.data) + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + .data 0x00800100 0x0 main.o + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800100 . = ALIGN (0x2) + 0x00800100 _edata = . + 0x00800100 PROVIDE (__data_end, .) + +.bss 0x00800100 0x0 + 0x00800100 PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o + .bss 0x00800100 0x0 main.o + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + 0x00800100 PROVIDE (__bss_end, .) + 0x000000a4 __data_load_start = LOADADDR (.data) + 0x000000a4 __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800100 0x0 + 0x00800100 PROVIDE (__noinit_start, .) + *(.noinit*) + 0x00800100 PROVIDE (__noinit_end, .) + 0x00800100 _end = . + 0x00800100 PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x20 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x119 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x119 main.o + +.debug_abbrev 0x00000000 0xd1 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0xd1 main.o + +.debug_line 0x00000000 0xd7 + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0xd7 main.o + +.debug_frame 0x00000000 0x24 + *(.debug_frame) + .debug_frame 0x00000000 0x24 main.o + +.debug_str 0x00000000 0x134 + *(.debug_str) + .debug_str 0x00000000 0x134 main.o + 0x168 (size before relaxing) + +.debug_loc 0x00000000 0x1f + *(.debug_loc) + .debug_loc 0x00000000 0x1f main.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x10 + *(.debug_ranges) + .debug_ranges 0x00000000 0x10 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +__bad_interrupt e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__heap_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__init e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__stack e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_1 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_10 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_11 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_12 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_13 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_14 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_15 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_17 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_18 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_19 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_20 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_21 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_23 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_24 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_25 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_5 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_7 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_9 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vector_default e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +__vectors e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +_exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) +exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr5\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o +main main.o + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr5/crtm328.o diff --git a/trunk/AVRProjects/ATMega328/main.sym b/trunk/AVRProjects/ATMega328/main.sym new file mode 100644 index 00000000..795fdd92 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/main.sym @@ -0,0 +1,52 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003f a __SREG__ +00000068 T __ctors_end +00000068 T __ctors_start +00000068 T __dtors_end +00000068 T __dtors_start +00000068 W __init +00000068 T __trampolines_end +00000068 T __trampolines_start +0000007c T __bad_interrupt +0000007c W __vector_1 +0000007c W __vector_10 +0000007c W __vector_11 +0000007c W __vector_12 +0000007c W __vector_13 +0000007c W __vector_14 +0000007c W __vector_15 +0000007c W __vector_16 +0000007c W __vector_17 +0000007c W __vector_18 +0000007c W __vector_19 +0000007c W __vector_2 +0000007c W __vector_20 +0000007c W __vector_21 +0000007c W __vector_22 +0000007c W __vector_23 +0000007c W __vector_24 +0000007c W __vector_25 +0000007c W __vector_3 +0000007c W __vector_4 +0000007c W __vector_5 +0000007c W __vector_6 +0000007c W __vector_7 +0000007c W __vector_8 +0000007c W __vector_9 +00000080 T main +000000a0 T _exit +000000a0 W exit +000000a2 t __stop_program +000000a4 A __data_load_end +000000a4 A __data_load_start +000000a4 T _etext +000008ff W __stack +00800100 D _edata +00800100 T _end +00810000 T __eeprom_end diff --git a/trunk/AVRProjects/ATMega328/makefile b/trunk/AVRProjects/ATMega328/makefile new file mode 100644 index 00000000..6ca483c7 --- /dev/null +++ b/trunk/AVRProjects/ATMega328/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega328 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATMega48/.dep/main.o.d b/trunk/AVRProjects/ATMega48/.dep/main.o.d new file mode 100644 index 00000000..0bb21193 --- /dev/null +++ b/trunk/AVRProjects/ATMega48/.dep/main.o.d @@ -0,0 +1,48 @@ +main.o: main.c main.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom48.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iomx8.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h + +main.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iom48.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iomx8.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: diff --git a/trunk/AVRProjects/ATMega48/main.c b/trunk/AVRProjects/ATMega48/main.c new file mode 100644 index 00000000..679fd398 --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.c @@ -0,0 +1,45 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include "main.h" +#include +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000100; + PORTB = zwischenspeicher; + _delay_ms(500); + } + return 0; +} + diff --git a/trunk/AVRProjects/ATMega48/main.eep b/trunk/AVRProjects/ATMega48/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATMega48/main.elf b/trunk/AVRProjects/ATMega48/main.elf new file mode 100644 index 00000000..a5593e85 Binary files /dev/null and b/trunk/AVRProjects/ATMega48/main.elf differ diff --git a/trunk/AVRProjects/ATMega48/main.h b/trunk/AVRProjects/ATMega48/main.h new file mode 100644 index 00000000..6e53eb8a --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.h @@ -0,0 +1,18 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ + +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 1000000L +#endif + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/ATMega48/main.hex b/trunk/AVRProjects/ATMega48/main.hex new file mode 100644 index 00000000..be7e58d7 --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.hex @@ -0,0 +1,8 @@ +:1000000019C020C01FC01EC01DC01CC01BC01AC00C +:1000100019C018C017C016C015C014C013C012C034 +:1000200011C010C00FC00EC00DC00CC00BC00AC064 +:1000300009C008C011241FBECFEFD2E0DEBFCDBF84 +:1000400002D011C0DDCF84E084B994E085B1892766 +:1000500085B92FE936E881E0215030408040E1F752 +:0A00600000C00000F3CFF894FFCFBA +:00000001FF diff --git a/trunk/AVRProjects/ATMega48/main.lss b/trunk/AVRProjects/ATMega48/main.lss new file mode 100644 index 00000000..170b8ae7 --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.lss @@ -0,0 +1,118 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 0000006a 000000de 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 0000006a 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 00000011 00000000 00000000 000000de 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000020 00000000 00000000 000000ef 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000119 00000000 00000000 0000010f 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 000000d1 00000000 00000000 00000228 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000000d9 00000000 00000000 000002f9 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000024 00000000 00000000 000003d4 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 00000132 00000000 00000000 000003f8 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 0000001f 00000000 00000000 0000052a 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000010 00000000 00000000 00000549 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 19 c0 rjmp .+50 ; 0x34 <__ctors_end> + 2: 20 c0 rjmp .+64 ; 0x44 <__bad_interrupt> + 4: 1f c0 rjmp .+62 ; 0x44 <__bad_interrupt> + 6: 1e c0 rjmp .+60 ; 0x44 <__bad_interrupt> + 8: 1d c0 rjmp .+58 ; 0x44 <__bad_interrupt> + a: 1c c0 rjmp .+56 ; 0x44 <__bad_interrupt> + c: 1b c0 rjmp .+54 ; 0x44 <__bad_interrupt> + e: 1a c0 rjmp .+52 ; 0x44 <__bad_interrupt> + 10: 19 c0 rjmp .+50 ; 0x44 <__bad_interrupt> + 12: 18 c0 rjmp .+48 ; 0x44 <__bad_interrupt> + 14: 17 c0 rjmp .+46 ; 0x44 <__bad_interrupt> + 16: 16 c0 rjmp .+44 ; 0x44 <__bad_interrupt> + 18: 15 c0 rjmp .+42 ; 0x44 <__bad_interrupt> + 1a: 14 c0 rjmp .+40 ; 0x44 <__bad_interrupt> + 1c: 13 c0 rjmp .+38 ; 0x44 <__bad_interrupt> + 1e: 12 c0 rjmp .+36 ; 0x44 <__bad_interrupt> + 20: 11 c0 rjmp .+34 ; 0x44 <__bad_interrupt> + 22: 10 c0 rjmp .+32 ; 0x44 <__bad_interrupt> + 24: 0f c0 rjmp .+30 ; 0x44 <__bad_interrupt> + 26: 0e c0 rjmp .+28 ; 0x44 <__bad_interrupt> + 28: 0d c0 rjmp .+26 ; 0x44 <__bad_interrupt> + 2a: 0c c0 rjmp .+24 ; 0x44 <__bad_interrupt> + 2c: 0b c0 rjmp .+22 ; 0x44 <__bad_interrupt> + 2e: 0a c0 rjmp .+20 ; 0x44 <__bad_interrupt> + 30: 09 c0 rjmp .+18 ; 0x44 <__bad_interrupt> + 32: 08 c0 rjmp .+16 ; 0x44 <__bad_interrupt> + +00000034 <__ctors_end>: + 34: 11 24 eor r1, r1 + 36: 1f be out 0x3f, r1 ; 63 + 38: cf ef ldi r28, 0xFF ; 255 + 3a: d2 e0 ldi r29, 0x02 ; 2 + 3c: de bf out 0x3e, r29 ; 62 + 3e: cd bf out 0x3d, r28 ; 61 + 40: 02 d0 rcall .+4 ; 0x46
+ 42: 11 c0 rjmp .+34 ; 0x66 <_exit> + +00000044 <__bad_interrupt>: + 44: dd cf rjmp .-70 ; 0x0 <__vectors> + +00000046
: +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + 46: 84 e0 ldi r24, 0x04 ; 4 + 48: 84 b9 out 0x04, r24 ; 4 + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000100; + 4a: 94 e0 ldi r25, 0x04 ; 4 +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + while(1) + { + zwischenspeicher = PORTB; + 4c: 85 b1 in r24, 0x05 ; 5 + zwischenspeicher = zwischenspeicher ^ 0b00000100; + 4e: 89 27 eor r24, r25 + PORTB = zwischenspeicher; + 50: 85 b9 out 0x05, r24 ; 5 + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + 52: 2f e9 ldi r18, 0x9F ; 159 + 54: 36 e8 ldi r19, 0x86 ; 134 + 56: 81 e0 ldi r24, 0x01 ; 1 + 58: 21 50 subi r18, 0x01 ; 1 + 5a: 30 40 sbci r19, 0x00 ; 0 + 5c: 80 40 sbci r24, 0x00 ; 0 + 5e: e1 f7 brne .-8 ; 0x58 + 60: 00 c0 rjmp .+0 ; 0x62 + 62: 00 00 nop + 64: f3 cf rjmp .-26 ; 0x4c + +00000066 <_exit>: + 66: f8 94 cli + +00000068 <__stop_program>: + 68: ff cf rjmp .-2 ; 0x68 <__stop_program> diff --git a/trunk/AVRProjects/ATMega48/main.lst b/trunk/AVRProjects/ATMega48/main.lst new file mode 100644 index 00000000..2ae9169a --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.lst @@ -0,0 +1,271 @@ + 1 .file "main.c" + 2 __SP_H__ = 0x3e + 3 __SP_L__ = 0x3d + 4 __SREG__ = 0x3f + 5 __tmp_reg__ = 0 + 6 __zero_reg__ = 1 + 7 .text + 8 .Ltext0: + 9 .cfi_sections .debug_frame + 10 .section .text.startup,"ax",@progbits + 11 .global main + 13 main: + 14 .LFB6: + 15 .file 1 "main.c" + 1:main.c **** /* ******************************************************** * + 2:main.c **** * + 3:main.c **** * Simple Template for ATMEL Microcontroller * + 4:main.c **** * -------------------------------------------------------- * + 5:main.c **** * Created on: 25.07.2016 + 6:main.c **** * Author: Paolo Iocco + 7:main.c **** * ******************************************************** */ + 8:main.c **** /* ******************************************************** * + 9:main.c **** ATtiny 88 / Mega 168 / Mega 328 Pin map + 10:main.c **** +-\/-+ + 11:main.c **** /Reset PC6 1|o |28 PC5 ADC5 + 12:main.c **** RXD PD0 2| |27 PC4 ADC4 + 13:main.c **** TXD PD1 3| |26 PC3 ADC3 + 14:main.c **** PD2 4| |25 PC2 ADC2 + 15:main.c **** OC2B PD3 5| |24 PC1 ADC1 + 16:main.c **** PD4 6| |23 PC0 ADC0 + 17:main.c **** VCC 7| |22 GND + 18:main.c **** GND 8| |21 AREF + 19:main.c **** OSC1 PB6 9| |20 VCC + 20:main.c **** OSC2 PB7 10| |19 PB5 SCK + 21:main.c **** OC0B PD5 11| |18 PB4 MISO + 22:main.c **** AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + 23:main.c **** AIN1 PD7 13| |16 PB2 OC1B + 24:main.c **** PB0 14| |15 PB1 OC1A + 25:main.c **** +----+ + 26:main.c **** * ******************************************************** */ + 27:main.c **** + 28:main.c **** #include "main.h" + 29:main.c **** #include + 30:main.c **** #include + 31:main.c **** + 32:main.c **** int main (void) + 33:main.c **** { + 16 .loc 1 33 0 + 17 .cfi_startproc + 18 /* prologue: function */ + 19 /* frame size = 0 */ + 20 /* stack size = 0 */ + 21 .L__stack_usage = 0 + 34:main.c **** unsigned char zwischenspeicher; + 35:main.c **** DDRB = 0b00000100; + 22 .loc 1 35 0 + 23 0000 84E0 ldi r24,lo8(4) + 24 0002 84B9 out 0x4,r24 + 36:main.c **** while(1) + 37:main.c **** { + 38:main.c **** zwischenspeicher = PORTB; + 39:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000100; + 25 .loc 1 39 0 + 26 0004 94E0 ldi r25,lo8(4) + 27 .L2: + 38:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000100; + 28 .loc 1 38 0 discriminator 1 + 29 0006 85B1 in r24,0x5 + 30 .LVL0: + 31 .loc 1 39 0 discriminator 1 + 32 0008 8927 eor r24,r25 + 33 .LVL1: + 40:main.c **** PORTB = zwischenspeicher; + 34 .loc 1 40 0 discriminator 1 + 35 000a 85B9 out 0x5,r24 + 36 .LVL2: + 37 .LBB4: + 38 .LBB5: + 39 .file 2 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\util\\delay.h" + 1:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz + 2:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch + 3:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2007 Florin-Viorel Petrov + 4:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** All rights reserved. + 5:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 6:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Redistribution and use in source and binary forms, with or without + 7:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** modification, are permitted provided that the following conditions are met: + 8:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 9:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions of source code must retain the above copyright + 10:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer. + 11:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 12:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions in binary form must reproduce the above copyright + 13:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer in + 14:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the documentation and/or other materials provided with the + 15:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** distribution. + 16:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 17:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Neither the name of the copyright holders nor the names of + 18:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** contributors may be used to endorse or promote products derived + 19:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** from this software without specific prior written permission. + 20:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 21:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + 22:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + 23:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + 24:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + 25:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + 26:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + 27:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + 28:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + 29:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 30:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + 31:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** POSSIBILITY OF SUCH DAMAGE. */ + 32:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 33:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* $Id$ */ + 34:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 35:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef _UTIL_DELAY_H_ + 36:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define _UTIL_DELAY_H_ 1 + 37:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 38:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __HAS_DELAY_CYCLES + 39:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define __HAS_DELAY_CYCLES 1 + 40:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 41:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 42:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \file */ + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \code + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define F_CPU 1000000UL // 1 MHz + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //#define F_CPU 14.7456E6 + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \endcode + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note As an alternative method, it is possible to pass the + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU macro down to the compiler from the Makefile. + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Obviously, in that case, no \c \#define statement should be + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** used. + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions in this header file are wrappers around the basic + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** busy-wait functions from . They are meant as + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** convenience functions where actual time values can be specified + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** rather than a number of cycles to wait for. The idea behind is + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** that compile-time constant expressions will be eliminated by + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compiler optimization so floating-point expressions can be used + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to calculate the number of delay cycles needed based on the CPU + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** frequency passed by the macro F_CPU. + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note In order for these functions to work as intended, compiler + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** optimizations must be enabled, and the delay time + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** must be an expression that is a known constant at + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compile-time. If these requirements are not met, the resulting + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delay will be much longer (and basically unpredictable), and + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** applications that otherwise do not use floating-point calculations + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** will experience severe code bloat by the floating-point library + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** routines linked into the application. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions available allow the specification of microsecond, and + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** millisecond delays directly, using the application-supplied macro + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU as the CPU clock frequency (in Hertz). + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if !defined(__DOXYGEN__) + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef F_CPU + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* prevent compiler error by supplying a default */ + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "F_CPU not defined for " + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # define F_CPU 1000000UL + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __OPTIMIZE__ + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # include + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \ingroup util_delay + 106:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 107:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + 108:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 109:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The macro F_CPU is supposed to be defined to a + 110:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** constant defining the CPU clock frequency (in Hertz). + 111:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 112:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. + 113:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 114:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** When the user request delay which exceed the maximum possible one, + 115:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms() provides a decreased resolution functionality. In this + 116:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing + 117:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The + 118:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** user will not be informed about decreased resolution. + 119:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 120:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) + 121:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For + 122:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** values greater than the maximal possible delay, overflows results in + 123:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** no delay i.e., 0ms. + 124:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 125:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Conversion of __us into clock cycles may not always result in integer. + 126:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** By default, the clock cycles rounded up to next integer. This ensures that + 127:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the user gets atleast __us microseconds of delay. + 128:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 129:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ + 130:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to round down and round to closest integer. + 131:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 132:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Note: The new implementation of _delay_ms(double __ms) with + 133:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. + 134:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. + 135:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Also, the backward compatible + 136:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** algorithm will be chosen if the code is compiled in a freestanding + 137:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** environment (GCC option \c -ffreestanding), as the math functions + 138:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** required for rounding are not available to the compiler then. + 139:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 140:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 141:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** void + 142:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms(double __ms) + 143:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 144:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** double __tmp ; + 145:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 146:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 147:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 148:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint32_t __ticks_dc; + 149:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); + 150:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; + 151:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 152:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if defined(__DELAY_ROUND_DOWN__) + 153:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); + 154:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 155:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) + 156:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); + 157:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 158:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 159:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //round up by default + 160:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + 161:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 162:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 163:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(__ticks_dc); + 40 .loc 2 163 0 discriminator 1 + 41 000c 2FE9 ldi r18,lo8(99999) + 42 000e 36E8 ldi r19,hi8(99999) + 43 0010 81E0 ldi r24,hlo8(99999) + 44 0012 2150 1: subi r18,1 + 45 0014 3040 sbci r19,0 + 46 0016 8040 sbci r24,0 + 47 0018 01F4 brne 1b + 48 .LVL3: + 49 001a 00C0 rjmp . + 50 001c 0000 nop + 51 001e 00C0 rjmp .L2 + 52 .LBE5: + 53 .LBE4: + 54 .cfi_endproc + 55 .LFE6: + 57 .text + 58 .Letext0: + 59 .file 3 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\stdint.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\cckLBHgu.s:2 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp\cckLBHgu.s:3 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\cckLBHgu.s:4 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\cckLBHgu.s:5 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\cckLBHgu.s:6 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\cckLBHgu.s:13 .text.startup:00000000 main + +NO UNDEFINED SYMBOLS diff --git a/trunk/AVRProjects/ATMega48/main.map b/trunk/AVRProjects/ATMega48/main.map new file mode 100644 index 00000000..049ded57 --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.map @@ -0,0 +1,429 @@ +Archive member included to satisfy reference by file (symbol) + +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00002000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +Address of section .data set to 0x800100 +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +LOAD main.o +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4\libm.a +START GROUP +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4\libm.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4\libc.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x6a + *(.vectors) + .vectors 0x00000000 0x34 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x00000034 . = ALIGN (0x2) + 0x00000034 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000034 0x0 linker stubs + *(.trampolines*) + 0x00000034 __trampolines_end = . + *(.progmem*) + 0x00000034 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000034 __ctors_start = . + *(.ctors) + 0x00000034 __ctors_end = . + 0x00000034 __dtors_start = . + *(.dtors) + 0x00000034 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000034 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + 0x00000034 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000034 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x00000040 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + *(.init9) + *(.text) + .text 0x00000044 0x2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + 0x00000044 __vector_22 + 0x00000044 __vector_1 + 0x00000044 __vector_24 + 0x00000044 __vector_12 + 0x00000044 __bad_interrupt + 0x00000044 __vector_6 + 0x00000044 __vector_3 + 0x00000044 __vector_23 + 0x00000044 __vector_25 + 0x00000044 __vector_11 + 0x00000044 __vector_13 + 0x00000044 __vector_17 + 0x00000044 __vector_19 + 0x00000044 __vector_7 + 0x00000044 __vector_5 + 0x00000044 __vector_4 + 0x00000044 __vector_9 + 0x00000044 __vector_2 + 0x00000044 __vector_21 + 0x00000044 __vector_15 + 0x00000044 __vector_8 + 0x00000044 __vector_14 + 0x00000044 __vector_10 + 0x00000044 __vector_16 + 0x00000044 __vector_18 + 0x00000044 __vector_20 + .text 0x00000046 0x0 main.o + .text 0x00000046 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + 0x00000046 . = ALIGN (0x2) + *(.text.*) + .text.startup 0x00000046 0x20 main.o + 0x00000046 main + .text.libgcc.mul + 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + .text.libgcc.div + 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + .text.libgcc 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + 0x00000066 . = ALIGN (0x2) + *(.fini9) + .fini9 0x00000066 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + 0x00000066 _exit + 0x00000066 exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x00000066 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + *(.fini0) + 0x0000006a _etext = . + +.data 0x00800100 0x0 load address 0x0000006a + [!provide] PROVIDE (__data_start, .) + *(.data) + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + .data 0x00800100 0x0 main.o + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800100 . = ALIGN (0x2) + 0x00800100 _edata = . + [!provide] PROVIDE (__data_end, .) + +.bss 0x00800100 0x0 + [!provide] PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o + .bss 0x00800100 0x0 main.o + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + [!provide] PROVIDE (__bss_end, .) + 0x0000006a __data_load_start = LOADADDR (.data) + 0x0000006a __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800100 0x0 + [!provide] PROVIDE (__noinit_start, .) + *(.noinit*) + [!provide] PROVIDE (__noinit_end, .) + 0x00800100 _end = . + [!provide] PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x20 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x119 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x119 main.o + +.debug_abbrev 0x00000000 0xd1 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0xd1 main.o + +.debug_line 0x00000000 0xd9 + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0xd9 main.o + +.debug_frame 0x00000000 0x24 + *(.debug_frame) + .debug_frame 0x00000000 0x24 main.o + +.debug_str 0x00000000 0x132 + *(.debug_str) + .debug_str 0x00000000 0x132 main.o + 0x166 (size before relaxing) + +.debug_loc 0x00000000 0x1f + *(.debug_loc) + .debug_loc 0x00000000 0x1f main.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x10 + *(.debug_ranges) + .debug_ranges 0x00000000 0x10 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +__bad_interrupt e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__heap_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__init e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__stack e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_1 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_10 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_11 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_12 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_13 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_14 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_15 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_17 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_18 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_19 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_20 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_21 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_23 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_24 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_25 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_5 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_7 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_9 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vector_default e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +__vectors e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +_exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) +exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr4\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o +main main.o + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr4/crtm48.o diff --git a/trunk/AVRProjects/ATMega48/main.sym b/trunk/AVRProjects/ATMega48/main.sym new file mode 100644 index 00000000..bd4c81a4 --- /dev/null +++ b/trunk/AVRProjects/ATMega48/main.sym @@ -0,0 +1,52 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +00000034 T __ctors_end +00000034 T __ctors_start +00000034 T __dtors_end +00000034 T __dtors_start +00000034 W __init +00000034 T __trampolines_end +00000034 T __trampolines_start +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003f a __SREG__ +00000044 T __bad_interrupt +00000044 W __vector_1 +00000044 W __vector_10 +00000044 W __vector_11 +00000044 W __vector_12 +00000044 W __vector_13 +00000044 W __vector_14 +00000044 W __vector_15 +00000044 W __vector_16 +00000044 W __vector_17 +00000044 W __vector_18 +00000044 W __vector_19 +00000044 W __vector_2 +00000044 W __vector_20 +00000044 W __vector_21 +00000044 W __vector_22 +00000044 W __vector_23 +00000044 W __vector_24 +00000044 W __vector_25 +00000044 W __vector_3 +00000044 W __vector_4 +00000044 W __vector_5 +00000044 W __vector_6 +00000044 W __vector_7 +00000044 W __vector_8 +00000044 W __vector_9 +00000046 T main +00000066 T _exit +00000066 W exit +00000068 t __stop_program +0000006a A __data_load_end +0000006a A __data_load_start +0000006a T _etext +000002ff W __stack +00800100 D _edata +00800100 T _end +00810000 T __eeprom_end diff --git a/trunk/AVRProjects/ATMega48/makefile b/trunk/AVRProjects/ATMega48/makefile new file mode 100644 index 00000000..46f8b11f --- /dev/null +++ b/trunk/AVRProjects/ATMega48/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = atmega48 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 8000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATTiny13/.dep/main.o.d b/trunk/AVRProjects/ATTiny13/.dep/main.o.d new file mode 100644 index 00000000..d2f034a3 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/.dep/main.o.d @@ -0,0 +1,35 @@ +main.o: main.c main.h a:\hardware\tools\avr\avr\include\avr\io.h \ + a:\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + a:\hardware\tools\avr\avr\include\inttypes.h \ + a:\hardware\tools\avr\lib\gcc\avr\4.9.2\include\stdint.h \ + a:\hardware\tools\avr\avr\include\stdint.h \ + a:\hardware\tools\avr\avr\include\avr\iotn13.h \ + a:\hardware\tools\avr\avr\include\avr\portpins.h \ + a:\hardware\tools\avr\avr\include\avr\common.h \ + a:\hardware\tools\avr\avr\include\avr\version.h \ + a:\hardware\tools\avr\avr\include\avr\fuse.h \ + a:\hardware\tools\avr\avr\include\avr\lock.h + +main.h: + +a:\hardware\tools\avr\avr\include\avr\io.h: + +a:\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +a:\hardware\tools\avr\avr\include\inttypes.h: + +a:\hardware\tools\avr\lib\gcc\avr\4.9.2\include\stdint.h: + +a:\hardware\tools\avr\avr\include\stdint.h: + +a:\hardware\tools\avr\avr\include\avr\iotn13.h: + +a:\hardware\tools\avr\avr\include\avr\portpins.h: + +a:\hardware\tools\avr\avr\include\avr\common.h: + +a:\hardware\tools\avr\avr\include\avr\version.h: + +a:\hardware\tools\avr\avr\include\avr\fuse.h: + +a:\hardware\tools\avr\avr\include\avr\lock.h: diff --git a/trunk/AVRProjects/ATTiny13/main.c b/trunk/AVRProjects/ATTiny13/main.c new file mode 100644 index 00000000..c89e0e9e --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.c @@ -0,0 +1,67 @@ +/* ******************************************************** * + * + * Simple program with avr-gcc and ATtiny13 + * -------------------------------------------------------- * + * Created on: 07.06.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 13/45/85 Pin map + +--\/--+ + /Reset ADC0 PB5 -|1° 8|- Vcc + ADC3 PB3 -|2 7|- PB2 ADC1 SCK + ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1 + GND -|4 5|- PB0 OC0A MOSI AIN0 + +------+ +* ********************************************************* */ + +#include "main.h" + +void adc_setup (void) +{ + // Set the ADC input to PB2/ADC1 + ADMUX |= (1 << MUX0); + ADMUX |= (1 << ADLAR); + // Set the prescaler to clock/128 & enable ADC + ADCSRA |= (1 << ADPS1) | (1 << ADPS0) | (1 << ADEN); +} + +int adc_read (void) +{ + // Start the conversion + ADCSRA |= (1 << ADSC); + // Wait for it to finish + while (ADCSRA & (1 << ADSC)); + return ADCH; +} + +void pwm_setup (void) +{ + // Set Timer 0 prescaler to clock/8. + // At 9.6 MHz this is 1.2 MHz. + TCCR0B |= (1 << CS01) | (1 << CS00); + // Set to 'Fast PWM' mode + TCCR0A |= (1 << WGM01) | (1 << WGM00); + // Clear OC0B output on compare match, upwards counting. + TCCR0A |= (1 << COM0B1); +} + +void pwm_write (int val) +{ + OCR0B = val; +} + +int main (void) +{ + int adc_in; + // LED is an output. + DDRB |= (1 << LED); + adc_setup(); + pwm_setup(); + while (1) { + // Get the ADC value + adc_in = adc_read(); + // Now write it to the PWM counter + pwm_write(adc_in); + } +} diff --git a/trunk/AVRProjects/ATTiny13/main.eep b/trunk/AVRProjects/ATTiny13/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATTiny13/main.elf b/trunk/AVRProjects/ATTiny13/main.elf new file mode 100644 index 00000000..82a8229a Binary files /dev/null and b/trunk/AVRProjects/ATTiny13/main.elf differ diff --git a/trunk/AVRProjects/ATTiny13/main.h b/trunk/AVRProjects/ATTiny13/main.h new file mode 100644 index 00000000..38af9774 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.h @@ -0,0 +1,18 @@ +/* + * main.h + * + * Created on: 20.07.2016 + * Author: q242695 + */ +#ifndef MAIN_H_ +#define MAIN_H_ + +#include + +#ifndef F_CPU +#define F_CPU 9600000L +#endif + +#define LED PB3 + +#endif /* MAIN_H_ */ diff --git a/trunk/AVRProjects/ATTiny13/main.hex b/trunk/AVRProjects/ATTiny13/main.hex new file mode 100644 index 00000000..bd7e1ea3 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.hex @@ -0,0 +1,8 @@ +:1000000009C00EC00DC00CC00BC00AC009C008C09A +:1000100007C006C011241FBECFE9CDBF1AD01FC034 +:10002000EFCF389A3D9A86B1836886B90895369A9B +:100030003699FECF85B190E0089583B7836083BF82 +:100040008FB583608FBD8FB580628FBD089589BDE8 +:100050000895BB9AE6DFF1DFEADF89BDFDCFF894B2 +:02006000FFCFD0 +:00000001FF diff --git a/trunk/AVRProjects/ATTiny13/main.lss b/trunk/AVRProjects/ATTiny13/main.lss new file mode 100644 index 00000000..00114762 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.lss @@ -0,0 +1,149 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 00000062 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .data 00000000 00800060 00000062 000000d6 2**0 + CONTENTS, ALLOC, LOAD, DATA + 2 .comment 00000011 00000000 00000000 000000d6 2**0 + CONTENTS, READONLY + 3 .note.gnu.avr.deviceinfo 0000003c 00000000 00000000 000000e8 2**2 + CONTENTS, READONLY + 4 .debug_aranges 00000028 00000000 00000000 00000124 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_info 00000410 00000000 00000000 0000014c 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_abbrev 0000037f 00000000 00000000 0000055c 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_line 0000010a 00000000 00000000 000008db 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_frame 00000064 00000000 00000000 000009e8 2**2 + CONTENTS, READONLY, DEBUGGING + 9 .debug_str 00000217 00000000 00000000 00000a4c 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000018 00000000 00000000 00000c63 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 09 c0 rjmp .+18 ; 0x14 <__ctors_end> + 2: 0e c0 rjmp .+28 ; 0x20 <__bad_interrupt> + 4: 0d c0 rjmp .+26 ; 0x20 <__bad_interrupt> + 6: 0c c0 rjmp .+24 ; 0x20 <__bad_interrupt> + 8: 0b c0 rjmp .+22 ; 0x20 <__bad_interrupt> + a: 0a c0 rjmp .+20 ; 0x20 <__bad_interrupt> + c: 09 c0 rjmp .+18 ; 0x20 <__bad_interrupt> + e: 08 c0 rjmp .+16 ; 0x20 <__bad_interrupt> + 10: 07 c0 rjmp .+14 ; 0x20 <__bad_interrupt> + 12: 06 c0 rjmp .+12 ; 0x20 <__bad_interrupt> + +00000014 <__ctors_end>: + 14: 11 24 eor r1, r1 + 16: 1f be out 0x3f, r1 ; 63 + 18: cf e9 ldi r28, 0x9F ; 159 + 1a: cd bf out 0x3d, r28 ; 61 + 1c: 1a d0 rcall .+52 ; 0x52
+ 1e: 1f c0 rjmp .+62 ; 0x5e <_exit> + +00000020 <__bad_interrupt>: + 20: ef cf rjmp .-34 ; 0x0 <__vectors> + +00000022 : +#include "main.h" + +void adc_setup (void) +{ + // Set the ADC input to PB2/ADC1 + ADMUX |= (1 << MUX0); + 22: 38 9a sbi 0x07, 0 ; 7 + ADMUX |= (1 << ADLAR); + 24: 3d 9a sbi 0x07, 5 ; 7 + // Set the prescaler to clock/128 & enable ADC + ADCSRA |= (1 << ADPS1) | (1 << ADPS0) | (1 << ADEN); + 26: 86 b1 in r24, 0x06 ; 6 + 28: 83 68 ori r24, 0x83 ; 131 + 2a: 86 b9 out 0x06, r24 ; 6 + 2c: 08 95 ret + +0000002e : +} + +int adc_read (void) +{ + // Start the conversion + ADCSRA |= (1 << ADSC); + 2e: 36 9a sbi 0x06, 6 ; 6 + // Wait for it to finish + while (ADCSRA & (1 << ADSC)); + 30: 36 99 sbic 0x06, 6 ; 6 + 32: fe cf rjmp .-4 ; 0x30 + return ADCH; + 34: 85 b1 in r24, 0x05 ; 5 +} + 36: 90 e0 ldi r25, 0x00 ; 0 + 38: 08 95 ret + +0000003a : + +void pwm_setup (void) +{ + // Set Timer 0 prescaler to clock/8. + // At 9.6 MHz this is 1.2 MHz. + TCCR0B |= (1 << CS01) | (1 << CS00); + 3a: 83 b7 in r24, 0x33 ; 51 + 3c: 83 60 ori r24, 0x03 ; 3 + 3e: 83 bf out 0x33, r24 ; 51 + // Set to 'Fast PWM' mode + TCCR0A |= (1 << WGM01) | (1 << WGM00); + 40: 8f b5 in r24, 0x2f ; 47 + 42: 83 60 ori r24, 0x03 ; 3 + 44: 8f bd out 0x2f, r24 ; 47 + // Clear OC0B output on compare match, upwards counting. + TCCR0A |= (1 << COM0B1); + 46: 8f b5 in r24, 0x2f ; 47 + 48: 80 62 ori r24, 0x20 ; 32 + 4a: 8f bd out 0x2f, r24 ; 47 + 4c: 08 95 ret + +0000004e : +} + +void pwm_write (int val) +{ + OCR0B = val; + 4e: 89 bd out 0x29, r24 ; 41 + 50: 08 95 ret + +00000052
: + +int main (void) +{ + int adc_in; + // LED is an output. + DDRB |= (1 << LED); + 52: bb 9a sbi 0x17, 3 ; 23 + adc_setup(); + 54: e6 df rcall .-52 ; 0x22 + pwm_setup(); + 56: f1 df rcall .-30 ; 0x3a + while (1) { + // Get the ADC value + adc_in = adc_read(); + 58: ea df rcall .-44 ; 0x2e + TCCR0A |= (1 << COM0B1); +} + +void pwm_write (int val) +{ + OCR0B = val; + 5a: 89 bd out 0x29, r24 ; 41 + 5c: fd cf rjmp .-6 ; 0x58 + +0000005e <_exit>: + 5e: f8 94 cli + +00000060 <__stop_program>: + 60: ff cf rjmp .-2 ; 0x60 <__stop_program> diff --git a/trunk/AVRProjects/ATTiny13/main.lst b/trunk/AVRProjects/ATTiny13/main.lst new file mode 100644 index 00000000..3071ea63 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.lst @@ -0,0 +1,201 @@ + 1 .file "main.c" + 2 __SP_L__ = 0x3d + 3 __SREG__ = 0x3f + 4 __tmp_reg__ = 0 + 5 __zero_reg__ = 1 + 6 .text + 7 .Ltext0: + 8 .cfi_sections .debug_frame + 9 .global adc_setup + 11 adc_setup: + 12 .LFB0: + 13 .file 1 "main.c" + 1:main.c **** /* ******************************************************** * + 2:main.c **** * + 3:main.c **** * Simple program with avr-gcc and ATtiny13 + 4:main.c **** * -------------------------------------------------------- * + 5:main.c **** * Created on: 07.06.2016 + 6:main.c **** * Author: Paolo Iocco + 7:main.c **** * ******************************************************** */ + 8:main.c **** /* ******************************************************** * + 9:main.c **** ATtiny 13/45/85 Pin map + 10:main.c **** +--\/--+ + 11:main.c **** /Reset ADC0 PB5 -|1° 8|- Vcc + 12:main.c **** ADC3 PB3 -|2 7|- PB2 ADC1 SCK + 13:main.c **** ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1 + 14:main.c **** GND -|4 5|- PB0 OC0A MOSI AIN0 + 15:main.c **** +------+ + 16:main.c **** * ********************************************************* */ + 17:main.c **** + 18:main.c **** #include "main.h" + 19:main.c **** + 20:main.c **** void adc_setup (void) + 21:main.c **** { + 14 .loc 1 21 0 + 15 .cfi_startproc + 16 /* prologue: function */ + 17 /* frame size = 0 */ + 18 /* stack size = 0 */ + 19 .L__stack_usage = 0 + 22:main.c **** // Set the ADC input to PB2/ADC1 + 23:main.c **** ADMUX |= (1 << MUX0); + 20 .loc 1 23 0 + 21 0000 389A sbi 0x7,0 + 24:main.c **** ADMUX |= (1 << ADLAR); + 22 .loc 1 24 0 + 23 0002 3D9A sbi 0x7,5 + 25:main.c **** // Set the prescaler to clock/128 & enable ADC + 26:main.c **** ADCSRA |= (1 << ADPS1) | (1 << ADPS0) | (1 << ADEN); + 24 .loc 1 26 0 + 25 0004 86B1 in r24,0x6 + 26 0006 8368 ori r24,lo8(-125) + 27 0008 86B9 out 0x6,r24 + 28 000a 0895 ret + 29 .cfi_endproc + 30 .LFE0: + 32 .global adc_read + 34 adc_read: + 35 .LFB1: + 27:main.c **** } + 28:main.c **** + 29:main.c **** int adc_read (void) + 30:main.c **** { + 36 .loc 1 30 0 + 37 .cfi_startproc + 38 /* prologue: function */ + 39 /* frame size = 0 */ + 40 /* stack size = 0 */ + 41 .L__stack_usage = 0 + 31:main.c **** // Start the conversion + 32:main.c **** ADCSRA |= (1 << ADSC); + 42 .loc 1 32 0 + 43 000c 369A sbi 0x6,6 + 44 .L3: + 33:main.c **** // Wait for it to finish + 34:main.c **** while (ADCSRA & (1 << ADSC)); + 45 .loc 1 34 0 discriminator 1 + 46 000e 3699 sbic 0x6,6 + 47 0010 00C0 rjmp .L3 + 35:main.c **** return ADCH; + 48 .loc 1 35 0 + 49 0012 85B1 in r24,0x5 + 36:main.c **** } + 50 .loc 1 36 0 + 51 0014 90E0 ldi r25,0 + 52 0016 0895 ret + 53 .cfi_endproc + 54 .LFE1: + 56 .global pwm_setup + 58 pwm_setup: + 59 .LFB2: + 37:main.c **** + 38:main.c **** void pwm_setup (void) + 39:main.c **** { + 60 .loc 1 39 0 + 61 .cfi_startproc + 62 /* prologue: function */ + 63 /* frame size = 0 */ + 64 /* stack size = 0 */ + 65 .L__stack_usage = 0 + 40:main.c **** // Set Timer 0 prescaler to clock/8. + 41:main.c **** // At 9.6 MHz this is 1.2 MHz. + 42:main.c **** TCCR0B |= (1 << CS01) | (1 << CS00); + 66 .loc 1 42 0 + 67 0018 83B7 in r24,0x33 + 68 001a 8360 ori r24,lo8(3) + 69 001c 83BF out 0x33,r24 + 43:main.c **** // Set to 'Fast PWM' mode + 44:main.c **** TCCR0A |= (1 << WGM01) | (1 << WGM00); + 70 .loc 1 44 0 + 71 001e 8FB5 in r24,0x2f + 72 0020 8360 ori r24,lo8(3) + 73 0022 8FBD out 0x2f,r24 + 45:main.c **** // Clear OC0B output on compare match, upwards counting. + 46:main.c **** TCCR0A |= (1 << COM0B1); + 74 .loc 1 46 0 + 75 0024 8FB5 in r24,0x2f + 76 0026 8062 ori r24,lo8(32) + 77 0028 8FBD out 0x2f,r24 + 78 002a 0895 ret + 79 .cfi_endproc + 80 .LFE2: + 82 .global pwm_write + 84 pwm_write: + 85 .LFB3: + 47:main.c **** } + 48:main.c **** + 49:main.c **** void pwm_write (int val) + 50:main.c **** { + 86 .loc 1 50 0 + 87 .cfi_startproc + 88 .LVL0: + 89 /* prologue: function */ + 90 /* frame size = 0 */ + 91 /* stack size = 0 */ + 92 .L__stack_usage = 0 + 51:main.c **** OCR0B = val; + 93 .loc 1 51 0 + 94 002c 89BD out 0x29,r24 + 95 002e 0895 ret + 96 .cfi_endproc + 97 .LFE3: + 99 .section .text.startup,"ax",@progbits + 100 .global main + 102 main: + 103 .LFB4: + 52:main.c **** } + 53:main.c **** + 54:main.c **** int main (void) + 55:main.c **** { + 104 .loc 1 55 0 + 105 .cfi_startproc + 106 /* prologue: function */ + 107 /* frame size = 0 */ + 108 /* stack size = 0 */ + 109 .L__stack_usage = 0 + 56:main.c **** int adc_in; + 57:main.c **** // LED is an output. + 58:main.c **** DDRB |= (1 << LED); + 110 .loc 1 58 0 + 111 0000 BB9A sbi 0x17,3 + 59:main.c **** adc_setup(); + 112 .loc 1 59 0 + 113 0002 00D0 rcall adc_setup + 114 .LVL1: + 60:main.c **** pwm_setup(); + 115 .loc 1 60 0 + 116 0004 00D0 rcall pwm_setup + 117 .LVL2: + 118 .L9: + 61:main.c **** while (1) { + 62:main.c **** // Get the ADC value + 63:main.c **** adc_in = adc_read(); + 119 .loc 1 63 0 discriminator 1 + 120 0006 00D0 rcall adc_read + 121 .LVL3: + 122 .LBB4: + 123 .LBB5: + 51:main.c **** } + 124 .loc 1 51 0 discriminator 1 + 125 0008 89BD out 0x29,r24 + 126 000a 00C0 rjmp .L9 + 127 .LBE5: + 128 .LBE4: + 129 .cfi_endproc + 130 .LFE4: + 132 .text + 133 .Letext0: + 134 .file 2 "a:\\hardware\\tools\\avr\\avr\\include\\stdint.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:2 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:3 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:4 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:5 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:11 .text:00000000 adc_setup +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:34 .text:0000000c adc_read +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:58 .text:00000018 pwm_setup +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:84 .text:0000002c pwm_write +C:\Users\q242695\AppData\Local\Temp\ccY7rbVv.s:102 .text.startup:00000000 main + +NO UNDEFINED SYMBOLS diff --git a/trunk/AVRProjects/ATTiny13/main.map b/trunk/AVRProjects/ATTiny13/main.map new file mode 100644 index 00000000..15203392 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.map @@ -0,0 +1,427 @@ +Archive member included to satisfy reference by file (symbol) + +a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00002000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000002 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +user_signatures 0x00850000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +LOAD a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +LOAD main.o +LOAD a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack\libm.a +START GROUP +LOAD a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a +LOAD a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack\libm.a +LOAD a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack\libc.a +LOAD a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack\libattiny13.a +END GROUP + 0x00002000 __TEXT_REGION_LENGTH__ = DEFINED (__TEXT_REGION_LENGTH__)?__TEXT_REGION_LENGTH__:0x2000 + 0x0000ffa0 __DATA_REGION_LENGTH__ = DEFINED (__DATA_REGION_LENGTH__)?__DATA_REGION_LENGTH__:0xffa0 + 0x00010000 __EEPROM_REGION_LENGTH__ = DEFINED (__EEPROM_REGION_LENGTH__)?__EEPROM_REGION_LENGTH__:0x10000 + [0x00000002] __FUSE_REGION_LENGTH__ = DEFINED (__FUSE_REGION_LENGTH__)?__FUSE_REGION_LENGTH__:0x400 + 0x00000400 __LOCK_REGION_LENGTH__ = DEFINED (__LOCK_REGION_LENGTH__)?__LOCK_REGION_LENGTH__:0x400 + 0x00000400 __SIGNATURE_REGION_LENGTH__ = DEFINED (__SIGNATURE_REGION_LENGTH__)?__SIGNATURE_REGION_LENGTH__:0x400 + 0x00000400 __USER_SIGNATURE_REGION_LENGTH__ = DEFINED (__USER_SIGNATURE_REGION_LENGTH__)?__USER_SIGNATURE_REGION_LENGTH__:0x400 + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x62 + *(.vectors) + .vectors 0x00000000 0x14 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x00000014 . = ALIGN (0x2) + 0x00000014 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000014 0x0 linker stubs + *(.trampolines*) + 0x00000014 __trampolines_end = . + *libprintf_flt.a:*(.progmem.data) + *libc.a:*(.progmem.data) + *(.progmem*) + 0x00000014 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000014 __ctors_start = . + *(.ctors) + 0x00000014 __ctors_end = . + 0x00000014 __dtors_start = . + *(.dtors) + 0x00000014 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000014 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + 0x00000014 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000014 0x8 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x0000001c 0x4 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + *(.init9) + *(.text) + .text 0x00000020 0x2 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + 0x00000020 __vector_1 + 0x00000020 __bad_interrupt + 0x00000020 __vector_6 + 0x00000020 __vector_3 + 0x00000020 __vector_7 + 0x00000020 __vector_5 + 0x00000020 __vector_4 + 0x00000020 __vector_9 + 0x00000020 __vector_2 + 0x00000020 __vector_8 + .text 0x00000022 0x30 main.o + 0x00000022 adc_setup + 0x0000002e adc_read + 0x0000003a pwm_setup + 0x0000004e pwm_write + .text 0x00000052 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + 0x00000052 . = ALIGN (0x2) + *(.text.*) + .text.startup 0x00000052 0xc main.o + 0x00000052 main + .text.libgcc.mul + 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + .text.libgcc.div + 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + .text.libgcc 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + 0x0000005e . = ALIGN (0x2) + *(.fini9) + .fini9 0x0000005e 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + 0x0000005e _exit + 0x0000005e exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x0000005e 0x4 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + *(.fini0) + 0x00000062 _etext = . + +.data 0x00800060 0x0 load address 0x00000062 + [!provide] PROVIDE (__data_start, .) + *(.data) + .data 0x00800060 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + .data 0x00800060 0x0 main.o + .data 0x00800060 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800060 . = ALIGN (0x2) + 0x00800060 _edata = . + [!provide] PROVIDE (__data_end, .) + +.bss 0x00800060 0x0 + [!provide] PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800060 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + .bss 0x00800060 0x0 main.o + .bss 0x00800060 0x0 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + [!provide] PROVIDE (__bss_end, .) + 0x00000062 __data_load_start = LOADADDR (.data) + 0x00000062 __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800060 0x0 + [!provide] PROVIDE (__noinit_start, .) + *(.noinit*) + [!provide] PROVIDE (__noinit_end, .) + 0x00800060 _end = . + [!provide] PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.user_signatures + *(.user_signatures*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + +.note.gnu.avr.deviceinfo + 0x00000000 0x3c + .note.gnu.avr.deviceinfo + 0x00000000 0x3c a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x28 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x28 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x410 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x2b8 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + .debug_info 0x000002b8 0x158 main.o + +.debug_abbrev 0x00000000 0x37f + *(.debug_abbrev) + .debug_abbrev 0x00000000 0x294 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + .debug_abbrev 0x00000294 0xeb main.o + +.debug_line 0x00000000 0x10a + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0x1a a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + .debug_line 0x0000001a 0xf0 main.o + +.debug_frame 0x00000000 0x64 + *(.debug_frame) + .debug_frame 0x00000000 0x64 main.o + +.debug_str 0x00000000 0x217 + *(.debug_str) + .debug_str 0x00000000 0xf6 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o + .debug_str 0x000000f6 0x121 main.o + 0x155 (size before relaxing) + +.debug_loc + *(.debug_loc) + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x18 + *(.debug_ranges) + .debug_ranges 0x00000000 0x18 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +__FUSE_REGION_LENGTH__ a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__bad_interrupt a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__heap_end a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__init a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__stack a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_1 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_2 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_3 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_4 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_5 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_6 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_7 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_8 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_9 a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vector_default a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +__vectors a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +_exit a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) +adc_read main.o +adc_setup main.o +exit a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/avr25/tiny-stack\libgcc.a(_exit.o) + a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +main main.o + a:/hardware/tools/avr/bin/../lib/gcc/avr/4.9.2/../../../../avr/lib/avr25/tiny-stack/crtattiny13.o +pwm_setup main.o +pwm_write main.o diff --git a/trunk/AVRProjects/ATTiny13/main.sym b/trunk/AVRProjects/ATTiny13/main.sym new file mode 100644 index 00000000..29b1c788 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/main.sym @@ -0,0 +1,46 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +00000002 A __FUSE_REGION_LENGTH__ +00000014 T __ctors_end +00000014 T __ctors_start +00000014 T __dtors_end +00000014 T __dtors_start +00000014 W __init +00000014 T __trampolines_end +00000014 T __trampolines_start +00000020 T __bad_interrupt +00000020 W __vector_1 +00000020 W __vector_2 +00000020 W __vector_3 +00000020 W __vector_4 +00000020 W __vector_5 +00000020 W __vector_6 +00000020 W __vector_7 +00000020 W __vector_8 +00000020 W __vector_9 +00000022 T adc_setup +0000002e T adc_read +0000003a T pwm_setup +0000003d a __SP_L__ +0000003f a __SREG__ +0000004e T pwm_write +00000052 T main +0000005e T _exit +0000005e W exit +00000060 t __stop_program +00000062 A __data_load_end +00000062 A __data_load_start +00000062 T _etext +0000009f W __stack +00000400 A __LOCK_REGION_LENGTH__ +00000400 A __SIGNATURE_REGION_LENGTH__ +00000400 A __USER_SIGNATURE_REGION_LENGTH__ +00002000 A __TEXT_REGION_LENGTH__ +0000ffa0 A __DATA_REGION_LENGTH__ +00010000 A __EEPROM_REGION_LENGTH__ +00800060 D _edata +00800060 D _end +00810000 D __eeprom_end diff --git a/trunk/AVRProjects/ATTiny13/makefile b/trunk/AVRProjects/ATTiny13/makefile new file mode 100644 index 00000000..c1ba6d20 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny13 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +#F_OSC = 9600000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.avr b/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.avr new file mode 100644 index 00000000..bf1aad5b --- /dev/null +++ b/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.avr @@ -0,0 +1,36 @@ +;* ******************************************************** * +; ATtiny 13/45/85 Pin map +; +--\/--+ +; /Reset ADC0 PB5 -|1° 8|- Vcc +; ADC3 PB3 -|2 7|- PB2 ADC1 SCK +; ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1 +; GND -|4 5|- PB0 OC0A MOSI AIN0 +; +------+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +;.DEVICE ATtiny13A +.include "tn13def.inc" + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ;Reset + reti ;INT0 - External Int0 Vector + reti ;PCINT0 - Pin Change Interrupt handler + reti ;TIM0_OVF - Timer0 Overflow handler + reti ;EE_RDY - EEPROM Ready Handler + reti ;ANA_COMP - Analog Comparator Handler + reti ;TIM0_COMPA - Timer0 Compare match A Handler + reti ;TIM0_COMPB - Timer0 Compare match B Handler + reti ;WDT - Watchdog Overflow Handler + reti ;ADC - ADC Conversion Handler + +.ORG $000A +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ; Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.hex b/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.hex new file mode 100644 index 00000000..b3e04610 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.hex @@ -0,0 +1,4 @@ +:020000020000FC +:1000000009C018951895189518951895189518956C +:0C00100018951895F8940FE90DBFFFCF6C +:00000001FF diff --git a/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.lst b/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.lst new file mode 100644 index 00000000..598b93a1 --- /dev/null +++ b/trunk/AVRProjects/ATTiny13a-primo_asm/tiny13a_primo.lst @@ -0,0 +1,50 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny13a_primo.avr +Hex file: tiny13a_primo.hex +Eeprom file: tiny13a_primo.eep +Compiled: 08.11.2019, 14:49:53 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 13/45/85 Pin map + 3: ; +--\/--+ + 4: ; /Reset ADC0 PB5 -|1° 8|- Vcc + 5: ; ADC3 PB3 -|2 7|- PB2 ADC1 SCK + 6: ; ADC2 PB4 -|3 6|- PB1 OC0B MISO AIN1 + 7: ; GND -|4 5|- PB0 OC0A MOSI AIN0 + 8: ; +------+ + 9: ;* ******************************************************** */ + 10: + 11: ; Define processor type on top of the source code + 12: ; + 13: .DEVICE ATtiny13A + 14: + 15: ; Int-Vector area + 16: .CSEG + 17: .ORG $0000 + 18: 000000 C009 rjmp Setup ;Reset + 19: 000001 9518 reti ;INT0 - External Int0 Vector + 20: 000002 9518 reti ;PCINT0 - Pin Change Interrupt handler + 21: 000003 9518 reti ;TIM0_OVF - Timer0 Overflow handler + 22: 000004 9518 reti ;EE_RDY - EEPROM Ready Handler + 23: 000005 9518 reti ;ANA_COMP - Analog Comparator Handler + 24: 000006 9518 reti ;TIM0_COMPA - Timer0 Compare match A Handler + 25: 000007 9518 reti ;TIM0_COMPB - Timer0 Compare match B Handler + 26: 000008 9518 reti ;WDT - Watchdog Overflow Handler + 27: 000009 9518 reti ;ADC - ADC Conversion Handler + 28: + 29: .ORG $000A + 30: Setup: + 31: 00000A 94F8 cli ; Disable Interrupts + 32: 00000B E90F ldi r16, low(RAMEND) + 33: 00000C BF0D out SPL,r16 ; Set Stack Pointer to top of RAM + 34: Main: + 35: 00000D CFFF rjmp Main ; infinite loop + +Program : 14 words. +Constants : 0 words. +Total program memory: 14 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 08.11.2019, 14:49:53 diff --git a/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.avr b/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.avr new file mode 100644 index 00000000..bb0b2055 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.avr @@ -0,0 +1,49 @@ +;* ******************************************************** * +; ATtiny 2313/4313 Pin map +; +-\/-+ +; /Reset PA2 1|o |20 Vcc +; RXD PD0 2| |19 PB7 SCK +; TXD PD1 3| |18 PB6 MISO +; PA1 4| |17 PB5 MOSI +; PA0 5| |16 PB4 OC1B +; PD2 6| |15 PB3 OC1A +; PD3 7| |14 PB2 OC0A +; PD4 8| |13 PB1 AIN1 +; OC0B PD5 9| |12 PB0 AIN0 +; GND 10| |11 PD6 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny2313A + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ; for all types + reti ; External Int0 Vector, not used + reti ; External Int1 Vector, not used + reti ; Timer Tim1_Capt, not used + reti ; Timer Tim1_CompA, not used + reti ; Timer Tim1_Ovf, not used + reti ; Timer Tim0_Ovf, used + reti ; Usart_RXC, not used + reti ; Usart_dre, not used + reti ; Usart_TXC, not used + reti ; ANA_COMP ; Analog Comparator Handler + reti ; PCINT ; Pin Change Interrupt + reti ; TIMER1_COMPB ; Timer1 Compare B Handler + reti ; TIMER0_COMPA ; Timer0 Compare A Handler + reti ; TIMER0_COMPB ; Timer0 Compare B Handler + reti ; USI_START ; USI Start Handler + reti ; USI_OVERFLOW ; USI Overflow Handler + reti ; EE_READY ; EEPROM Ready Handler + reti ; WDT_OVERFLOW ; Watchdog Overflow Handler + +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.hex b/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.hex new file mode 100644 index 00000000..d1c0cb27 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.hex @@ -0,0 +1,5 @@ +:020000020000FC +:1000000012C0189518951895189518951895189563 +:100010001895189518951895189518951895189578 +:0E002000189518951895F8940FED0DBFFFCFA9 +:00000001FF diff --git a/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.lst b/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.lst new file mode 100644 index 00000000..46072c54 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-primo_asm/tiny2313a_primo.lst @@ -0,0 +1,64 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny2313a_primo.avr +Hex file: tiny2313a_primo.hex +Eeprom file: tiny2313a_primo.eep +Compiled: 26.07.2016, 11:35:04 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 2313/4313 Pin map + 3: ; +-\/-+ + 4: ; /Reset PA2 1|o |20 Vcc + 5: ; RXD PD0 2| |19 PB7 SCK + 6: ; TXD PD1 3| |18 PB6 MISO + 7: ; PA1 4| |17 PB5 MOSI + 8: ; PA0 5| |16 PB4 OC1B + 9: ; PD2 6| |15 PB3 OC1A + 10: ; PD3 7| |14 PB2 OC0A + 11: ; PD4 8| |13 PB1 AIN1 + 12: ; OC0B PD5 9| |12 PB0 AIN0 + 13: ; GND 10| |11 PD6 + 14: ; +----+ + 15: ;* ******************************************************** */ + 16: + 17: ; Define processor type on top of the source code + 18: ; + 19: .DEVICE ATtiny2313A + 20: + 21: ; Int-Vector area + 22: .CSEG + 23: .ORG $0000 + 24: 000000 C012 rjmp Setup ; for all types + 25: 000001 9518 reti ; External Int0 Vector, not used + 26: 000002 9518 reti ; External Int1 Vector, not used + 27: 000003 9518 reti ; Timer Tim1_Capt, not used + 28: 000004 9518 reti ; Timer Tim1_CompA, not used + 29: 000005 9518 reti ; Timer Tim1_Ovf, not used + 30: 000006 9518 reti ; Timer Tim0_Ovf, used + 31: 000007 9518 reti ; Usart_RXC, not used + 32: 000008 9518 reti ; Usart_dre, not used + 33: 000009 9518 reti ; Usart_TXC, not used + 34: 00000A 9518 reti ; ANA_COMP ; Analog Comparator Handler + 35: 00000B 9518 reti ; PCINT ; Pin Change Interrupt + 36: 00000C 9518 reti ; TIMER1_COMPB ; Timer1 Compare B Handler + 37: 00000D 9518 reti ; TIMER0_COMPA ; Timer0 Compare A Handler + 38: 00000E 9518 reti ; TIMER0_COMPB ; Timer0 Compare B Handler + 39: 00000F 9518 reti ; USI_START ; USI Start Handler + 40: 000010 9518 reti ; USI_OVERFLOW ; USI Overflow Handler + 41: 000011 9518 reti ; EE_READY ; EEPROM Ready Handler + 42: 000012 9518 reti ; WDT_OVERFLOW ; Watchdog Overflow Handler + 43: + 44: Setup: + 45: 000013 94F8 cli ; Disable Interrupts + 46: 000014 ED0F ldi r16, low(RAMEND) + 47: 000015 BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 48: Main: + 49: 000016 CFFF rjmp Main ; infinite loop + +Program : 23 words. +Constants : 0 words. +Total program memory: 23 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 26.07.2016, 11:35:04 diff --git a/trunk/AVRProjects/ATTiny2313-usb/License.txt b/trunk/AVRProjects/ATTiny2313-usb/License.txt new file mode 100644 index 00000000..818433ec --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/License.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/trunk/AVRProjects/ATTiny2313-usb/Makefile b/trunk/AVRProjects/ATTiny2313-usb/Makefile new file mode 100644 index 00000000..0e25c9ea --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/Makefile @@ -0,0 +1,51 @@ +# WinAVR cross-compiler toolchain is used here +CC = avr-gcc +OBJCOPY = avr-objcopy +DUDE = avrdude + +# If you are not using ATtiny2313 and the USBtiny programmer, +# update the lines below to match your configuration +CFLAGS = -Wall -Os -Iusbdrv -mmcu=attiny2313 +OBJFLAGS = -j .text -j .data -O ihex +DUDEFLAGS = -p attiny2313 -c usbtiny -v + +# Object files for the firmware (usbdrv/oddebug.o not strictly needed I think) +OBJECTS = usbdrv/usbdrv.o usbdrv/oddebug.o usbdrv/usbdrvasm.o main.o + +# Command-line client +CMDLINE = usbtest.exe + +# By default, build the firmware and command-line client, but do not flash +all: main.hex $(CMDLINE) + +# With this, you can flash the firmware by just typing "make flash" on command-line +flash: main.hex + $(DUDE) $(DUDEFLAGS) -U flash:w:$< + +# One-liner to compile the command-line client from usbtest.c +$(CMDLINE): usbtest.c + gcc -I ./libusb/include -L ./libusb/lib/gcc -O -Wall usbtest.c -o usbtest.exe -lusb + +# Housekeeping if you want it +clean: + $(RM) *.o *.hex *.elf usbdrv/*.o + +# From .elf file to .hex +%.hex: %.elf + $(OBJCOPY) $(OBJFLAGS) $< $@ + +# Main.elf requires additional objects to the firmware, not just main.o +main.elf: $(OBJECTS) + $(CC) $(CFLAGS) $(OBJECTS) -o $@ + +# Without this dependance, .o files will not be recompiled if you change +# the config! I spent a few hours debugging because of this... +$(OBJECTS): usbdrv/usbconfig.h + +# From C source to .o object file +%.o: %.c + $(CC) $(CFLAGS) -c $< -o $@ + +# From assembler source to .o object file +%.o: %.S + $(CC) $(CFLAGS) -x assembler-with-cpp -c $< -o $@ diff --git a/trunk/AVRProjects/ATTiny2313-usb/README.txt b/trunk/AVRProjects/ATTiny2313-usb/README.txt new file mode 100644 index 00000000..21898d4b --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/README.txt @@ -0,0 +1,13 @@ +This is the source code package for AVR ATtiny USB Tutorial by Joonas Pihlajamaa, published at Code and Life blog, http://codeandlife.com: + +http://codeandlife.com/2012/01/22/avr-attiny-usb-tutorial-part-1/ +http://codeandlife.com/2012/01/25/avr-attiny-usb-tutorial-part-2/ +http://codeandlife.com/2012/01/29/avr-attiny-usb-tutorial-part-3/ +http://codeandlife.com/2012/02/04/avr-attiny-usb-tutorial-part-4/ + + +The subfolders contain parts of libusb-win32 available at http://sourceforge.net/apps/trac/libusb-win32/wiki and V-USB library available at http://www.obdev.at/avrusb/ and their contents are copyrighted by their respective authors. My productions in the root folder are published under GNU GPL v3 (see License.txt). + +I hope you have fun with this project! + +- Joonas Pihlajamaa \ No newline at end of file diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/USBexample.inf b/trunk/AVRProjects/ATTiny2313-usb/driver/USBexample.inf new file mode 100644 index 00000000..e2cb6d8f Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/USBexample.inf differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/amd64/libusb0.dll b/trunk/AVRProjects/ATTiny2313-usb/driver/amd64/libusb0.dll new file mode 100644 index 00000000..f916b089 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/amd64/libusb0.dll differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/amd64/libusb0.sys b/trunk/AVRProjects/ATTiny2313-usb/driver/amd64/libusb0.sys new file mode 100644 index 00000000..0718dfb7 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/amd64/libusb0.sys differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/ia64/libusb0.dll b/trunk/AVRProjects/ATTiny2313-usb/driver/ia64/libusb0.dll new file mode 100644 index 00000000..292df278 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/ia64/libusb0.dll differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/ia64/libusb0.sys b/trunk/AVRProjects/ATTiny2313-usb/driver/ia64/libusb0.sys new file mode 100644 index 00000000..f17914b8 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/ia64/libusb0.sys differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/installer_x64.exe b/trunk/AVRProjects/ATTiny2313-usb/driver/installer_x64.exe new file mode 100644 index 00000000..c38919ee Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/installer_x64.exe differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/installer_x86.exe b/trunk/AVRProjects/ATTiny2313-usb/driver/installer_x86.exe new file mode 100644 index 00000000..030ec300 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/installer_x86.exe differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/license/libusb0/installer_license.txt b/trunk/AVRProjects/ATTiny2313-usb/driver/license/libusb0/installer_license.txt new file mode 100644 index 00000000..6128be63 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/driver/license/libusb0/installer_license.txt @@ -0,0 +1,851 @@ +Copyright (c) 2002-2004 Stephan Meyer, +Copyright (c) 2000-2004 Johannes Erdfelt, +Copyright (c) 2000-2004 Thomas Sailer, +Copyright (c) 2010 Travis Robinson, + +This software is distributed under the following licenses: +Driver: GNU General Public License (GPL) +Library, Test Files, Installer: GNU Lesser General Public License (LGPL) + +*********************************************************************** + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/x86/libusb0.sys b/trunk/AVRProjects/ATTiny2313-usb/driver/x86/libusb0.sys new file mode 100644 index 00000000..5322e5b9 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/x86/libusb0.sys differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/driver/x86/libusb0_x86.dll b/trunk/AVRProjects/ATTiny2313-usb/driver/x86/libusb0_x86.dll new file mode 100644 index 00000000..6e475b90 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/driver/x86/libusb0_x86.dll differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/AUTHORS.txt b/trunk/AVRProjects/ATTiny2313-usb/libusb/AUTHORS.txt new file mode 100644 index 00000000..6edc318e --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/AUTHORS.txt @@ -0,0 +1,16 @@ + +Library, Test Programs: + +Stephan Meyer, +Johannes Erdfelt, +Thomas Sailer, + +Drivers, Installer: + +Stephan Meyer, +Travis Robinson, + +Testing, Technical support: + +Xiaofan Chen, + diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/COPYING_GPL.txt b/trunk/AVRProjects/ATTiny2313-usb/libusb/COPYING_GPL.txt new file mode 100644 index 00000000..818433ec --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/COPYING_GPL.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/COPYING_LGPL.txt b/trunk/AVRProjects/ATTiny2313-usb/libusb/COPYING_LGPL.txt new file mode 100644 index 00000000..b14ca0a5 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/COPYING_LGPL.txt @@ -0,0 +1,165 @@ + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/README.txt b/trunk/AVRProjects/ATTiny2313-usb/libusb/README.txt new file mode 100644 index 00000000..fd0b29e6 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/README.txt @@ -0,0 +1,12 @@ + +This is libusb-win32 (http://libusb-win32.sourceforge.net) version 1.2.6.0. +Libusb-win32 is a library that allows userspace application to access USB +devices on Windows operation systems (Win2k, WinXP, Vista, Win7). +It is derived from and fully API compatible to libusb available at +http://libusb.sourceforge.net. + +For more information visit the project's web site at: + +http://libusb-win32.sourceforge.net +http://sourceforge.net/projects/libusb-win32 + diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/include/lusb0_usb.h b/trunk/AVRProjects/ATTiny2313-usb/libusb/include/lusb0_usb.h new file mode 100644 index 00000000..320349bb --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/include/lusb0_usb.h @@ -0,0 +1,427 @@ +#ifndef __USB_H__ +#define __USB_H__ + +#include +#include + +/* + * 'interface' is defined somewhere in the Windows header files. This macro + * is deleted here to avoid conflicts and compile errors. + */ + +#ifdef interface +#undef interface +#endif + +/* + * PATH_MAX from limits.h can't be used on Windows if the dll and + * import libraries are build/used by different compilers + */ + +#define LIBUSB_PATH_MAX 512 + + +/* + * USB spec information + * + * This is all stuff grabbed from various USB specs and is pretty much + * not subject to change + */ + +/* + * Device and/or Interface Class codes + */ +#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ +#define USB_CLASS_AUDIO 1 +#define USB_CLASS_COMM 2 +#define USB_CLASS_HID 3 +#define USB_CLASS_PRINTER 7 +#define USB_CLASS_MASS_STORAGE 8 +#define USB_CLASS_HUB 9 +#define USB_CLASS_DATA 10 +#define USB_CLASS_VENDOR_SPEC 0xff + +/* + * Descriptor types + */ +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 + +#define USB_DT_HID 0x21 +#define USB_DT_REPORT 0x22 +#define USB_DT_PHYSICAL 0x23 +#define USB_DT_HUB 0x29 + +/* + * Descriptor sizes per descriptor type + */ +#define USB_DT_DEVICE_SIZE 18 +#define USB_DT_CONFIG_SIZE 9 +#define USB_DT_INTERFACE_SIZE 9 +#define USB_DT_ENDPOINT_SIZE 7 +#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define USB_DT_HUB_NONVAR_SIZE 7 + + +/* ensure byte-packed structures */ +#include + + +/* All standard descriptors have these 2 fields in common */ +struct usb_descriptor_header +{ + unsigned char bLength; + unsigned char bDescriptorType; +}; + +/* String descriptor */ +struct usb_string_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short wData[1]; +}; + +/* HID descriptor */ +struct usb_hid_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdHID; + unsigned char bCountryCode; + unsigned char bNumDescriptors; +}; + +/* Endpoint descriptor */ +#define USB_MAXENDPOINTS 32 +struct usb_endpoint_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned char bEndpointAddress; + unsigned char bmAttributes; + unsigned short wMaxPacketSize; + unsigned char bInterval; + unsigned char bRefresh; + unsigned char bSynchAddress; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +}; + +#define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ +#define USB_ENDPOINT_DIR_MASK 0x80 + +#define USB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */ +#define USB_ENDPOINT_TYPE_CONTROL 0 +#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1 +#define USB_ENDPOINT_TYPE_BULK 2 +#define USB_ENDPOINT_TYPE_INTERRUPT 3 + +/* Interface descriptor */ +#define USB_MAXINTERFACES 32 +struct usb_interface_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned char bInterfaceNumber; + unsigned char bAlternateSetting; + unsigned char bNumEndpoints; + unsigned char bInterfaceClass; + unsigned char bInterfaceSubClass; + unsigned char bInterfaceProtocol; + unsigned char iInterface; + + struct usb_endpoint_descriptor *endpoint; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +}; + +#define USB_MAXALTSETTING 128 /* Hard limit */ + +struct usb_interface +{ + struct usb_interface_descriptor *altsetting; + + int num_altsetting; +}; + +/* Configuration descriptor information.. */ +#define USB_MAXCONFIG 8 +struct usb_config_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short wTotalLength; + unsigned char bNumInterfaces; + unsigned char bConfigurationValue; + unsigned char iConfiguration; + unsigned char bmAttributes; + unsigned char MaxPower; + + struct usb_interface *interface; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +}; + +/* Device descriptor */ +struct usb_device_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdUSB; + unsigned char bDeviceClass; + unsigned char bDeviceSubClass; + unsigned char bDeviceProtocol; + unsigned char bMaxPacketSize0; + unsigned short idVendor; + unsigned short idProduct; + unsigned short bcdDevice; + unsigned char iManufacturer; + unsigned char iProduct; + unsigned char iSerialNumber; + unsigned char bNumConfigurations; +}; + +struct usb_ctrl_setup +{ + unsigned char bRequestType; + unsigned char bRequest; + unsigned short wValue; + unsigned short wIndex; + unsigned short wLength; +}; + +/* + * Standard requests + */ +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +/* 0x02 is reserved */ +#define USB_REQ_SET_FEATURE 0x03 +/* 0x04 is reserved */ +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIGURATION 0x08 +#define USB_REQ_SET_CONFIGURATION 0x09 +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C + +#define USB_TYPE_STANDARD (0x00 << 5) +#define USB_TYPE_CLASS (0x01 << 5) +#define USB_TYPE_VENDOR (0x02 << 5) +#define USB_TYPE_RESERVED (0x03 << 5) + +#define USB_RECIP_DEVICE 0x00 +#define USB_RECIP_INTERFACE 0x01 +#define USB_RECIP_ENDPOINT 0x02 +#define USB_RECIP_OTHER 0x03 + +/* + * Various libusb API related stuff + */ + +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 + +/* Error codes */ +#define USB_ERROR_BEGIN 500000 + +/* + * This is supposed to look weird. This file is generated from autoconf + * and I didn't want to make this too complicated. + */ +#define USB_LE16_TO_CPU(x) + +/* + * Device reset types for usb_reset_ex. + * http://msdn.microsoft.com/en-us/library/ff537269%28VS.85%29.aspx + * http://msdn.microsoft.com/en-us/library/ff537243%28v=vs.85%29.aspx + */ +#define USB_RESET_TYPE_RESET_PORT (1 << 0) +#define USB_RESET_TYPE_CYCLE_PORT (1 << 1) +#define USB_RESET_TYPE_FULL_RESET (USB_RESET_TYPE_CYCLE_PORT | USB_RESET_TYPE_RESET_PORT) + + +/* Data types */ +/* struct usb_device; */ +/* struct usb_bus; */ + +struct usb_device +{ + struct usb_device *next, *prev; + + char filename[LIBUSB_PATH_MAX]; + + struct usb_bus *bus; + + struct usb_device_descriptor descriptor; + struct usb_config_descriptor *config; + + void *dev; /* Darwin support */ + + unsigned char devnum; + + unsigned char num_children; + struct usb_device **children; +}; + +struct usb_bus +{ + struct usb_bus *next, *prev; + + char dirname[LIBUSB_PATH_MAX]; + + struct usb_device *devices; + unsigned long location; + + struct usb_device *root_dev; +}; + +/* Version information, Windows specific */ +struct usb_version +{ + struct + { + int major; + int minor; + int micro; + int nano; + } dll; + struct + { + int major; + int minor; + int micro; + int nano; + } driver; +}; + + +struct usb_dev_handle; +typedef struct usb_dev_handle usb_dev_handle; + +/* Variables */ +#ifndef __USB_C__ +#define usb_busses usb_get_busses() +#endif + + + +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Function prototypes */ + + /* usb.c */ + usb_dev_handle *usb_open(struct usb_device *dev); + int usb_close(usb_dev_handle *dev); + int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf, + size_t buflen); + int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf, + size_t buflen); + + /* descriptors.c */ + int usb_get_descriptor_by_endpoint(usb_dev_handle *udev, int ep, + unsigned char type, unsigned char index, + void *buf, int size); + int usb_get_descriptor(usb_dev_handle *udev, unsigned char type, + unsigned char index, void *buf, int size); + + /* .c */ + int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, + int value, int index, char *bytes, int size, + int timeout); + int usb_set_configuration(usb_dev_handle *dev, int configuration); + int usb_claim_interface(usb_dev_handle *dev, int interface); + int usb_release_interface(usb_dev_handle *dev, int interface); + int usb_set_altinterface(usb_dev_handle *dev, int alternate); + int usb_resetep(usb_dev_handle *dev, unsigned int ep); + int usb_clear_halt(usb_dev_handle *dev, unsigned int ep); + int usb_reset(usb_dev_handle *dev); + int usb_reset_ex(usb_dev_handle *dev, unsigned int reset_type); + + char *usb_strerror(void); + + void usb_init(void); + void usb_set_debug(int level); + int usb_find_busses(void); + int usb_find_devices(void); + struct usb_device *usb_device(usb_dev_handle *dev); + struct usb_bus *usb_get_busses(void); + + + /* Windows specific functions */ + +#define LIBUSB_HAS_INSTALL_SERVICE_NP 1 + int usb_install_service_np(void); + void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1 + int usb_uninstall_service_np(void); + void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_INSTALL_DRIVER_NP 1 + int usb_install_driver_np(const char *inf_file); + void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_TOUCH_INF_FILE_NP 1 + int usb_touch_inf_file_np(const char *inf_file); + void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1 + int usb_install_needs_restart_np(void); + +#define LIBUSB_HAS_INSTALL_NP 1 + int usb_install_npW(HWND hwnd, HINSTANCE instance, LPCWSTR cmd_line, int starg_arg); + int usb_install_npA(HWND hwnd, HINSTANCE instance, LPCSTR cmd_line, int starg_arg); + #define usb_install_np usb_install_npA + void CALLBACK usb_install_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + + const struct usb_version *usb_get_version(void); + + int usb_isochronous_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep, int pktsize); + int usb_bulk_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep); + int usb_interrupt_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep); + + int usb_submit_async(void *context, char *bytes, int size); + int usb_reap_async(void *context, int timeout); + int usb_reap_async_nocancel(void *context, int timeout); + int usb_cancel_async(void *context); + int usb_free_async(void **context); + + +#ifdef __cplusplus +} +#endif + +#endif /* __USB_H__ */ + diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/include/usb.h b/trunk/AVRProjects/ATTiny2313-usb/libusb/include/usb.h new file mode 100644 index 00000000..320349bb --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/include/usb.h @@ -0,0 +1,427 @@ +#ifndef __USB_H__ +#define __USB_H__ + +#include +#include + +/* + * 'interface' is defined somewhere in the Windows header files. This macro + * is deleted here to avoid conflicts and compile errors. + */ + +#ifdef interface +#undef interface +#endif + +/* + * PATH_MAX from limits.h can't be used on Windows if the dll and + * import libraries are build/used by different compilers + */ + +#define LIBUSB_PATH_MAX 512 + + +/* + * USB spec information + * + * This is all stuff grabbed from various USB specs and is pretty much + * not subject to change + */ + +/* + * Device and/or Interface Class codes + */ +#define USB_CLASS_PER_INTERFACE 0 /* for DeviceClass */ +#define USB_CLASS_AUDIO 1 +#define USB_CLASS_COMM 2 +#define USB_CLASS_HID 3 +#define USB_CLASS_PRINTER 7 +#define USB_CLASS_MASS_STORAGE 8 +#define USB_CLASS_HUB 9 +#define USB_CLASS_DATA 10 +#define USB_CLASS_VENDOR_SPEC 0xff + +/* + * Descriptor types + */ +#define USB_DT_DEVICE 0x01 +#define USB_DT_CONFIG 0x02 +#define USB_DT_STRING 0x03 +#define USB_DT_INTERFACE 0x04 +#define USB_DT_ENDPOINT 0x05 + +#define USB_DT_HID 0x21 +#define USB_DT_REPORT 0x22 +#define USB_DT_PHYSICAL 0x23 +#define USB_DT_HUB 0x29 + +/* + * Descriptor sizes per descriptor type + */ +#define USB_DT_DEVICE_SIZE 18 +#define USB_DT_CONFIG_SIZE 9 +#define USB_DT_INTERFACE_SIZE 9 +#define USB_DT_ENDPOINT_SIZE 7 +#define USB_DT_ENDPOINT_AUDIO_SIZE 9 /* Audio extension */ +#define USB_DT_HUB_NONVAR_SIZE 7 + + +/* ensure byte-packed structures */ +#include + + +/* All standard descriptors have these 2 fields in common */ +struct usb_descriptor_header +{ + unsigned char bLength; + unsigned char bDescriptorType; +}; + +/* String descriptor */ +struct usb_string_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short wData[1]; +}; + +/* HID descriptor */ +struct usb_hid_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdHID; + unsigned char bCountryCode; + unsigned char bNumDescriptors; +}; + +/* Endpoint descriptor */ +#define USB_MAXENDPOINTS 32 +struct usb_endpoint_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned char bEndpointAddress; + unsigned char bmAttributes; + unsigned short wMaxPacketSize; + unsigned char bInterval; + unsigned char bRefresh; + unsigned char bSynchAddress; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +}; + +#define USB_ENDPOINT_ADDRESS_MASK 0x0f /* in bEndpointAddress */ +#define USB_ENDPOINT_DIR_MASK 0x80 + +#define USB_ENDPOINT_TYPE_MASK 0x03 /* in bmAttributes */ +#define USB_ENDPOINT_TYPE_CONTROL 0 +#define USB_ENDPOINT_TYPE_ISOCHRONOUS 1 +#define USB_ENDPOINT_TYPE_BULK 2 +#define USB_ENDPOINT_TYPE_INTERRUPT 3 + +/* Interface descriptor */ +#define USB_MAXINTERFACES 32 +struct usb_interface_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned char bInterfaceNumber; + unsigned char bAlternateSetting; + unsigned char bNumEndpoints; + unsigned char bInterfaceClass; + unsigned char bInterfaceSubClass; + unsigned char bInterfaceProtocol; + unsigned char iInterface; + + struct usb_endpoint_descriptor *endpoint; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +}; + +#define USB_MAXALTSETTING 128 /* Hard limit */ + +struct usb_interface +{ + struct usb_interface_descriptor *altsetting; + + int num_altsetting; +}; + +/* Configuration descriptor information.. */ +#define USB_MAXCONFIG 8 +struct usb_config_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short wTotalLength; + unsigned char bNumInterfaces; + unsigned char bConfigurationValue; + unsigned char iConfiguration; + unsigned char bmAttributes; + unsigned char MaxPower; + + struct usb_interface *interface; + + unsigned char *extra; /* Extra descriptors */ + int extralen; +}; + +/* Device descriptor */ +struct usb_device_descriptor +{ + unsigned char bLength; + unsigned char bDescriptorType; + unsigned short bcdUSB; + unsigned char bDeviceClass; + unsigned char bDeviceSubClass; + unsigned char bDeviceProtocol; + unsigned char bMaxPacketSize0; + unsigned short idVendor; + unsigned short idProduct; + unsigned short bcdDevice; + unsigned char iManufacturer; + unsigned char iProduct; + unsigned char iSerialNumber; + unsigned char bNumConfigurations; +}; + +struct usb_ctrl_setup +{ + unsigned char bRequestType; + unsigned char bRequest; + unsigned short wValue; + unsigned short wIndex; + unsigned short wLength; +}; + +/* + * Standard requests + */ +#define USB_REQ_GET_STATUS 0x00 +#define USB_REQ_CLEAR_FEATURE 0x01 +/* 0x02 is reserved */ +#define USB_REQ_SET_FEATURE 0x03 +/* 0x04 is reserved */ +#define USB_REQ_SET_ADDRESS 0x05 +#define USB_REQ_GET_DESCRIPTOR 0x06 +#define USB_REQ_SET_DESCRIPTOR 0x07 +#define USB_REQ_GET_CONFIGURATION 0x08 +#define USB_REQ_SET_CONFIGURATION 0x09 +#define USB_REQ_GET_INTERFACE 0x0A +#define USB_REQ_SET_INTERFACE 0x0B +#define USB_REQ_SYNCH_FRAME 0x0C + +#define USB_TYPE_STANDARD (0x00 << 5) +#define USB_TYPE_CLASS (0x01 << 5) +#define USB_TYPE_VENDOR (0x02 << 5) +#define USB_TYPE_RESERVED (0x03 << 5) + +#define USB_RECIP_DEVICE 0x00 +#define USB_RECIP_INTERFACE 0x01 +#define USB_RECIP_ENDPOINT 0x02 +#define USB_RECIP_OTHER 0x03 + +/* + * Various libusb API related stuff + */ + +#define USB_ENDPOINT_IN 0x80 +#define USB_ENDPOINT_OUT 0x00 + +/* Error codes */ +#define USB_ERROR_BEGIN 500000 + +/* + * This is supposed to look weird. This file is generated from autoconf + * and I didn't want to make this too complicated. + */ +#define USB_LE16_TO_CPU(x) + +/* + * Device reset types for usb_reset_ex. + * http://msdn.microsoft.com/en-us/library/ff537269%28VS.85%29.aspx + * http://msdn.microsoft.com/en-us/library/ff537243%28v=vs.85%29.aspx + */ +#define USB_RESET_TYPE_RESET_PORT (1 << 0) +#define USB_RESET_TYPE_CYCLE_PORT (1 << 1) +#define USB_RESET_TYPE_FULL_RESET (USB_RESET_TYPE_CYCLE_PORT | USB_RESET_TYPE_RESET_PORT) + + +/* Data types */ +/* struct usb_device; */ +/* struct usb_bus; */ + +struct usb_device +{ + struct usb_device *next, *prev; + + char filename[LIBUSB_PATH_MAX]; + + struct usb_bus *bus; + + struct usb_device_descriptor descriptor; + struct usb_config_descriptor *config; + + void *dev; /* Darwin support */ + + unsigned char devnum; + + unsigned char num_children; + struct usb_device **children; +}; + +struct usb_bus +{ + struct usb_bus *next, *prev; + + char dirname[LIBUSB_PATH_MAX]; + + struct usb_device *devices; + unsigned long location; + + struct usb_device *root_dev; +}; + +/* Version information, Windows specific */ +struct usb_version +{ + struct + { + int major; + int minor; + int micro; + int nano; + } dll; + struct + { + int major; + int minor; + int micro; + int nano; + } driver; +}; + + +struct usb_dev_handle; +typedef struct usb_dev_handle usb_dev_handle; + +/* Variables */ +#ifndef __USB_C__ +#define usb_busses usb_get_busses() +#endif + + + +#include + + +#ifdef __cplusplus +extern "C" +{ +#endif + + /* Function prototypes */ + + /* usb.c */ + usb_dev_handle *usb_open(struct usb_device *dev); + int usb_close(usb_dev_handle *dev); + int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf, + size_t buflen); + int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf, + size_t buflen); + + /* descriptors.c */ + int usb_get_descriptor_by_endpoint(usb_dev_handle *udev, int ep, + unsigned char type, unsigned char index, + void *buf, int size); + int usb_get_descriptor(usb_dev_handle *udev, unsigned char type, + unsigned char index, void *buf, int size); + + /* .c */ + int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout); + int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, + int value, int index, char *bytes, int size, + int timeout); + int usb_set_configuration(usb_dev_handle *dev, int configuration); + int usb_claim_interface(usb_dev_handle *dev, int interface); + int usb_release_interface(usb_dev_handle *dev, int interface); + int usb_set_altinterface(usb_dev_handle *dev, int alternate); + int usb_resetep(usb_dev_handle *dev, unsigned int ep); + int usb_clear_halt(usb_dev_handle *dev, unsigned int ep); + int usb_reset(usb_dev_handle *dev); + int usb_reset_ex(usb_dev_handle *dev, unsigned int reset_type); + + char *usb_strerror(void); + + void usb_init(void); + void usb_set_debug(int level); + int usb_find_busses(void); + int usb_find_devices(void); + struct usb_device *usb_device(usb_dev_handle *dev); + struct usb_bus *usb_get_busses(void); + + + /* Windows specific functions */ + +#define LIBUSB_HAS_INSTALL_SERVICE_NP 1 + int usb_install_service_np(void); + void CALLBACK usb_install_service_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_UNINSTALL_SERVICE_NP 1 + int usb_uninstall_service_np(void); + void CALLBACK usb_uninstall_service_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_INSTALL_DRIVER_NP 1 + int usb_install_driver_np(const char *inf_file); + void CALLBACK usb_install_driver_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_TOUCH_INF_FILE_NP 1 + int usb_touch_inf_file_np(const char *inf_file); + void CALLBACK usb_touch_inf_file_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + +#define LIBUSB_HAS_INSTALL_NEEDS_RESTART_NP 1 + int usb_install_needs_restart_np(void); + +#define LIBUSB_HAS_INSTALL_NP 1 + int usb_install_npW(HWND hwnd, HINSTANCE instance, LPCWSTR cmd_line, int starg_arg); + int usb_install_npA(HWND hwnd, HINSTANCE instance, LPCSTR cmd_line, int starg_arg); + #define usb_install_np usb_install_npA + void CALLBACK usb_install_np_rundll(HWND wnd, HINSTANCE instance, + LPSTR cmd_line, int cmd_show); + + const struct usb_version *usb_get_version(void); + + int usb_isochronous_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep, int pktsize); + int usb_bulk_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep); + int usb_interrupt_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep); + + int usb_submit_async(void *context, char *bytes, int size); + int usb_reap_async(void *context, int timeout); + int usb_reap_async_nocancel(void *context, int timeout); + int usb_cancel_async(void *context); + int usb_free_async(void **context); + + +#ifdef __cplusplus +} +#endif + +#endif /* __USB_H__ */ + diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/installer_license.txt b/trunk/AVRProjects/ATTiny2313-usb/libusb/installer_license.txt new file mode 100644 index 00000000..6128be63 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/installer_license.txt @@ -0,0 +1,851 @@ +Copyright (c) 2002-2004 Stephan Meyer, +Copyright (c) 2000-2004 Johannes Erdfelt, +Copyright (c) 2000-2004 Thomas Sailer, +Copyright (c) 2010 Travis Robinson, + +This software is distributed under the following licenses: +Driver: GNU General Public License (GPL) +Library, Test Files, Installer: GNU Lesser General Public License (LGPL) + +*********************************************************************** + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. + + GNU LESSER GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + + This version of the GNU Lesser General Public License incorporates +the terms and conditions of version 3 of the GNU General Public +License, supplemented by the additional permissions listed below. + + 0. Additional Definitions. + + As used herein, "this License" refers to version 3 of the GNU Lesser +General Public License, and the "GNU GPL" refers to version 3 of the GNU +General Public License. + + "The Library" refers to a covered work governed by this License, +other than an Application or a Combined Work as defined below. + + An "Application" is any work that makes use of an interface provided +by the Library, but which is not otherwise based on the Library. +Defining a subclass of a class defined by the Library is deemed a mode +of using an interface provided by the Library. + + A "Combined Work" is a work produced by combining or linking an +Application with the Library. The particular version of the Library +with which the Combined Work was made is also called the "Linked +Version". + + The "Minimal Corresponding Source" for a Combined Work means the +Corresponding Source for the Combined Work, excluding any source code +for portions of the Combined Work that, considered in isolation, are +based on the Application, and not on the Linked Version. + + The "Corresponding Application Code" for a Combined Work means the +object code and/or source code for the Application, including any data +and utility programs needed for reproducing the Combined Work from the +Application, but excluding the System Libraries of the Combined Work. + + 1. Exception to Section 3 of the GNU GPL. + + You may convey a covered work under sections 3 and 4 of this License +without being bound by section 3 of the GNU GPL. + + 2. Conveying Modified Versions. + + If you modify a copy of the Library, and, in your modifications, a +facility refers to a function or data to be supplied by an Application +that uses the facility (other than as an argument passed when the +facility is invoked), then you may convey a copy of the modified +version: + + a) under this License, provided that you make a good faith effort to + ensure that, in the event an Application does not supply the + function or data, the facility still operates, and performs + whatever part of its purpose remains meaningful, or + + b) under the GNU GPL, with none of the additional permissions of + this License applicable to that copy. + + 3. Object Code Incorporating Material from Library Header Files. + + The object code form of an Application may incorporate material from +a header file that is part of the Library. You may convey such object +code under terms of your choice, provided that, if the incorporated +material is not limited to numerical parameters, data structure +layouts and accessors, or small macros, inline functions and templates +(ten or fewer lines in length), you do both of the following: + + a) Give prominent notice with each copy of the object code that the + Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the object code with a copy of the GNU GPL and this license + document. + + 4. Combined Works. + + You may convey a Combined Work under terms of your choice that, +taken together, effectively do not restrict modification of the +portions of the Library contained in the Combined Work and reverse +engineering for debugging such modifications, if you also do each of +the following: + + a) Give prominent notice with each copy of the Combined Work that + the Library is used in it and that the Library and its use are + covered by this License. + + b) Accompany the Combined Work with a copy of the GNU GPL and this license + document. + + c) For a Combined Work that displays copyright notices during + execution, include the copyright notice for the Library among + these notices, as well as a reference directing the user to the + copies of the GNU GPL and this license document. + + d) Do one of the following: + + 0) Convey the Minimal Corresponding Source under the terms of this + License, and the Corresponding Application Code in a form + suitable for, and under terms that permit, the user to + recombine or relink the Application with a modified version of + the Linked Version to produce a modified Combined Work, in the + manner specified by section 6 of the GNU GPL for conveying + Corresponding Source. + + 1) Use a suitable shared library mechanism for linking with the + Library. A suitable mechanism is one that (a) uses at run time + a copy of the Library already present on the user's computer + system, and (b) will operate properly with a modified version + of the Library that is interface-compatible with the Linked + Version. + + e) Provide Installation Information, but only if you would otherwise + be required to provide such information under section 6 of the + GNU GPL, and only to the extent that such information is + necessary to install and execute a modified version of the + Combined Work produced by recombining or relinking the + Application with a modified version of the Linked Version. (If + you use option 4d0, the Installation Information must accompany + the Minimal Corresponding Source and Corresponding Application + Code. If you use option 4d1, you must provide the Installation + Information in the manner specified by section 6 of the GNU GPL + for conveying Corresponding Source.) + + 5. Combined Libraries. + + You may place library facilities that are a work based on the +Library side by side in a single library together with other library +facilities that are not Applications and are not covered by this +License, and convey such a combined library under terms of your +choice, if you do both of the following: + + a) Accompany the combined library with a copy of the same work based + on the Library, uncombined with any other library facilities, + conveyed under the terms of this License. + + b) Give prominent notice with the combined library that part of it + is a work based on the Library, and explaining where to find the + accompanying uncombined form of the same work. + + 6. Revised Versions of the GNU Lesser General Public License. + + The Free Software Foundation may publish revised and/or new versions +of the GNU Lesser General Public License from time to time. Such new +versions will be similar in spirit to the present version, but may +differ in detail to address new problems or concerns. + + Each version is given a distinguishing version number. If the +Library as you received it specifies that a certain numbered version +of the GNU Lesser General Public License "or any later version" +applies to it, you have the option of following the terms and +conditions either of that published version or of any later version +published by the Free Software Foundation. If the Library as you +received it does not specify a version number of the GNU Lesser +General Public License, you may choose any version of the GNU Lesser +General Public License ever published by the Free Software Foundation. + + If the Library as you received it specifies that a proxy can decide +whether future versions of the GNU Lesser General Public License shall +apply, that proxy's public statement of acceptance of any version is +permanent authorization for you to choose that version for the +Library. + diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/bcc/libusb.lib b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/bcc/libusb.lib new file mode 100644 index 00000000..86c0cede Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/bcc/libusb.lib differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/dynamic/libusb_dyn.c b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/dynamic/libusb_dyn.c new file mode 100644 index 00000000..f0fac9a2 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/dynamic/libusb_dyn.c @@ -0,0 +1,497 @@ +/* LIBUSB-WIN32, Generic Windows USB Library + * Copyright (c) 2002-2005 Stephan Meyer + * + * This library is free software; you can redistribute it and/or + * modify it under the terms of the GNU Lesser General Public + * License as published by the Free Software Foundation; either + * version 2 of the License, or (at your option) any later version. + * + * This library is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU + * Lesser General Public License for more details. + * + * You should have received a copy of the GNU Lesser General Public + * License along with this library; if not, write to the Free Software + * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + */ + + +#include +#include + +#include "usb.h" + +#define LIBUSB_DLL_NAME "libusb0.dll" + + +typedef usb_dev_handle * (*usb_open_t)(struct usb_device *dev); +typedef int (*usb_close_t)(usb_dev_handle *dev); +typedef int (*usb_get_string_t)(usb_dev_handle *dev, int index, int langid, + char *buf, size_t buflen); +typedef int (*usb_get_string_simple_t)(usb_dev_handle *dev, int index, + char *buf, size_t buflen); +typedef int (*usb_get_descriptor_by_endpoint_t)(usb_dev_handle *udev, int ep, + unsigned char type, + unsigned char index, + void *buf, int size); +typedef int (*usb_get_descriptor_t)(usb_dev_handle *udev, unsigned char type, + unsigned char index, void *buf, int size); +typedef int (*usb_bulk_write_t)(usb_dev_handle *dev, int ep, char *bytes, + int size, int timeout); +typedef int (*usb_bulk_read_t)(usb_dev_handle *dev, int ep, char *bytes, + int size, int timeout); +typedef int (*usb_interrupt_write_t)(usb_dev_handle *dev, int ep, char *bytes, + int size, int timeout); +typedef int (*usb_interrupt_read_t)(usb_dev_handle *dev, int ep, char *bytes, + int size, int timeout); +typedef int (*usb_control_msg_t)(usb_dev_handle *dev, int requesttype, + int request, int value, int index, + char *bytes, int size, int timeout); +typedef int (*usb_set_configuration_t)(usb_dev_handle *dev, int configuration); +typedef int (*usb_claim_interface_t)(usb_dev_handle *dev, int interface); +typedef int (*usb_release_interface_t)(usb_dev_handle *dev, int interface); +typedef int (*usb_set_altinterface_t)(usb_dev_handle *dev, int alternate); +typedef int (*usb_resetep_t)(usb_dev_handle *dev, unsigned int ep); +typedef int (*usb_clear_halt_t)(usb_dev_handle *dev, unsigned int ep); +typedef int (*usb_reset_t)(usb_dev_handle *dev); +typedef int (*usb_reset_ex_t)(usb_dev_handle *dev, unsigned int reset_type); +typedef char * (*usb_strerror_t)(void); +typedef void (*usb_init_t)(void); +typedef void (*usb_set_debug_t)(int level); +typedef int (*usb_find_busses_t)(void); +typedef int (*usb_find_devices_t)(void); +typedef struct usb_device * (*usb_device_t)(usb_dev_handle *dev); +typedef struct usb_bus * (*usb_get_busses_t)(void); +typedef int (*usb_install_service_np_t)(void); +typedef int (*usb_uninstall_service_np_t)(void); +typedef int (*usb_install_driver_np_t)(const char *inf_file); +typedef const struct usb_version * (*usb_get_version_t)(void); +typedef int (*usb_isochronous_setup_async_t)(usb_dev_handle *dev, + void **context, + unsigned char ep, int pktsize); +typedef int (*usb_bulk_setup_async_t)(usb_dev_handle *dev, void **context, + unsigned char ep); +typedef int (*usb_interrupt_setup_async_t)(usb_dev_handle *dev, void **context, + unsigned char ep); +typedef int (*usb_submit_async_t)(void *context, char *bytes, int size); +typedef int (*usb_reap_async_t)(void *context, int timeout); +typedef int (*usb_free_async_t)(void **context); + + +static usb_open_t _usb_open = NULL; +static usb_close_t _usb_close = NULL; +static usb_get_string_t _usb_get_string = NULL; +static usb_get_string_simple_t _usb_get_string_simple = NULL; +static usb_get_descriptor_by_endpoint_t _usb_get_descriptor_by_endpoint = NULL; +static usb_get_descriptor_t _usb_get_descriptor = NULL; +static usb_bulk_write_t _usb_bulk_write = NULL; +static usb_bulk_read_t _usb_bulk_read = NULL; +static usb_interrupt_write_t _usb_interrupt_write = NULL; +static usb_interrupt_read_t _usb_interrupt_read = NULL; +static usb_control_msg_t _usb_control_msg = NULL; +static usb_set_configuration_t _usb_set_configuration = NULL; +static usb_claim_interface_t _usb_claim_interface = NULL; +static usb_release_interface_t _usb_release_interface = NULL; +static usb_set_altinterface_t _usb_set_altinterface = NULL; +static usb_resetep_t _usb_resetep = NULL; +static usb_clear_halt_t _usb_clear_halt = NULL; +static usb_reset_t _usb_reset = NULL; +static usb_reset_ex_t _usb_reset_ex = NULL; +static usb_strerror_t _usb_strerror = NULL; +static usb_init_t _usb_init = NULL; +static usb_set_debug_t _usb_set_debug = NULL; +static usb_find_busses_t _usb_find_busses = NULL; +static usb_find_devices_t _usb_find_devices = NULL; +static usb_device_t _usb_device = NULL; +static usb_get_busses_t _usb_get_busses = NULL; +static usb_install_service_np_t _usb_install_service_np = NULL; +static usb_uninstall_service_np_t _usb_uninstall_service_np = NULL; +static usb_install_driver_np_t _usb_install_driver_np = NULL; +static usb_get_version_t _usb_get_version = NULL; +static usb_isochronous_setup_async_t _usb_isochronous_setup_async = NULL; +static usb_bulk_setup_async_t _usb_bulk_setup_async = NULL; +static usb_interrupt_setup_async_t _usb_interrupt_setup_async = NULL; +static usb_submit_async_t _usb_submit_async = NULL; +static usb_reap_async_t _usb_reap_async = NULL; +static usb_free_async_t _usb_free_async = NULL; + + + + +void usb_init(void) +{ + HINSTANCE libusb_dll = LoadLibrary(LIBUSB_DLL_NAME); + + if (!libusb_dll) + return; + + _usb_open = (usb_open_t) + GetProcAddress(libusb_dll, "usb_open"); + _usb_close = (usb_close_t) + GetProcAddress(libusb_dll, "usb_close"); + _usb_get_string = (usb_get_string_t) + GetProcAddress(libusb_dll, "usb_get_string"); + _usb_get_string_simple = (usb_get_string_simple_t) + GetProcAddress(libusb_dll, "usb_get_string_simple"); + _usb_get_descriptor_by_endpoint = (usb_get_descriptor_by_endpoint_t) + GetProcAddress(libusb_dll, "usb_get_descriptor_by_endpoint"); + _usb_get_descriptor = (usb_get_descriptor_t) + GetProcAddress(libusb_dll, "usb_get_descriptor"); + _usb_bulk_write = (usb_bulk_write_t) + GetProcAddress(libusb_dll, "usb_bulk_write"); + _usb_bulk_read = (usb_bulk_read_t) + GetProcAddress(libusb_dll, "usb_bulk_read"); + _usb_interrupt_write = (usb_interrupt_write_t) + GetProcAddress(libusb_dll, "usb_interrupt_write"); + _usb_interrupt_read = (usb_interrupt_read_t) + GetProcAddress(libusb_dll, "usb_interrupt_read"); + _usb_control_msg = (usb_control_msg_t) + GetProcAddress(libusb_dll, "usb_control_msg"); + _usb_set_configuration = (usb_set_configuration_t) + GetProcAddress(libusb_dll, "usb_set_configuration"); + _usb_claim_interface = (usb_claim_interface_t) + GetProcAddress(libusb_dll, "usb_claim_interface"); + _usb_release_interface = (usb_release_interface_t) + GetProcAddress(libusb_dll, "usb_release_interface"); + _usb_set_altinterface = (usb_set_altinterface_t) + GetProcAddress(libusb_dll, "usb_set_altinterface"); + _usb_resetep = (usb_resetep_t) + GetProcAddress(libusb_dll, "usb_resetep"); + _usb_clear_halt = (usb_clear_halt_t) + GetProcAddress(libusb_dll, "usb_clear_halt"); + _usb_reset = (usb_reset_t) + GetProcAddress(libusb_dll, "usb_reset"); + _usb_reset_ex = (usb_reset_ex_t) + GetProcAddress(libusb_dll, "usb_reset_ex"); + _usb_strerror = (usb_strerror_t) + GetProcAddress(libusb_dll, "usb_strerror"); + _usb_init = (usb_init_t) + GetProcAddress(libusb_dll, "usb_init"); + _usb_set_debug = (usb_set_debug_t) + GetProcAddress(libusb_dll, "usb_set_debug"); + _usb_find_busses = (usb_find_busses_t) + GetProcAddress(libusb_dll, "usb_find_busses"); + _usb_find_devices = (usb_find_devices_t) + GetProcAddress(libusb_dll, "usb_find_devices"); + _usb_device = (usb_device_t) + GetProcAddress(libusb_dll, "usb_device"); + _usb_get_busses = (usb_get_busses_t) + GetProcAddress(libusb_dll, "usb_get_busses"); + _usb_install_service_np = (usb_install_service_np_t) + GetProcAddress(libusb_dll, "usb_install_service_np"); + _usb_uninstall_service_np = (usb_uninstall_service_np_t) + GetProcAddress(libusb_dll, "usb_uninstall_service_np"); + _usb_install_driver_np = (usb_install_driver_np_t) + GetProcAddress(libusb_dll, "usb_install_driver_np"); + _usb_get_version = (usb_get_version_t) + GetProcAddress(libusb_dll, "usb_get_version"); + _usb_isochronous_setup_async = (usb_isochronous_setup_async_t) + GetProcAddress(libusb_dll, "usb_isochronous_setup_async"); + _usb_bulk_setup_async = (usb_bulk_setup_async_t) + GetProcAddress(libusb_dll, "usb_bulk_setup_async"); + _usb_interrupt_setup_async = (usb_interrupt_setup_async_t) + GetProcAddress(libusb_dll, "usb_interrupt_setup_async"); + _usb_submit_async = (usb_submit_async_t) + GetProcAddress(libusb_dll, "usb_submit_async"); + _usb_reap_async = (usb_reap_async_t) + GetProcAddress(libusb_dll, "usb_reap_async"); + _usb_free_async = (usb_free_async_t) + GetProcAddress(libusb_dll, "usb_free_async"); + + if (_usb_init) + _usb_init(); +} + +usb_dev_handle *usb_open(struct usb_device *dev) +{ + if (_usb_open) + return _usb_open(dev); + else + return NULL; +} + +int usb_close(usb_dev_handle *dev) +{ + if (_usb_close) + return _usb_close(dev); + else + return -ENOFILE; +} + +int usb_get_string(usb_dev_handle *dev, int index, int langid, char *buf, + size_t buflen) +{ + if (_usb_get_string) + return _usb_get_string(dev, index, langid, buf, buflen); + else + return -ENOFILE; +} + +int usb_get_string_simple(usb_dev_handle *dev, int index, char *buf, + size_t buflen) +{ + if (_usb_get_string_simple) + return _usb_get_string_simple(dev, index, buf, buflen); + else + return -ENOFILE; +} + +int usb_get_descriptor_by_endpoint(usb_dev_handle *udev, int ep, + unsigned char type, unsigned char index, + void *buf, int size) +{ + if (_usb_get_descriptor_by_endpoint) + return _usb_get_descriptor_by_endpoint(udev, ep, type, index, buf, size); + else + return -ENOFILE; +} + +int usb_get_descriptor(usb_dev_handle *udev, unsigned char type, + unsigned char index, void *buf, int size) +{ + if (_usb_get_descriptor) + return _usb_get_descriptor(udev, type, index, buf, size); + else + return -ENOFILE; +} + +int usb_bulk_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout) +{ + if (_usb_bulk_write) + return _usb_bulk_write(dev, ep, bytes, size, timeout); + else + return -ENOFILE; +} + +int usb_bulk_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout) +{ + if (_usb_bulk_read) + return _usb_bulk_read(dev, ep, bytes, size, timeout); + else + return -ENOFILE; +} + +int usb_interrupt_write(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout) +{ + if (_usb_interrupt_write) + return _usb_interrupt_write(dev, ep, bytes, size, timeout); + else + return -ENOFILE; +} + +int usb_interrupt_read(usb_dev_handle *dev, int ep, char *bytes, int size, + int timeout) +{ + if (_usb_interrupt_read) + return _usb_interrupt_read(dev, ep, bytes, size, timeout); + else + return -ENOFILE; +} + +int usb_control_msg(usb_dev_handle *dev, int requesttype, int request, + int value, int index, char *bytes, int size, + int timeout) +{ + if (_usb_control_msg) + return _usb_control_msg(dev, requesttype, request, value, index, bytes, + size, timeout); + else + return -ENOFILE; +} + +int usb_set_configuration(usb_dev_handle *dev, int configuration) +{ + if (_usb_set_configuration) + return _usb_set_configuration(dev, configuration); + else + return -ENOFILE; +} + +int usb_claim_interface(usb_dev_handle *dev, int interface) +{ + if (_usb_claim_interface) + return _usb_claim_interface(dev, interface); + else + return -ENOFILE; +} + +int usb_release_interface(usb_dev_handle *dev, int interface) +{ + if (_usb_release_interface) + return _usb_release_interface(dev, interface); + else + return -ENOFILE; +} + +int usb_set_altinterface(usb_dev_handle *dev, int alternate) +{ + if (_usb_set_altinterface) + return _usb_set_altinterface(dev, alternate); + else + return -ENOFILE; +} + +int usb_resetep(usb_dev_handle *dev, unsigned int ep) +{ + if (_usb_resetep) + return _usb_resetep(dev, ep); + else + return -ENOFILE; +} + +int usb_clear_halt(usb_dev_handle *dev, unsigned int ep) +{ + if (_usb_clear_halt) + return _usb_clear_halt(dev, ep); + else + return -ENOFILE; +} + +int usb_reset(usb_dev_handle *dev) +{ + if (_usb_reset) + return _usb_reset(dev); + else + return -ENOFILE; +} + +int usb_reset_ex(usb_dev_handle *dev, unsigned int reset_type) +{ + if (_usb_reset_ex) + return _usb_reset_ex(dev, reset_type); + else + return -ENOFILE; +} + +char *usb_strerror(void) +{ + if (_usb_strerror) + return _usb_strerror(); + else + return NULL; +} + +void usb_set_debug(int level) +{ + if (_usb_set_debug) + return _usb_set_debug(level); +} + +int usb_find_busses(void) +{ + if (_usb_find_busses) + return _usb_find_busses(); + else + return -ENOFILE; +} + +int usb_find_devices(void) +{ + if (_usb_find_devices) + return _usb_find_devices(); + else + return -ENOFILE; +} + +struct usb_device *usb_device(usb_dev_handle *dev) +{ + if (_usb_device) + return _usb_device(dev); + else + return NULL; +} + +struct usb_bus *usb_get_busses(void) +{ + if (_usb_get_busses) + return _usb_get_busses(); + else + return NULL; +} + +int usb_install_service_np(void) +{ + if (_usb_install_service_np) + return _usb_install_service_np(); + else + return -ENOFILE; +} + +int usb_uninstall_service_np(void) +{ + if (_usb_uninstall_service_np) + return _usb_uninstall_service_np(); + else + return -ENOFILE; +} + +int usb_install_driver_np(const char *inf_file) +{ + if (_usb_install_driver_np) + return _usb_install_driver_np(inf_file); + else + return -ENOFILE; +} + +const struct usb_version *usb_get_version(void) +{ + if (_usb_get_version) + return _usb_get_version(); + else + return NULL; +} + +int usb_isochronous_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep, int pktsize) +{ + if (_usb_isochronous_setup_async) + return _usb_isochronous_setup_async(dev, context, ep, pktsize); + else + return -ENOFILE; +} + +int usb_bulk_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep) +{ + if (_usb_bulk_setup_async) + return _usb_bulk_setup_async(dev, context, ep); + else + return -ENOFILE; +} + +int usb_interrupt_setup_async(usb_dev_handle *dev, void **context, + unsigned char ep) +{ + if (_usb_interrupt_setup_async) + return _usb_interrupt_setup_async(dev, context, ep); + else + return -ENOFILE; +} + +int usb_submit_async(void *context, char *bytes, int size) +{ + if (_usb_submit_async) + return _usb_submit_async(context, bytes, size); + else + return -ENOFILE; +} + +int usb_reap_async(void *context, int timeout) +{ + if (_usb_reap_async) + return _usb_reap_async(context, timeout); + else + return -ENOFILE; +} + +int usb_free_async(void **context) +{ + if (_usb_free_async) + return _usb_free_async(context); + else + return -ENOFILE; +} diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc/libusb.lib b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc/libusb.lib new file mode 100644 index 00000000..64ac6f79 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc/libusb.lib differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc_i64/libusb.lib b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc_i64/libusb.lib new file mode 100644 index 00000000..21c73d5e Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc_i64/libusb.lib differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc_x64/libusb.lib b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc_x64/libusb.lib new file mode 100644 index 00000000..dfdaad05 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/libusb/lib/msvc_x64/libusb.lib differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/libusb/libusb-win32-changelog-1.2.6.0.txt b/trunk/AVRProjects/ATTiny2313-usb/libusb/libusb-win32-changelog-1.2.6.0.txt new file mode 100644 index 00000000..30b72ae0 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/libusb/libusb-win32-changelog-1.2.6.0.txt @@ -0,0 +1,239 @@ +LibUsb-Win32 Change Log +V1.2.6.0 (01/17/2012) +============================================== +* Official release. + +* Removed ISO maximum transfer size restrictions/transfer spltting. + +* Fixed inf-wizard device notification issue. + +V1.2.5.0 (07/23/2011) +============================================== +* Official release. + +V1.2.4.9 (07/13/2011) - SNAPSHOT RELEASE +============================================== +* Updated GCC lib file 'libusb.a' + +V1.2.4.8 (07/12/2011) - SNAPSHOT RELEASE +============================================== +* Added new public api function 'usb_reset_ex'. This is an extended + device reset function which allows developers to specify a port reset, a + port cycle, or both. + +* Added new public defines 'USB_RESET_TYPE_XXX' for 'usb_reset_ex' + function. + +V1.2.4.7 (07/02/2011) - SNAPSHOT RELEASE +============================================== +* Sync transfers which specify a zero (0) timeout are now considered to be + INFINITE. + +V1.2.4.6 (05/12/2011) - SNAPSHOT RELEASE +============================================== +* Added device interface registration. This provides identical + functionality to the "DeviceInterfaceGUIDs" supported by WinUSB and + libusbK. A device interface guid can be specified in the .inf file. They + can be used to quickly locate a usb device or set of USB devices using + the setup api as well as device notification registration. + +* New IOCTL codes added to for native libusbK/WinUSB compatibility. + NOTE: These IOCTLs are currently used only by libusbK.dll. + o LIBUSB_IOCTL_QUERY_DEVICE_INFORMATION + o LIBUSB_IOCTL_SET_PIPE_POLICY + o LIBUSB_IOCTL_GET_PIPE_POLICY + o LIBUSB_IOCTL_SET_POWER_POLICY + o LIBUSB_IOCTL_GET_POWER_POLICY + o LIBUSB_IOCTL_CONTROL_WRITE + o LIBUSB_IOCTL_CONTROL_READ + o LIBUSB_IOCTL_FLUSH_PIPE + o LIBUSBK_IOCTL_CLAIM_INTERFACE + o LIBUSBK_IOCTL_RELEASE_INTERFACE + o LIBUSBK_IOCTL_RELEASE_ALL_INTERFACES + o LIBUSBK_IOCTL_SET_INTERFACE + o LIBUSBK_IOCTL_GET_INTERFACE + +* Renamed main header file (usb.h) to lusb0_usb.h. This eliminates + conflicts with the main WDK usb include as well as making the + libusb-win32 header more distinguishable from other usb library header + files. + +* Added device descriptor caching and active/first config descriptor + caching. Descriptor caching prevents unnecessary control requests from + interrupting devices that could potentially be in-use. It also makes + libusb0.sys more compliant with usb libraries targeting platform where + descriptor caching is done automatically. (linux/mac) + +* Upgraded to libwdi v1.1.1 + o Zadig UI improvements + o wdi-simple now handles certificate related operations + o New NSIS (Nullsoft Scriptable Install System) script sample + o improved INNO Setup script sample + o libusbK support + o autogeneration and self-signing of a .cat file, to prevent further security + prompts during driver installation on Vista and later. + for more information, see http://libwdi-cps.akeo.ie + o disable restore point creation during installation + o Visual Studio 2010 support and overall MS file cleanup + o use of the Kerberos/e2fsprogs parser in Zadig instead of libconfig + +V1.2.4.0 (04/11/2011) +======================= +* Removed get configuration request from the core driver + set_configuration function. This caused problems with + some non-compliant usb devices. + +* Added device descriptor dump to test applications. + +V1.2.3.0 (03/16/2011) +======================= +* Fixed bug-id 3117686 reported by Tim Schuerewegen. + +* Added LIBUSB_IOCTL_GET_OBJECT_NAME. This new IOCTL code retrieves object + from the driver. The only valid object name index is 0. Index 0 is + returns the devices plug and play registry key pathname. + +* Removed maximum timeout restriction for vendor class requests. + +V1.2.2.0 (10/02/2010) +======================= +* Added install-filter-win.exe. A gui installer for device filters. + +* Added new libusb0.dll function usb_install_np_rundll(). This function + is designed for rundll32.exe and takes the same parameters as + install-filter.exe. + +* Updated install-filter.exe. This application has several new features. + Type "install-filter --help" for more details. + +* Updated libusb-win32-devel-filter package. This package is once again + available for download as a setup.exe. + +* Updated libusb-win32 "bin" package format. inf-wizard.exe has been moved + up one directory. + +* Updated driver_installer_template.iss example. This is an Inno Setup + Script showing how to create your own setup.exe for installing your + application and driver. + +* Fixed missing byte order marker in inf-wizard.exe .inf files. (libwdi) + +* Fixed auto-configuration issue when there is more than one driver in the + stack. + +* Fixed BSOD when using the filter driver with devices that are auto + suspended by other drivers in the stack. + +* Fixed BSOD for devices with endpoints that have '0' for wMaxPacketSize. + +* Fixed BSOD when cancelling large transfers on high speed devices. + + +V1.2.1.0 (07/28/2010) +======================= +* Updated bulk.c to include async i/o example code. + +* Fixed usb_install_driver_np() issue with inf-wizard generated infs. + +* Fixed inf2cat.exe issue with inf-wizard generated infs. + +* Added 'Install Now' feature to inf-wizard. (libwdi) + +* Added embedded libusb-win32 binaries to inf-wizard. (libwdi) + +* Added libwdi (http://www.libusb.org/wiki/libwdi) to inf-wizard. + +* Added get cached configuration request to usb_open(). This is a new + control code that involves no device i/o and allows + usb_set_configuration() to be omitted if the driver has already + configured it. + +* Fixed set_configuration() failure for devices that do not properly + support get_configuration(). + +V1.2.0.0 (07/07/2010) +======================= +* First signed driver release! The libusb-win32 kernel driver (libusb0.sys) + can now be used on x64 Windows machines that require signed drivers. + +* Fixed 2128187 reported by Tim Green. usb_get_descriptor() can fail + because the given buffer of 8 bytes is too small. + +* Fixed 2928293 reported by Tim Green. Sometimes the call to + usb_fetch_and_parse_descriptors() in usb_find_devices() can fail. This + patch moves the LIST_ADD to after a successful read of the device's + configuration descriptors. + +* Fixed issue causing libusb-win32 to not act as power policy owner + when it should. + +* Fixed issue in which on rare occasion, a libusb-win32 filter device could + run as a "normal" device. + +* Fixed filter driver issue for device using wudfr.sys. + +* Added large transfer splitting to driver (bulk, int, iso). NOTE: + The dll continues to break transfers in the same manner it always has. + + +V1.1.14.3 (06/12/2010) +======================= +* Remove get_configuration() request from usb_open(). This caused claim + interface to fail when used as a filter driver. + +V1.1.14.0 (06/01/2010) +======================= +* Updated logging functions and standardized log message display format. + +* Updated inf-wizard to use the new directory format for the libusb-win32 + binaries. + +* Updated package directories to reflect the winddk BUILDARCH env variable. + (i64 := ia64, x64 := amd64) + +* Added request to get the current configuration in usb_open(). + +* Fixed 2960644 (reported by farthen) crash on shutdown with x64 based + systems while using inf files for each libusb device. + +* Added additional log message only included in debug/chk builds. + +* Updated default log levels to highest verbose level for debug builds. + +* Added test signing support to the libusb-win32 make.cmd. This allows + libusb0.sys and libusb0.dll to be signed with a digital signature. + (see make.cmd for mmore details) + +* Added MSVC 2008 project files + +* Moved version defines to an include file (libusb_version.h) + This file is generated from libusb_version_h.in with "make.cmd makever" + +* Removed all "dist" commands from cyg/mingw makefile. Instead use "make.cmd" + in the "ddk_make" directory. + +* Fixed filter setup not running in 64bit mode + +* Fixed 64bit inf-wizard, testlibusb-win builds + +* Added set initial config value #1 when the driver is not a filter. + optionally, the initial configuration value can be specified in the inf + file: HKR,,"InitialConfigValue",0x00010001, + +* Added support for querying device registry keys + (LIBUSB_IOCTL_GET_CUSTOM_REG_PROPERTY) + +* Added support for querying device properties + (LIBUSB_IOCTL_GET_DEVICE_PROPERTY) + +* Fixed possible race condition in kernel add_device() + +* Updated default ddk build version number to 1.1.14.0 to facilitate + Microsoft WHQL submission. + +* Added DDK build distribution system. Official libusb-win32 releases + (after 0.1.12.2) are built using Microsoft's WinDDK. (see make.cmd) + +* Fixed 2658937 (reported by Tim Roberts) The libusb-win32 driver always + acts as a power policy owner. + diff --git a/trunk/AVRProjects/ATTiny2313-usb/main.c b/trunk/AVRProjects/ATTiny2313-usb/main.c new file mode 100644 index 00000000..0b76075c --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/main.c @@ -0,0 +1,93 @@ +/** + * Project: AVR ATtiny USB Tutorial at http://codeandlife.com/ + * Author: Joonas Pihlajamaa, joonas.pihlajamaa@iki.fi + * Inspired by V-USB example code by Christian Starkjohann + * Copyright: (C) 2012 by Joonas Pihlajamaa + * License: GNU GPL v3 (see License.txt) + */ +#include +#include +#include + +#include "usbdrv.h" + +#define F_CPU 12000000L +#include + +#define USB_LED_OFF 0 +#define USB_LED_ON 1 +#define USB_DATA_OUT 2 +#define USB_DATA_WRITE 3 +#define USB_DATA_IN 4 + +static uchar replyBuf[16] = "Hello, USB!"; +static uchar dataReceived = 0, dataLength = 0; // for USB_DATA_IN + +// this gets called when custom control message is received +USB_PUBLIC uchar usbFunctionSetup(uchar data[8]) { + usbRequest_t *rq = (void *)data; // cast data to correct type + + switch(rq->bRequest) { // custom command is in the bRequest field + case USB_LED_ON: + PORTB |= 1; // turn LED on + return 0; + case USB_LED_OFF: + PORTB &= ~1; // turn LED off + return 0; + case USB_DATA_OUT: // send data to PC + usbMsgPtr = replyBuf; + return sizeof(replyBuf); + case USB_DATA_WRITE: // modify reply buffer + replyBuf[7] = rq->wValue.bytes[0]; + replyBuf[8] = rq->wValue.bytes[1]; + replyBuf[9] = rq->wIndex.bytes[0]; + replyBuf[10] = rq->wIndex.bytes[1]; + return 0; + case USB_DATA_IN: // receive data from PC + dataLength = (uchar)rq->wLength.word; + dataReceived = 0; + + if(dataLength > sizeof(replyBuf)) // limit to buffer size + dataLength = sizeof(replyBuf); + + return USB_NO_MSG; // usbFunctionWrite will be called now + } + + return 0; // should not get here +} + +// This gets called when data is sent from PC to the device +USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len) { + uchar i; + + for(i = 0; dataReceived < dataLength && i < len; i++, dataReceived++) + replyBuf[dataReceived] = data[i]; + + return (dataReceived == dataLength); // 1 if we received it all, 0 if not +} + +int main() { + uchar i; + + DDRB = 1; // PB0 as output + + wdt_enable(WDTO_1S); // enable 1s watchdog timer + + usbInit(); + + usbDeviceDisconnect(); // enforce re-enumeration + for(i = 0; i<250; i++) { // wait 500 ms + wdt_reset(); // keep the watchdog happy + _delay_ms(2); + } + usbDeviceConnect(); + + sei(); // Enable interrupts after re-enumeration + + while(1) { + wdt_reset(); // keep the watchdog happy + usbPoll(); + } + + return 0; +} diff --git a/trunk/AVRProjects/ATTiny2313-usb/main.elf b/trunk/AVRProjects/ATTiny2313-usb/main.elf new file mode 100644 index 00000000..fe61b998 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/main.elf differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/main.hex b/trunk/AVRProjects/ATTiny2313-usb/main.hex new file mode 100644 index 00000000..19255a24 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/main.hex @@ -0,0 +1,103 @@ +:1000000041C07AC158C057C056C055C054C053C033 +:1000100052C051C050C04FC04EC04DC04CC04BC06C +:100020004AC049C048C009021200010100801909F4 +:10003000040000000000000012011001FF00000891 +:10004000C016DC0500010102000116035500530033 +:1000500042006500780061006D0070006C00650072 +:10006000200363006F006400650061006E0064009F +:100070006C006900660065002E0063006F006D0073 +:100080000403090411241FBECFEDCDBF10E0A0E68C +:10009000B0E0E4E3F6E002C005900D92A237B107AC +:1000A000D9F720E0A2E7B0E001C01D92AF39B20756 +:1000B000E1F7A2D2BDC2A4CFCF93DF9360918500B8 +:1000C000635067FDA2C080918200CCE0D0E0C81BE5 +:1000D000D109C757DF4F809181008D3209F084C06C +:1000E000683009F090C083EC809375008AE58093B6 +:1000F0006100109272008881807619F0CE0129D2B9 +:1001000060C08A8110927E009981911106C0109280 +:100110007F002EE730E082E050C0953019F48093E4 +:1001200086003DC09630A9F59B81913019F488E393 +:1001300090E004C0923041F486E290E09093840015 +:100140008093830082E121C09330F1F4811108C0D3 +:1001500080E890E0909384008093830084E015C051 +:10016000813041F480E690E0909384008093830096 +:1001700080E20BC0823041F48AE490E090938400E6 +:100180008093830086E101C080E090E49093720048 +:1001900018C0983079F0993031F4809388002EE7B8 +:1001A00030E080E00AC081E09A3009F080E02EE77C +:1001B00030E003C028E830E081E0309384002093F1 +:1001C00083008F3F39F4988197FD8E8190E890935A +:1001D000720007C09F81911104C09E81981708F496 +:1001E000892F809360000FC08091720087FF0BC041 +:1001F000CE01E5D18F3F21F48EE18093610003C0F1 +:10020000811110926000109285008091610084FF3E +:1002100046C0809160008F3F09F441C0C82F8930EB +:1002200008F0C8E08C1B809360008091750098E80E +:10023000892780937500CC2331F120918300309180 +:1002400084008091720086FF0BC0A6E7B0E0F90140 +:100250008C2F8A0F94919D9331968A13FBCF09C0FE +:10026000D901E6E7F0E08C2F8E0F9D9191938E13CC +:10027000FCCF8FEF8C0F90E00196820F931F90932D +:100280008400809383006C2F86E790E031D0CC5FB0 +:10029000CC3019F08FEF80936000C093610084E14F +:1002A00090B39C7031F48150D9F71092860010926F +:1002B0008000DF91CF91089585B7826085BF8BB7AD +:1002C00080648BBF0895A82FB92F80E090E041E0B3 +:1002D00050EA609530E009C02D9182279795879567 +:1002E00010F084279527305EC8F36F5FA8F3089558 +:1002F000EADF8D939D930895CF93CFB7CF93C395A6 +:10030000839BE9F7839B09C0839B07C0839B05C040 +:10031000839B03C0839B01C0A1C0DF93C091820077 +:10032000DD27C757DF4F839B02C0DF91EBCF2F93B1 +:100330000F931F9300B32FEF03FB20F94F933F93CD +:1003400010B34FEF012703FB21F93BE031C04E7F93 +:10035000012F10B3216028C0102F4D7F22600000B4 +:1003600000B329C04B7F2460012F000010B32BC0C5 +:1003700010B3477F28602AC04F7E00B320612CC095 +:100380004F7D10B320622FC04F7B00B3206432C07A +:10039000422700B349934FEF0000102713FB20F9C9 +:1003A00010B31C70C9F1297F91F2012703FB21F9D9 +:1003B00000B3237F89F2315058F1102713FB22F943 +:1003C00010B3277E79F2012703FB23F92F7C81F2FA +:1003D00000B3102713FB24F92F7971F200C010B37A +:1003E000012703FB25F92F7359F200C000B3102732 +:1003F00013FB26F9223040F200C010B3012703FBA3 +:1004000027F9243028F64F77206810B30000F9CF81 +:1004100010E41ABF002717C03B503195C31BD040D2 +:1004200010E41ABF0881033CE9F00B34D9F02091A5 +:1004300080001981110F1213EDCF093641F10D32F1 +:1004400011F0013E39F7009387003F914F911F91C2 +:100450000F912F91DF91CAB7C6FD51CFCF91CFBF7A +:10046000CF91189520918700222379F31091850070 +:10047000112311F5343012F130938500209381005F +:10048000109182003BE0311B3093820017C0009135 +:10049000850001308CF40AE53091610034FD10C014 +:1004A00000936100C5E7D0E00FC02795A8F4515034 +:1004B000A9F4220F0000F9CF4AE503C042ED01C0C4 +:1004C000432FC4E1D0E032E011B31C60939A11BB1A +:1004D00002B320E41CE05F93012756E002BB27959E +:1004E00020F4515021F4220FF9CF012756E00000EB +:1004F0003B5A02BBD0F2279528F4515029F4220F21 +:100500000000F9CF012756E0279502BB20F4515097 +:1005100021F4220FF9CF012756E02991332302BBA2 +:1005200021F6037F10918600110FC651D04002BB07 +:1005300011F01093800010E41ABF086011B3137F0C +:10054000402F437F5F9100C000C002BB11BB42BB84 +:100550007CCFFC018181823071F030F4882349F036 +:10056000813049F5C09A27C0833069F08430C1F0EA +:1005700022C0C098089582E690E090938400809312 +:10058000830080E108958281809369008381809354 +:100590006A00848180936B00858180936C000BC01E +:1005A00086818093730010927400813130F080E175 +:1005B0008093730002C080E008958FEF089520912A +:1005C0007300382FFC01A0917400A21738F0A0939B +:1005D000740081E0A21779F080E0089591E09A0F0D +:1005E0008E2F831B861798F78191B0E0AE59BF4FCD +:1005F0008C93A92FEACF089581E087BB2EE088E194 +:1006000090E00FB6F894A89581BD0FBE21BD54DED1 +:100610008B9A8AEFA895EFE6F7E13197F1F700C0E2 +:1006200000008150B9F78B987894A89545DDFDCFEF +:04063000F894FFCF6C +:10063400FF5A48656C6C6F2C205553422100000012 +:020644000000B4 +:00000001FF diff --git a/trunk/AVRProjects/ATTiny2313-usb/schematic.png b/trunk/AVRProjects/ATTiny2313-usb/schematic.png new file mode 100644 index 00000000..188acfff Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/schematic.png differ diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/Changelog.txt b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/Changelog.txt new file mode 100644 index 00000000..5fae8f32 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/Changelog.txt @@ -0,0 +1,318 @@ +This file documents changes in the firmware-only USB driver for atmel's AVR +microcontrollers. New entries are always appended to the end of the file. +Scroll down to the bottom to see the most recent changes. + +2005-04-01: + - Implemented endpoint 1 as interrupt-in endpoint. + - Moved all configuration options to usbconfig.h which is not part of the + driver. + - Changed interface for usbVendorSetup(). + - Fixed compatibility with ATMega8 device. + - Various minor optimizations. + +2005-04-11: + - Changed interface to application: Use usbFunctionSetup(), usbFunctionRead() + and usbFunctionWrite() now. Added configuration options to choose which + of these functions to compile in. + - Assembler module delivers receive data non-inverted now. + - Made register and bit names compatible with more AVR devices. + +2005-05-03: + - Allow address of usbRxBuf on any memory page as long as the buffer does + not cross 256 byte page boundaries. + - Better device compatibility: works with Mega88 now. + - Code optimization in debugging module. + - Documentation updates. + +2006-01-02: + - Added (free) default Vendor- and Product-IDs bought from voti.nl. + - Added USBID-License.txt file which defines the rules for using the free + shared VID/PID pair. + - Added Readme.txt to the usbdrv directory which clarifies administrative + issues. + +2006-01-25: + - Added "configured state" to become more standards compliant. + - Added "HALT" state for interrupt endpoint. + - Driver passes the "USB Command Verifier" test from usb.org now. + - Made "serial number" a configuration option. + - Minor optimizations, we now recommend compiler option "-Os" for best + results. + - Added a version number to usbdrv.h + +2006-02-03: + - New configuration variable USB_BUFFER_SECTION for the memory section where + the USB rx buffer will go. This defaults to ".bss" if not defined. Since + this buffer MUST NOT cross 256 byte pages (not even touch a page at the + end), the user may want to pass a linker option similar to + "-Wl,--section-start=.mybuffer=0x800060". + - Provide structure for usbRequest_t. + - New defines for USB constants. + - Prepared for HID implementations. + - Increased data size limit for interrupt transfers to 8 bytes. + - New macro usbInterruptIsReady() to query interrupt buffer state. + +2006-02-18: + - Ensure that the data token which is sent as an ack to an OUT transfer is + always zero sized. This fixes a bug where the host reports an error after + sending an out transfer to the device, although all data arrived at the + device. + - Updated docs in usbdrv.h to reflect changed API in usbFunctionWrite(). + +* Release 2006-02-20 + + - Give a compiler warning when compiling with debugging turned on. + - Added Oleg Semyonov's changes for IAR-cc compatibility. + - Added new (optional) functions usbDeviceConnect() and usbDeviceDisconnect() + (also thanks to Oleg!). + - Rearranged tests in usbPoll() to save a couple of instructions in the most + likely case that no actions are pending. + - We need a delay between the SET ADDRESS request until the new address + becomes active. This delay was handled in usbPoll() until now. Since the + spec says that the delay must not exceed 2ms, previous versions required + aggressive polling during the enumeration phase. We have now moved the + handling of the delay into the interrupt routine. + - We must not reply with NAK to a SETUP transaction. We can only achieve this + by making sure that the rx buffer is empty when SETUP tokens are expected. + We therefore don't pass zero sized data packets from the status phase of + a transfer to usbPoll(). This change MAY cause troubles if you rely on + receiving a less than 8 bytes long packet in usbFunctionWrite() to + identify the end of a transfer. usbFunctionWrite() will NEVER be called + with a zero length. + +* Release 2006-03-14 + + - Improved IAR C support: tiny memory model, more devices + - Added template usbconfig.h file under the name usbconfig-prototype.h + +* Release 2006-03-26 + + - Added provision for one more interrupt-in endpoint (endpoint 3). + - Added provision for one interrupt-out endpoint (endpoint 1). + - Added flowcontrol macros for USB. + - Added provision for custom configuration descriptor. + - Allow ANY two port bits for D+ and D-. + - Merged (optional) receive endpoint number into global usbRxToken variable. + - Use USB_CFG_IOPORTNAME instead of USB_CFG_IOPORT. We now construct the + variable name from the single port letter instead of computing the address + of related ports from the output-port address. + +* Release 2006-06-26 + + - Updated documentation in usbdrv.h and usbconfig-prototype.h to reflect the + new features. + - Removed "#warning" directives because IAR does not understand them. Use + unused static variables instead to generate a warning. + - Do not include when compiling with IAR. + - Introduced USB_CFG_DESCR_PROPS_* in usbconfig.h to configure how each + USB descriptor should be handled. It is now possible to provide descriptor + data in Flash, RAM or dynamically at runtime. + - STALL is now a status in usbTxLen* instead of a message. We can now conform + to the spec and leave the stall status pending until it is cleared. + - Made usbTxPacketCnt1 and usbTxPacketCnt3 public. This allows the + application code to reset data toggling on interrupt pipes. + +* Release 2006-07-18 + + - Added an #if !defined __ASSEMBLER__ to the warning in usbdrv.h. This fixes + an assembler error. + - usbDeviceDisconnect() takes pull-up resistor to high impedance now. + +* Release 2007-02-01 + + - Merged in some code size improvements from usbtiny (thanks to Dick + Streefland for these optimizations!) + - Special alignment requirement for usbRxBuf not required any more. Thanks + again to Dick Streefland for this hint! + - Reverted to "#warning" instead of unused static variables -- new versions + of IAR CC should handle this directive. + - Changed Open Source license to GNU GPL v2 in order to make linking against + other free libraries easier. We no longer require publication of the + circuit diagrams, but we STRONGLY encourage it. If you improve the driver + itself, PLEASE grant us a royalty free license to your changes for our + commercial license. + +* Release 2007-03-29 + + - New configuration option "USB_PUBLIC" in usbconfig.h. + - Set USB version number to 1.10 instead of 1.01. + - Code used USB_CFG_DESCR_PROPS_STRING_DEVICE and + USB_CFG_DESCR_PROPS_STRING_PRODUCT inconsistently. Changed all occurrences + to USB_CFG_DESCR_PROPS_STRING_PRODUCT. + - New assembler module for 16.5 MHz RC oscillator clock with PLL in receiver + code. + - New assembler module for 16 MHz crystal. + - usbdrvasm.S contains common code only, clock-specific parts have been moved + to usbdrvasm12.S, usbdrvasm16.S and usbdrvasm165.S respectively. + +* Release 2007-06-25 + + - 16 MHz module: Do SE0 check in stuffed bits as well. + +* Release 2007-07-07 + + - Define hi8(x) for IAR compiler to limit result to 8 bits. This is necessary + for negative values. + - Added 15 MHz module contributed by V. Bosch. + - Interrupt vector name can now be configured. This is useful if somebody + wants to use a different hardware interrupt than INT0. + +* Release 2007-08-07 + + - Moved handleIn3 routine in usbdrvasm16.S so that relative jump range is + not exceeded. + - More config options: USB_RX_USER_HOOK(), USB_INITIAL_DATATOKEN, + USB_COUNT_SOF + - USB_INTR_PENDING can now be a memory address, not just I/O + +* Release 2007-09-19 + + - Split out common parts of assembler modules into separate include file + - Made endpoint numbers configurable so that given interface definitions + can be matched. See USB_CFG_EP3_NUMBER in usbconfig-prototype.h. + - Store endpoint number for interrupt/bulk-out so that usbFunctionWriteOut() + can handle any number of endpoints. + - Define usbDeviceConnect() and usbDeviceDisconnect() even if no + USB_CFG_PULLUP_IOPORTNAME is defined. Directly set D+ and D- to 0 in this + case. + +* Release 2007-12-01 + + - Optimize usbDeviceConnect() and usbDeviceDisconnect() for less code size + when USB_CFG_PULLUP_IOPORTNAME is not defined. + +* Release 2007-12-13 + + - Renamed all include-only assembler modules from *.S to *.inc so that + people don't add them to their project sources. + - Distribute leap bits in tx loop more evenly for 16 MHz module. + - Use "macro" and "endm" instead of ".macro" and ".endm" for IAR + - Avoid compiler warnings for constant expr range by casting some values in + USB descriptors. + +* Release 2008-01-21 + + - Fixed bug in 15 and 16 MHz module where the new address set with + SET_ADDRESS was already accepted at the next NAK or ACK we send, not at + the next data packet we send. This caused problems when the host polled + too fast. Thanks to Alexander Neumann for his help and patience debugging + this issue! + +* Release 2008-02-05 + + - Fixed bug in 16.5 MHz module where a register was used in the interrupt + handler before it was pushed. This bug was introduced with version + 2007-09-19 when common parts were moved to a separate file. + - Optimized CRC routine (thanks to Reimar Doeffinger). + +* Release 2008-02-16 + + - Removed outdated IAR compatibility stuff (code sections). + - Added hook macros for USB_RESET_HOOK() and USB_SET_ADDRESS_HOOK(). + - Added optional routine usbMeasureFrameLength() for calibration of the + internal RC oscillator. + +* Release 2008-02-28 + + - USB_INITIAL_DATATOKEN defaults to USBPID_DATA1 now, which means that we + start with sending USBPID_DATA0. + - Changed defaults in usbconfig-prototype.h + - Added free USB VID/PID pair for MIDI class devices + - Restructured AVR-USB as separate package, not part of PowerSwitch any more. + +* Release 2008-04-18 + + - Restructured usbdrv.c so that it is easier to read and understand. + - Better code optimization with gcc 4. + - If a second interrupt in endpoint is enabled, also add it to config + descriptor. + - Added config option for long transfers (above 254 bytes), see + USB_CFG_LONG_TRANSFERS in usbconfig.h. + - Added 20 MHz module contributed by Jeroen Benschop. + +* Release 2008-05-13 + + - Fixed bug in libs-host/hiddata.c function usbhidGetReport(): length + was not incremented, pointer to length was incremented instead. + - Added code to command line tool(s) which claims an interface. This code + is disabled by default, but may be necessary on newer Linux kernels. + - Added usbconfig.h option "USB_CFG_CHECK_DATA_TOGGLING". + - New header "usbportability.h" prepares ports to other development + environments. + - Long transfers (above 254 bytes) did not work when usbFunctionRead() was + used to supply the data. Fixed this bug. [Thanks to Alexander Neumann!] + - In hiddata.c (example code for sending/receiving data over HID), use + USB_RECIP_DEVICE instead of USB_RECIP_INTERFACE for control transfers so + that we need not claim the interface. + - in usbPoll() loop 20 times polling for RESET state instead of 10 times. + This accounts for the higher clock rates we now support. + - Added a module for 12.8 MHz RC oscillator with PLL in receiver loop. + - Added hook to SOF code so that oscillator can be tuned to USB frame clock. + - Added timeout to waitForJ loop. Helps preventing unexpected hangs. + - Added example code for oscillator tuning to libs-device (thanks to + Henrik Haftmann for the idea to this routine). + - Implemented option USB_CFG_SUPPRESS_INTR_CODE. + +* Release 2008-10-22 + + - Fixed libs-device/osctune.h: OSCCAL is memory address on ATMega88 and + similar, not offset of 0x20 needs to be added. + - Allow distribution under GPLv3 for those who have to link against other + code distributed under GPLv3. + +* Release 2008-11-26 + + - Removed libusb-win32 dependency for hid-data example in Makefile.windows. + It was never required and confused many people. + - Added extern uchar usbRxToken to usbdrv.h. + - Integrated a module with CRC checks at 18 MHz by Lukas Schrittwieser. + +* Release 2009-03-23 + + - Hid-mouse example used settings from hid-data example, fixed that. + - Renamed project to V-USB due to a trademark issue with Atmel(r). + - Changed CommercialLicense.txt and USBID-License.txt to make the + background of USB ID registration clearer. + +* Release 2009-04-15 + + - Changed CommercialLicense.txt to reflect the new range of PIDs from + Jason Kotzin. + - Removed USBID-License.txt in favor of USB-IDs-for-free.txt and + USB-ID-FAQ.txt + - Fixed a bug in the 12.8 MHz module: End Of Packet decection was made in + the center between bit 0 and 1 of each byte. This is where the data lines + are expected to change and the sampled data may therefore be nonsense. + We therefore check EOP ONLY if bits 0 AND 1 have both been read as 0 on D-. + - Fixed a bitstuffing problem in the 16 MHz module: If bit 6 was stuffed, + the unstuffing code in the receiver routine was 1 cycle too long. If + multiple bytes had the unstuffing in bit 6, the error summed up until the + receiver was out of sync. + - Included option for faster CRC routine. + Thanks to Slawomir Fras (BoskiDialer) for this code! + - Updated bits in Configuration Descriptor's bmAttributes according to + USB 1.1 (in particular bit 7, it is a must-be-set bit now). + +* Release 2009-08-22 + + - Moved first DBG1() after odDebugInit() in all examples. + - Use vector INT0_vect instead of SIG_INTERRUPT0 if defined. This makes + V-USB compatible with the new "p" suffix devices (e.g. ATMega328p). + - USB_CFG_CLOCK_KHZ setting is now required in usbconfig.h (no default any + more). + - New option USB_CFG_DRIVER_FLASH_PAGE allows boot loaders on devices with + more than 64 kB flash. + - Built-in configuration descriptor allows custom definition for second + endpoint now. + +* Release 2010-07-15 + + - Fixed bug in usbDriverSetup() which prevented descriptor sizes above 255 + bytes. + - Avoid a compiler warning for unused parameter in usbHandleResetHook() when + compiler option -Wextra is enabled. + - Fixed wrong hex value for some IDs in USB-IDs-for-free.txt. + - Keep a define for USBATTR_BUSPOWER, although the flag does not exist + in USB 1.1 any more. Set it to 0. This is for backward compatibility. + +* Release 2012-01-09 diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/CommercialLicense.txt b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/CommercialLicense.txt new file mode 100644 index 00000000..11d07d9d --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/CommercialLicense.txt @@ -0,0 +1,166 @@ +V-USB Driver Software License Agreement +Version 2009-08-03 + +THIS LICENSE AGREEMENT GRANTS YOU CERTAIN RIGHTS IN A SOFTWARE. YOU CAN +ENTER INTO THIS AGREEMENT AND ACQUIRE THE RIGHTS OUTLINED BELOW BY PAYING +THE AMOUNT ACCORDING TO SECTION 4 ("PAYMENT") TO OBJECTIVE DEVELOPMENT. + + +1 DEFINITIONS + +1.1 "OBJECTIVE DEVELOPMENT" shall mean OBJECTIVE DEVELOPMENT Software GmbH, +Grosse Schiffgasse 1A/7, 1020 Wien, AUSTRIA. + +1.2 "You" shall mean the Licensee. + +1.3 "V-USB" shall mean all files included in the package distributed under +the name "vusb" by OBJECTIVE DEVELOPMENT (http://www.obdev.at/vusb/) +unless otherwise noted. This includes the firmware-only USB device +implementation for Atmel AVR microcontrollers, some simple device examples +and host side software examples and libraries. + + +2 LICENSE GRANTS + +2.1 Source Code. OBJECTIVE DEVELOPMENT shall furnish you with the source +code of V-USB. + +2.2 Distribution and Use. OBJECTIVE DEVELOPMENT grants you the +non-exclusive right to use, copy and distribute V-USB with your hardware +product(s), restricted by the limitations in section 3 below. + +2.3 Modifications. OBJECTIVE DEVELOPMENT grants you the right to modify +the source code and your copy of V-USB according to your needs. + +2.4 USB IDs. OBJECTIVE DEVELOPMENT furnishes you with one or two USB +Product ID(s), sent to you in e-mail. These Product IDs are reserved +exclusively for you. OBJECTIVE DEVELOPMENT has obtained USB Product ID +ranges under the Vendor ID 5824 from Wouter van Ooijen (Van Ooijen +Technische Informatica, www.voti.nl) and under the Vendor ID 8352 from +Jason Kotzin (Clay Logic, www.claylogic.com). Both owners of the Vendor IDs +have obtained these IDs from the USB Implementers Forum, Inc. +(www.usb.org). OBJECTIVE DEVELOPMENT disclaims all liability which might +arise from the assignment of USB IDs. + +2.5 USB Certification. Although not part of this agreement, we want to make +it clear that you cannot become USB certified when you use V-USB or a USB +Product ID assigned by OBJECTIVE DEVELOPMENT. AVR microcontrollers don't +meet the electrical specifications required by the USB specification and +the USB Implementers Forum certifies only members who bought a Vendor ID of +their own. + + +3 LICENSE RESTRICTIONS + +3.1 Number of Units. Only one of the following three definitions is +applicable. Which one is determined by the amount you pay to OBJECTIVE +DEVELOPMENT, see section 4 ("Payment") below. + +Hobby License: You may use V-USB according to section 2 above in no more +than 5 hardware units. These units must not be sold for profit. + +Entry Level License: You may use V-USB according to section 2 above in no +more than 150 hardware units. + +Professional License: You may use V-USB according to section 2 above in +any number of hardware units, except for large scale production ("unlimited +fair use"). Quantities below 10,000 units are not considered large scale +production. If your reach quantities which are obviously large scale +production, you must pay a license fee of 0.10 EUR per unit for all units +above 10,000. + +3.2 Rental. You may not rent, lease, or lend V-USB or otherwise encumber +any copy of V-USB, or any of the rights granted herein. + +3.3 Transfer. You may not transfer your rights under this Agreement to +another party without OBJECTIVE DEVELOPMENT's prior written consent. If +such consent is obtained, you may permanently transfer this License to +another party. The recipient of such transfer must agree to all terms and +conditions of this Agreement. + +3.4 Reservation of Rights. OBJECTIVE DEVELOPMENT retains all rights not +expressly granted. + +3.5 Non-Exclusive Rights. Your license rights under this Agreement are +non-exclusive. + +3.6 Third Party Rights. This Agreement cannot grant you rights controlled +by third parties. In particular, you are not allowed to use the USB logo or +other trademarks owned by the USB Implementers Forum, Inc. without their +consent. Since such consent depends on USB certification, it should be +noted that V-USB will not pass certification because it does not +implement checksum verification and the microcontroller ports do not meet +the electrical specifications. + + +4 PAYMENT + +The payment amount depends on the variation of this agreement (according to +section 3.1) into which you want to enter. Concrete prices are listed on +OBJECTIVE DEVELOPMENT's web site, usually at +http://www.obdev.at/vusb/license.html. You agree to pay the amount listed +there to OBJECTIVE DEVELOPMENT or OBJECTIVE DEVELOPMENT's payment processor +or reseller. + + +5 COPYRIGHT AND OWNERSHIP + +V-USB is protected by copyright laws and international copyright +treaties, as well as other intellectual property laws and treaties. V-USB +is licensed, not sold. + + +6 TERM AND TERMINATION + +6.1 Term. This Agreement shall continue indefinitely. However, OBJECTIVE +DEVELOPMENT may terminate this Agreement and revoke the granted license and +USB-IDs if you fail to comply with any of its terms and conditions. + +6.2 Survival of Terms. All provisions regarding secrecy, confidentiality +and limitation of liability shall survive termination of this agreement. + + +7 DISCLAIMER OF WARRANTY AND LIABILITY + +LIMITED WARRANTY. V-USB IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY +KIND. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, OBJECTIVE +DEVELOPMENT AND ITS SUPPLIERS HEREBY DISCLAIM ALL WARRANTIES, EITHER +EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES +OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, TITLE, AND +NON-INFRINGEMENT, WITH REGARD TO V-USB, AND THE PROVISION OF OR FAILURE +TO PROVIDE SUPPORT SERVICES. THIS LIMITED WARRANTY GIVES YOU SPECIFIC LEGAL +RIGHTS. YOU MAY HAVE OTHERS, WHICH VARY FROM STATE/JURISDICTION TO +STATE/JURISDICTION. + +LIMITATION OF LIABILITY. TO THE MAXIMUM EXTENT PERMITTED BY APPLICABLE LAW, +IN NO EVENT SHALL OBJECTIVE DEVELOPMENT OR ITS SUPPLIERS BE LIABLE FOR ANY +SPECIAL, INCIDENTAL, INDIRECT, OR CONSEQUENTIAL DAMAGES WHATSOEVER +(INCLUDING, WITHOUT LIMITATION, DAMAGES FOR LOSS OF BUSINESS PROFITS, +BUSINESS INTERRUPTION, LOSS OF BUSINESS INFORMATION, OR ANY OTHER PECUNIARY +LOSS) ARISING OUT OF THE USE OF OR INABILITY TO USE V-USB OR THE +PROVISION OF OR FAILURE TO PROVIDE SUPPORT SERVICES, EVEN IF OBJECTIVE +DEVELOPMENT HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. IN ANY +CASE, OBJECTIVE DEVELOPMENT'S ENTIRE LIABILITY UNDER ANY PROVISION OF THIS +AGREEMENT SHALL BE LIMITED TO THE AMOUNT ACTUALLY PAID BY YOU FOR V-USB. + + +8 MISCELLANEOUS TERMS + +8.1 Marketing. OBJECTIVE DEVELOPMENT has the right to mention for marketing +purposes that you entered into this agreement. + +8.2 Entire Agreement. This document represents the entire agreement between +OBJECTIVE DEVELOPMENT and you. It may only be modified in writing signed by +an authorized representative of both, OBJECTIVE DEVELOPMENT and you. + +8.3 Severability. In case a provision of these terms and conditions should +be or become partly or entirely invalid, ineffective, or not executable, +the validity of all other provisions shall not be affected. + +8.4 Applicable Law. This agreement is governed by the laws of the Republic +of Austria. + +8.5 Responsible Courts. The responsible courts in Vienna/Austria will have +exclusive jurisdiction regarding all disputes in connection with this +agreement. + diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/License.txt b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/License.txt new file mode 100644 index 00000000..4460cfba --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/License.txt @@ -0,0 +1,361 @@ +OBJECTIVE DEVELOPMENT GmbH's V-USB driver software is distributed under the +terms and conditions of the GNU GPL version 2 or the GNU GPL version 3. It is +your choice whether you apply the terms of version 2 or version 3. The full +text of GPLv2 is included below. In addition to the requirements in the GPL, +we STRONGLY ENCOURAGE you to do the following: + +(1) Publish your entire project on a web site and drop us a note with the URL. +Use the form at http://www.obdev.at/vusb/feedback.html for your submission. + +(2) Adhere to minimum publication standards. Please include AT LEAST: + - a circuit diagram in PDF, PNG or GIF format + - full source code for the host software + - a Readme.txt file in ASCII format which describes the purpose of the + project and what can be found in which directories and which files + - a reference to http://www.obdev.at/vusb/ + +(3) If you improve the driver firmware itself, please give us a free license +to your modifications for our commercial license offerings. + + + + GNU GENERAL PUBLIC LICENSE + Version 2, June 1991 + + Copyright (C) 1989, 1991 Free Software Foundation, Inc. + 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The licenses for most software are designed to take away your +freedom to share and change it. By contrast, the GNU General Public +License is intended to guarantee your freedom to share and change free +software--to make sure the software is free for all its users. This +General Public License applies to most of the Free Software +Foundation's software and to any other program whose authors commit to +using it. (Some other Free Software Foundation software is covered by +the GNU Library General Public License instead.) You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +this service if you wish), that you receive source code or can get it +if you want it, that you can change the software or use pieces of it +in new free programs; and that you know you can do these things. + + To protect your rights, we need to make restrictions that forbid +anyone to deny you these rights or to ask you to surrender the rights. +These restrictions translate to certain responsibilities for you if you +distribute copies of the software, or if you modify it. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must give the recipients all the rights that +you have. You must make sure that they, too, receive or can get the +source code. And you must show them these terms so they know their +rights. + + We protect your rights with two steps: (1) copyright the software, and +(2) offer you this license which gives you legal permission to copy, +distribute and/or modify the software. + + Also, for each author's protection and ours, we want to make certain +that everyone understands that there is no warranty for this free +software. If the software is modified by someone else and passed on, we +want its recipients to know that what they have is not the original, so +that any problems introduced by others will not reflect on the original +authors' reputations. + + Finally, any free program is threatened constantly by software +patents. We wish to avoid the danger that redistributors of a free +program will individually obtain patent licenses, in effect making the +program proprietary. To prevent this, we have made it clear that any +patent must be licensed for everyone's free use or not licensed at all. + + The precise terms and conditions for copying, distribution and +modification follow. + + GNU GENERAL PUBLIC LICENSE + TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION + + 0. This License applies to any program or other work which contains +a notice placed by the copyright holder saying it may be distributed +under the terms of this General Public License. The "Program", below, +refers to any such program or work, and a "work based on the Program" +means either the Program or any derivative work under copyright law: +that is to say, a work containing the Program or a portion of it, +either verbatim or with modifications and/or translated into another +language. (Hereinafter, translation is included without limitation in +the term "modification".) Each licensee is addressed as "you". + +Activities other than copying, distribution and modification are not +covered by this License; they are outside its scope. The act of +running the Program is not restricted, and the output from the Program +is covered only if its contents constitute a work based on the +Program (independent of having been made by running the Program). +Whether that is true depends on what the Program does. + + 1. You may copy and distribute verbatim copies of the Program's +source code as you receive it, in any medium, provided that you +conspicuously and appropriately publish on each copy an appropriate +copyright notice and disclaimer of warranty; keep intact all the +notices that refer to this License and to the absence of any warranty; +and give any other recipients of the Program a copy of this License +along with the Program. + +You may charge a fee for the physical act of transferring a copy, and +you may at your option offer warranty protection in exchange for a fee. + + 2. You may modify your copy or copies of the Program or any portion +of it, thus forming a work based on the Program, and copy and +distribute such modifications or work under the terms of Section 1 +above, provided that you also meet all of these conditions: + + a) You must cause the modified files to carry prominent notices + stating that you changed the files and the date of any change. + + b) You must cause any work that you distribute or publish, that in + whole or in part contains or is derived from the Program or any + part thereof, to be licensed as a whole at no charge to all third + parties under the terms of this License. + + c) If the modified program normally reads commands interactively + when run, you must cause it, when started running for such + interactive use in the most ordinary way, to print or display an + announcement including an appropriate copyright notice and a + notice that there is no warranty (or else, saying that you provide + a warranty) and that users may redistribute the program under + these conditions, and telling the user how to view a copy of this + License. (Exception: if the Program itself is interactive but + does not normally print such an announcement, your work based on + the Program is not required to print an announcement.) + +These requirements apply to the modified work as a whole. If +identifiable sections of that work are not derived from the Program, +and can be reasonably considered independent and separate works in +themselves, then this License, and its terms, do not apply to those +sections when you distribute them as separate works. But when you +distribute the same sections as part of a whole which is a work based +on the Program, the distribution of the whole must be on the terms of +this License, whose permissions for other licensees extend to the +entire whole, and thus to each and every part regardless of who wrote it. + +Thus, it is not the intent of this section to claim rights or contest +your rights to work written entirely by you; rather, the intent is to +exercise the right to control the distribution of derivative or +collective works based on the Program. + +In addition, mere aggregation of another work not based on the Program +with the Program (or with a work based on the Program) on a volume of +a storage or distribution medium does not bring the other work under +the scope of this License. + + 3. You may copy and distribute the Program (or a work based on it, +under Section 2) in object code or executable form under the terms of +Sections 1 and 2 above provided that you also do one of the following: + + a) Accompany it with the complete corresponding machine-readable + source code, which must be distributed under the terms of Sections + 1 and 2 above on a medium customarily used for software interchange; or, + + b) Accompany it with a written offer, valid for at least three + years, to give any third party, for a charge no more than your + cost of physically performing source distribution, a complete + machine-readable copy of the corresponding source code, to be + distributed under the terms of Sections 1 and 2 above on a medium + customarily used for software interchange; or, + + c) Accompany it with the information you received as to the offer + to distribute corresponding source code. (This alternative is + allowed only for noncommercial distribution and only if you + received the program in object code or executable form with such + an offer, in accord with Subsection b above.) + +The source code for a work means the preferred form of the work for +making modifications to it. For an executable work, complete source +code means all the source code for all modules it contains, plus any +associated interface definition files, plus the scripts used to +control compilation and installation of the executable. However, as a +special exception, the source code distributed need not include +anything that is normally distributed (in either source or binary +form) with the major components (compiler, kernel, and so on) of the +operating system on which the executable runs, unless that component +itself accompanies the executable. + +If distribution of executable or object code is made by offering +access to copy from a designated place, then offering equivalent +access to copy the source code from the same place counts as +distribution of the source code, even though third parties are not +compelled to copy the source along with the object code. + + 4. You may not copy, modify, sublicense, or distribute the Program +except as expressly provided under this License. Any attempt +otherwise to copy, modify, sublicense or distribute the Program is +void, and will automatically terminate your rights under this License. +However, parties who have received copies, or rights, from you under +this License will not have their licenses terminated so long as such +parties remain in full compliance. + + 5. You are not required to accept this License, since you have not +signed it. However, nothing else grants you permission to modify or +distribute the Program or its derivative works. These actions are +prohibited by law if you do not accept this License. Therefore, by +modifying or distributing the Program (or any work based on the +Program), you indicate your acceptance of this License to do so, and +all its terms and conditions for copying, distributing or modifying +the Program or works based on it. + + 6. Each time you redistribute the Program (or any work based on the +Program), the recipient automatically receives a license from the +original licensor to copy, distribute or modify the Program subject to +these terms and conditions. You may not impose any further +restrictions on the recipients' exercise of the rights granted herein. +You are not responsible for enforcing compliance by third parties to +this License. + + 7. If, as a consequence of a court judgment or allegation of patent +infringement or for any other reason (not limited to patent issues), +conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot +distribute so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you +may not distribute the Program at all. For example, if a patent +license would not permit royalty-free redistribution of the Program by +all those who receive copies directly or indirectly through you, then +the only way you could satisfy both it and this License would be to +refrain entirely from distribution of the Program. + +If any portion of this section is held invalid or unenforceable under +any particular circumstance, the balance of the section is intended to +apply and the section as a whole is intended to apply in other +circumstances. + +It is not the purpose of this section to induce you to infringe any +patents or other property right claims or to contest validity of any +such claims; this section has the sole purpose of protecting the +integrity of the free software distribution system, which is +implemented by public license practices. Many people have made +generous contributions to the wide range of software distributed +through that system in reliance on consistent application of that +system; it is up to the author/donor to decide if he or she is willing +to distribute software through any other system and a licensee cannot +impose that choice. + +This section is intended to make thoroughly clear what is believed to +be a consequence of the rest of this License. + + 8. If the distribution and/or use of the Program is restricted in +certain countries either by patents or by copyrighted interfaces, the +original copyright holder who places the Program under this License +may add an explicit geographical distribution limitation excluding +those countries, so that distribution is permitted only in or among +countries not thus excluded. In such case, this License incorporates +the limitation as if written in the body of this License. + + 9. The Free Software Foundation may publish revised and/or new versions +of the General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + +Each version is given a distinguishing version number. If the Program +specifies a version number of this License which applies to it and "any +later version", you have the option of following the terms and conditions +either of that version or of any later version published by the Free +Software Foundation. If the Program does not specify a version number of +this License, you may choose any version ever published by the Free Software +Foundation. + + 10. If you wish to incorporate parts of the Program into other free +programs whose distribution conditions are different, write to the author +to ask for permission. For software which is copyrighted by the Free +Software Foundation, write to the Free Software Foundation; we sometimes +make exceptions for this. Our decision will be guided by the two goals +of preserving the free status of all derivatives of our free software and +of promoting the sharing and reuse of software generally. + + NO WARRANTY + + 11. BECAUSE THE PROGRAM IS LICENSED FREE OF CHARGE, THERE IS NO WARRANTY +FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN +OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES +PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED +OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF +MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS +TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE +PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, +REPAIR OR CORRECTION. + + 12. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY AND/OR +REDISTRIBUTE THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, +INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING +OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED +TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY +YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER +PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE +POSSIBILITY OF SUCH DAMAGES. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +convey the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software; you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation; either version 2 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program; if not, write to the Free Software + Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA + + +Also add information on how to contact you by electronic and paper mail. + +If the program is interactive, make it output a short notice like this +when it starts in an interactive mode: + + Gnomovision version 69, Copyright (C) year name of author + Gnomovision comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, the commands you use may +be called something other than `show w' and `show c'; they could even be +mouse-clicks or menu items--whatever suits your program. + +You should also get your employer (if you work as a programmer) or your +school, if any, to sign a "copyright disclaimer" for the program, if +necessary. Here is a sample; alter the names: + + Yoyodyne, Inc., hereby disclaims all copyright interest in the program + `Gnomovision' (which makes passes at compilers) written by James Hacker. + + , 1 April 1989 + Ty Coon, President of Vice + +This General Public License does not permit incorporating your program into +proprietary programs. If your program is a subroutine library, you may +consider it more useful to permit linking proprietary applications with the +library. If this is what you want to do, use the GNU Library General +Public License instead of this License. diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/Readme.txt b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/Readme.txt new file mode 100644 index 00000000..970dc66b --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/Readme.txt @@ -0,0 +1,172 @@ +This is the Readme file to Objective Development's firmware-only USB driver +for Atmel AVR microcontrollers. For more information please visit +http://www.obdev.at/vusb/ + +This directory contains the USB firmware only. Copy it as-is to your own +project and add all .c and .S files to your project (these files are marked +with an asterisk in the list below). Then copy usbconfig-prototype.h as +usbconfig.h to your project and edit it according to your configuration. + + +TECHNICAL DOCUMENTATION +======================= +The technical documentation (API) for the firmware driver is contained in the +file "usbdrv.h". Please read all of it carefully! Configuration options are +documented in "usbconfig-prototype.h". + +The driver consists of the following files: + Readme.txt ............. The file you are currently reading. + Changelog.txt .......... Release notes for all versions of the driver. + usbdrv.h ............... Driver interface definitions and technical docs. +* usbdrv.c ............... High level language part of the driver. Link this + module to your code! +* usbdrvasm.S ............ Assembler part of the driver. This module is mostly + a stub and includes one of the usbdrvasm*.S files + depending on processor clock. Link this module to + your code! + usbdrvasm*.inc ......... Assembler routines for particular clock frequencies. + Included by usbdrvasm.S, don't link it directly! + asmcommon.inc .......... Common assembler routines. Included by + usbdrvasm*.inc, don't link it directly! + usbconfig-prototype.h .. Prototype for your own usbdrv.h file. +* oddebug.c .............. Debug functions. Only used when DEBUG_LEVEL is + defined to a value greater than 0. Link this module + to your code! + oddebug.h .............. Interface definitions of the debug module. + usbportability.h ....... Header with compiler-dependent stuff. + usbdrvasm.asm .......... Compatibility stub for IAR-C-compiler. Use this + module instead of usbdrvasm.S when you assembler + with IAR's tools. + License.txt ............ Open Source license for this driver. + CommercialLicense.txt .. Optional commercial license for this driver. + USB-ID-FAQ.txt ......... General infos about USB Product- and Vendor-IDs. + USB-IDs-for-free.txt ... List and terms of use for free shared PIDs. + +(*) ... These files should be linked to your project. + + +CPU CORE CLOCK FREQUENCY +======================== +We supply assembler modules for clock frequencies of 12 MHz, 12.8 MHz, 15 MHz, +16 MHz, 16.5 MHz 18 MHz and 20 MHz. Other clock rates are not supported. The +actual clock rate must be configured in usbconfig.h. + +12 MHz Clock +This is the traditional clock rate of V-USB because it's the lowest clock +rate where the timing constraints of the USB spec can be met. + +15 MHz Clock +Similar to 12 MHz, but some NOPs inserted. On the other hand, the higher clock +rate allows for some loops which make the resulting code size somewhat smaller +than the 12 MHz version. + +16 MHz Clock +This clock rate has been added for users of the Arduino board and other +ready-made boards which come with a fixed 16 MHz crystal. It's also an option +if you need the slightly higher clock rate for performance reasons. Since +16 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code +is somewhat tricky and has to insert a leap cycle every third byte. + +12.8 MHz and 16.5 MHz Clock +The assembler modules for these clock rates differ from the other modules +because they have been built for an RC oscillator with only 1% precision. The +receiver code inserts leap cycles to compensate for clock deviations. 1% is +also the precision which can be achieved by calibrating the internal RC +oscillator of the AVR. Please note that only AVRs with internal 64 MHz PLL +oscillator can reach 16.5 MHz with the RC oscillator. This includes the very +popular ATTiny25, ATTiny45, ATTiny85 series as well as the ATTiny26. Almost +all AVRs can reach 12.8 MHz, although this is outside the specified range. + +See the EasyLogger example at http://www.obdev.at/vusb/easylogger.html for +code which calibrates the RC oscillator based on the USB frame clock. + +18 MHz Clock +This module is closer to the USB specification because it performs an on the +fly CRC check for incoming packets. Packets with invalid checksum are +discarded as required by the spec. If you also implement checks for data +PID toggling on application level (see option USB_CFG_CHECK_DATA_TOGGLING +in usbconfig.h for more info), this ensures data integrity. Due to the CRC +tables and alignment requirements, this code is bigger than modules for other +clock rates. To activate this module, you must define USB_CFG_CHECK_CRC to 1 +and USB_CFG_CLOCK_KHZ to 18000 in usbconfig.h. + +20 MHz Clock +This module is for people who won't do it with less than the maximum. Since +20 MHz is not divisible by the USB low speed bit clock of 1.5 MHz, the code +uses similar tricks as the 16 MHz module to insert leap cycles. + + +USB IDENTIFIERS +=============== +Every USB device needs a vendor- and a product-identifier (VID and PID). VIDs +are obtained from usb.org for a price of 1,500 USD. Once you have a VID, you +can assign PIDs at will. + +Since an entry level cost of 1,500 USD is too high for most small companies +and hobbyists, we provide some VID/PID pairs for free. See the file +USB-IDs-for-free.txt for details. + +Objective Development also has some license offerings which include product +IDs. See http://www.obdev.at/vusb/ for details. + + +DEVELOPMENT SYSTEM +================== +This driver has been developed and optimized for the GNU compiler version 3 +and 4. We recommend that you use the GNU compiler suite because it is freely +available. V-USB has also been ported to the IAR compiler and assembler. It +has been tested with IAR 4.10B/W32 and 4.12A/W32 on an ATmega8 with the +"small" and "tiny" memory model. Not every release is tested with IAR CC and +the driver may therefore fail to compile with IAR. Please note that gcc is +more efficient for usbdrv.c because this module has been deliberately +optimized for gcc. + +Gcc version 3 produces smaller code than version 4 due to new optimizing +capabilities which don't always improve things on 8 bit CPUs. The code size +generated by gcc 4 can be reduced with the compiler options +-fno-move-loop-invariants, -fno-tree-scev-cprop and +-fno-inline-small-functions in addition to -Os. On devices with more than +8k of flash memory, we also recommend the linker option --relax (written as +-Wl,--relax for gcc) to convert absolute calls into relative where possible. + +For more information about optimizing options see: + + http://www.tty1.net/blog/2008-04-29-avr-gcc-optimisations_en.html + +These optimizations are good for gcc 4.x. Version 3.x of gcc does not support +most of these options and produces good code anyway. + + +USING V-USB FOR FREE +==================== +The AVR firmware driver is published under the GNU General Public License +Version 2 (GPL2) and the GNU General Public License Version 3 (GPL3). It is +your choice whether you apply the terms of version 2 or version 3. + +If you decide for the free GPL2 or GPL3, we STRONGLY ENCOURAGE you to do the +following things IN ADDITION to the obligations from the GPL: + +(1) Publish your entire project on a web site and drop us a note with the URL. +Use the form at http://www.obdev.at/vusb/feedback.html for your submission. +If you don't have a web site, you can publish the project in obdev's +documentation wiki at +http://www.obdev.at/goto.php?t=vusb-wiki&p=hosted-projects. + +(2) Adhere to minimum publication standards. Please include AT LEAST: + - a circuit diagram in PDF, PNG or GIF format + - full source code for the host software + - a Readme.txt file in ASCII format which describes the purpose of the + project and what can be found in which directories and which files + - a reference to http://www.obdev.at/vusb/ + +(3) If you improve the driver firmware itself, please give us a free license +to your modifications for our commercial license offerings. + + +COMMERCIAL LICENSES FOR V-USB +============================= +If you don't want to publish your source code under the terms of the GPL, +you can simply pay money for V-USB. As an additional benefit you get +USB PIDs for free, reserved exclusively to you. See the file +"CommercialLicense.txt" for details. + diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/USB-ID-FAQ.txt b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/USB-ID-FAQ.txt new file mode 100644 index 00000000..d1de8fb6 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/USB-ID-FAQ.txt @@ -0,0 +1,149 @@ +Version 2009-08-22 + +========================== +WHY DO WE NEED THESE IDs? +========================== + +USB is more than a low level protocol for data transport. It also defines a +common set of requests which must be understood by all devices. And as part +of these common requests, the specification defines data structures, the +USB Descriptors, which are used to describe the properties of the device. + +From the perspective of an operating system, it is therefore possible to find +out basic properties of a device (such as e.g. the manufacturer and the name +of the device) without a device-specific driver. This is essential because +the operating system can choose a driver to load based on this information +(Plug-And-Play). + +Among the most important properties in the Device Descriptor are the USB +Vendor- and Product-ID. Both are 16 bit integers. The most simple form of +driver matching is based on these IDs. The driver announces the Vendor- and +Product-IDs of the devices it can handle and the operating system loads the +appropriate driver when the device is connected. + +It is obvious that this technique only works if the pair Vendor- plus +Product-ID is unique: Only devices which require the same driver can have the +same pair of IDs. + + +===================================================== +HOW DOES THE USB STANDARD ENSURE THAT IDs ARE UNIQUE? +===================================================== + +Since it is so important that USB IDs are unique, the USB Implementers Forum, +Inc. (usb.org) needs a way to enforce this legally. It is not forbidden by +law to build a device and assign it any random numbers as IDs. Usb.org +therefore needs an agreement to regulate the use of USB IDs. The agreement +binds only parties who agreed to it, of course. Everybody else is free to use +any numbers for their IDs. + +So how can usb.org ensure that every manufacturer of USB devices enters into +an agreement with them? They do it via trademark licensing. Usb.org has +registered the trademark "USB", all associated logos and related terms. If +you want to put an USB logo on your product or claim that it is USB +compliant, you must license these trademarks from usb.org. And this is where +you enter into an agreement. See the "USB-IF Trademark License Agreement and +Usage Guidelines for the USB-IF Logo" at +http://www.usb.org/developers/logo_license/. + +Licensing the USB trademarks requires that you buy a USB Vendor-ID from +usb.org (one-time fee of ca. 2,000 USD), that you become a member of usb.org +(yearly fee of ca. 4,000 USD) and that you meet all the technical +specifications from the USB spec. + +This means that most hobbyists and small companies will never be able to +become USB compliant, just because membership is so expensive. And you can't +be compliant with a driver based on V-USB anyway, because the AVR's port pins +don't meet the electrical specifications for USB. So, in principle, all +hobbyists and small companies are free to choose any random numbers for their +IDs. They have nothing to lose... + +There is one exception worth noting, though: If you use a sub-component which +implements USB, the vendor of the sub-components may guarantee USB +compliance. This might apply to some or all of FTDI's solutions. + + +======================================================================= +WHY SHOULD YOU OBTAIN USB IDs EVEN IF YOU DON'T LICENSE USB TRADEMARKS? +======================================================================= + +You have learned in the previous section that you are free to choose any +numbers for your IDs anyway. So why not do exactly this? There is still the +technical issue. If you choose IDs which are already in use by somebody else, +operating systems will load the wrong drivers and your device won't work. +Even if you choose IDs which are not currently in use, they may be in use in +the next version of the operating system or even after an automatic update. + +So what you need is a pair of Vendor- and Product-IDs for which you have the +guarantee that no USB compliant product uses them. This implies that no +operating system will ever ship with drivers responsible for these IDs. + + +============================================== +HOW DOES OBJECTIVE DEVELOPMENT HANDLE USB IDs? +============================================== + +Objective Development gives away pairs of USB-IDs with their V-USB licenses. +In order to ensure that these IDs are unique, Objective Development has an +agreement with the company/person who has bought the USB Vendor-ID from +usb.org. This agreement ensures that a range of USB Product-IDs is reserved +for assignment by Objective Development and that the owner of the Vendor-ID +won't give it to anybody else. + +This means that you have to trust three parties to ensure uniqueness of +your IDs: + + - Objective Development, that they don't give the same PID to more than + one person. + - The owner of the Vendor-ID that they don't assign PIDs from the range + assigned to Objective Development to anybody else. + - Usb.org that they don't assign the same Vendor-ID a second time. + + +================================== +WHO IS THE OWNER OF THE VENDOR-ID? +================================== + +Objective Development has obtained ranges of USB Product-IDs under two +Vendor-IDs: Under Vendor-ID 5824 from Wouter van Ooijen (Van Ooijen +Technische Informatica, www.voti.nl) and under Vendor-ID 8352 from Jason +Kotzin (Clay Logic, www.claylogic.com). Both VID owners have received their +Vendor-ID directly from usb.org. + + +========================================================================= +CAN I USE USB-IDs FROM OBJECTIVE DEVELOPMENT WITH OTHER DRIVERS/HARDWARE? +========================================================================= + +The short answer is: Yes. All you get is a guarantee that the IDs are never +assigned to anybody else. What more do you need? + + +============================ +WHAT ABOUT SHARED ID PAIRS? +============================ + +Objective Development has reserved some PID/VID pairs for shared use. You +have no guarantee of uniqueness for them, except that no USB compliant device +uses them. In order to avoid technical problems, we must ensure that all +devices with the same pair of IDs use the same driver on kernel level. For +details, see the file USB-IDs-for-free.txt. + + +====================================================== +I HAVE HEARD THAT SUB-LICENSING OF USB-IDs IS ILLEGAL? +====================================================== + +A 16 bit integer number cannot be protected by copyright laws. It is not +sufficiently complex. And since none of the parties involved entered into the +USB-IF Trademark License Agreement, we are not bound by this agreement. So +there is no reason why it should be illegal to sub-license USB-IDs. + + +============================================= +WHO IS LIABLE IF THERE ARE INCOMPATIBILITIES? +============================================= + +Objective Development disclaims all liabilities which might arise from the +assignment of IDs. If you guarantee product features to your customers +without proper disclaimer, YOU are liable for that. diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/USB-IDs-for-free.txt b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/USB-IDs-for-free.txt new file mode 100644 index 00000000..d46517d8 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/USB-IDs-for-free.txt @@ -0,0 +1,154 @@ +Version 2009-08-22 + +=========================== +FREE USB-IDs FOR SHARED USE +=========================== + +Objective Development has reserved a set of USB Product-IDs for use according +to the guidelines outlined below. For more information about the concept of +USB IDs please see the file USB-ID-FAQ.txt. Objective Development guarantees +that the IDs listed below are not used by any USB compliant devices. + + +==================== +MECHANISM OF SHARING +==================== + +From a technical point of view, two different devices can share the same USB +Vendor- and Product-ID if they require the same driver on operating system +level. We make use of this fact by assigning separate IDs for various device +classes. On application layer, devices must be distinguished by their textual +name or serial number. We offer separate sets of IDs for discrimination by +textual name and for serial number. + +Examples for shared use of USB IDs are included with V-USB in the "examples" +subdirectory. + + +====================================== +IDs FOR DISCRIMINATION BY TEXTUAL NAME +====================================== + +If you use one of the IDs listed below, your device and host-side software +must conform to these rules: + +(1) The USB device MUST provide a textual representation of the manufacturer +and product identification. The manufacturer identification MUST be available +at least in USB language 0x0409 (English/US). + +(2) The textual manufacturer identification MUST contain either an Internet +domain name (e.g. "mycompany.com") registered and owned by you, or an e-mail +address under your control (e.g. "myname@gmx.net"). You can embed the domain +name or e-mail address in any string you like, e.g. "Objective Development +http://www.obdev.at/vusb/". + +(3) You are responsible for retaining ownership of the domain or e-mail +address for as long as any of your products are in use. + +(4) You may choose any string for the textual product identification, as long +as this string is unique within the scope of your textual manufacturer +identification. + +(5) Application side device look-up MUST be based on the textual manufacturer +and product identification in addition to VID/PID matching. The driver +matching MUST be a comparison of the entire strings, NOT a sub-string match. + +(6) For devices which implement a particular USB device class (e.g. HID), the +operating system's default class driver MUST be used. If an operating system +driver for Vendor Class devices is needed, this driver must be libusb or +libusb-win32 (see http://libusb.org/ and +http://libusb-win32.sourceforge.net/). + +Table if IDs for discrimination by textual name: + +PID dec (hex) | VID dec (hex) | Description of use +==============+===============+============================================ +1500 (0x05dc) | 5824 (0x16c0) | For Vendor Class devices with libusb +--------------+---------------+-------------------------------------------- +1503 (0x05df) | 5824 (0x16c0) | For generic HID class devices (which are + | | NOT mice, keyboards or joysticks) +--------------+---------------+-------------------------------------------- +1505 (0x05e1) | 5824 (0x16c0) | For CDC-ACM class devices (modems) +--------------+---------------+-------------------------------------------- +1508 (0x05e4) | 5824 (0x16c0) | For MIDI class devices +--------------+---------------+-------------------------------------------- + +Note that Windows caches the textual product- and vendor-description for +mice, keyboards and joysticks. Name-bsed discrimination is therefore not +recommended for these device classes. + + +======================================= +IDs FOR DISCRIMINATION BY SERIAL NUMBER +======================================= + +If you use one of the IDs listed below, your device and host-side software +must conform to these rules: + +(1) The USB device MUST provide a textual representation of the serial +number, unless ONLY the operating system's default class driver is used. +The serial number string MUST be available at least in USB language 0x0409 +(English/US). + +(2) The serial number MUST start with either an Internet domain name (e.g. +"mycompany.com") registered and owned by you, or an e-mail address under your +control (e.g. "myname@gmx.net"), both terminated with a colon (":") character. +You MAY append any string you like for further discrimination of your devices. + +(3) You are responsible for retaining ownership of the domain or e-mail +address for as long as any of your products are in use. + +(5) Application side device look-up MUST be based on the serial number string +in addition to VID/PID matching. The matching must start at the first +character of the serial number string and include the colon character +terminating your domain or e-mail address. It MAY stop anywhere after that. + +(6) For devices which implement a particular USB device class (e.g. HID), the +operating system's default class driver MUST be used. If an operating system +driver for Vendor Class devices is needed, this driver must be libusb or +libusb-win32 (see http://libusb.org/ and +http://libusb-win32.sourceforge.net/). + +(7) If ONLY the operating system's default class driver is used, e.g. for +mice, keyboards, joysticks, CDC or MIDI devices and no discrimination by an +application is needed, the serial number may be omitted. + + +Table if IDs for discrimination by serial number string: + +PID dec (hex) | VID dec (hex) | Description of use +===============+===============+=========================================== +10200 (0x27d8) | 5824 (0x16c0) | For Vendor Class devices with libusb +---------------+---------------+------------------------------------------- +10201 (0x27d9) | 5824 (0x16c0) | For generic HID class devices (which are + | | NOT mice, keyboards or joysticks) +---------------+---------------+------------------------------------------- +10202 (0x27da) | 5824 (0x16c0) | For USB Mice +---------------+---------------+------------------------------------------- +10203 (0x27db) | 5824 (0x16c0) | For USB Keyboards +---------------+---------------+------------------------------------------- +10204 (0x27dc) | 5824 (0x16c0) | For USB Joysticks +---------------+---------------+------------------------------------------- +10205 (0x27dd) | 5824 (0x16c0) | For CDC-ACM class devices (modems) +---------------+---------------+------------------------------------------- +10206 (0x27de) | 5824 (0x16c0) | For MIDI class devices +---------------+---------------+------------------------------------------- + + +================= +ORIGIN OF USB-IDs +================= + +OBJECTIVE DEVELOPMENT Software GmbH has obtained all VID/PID pairs listed +here from Wouter van Ooijen (see www.voti.nl) for exclusive disposition. +Wouter van Ooijen has obtained the VID from the USB Implementers Forum, Inc. +(see www.usb.org). The VID is registered for the company name "Van Ooijen +Technische Informatica". + + +========== +DISCLAIMER +========== + +OBJECTIVE DEVELOPMENT Software GmbH disclaims all liability for any +problems which are caused by the shared use of these VID/PID pairs. diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/asmcommon.inc b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/asmcommon.inc new file mode 100644 index 00000000..07d692be --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/asmcommon.inc @@ -0,0 +1,188 @@ +/* Name: asmcommon.inc + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2007-11-05 + * Tabsize: 4 + * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * Revision: $Id$ + */ + +/* Do not link this file! Link usbdrvasm.S instead, which includes the + * appropriate implementation! + */ + +/* +General Description: +This file contains assembler code which is shared among the USB driver +implementations for different CPU cocks. Since the code must be inserted +in the middle of the module, it's split out into this file and #included. + +Jump destinations called from outside: + sofError: Called when no start sequence was found. + se0: Called when a package has been successfully received. + overflow: Called when receive buffer overflows. + doReturn: Called after sending data. + +Outside jump destinations used by this module: + waitForJ: Called to receive an already arriving packet. + sendAckAndReti: + sendNakAndReti: + sendCntAndReti: + usbSendAndReti: + +The following macros must be defined before this file is included: + .macro POP_STANDARD + .endm + .macro POP_RETI + .endm +*/ + +#define token x1 + +overflow: + ldi x2, 1< 0 + +#warning "Never compile production devices with debugging enabled" + +static void uartPutc(char c) +{ + while(!(ODDBG_USR & (1 << ODDBG_UDRE))); /* wait for data register empty */ + ODDBG_UDR = c; +} + +static uchar hexAscii(uchar h) +{ + h &= 0xf; + if(h >= 10) + h += 'a' - (uchar)10 - '0'; + h += '0'; + return h; +} + +static void printHex(uchar c) +{ + uartPutc(hexAscii(c >> 4)); + uartPutc(hexAscii(c)); +} + +void odDebug(uchar prefix, uchar *data, uchar len) +{ + printHex(prefix); + uartPutc(':'); + while(len--){ + uartPutc(' '); + printHex(*data++); + } + uartPutc('\r'); + uartPutc('\n'); +} + +#endif diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/oddebug.h b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/oddebug.h new file mode 100644 index 00000000..c56af1c3 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/oddebug.h @@ -0,0 +1,123 @@ +/* Name: oddebug.h + * Project: AVR library + * Author: Christian Starkjohann + * Creation Date: 2005-01-16 + * Tabsize: 4 + * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id$ + */ + +#ifndef __oddebug_h_included__ +#define __oddebug_h_included__ + +/* +General Description: +This module implements a function for debug logs on the serial line of the +AVR microcontroller. Debugging can be configured with the define +'DEBUG_LEVEL'. If this macro is not defined or defined to 0, all debugging +calls are no-ops. If it is 1, DBG1 logs will appear, but not DBG2. If it is +2, DBG1 and DBG2 logs will be printed. + +A debug log consists of a label ('prefix') to indicate which debug log created +the output and a memory block to dump in hex ('data' and 'len'). +*/ + + +#ifndef F_CPU +# define F_CPU 12000000 /* 12 MHz */ +#endif + +/* make sure we have the UART defines: */ +#include "usbportability.h" + +#ifndef uchar +# define uchar unsigned char +#endif + +#if DEBUG_LEVEL > 0 && !(defined TXEN || defined TXEN0) /* no UART in device */ +# warning "Debugging disabled because device has no UART" +# undef DEBUG_LEVEL +#endif + +#ifndef DEBUG_LEVEL +# define DEBUG_LEVEL 0 +#endif + +/* ------------------------------------------------------------------------- */ + +#if DEBUG_LEVEL > 0 +# define DBG1(prefix, data, len) odDebug(prefix, data, len) +#else +# define DBG1(prefix, data, len) +#endif + +#if DEBUG_LEVEL > 1 +# define DBG2(prefix, data, len) odDebug(prefix, data, len) +#else +# define DBG2(prefix, data, len) +#endif + +/* ------------------------------------------------------------------------- */ + +#if DEBUG_LEVEL > 0 +extern void odDebug(uchar prefix, uchar *data, uchar len); + +/* Try to find our control registers; ATMEL likes to rename these */ + +#if defined UBRR +# define ODDBG_UBRR UBRR +#elif defined UBRRL +# define ODDBG_UBRR UBRRL +#elif defined UBRR0 +# define ODDBG_UBRR UBRR0 +#elif defined UBRR0L +# define ODDBG_UBRR UBRR0L +#endif + +#if defined UCR +# define ODDBG_UCR UCR +#elif defined UCSRB +# define ODDBG_UCR UCSRB +#elif defined UCSR0B +# define ODDBG_UCR UCSR0B +#endif + +#if defined TXEN +# define ODDBG_TXEN TXEN +#else +# define ODDBG_TXEN TXEN0 +#endif + +#if defined USR +# define ODDBG_USR USR +#elif defined UCSRA +# define ODDBG_USR UCSRA +#elif defined UCSR0A +# define ODDBG_USR UCSR0A +#endif + +#if defined UDRE +# define ODDBG_UDRE UDRE +#else +# define ODDBG_UDRE UDRE0 +#endif + +#if defined UDR +# define ODDBG_UDR UDR +#elif defined UDR0 +# define ODDBG_UDR UDR0 +#endif + +static inline void odDebugInit(void) +{ + ODDBG_UCR |= (1<len & 0x10){ /* packet buffer was empty */ + txStatus->buffer[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* toggle token */ + }else{ + txStatus->len = USBPID_NAK; /* avoid sending outdated (overwritten) interrupt data */ + } + p = txStatus->buffer + 1; + i = len; + do{ /* if len == 0, we still copy 1 byte, but that's no problem */ + *p++ = *data++; + }while(--i > 0); /* loop control at the end is 2 bytes shorter than at beginning */ + usbCrc16Append(&txStatus->buffer[1], len); + txStatus->len = len + 4; /* len must be given including sync byte */ + DBG2(0x21 + (((int)txStatus >> 3) & 3), txStatus->buffer, len + 3); +} + +USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len) +{ + usbGenericSetInterrupt(data, len, &usbTxStatus1); +} +#endif + +#if USB_CFG_HAVE_INTRIN_ENDPOINT3 +USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len) +{ + usbGenericSetInterrupt(data, len, &usbTxStatus3); +} +#endif +#endif /* USB_CFG_SUPPRESS_INTR_CODE */ + +/* ------------------ utilities for code following below ------------------- */ + +/* Use defines for the switch statement so that we can choose between an + * if()else if() and a switch/case based implementation. switch() is more + * efficient for a LARGE set of sequential choices, if() is better in all other + * cases. + */ +#if USB_CFG_USE_SWITCH_STATEMENT +# define SWITCH_START(cmd) switch(cmd){{ +# define SWITCH_CASE(value) }break; case (value):{ +# define SWITCH_CASE2(v1,v2) }break; case (v1): case(v2):{ +# define SWITCH_CASE3(v1,v2,v3) }break; case (v1): case(v2): case(v3):{ +# define SWITCH_DEFAULT }break; default:{ +# define SWITCH_END }} +#else +# define SWITCH_START(cmd) {uchar _cmd = cmd; if(0){ +# define SWITCH_CASE(value) }else if(_cmd == (value)){ +# define SWITCH_CASE2(v1,v2) }else if(_cmd == (v1) || _cmd == (v2)){ +# define SWITCH_CASE3(v1,v2,v3) }else if(_cmd == (v1) || _cmd == (v2) || (_cmd == v3)){ +# define SWITCH_DEFAULT }else{ +# define SWITCH_END }} +#endif + +#ifndef USB_RX_USER_HOOK +#define USB_RX_USER_HOOK(data, len) +#endif +#ifndef USB_SET_ADDRESS_HOOK +#define USB_SET_ADDRESS_HOOK() +#endif + +/* ------------------------------------------------------------------------- */ + +/* We use if() instead of #if in the macro below because #if can't be used + * in macros and the compiler optimizes constant conditions anyway. + * This may cause problems with undefined symbols if compiled without + * optimizing! + */ +#define GET_DESCRIPTOR(cfgProp, staticName) \ + if(cfgProp){ \ + if((cfgProp) & USB_PROP_IS_RAM) \ + flags = 0; \ + if((cfgProp) & USB_PROP_IS_DYNAMIC){ \ + len = usbFunctionDescriptor(rq); \ + }else{ \ + len = USB_PROP_LENGTH(cfgProp); \ + usbMsgPtr = (uchar *)(staticName); \ + } \ + } + +/* usbDriverDescriptor() is similar to usbFunctionDescriptor(), but used + * internally for all types of descriptors. + */ +static inline usbMsgLen_t usbDriverDescriptor(usbRequest_t *rq) +{ +usbMsgLen_t len = 0; +uchar flags = USB_FLG_MSGPTR_IS_ROM; + + SWITCH_START(rq->wValue.bytes[1]) + SWITCH_CASE(USBDESCR_DEVICE) /* 1 */ + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_DEVICE, usbDescriptorDevice) + SWITCH_CASE(USBDESCR_CONFIG) /* 2 */ + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_CONFIGURATION, usbDescriptorConfiguration) + SWITCH_CASE(USBDESCR_STRING) /* 3 */ +#if USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC + if(USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_RAM) + flags = 0; + len = usbFunctionDescriptor(rq); +#else /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ + SWITCH_START(rq->wValue.bytes[0]) + SWITCH_CASE(0) + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_0, usbDescriptorString0) + SWITCH_CASE(1) + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_VENDOR, usbDescriptorStringVendor) + SWITCH_CASE(2) + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_PRODUCT, usbDescriptorStringDevice) + SWITCH_CASE(3) + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_STRING_SERIAL_NUMBER, usbDescriptorStringSerialNumber) + SWITCH_DEFAULT + if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ + len = usbFunctionDescriptor(rq); + } + SWITCH_END +#endif /* USB_CFG_DESCR_PROPS_STRINGS & USB_PROP_IS_DYNAMIC */ +#if USB_CFG_DESCR_PROPS_HID_REPORT /* only support HID descriptors if enabled */ + SWITCH_CASE(USBDESCR_HID) /* 0x21 */ + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID, usbDescriptorConfiguration + 18) + SWITCH_CASE(USBDESCR_HID_REPORT)/* 0x22 */ + GET_DESCRIPTOR(USB_CFG_DESCR_PROPS_HID_REPORT, usbDescriptorHidReport) +#endif + SWITCH_DEFAULT + if(USB_CFG_DESCR_PROPS_UNKNOWN & USB_PROP_IS_DYNAMIC){ + len = usbFunctionDescriptor(rq); + } + SWITCH_END + usbMsgFlags = flags; + return len; +} + +/* ------------------------------------------------------------------------- */ + +/* usbDriverSetup() is similar to usbFunctionSetup(), but it's used for + * standard requests instead of class and custom requests. + */ +static inline usbMsgLen_t usbDriverSetup(usbRequest_t *rq) +{ +usbMsgLen_t len = 0; +uchar *dataPtr = usbTxBuf + 9; /* there are 2 bytes free space at the end of the buffer */ +uchar value = rq->wValue.bytes[0]; +#if USB_CFG_IMPLEMENT_HALT +uchar index = rq->wIndex.bytes[0]; +#endif + + dataPtr[0] = 0; /* default reply common to USBRQ_GET_STATUS and USBRQ_GET_INTERFACE */ + SWITCH_START(rq->bRequest) + SWITCH_CASE(USBRQ_GET_STATUS) /* 0 */ + uchar recipient = rq->bmRequestType & USBRQ_RCPT_MASK; /* assign arith ops to variables to enforce byte size */ + if(USB_CFG_IS_SELF_POWERED && recipient == USBRQ_RCPT_DEVICE) + dataPtr[0] = USB_CFG_IS_SELF_POWERED; +#if USB_CFG_IMPLEMENT_HALT + if(recipient == USBRQ_RCPT_ENDPOINT && index == 0x81) /* request status for endpoint 1 */ + dataPtr[0] = usbTxLen1 == USBPID_STALL; +#endif + dataPtr[1] = 0; + len = 2; +#if USB_CFG_IMPLEMENT_HALT + SWITCH_CASE2(USBRQ_CLEAR_FEATURE, USBRQ_SET_FEATURE) /* 1, 3 */ + if(value == 0 && index == 0x81){ /* feature 0 == HALT for endpoint == 1 */ + usbTxLen1 = rq->bRequest == USBRQ_CLEAR_FEATURE ? USBPID_NAK : USBPID_STALL; + usbResetDataToggling(); + } +#endif + SWITCH_CASE(USBRQ_SET_ADDRESS) /* 5 */ + usbNewDeviceAddr = value; + USB_SET_ADDRESS_HOOK(); + SWITCH_CASE(USBRQ_GET_DESCRIPTOR) /* 6 */ + len = usbDriverDescriptor(rq); + goto skipMsgPtrAssignment; + SWITCH_CASE(USBRQ_GET_CONFIGURATION) /* 8 */ + dataPtr = &usbConfiguration; /* send current configuration value */ + len = 1; + SWITCH_CASE(USBRQ_SET_CONFIGURATION) /* 9 */ + usbConfiguration = value; + usbResetStall(); + SWITCH_CASE(USBRQ_GET_INTERFACE) /* 10 */ + len = 1; +#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE + SWITCH_CASE(USBRQ_SET_INTERFACE) /* 11 */ + usbResetDataToggling(); + usbResetStall(); +#endif + SWITCH_DEFAULT /* 7=SET_DESCRIPTOR, 12=SYNC_FRAME */ + /* Should we add an optional hook here? */ + SWITCH_END + usbMsgPtr = dataPtr; +skipMsgPtrAssignment: + return len; +} + +/* ------------------------------------------------------------------------- */ + +/* usbProcessRx() is called for every message received by the interrupt + * routine. It distinguishes between SETUP and DATA packets and processes + * them accordingly. + */ +static inline void usbProcessRx(uchar *data, uchar len) +{ +usbRequest_t *rq = (void *)data; + +/* usbRxToken can be: + * 0x2d 00101101 (USBPID_SETUP for setup data) + * 0xe1 11100001 (USBPID_OUT: data phase of setup transfer) + * 0...0x0f for OUT on endpoint X + */ + DBG2(0x10 + (usbRxToken & 0xf), data, len + 2); /* SETUP=1d, SETUP-DATA=11, OUTx=1x */ + USB_RX_USER_HOOK(data, len) +#if USB_CFG_IMPLEMENT_FN_WRITEOUT + if(usbRxToken < 0x10){ /* OUT to endpoint != 0: endpoint number in usbRxToken */ + usbFunctionWriteOut(data, len); + return; + } +#endif + if(usbRxToken == (uchar)USBPID_SETUP){ + if(len != 8) /* Setup size must be always 8 bytes. Ignore otherwise. */ + return; + usbMsgLen_t replyLen; + usbTxBuf[0] = USBPID_DATA0; /* initialize data toggling */ + usbTxLen = USBPID_NAK; /* abort pending transmit */ + usbMsgFlags = 0; + uchar type = rq->bmRequestType & USBRQ_TYPE_MASK; + if(type != USBRQ_TYPE_STANDARD){ /* standard requests are handled by driver */ + replyLen = usbFunctionSetup(data); + }else{ + replyLen = usbDriverSetup(rq); + } +#if USB_CFG_IMPLEMENT_FN_READ || USB_CFG_IMPLEMENT_FN_WRITE + if(replyLen == USB_NO_MSG){ /* use user-supplied read/write function */ + /* do some conditioning on replyLen, but on IN transfers only */ + if((rq->bmRequestType & USBRQ_DIR_MASK) != USBRQ_DIR_HOST_TO_DEVICE){ + if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ + replyLen = rq->wLength.bytes[0]; + }else{ + replyLen = rq->wLength.word; + } + } + usbMsgFlags = USB_FLG_USE_USER_RW; + }else /* The 'else' prevents that we limit a replyLen of USB_NO_MSG to the maximum transfer len. */ +#endif + if(sizeof(replyLen) < sizeof(rq->wLength.word)){ /* help compiler with optimizing */ + if(!rq->wLength.bytes[1] && replyLen > rq->wLength.bytes[0]) /* limit length to max */ + replyLen = rq->wLength.bytes[0]; + }else{ + if(replyLen > rq->wLength.word) /* limit length to max */ + replyLen = rq->wLength.word; + } + usbMsgLen = replyLen; + }else{ /* usbRxToken must be USBPID_OUT, which means data phase of setup (control-out) */ +#if USB_CFG_IMPLEMENT_FN_WRITE + if(usbMsgFlags & USB_FLG_USE_USER_RW){ + uchar rval = usbFunctionWrite(data, len); + if(rval == 0xff){ /* an error occurred */ + usbTxLen = USBPID_STALL; + }else if(rval != 0){ /* This was the final package */ + usbMsgLen = 0; /* answer with a zero-sized data packet */ + } + } +#endif + } +} + +/* ------------------------------------------------------------------------- */ + +/* This function is similar to usbFunctionRead(), but it's also called for + * data handled automatically by the driver (e.g. descriptor reads). + */ +static uchar usbDeviceRead(uchar *data, uchar len) +{ + if(len > 0){ /* don't bother app with 0 sized reads */ +#if USB_CFG_IMPLEMENT_FN_READ + if(usbMsgFlags & USB_FLG_USE_USER_RW){ + len = usbFunctionRead(data, len); + }else +#endif + { + uchar i = len, *r = usbMsgPtr; + if(usbMsgFlags & USB_FLG_MSGPTR_IS_ROM){ /* ROM data */ + do{ + uchar c = USB_READ_FLASH(r); /* assign to char size variable to enforce byte ops */ + *data++ = c; + r++; + }while(--i); + }else{ /* RAM data */ + do{ + *data++ = *r++; + }while(--i); + } + usbMsgPtr = r; + } + } + return len; +} + +/* ------------------------------------------------------------------------- */ + +/* usbBuildTxBlock() is called when we have data to transmit and the + * interrupt routine's transmit buffer is empty. + */ +static inline void usbBuildTxBlock(void) +{ +usbMsgLen_t wantLen; +uchar len; + + wantLen = usbMsgLen; + if(wantLen > 8) + wantLen = 8; + usbMsgLen -= wantLen; + usbTxBuf[0] ^= USBPID_DATA0 ^ USBPID_DATA1; /* DATA toggling */ + len = usbDeviceRead(usbTxBuf + 1, wantLen); + if(len <= 8){ /* valid data packet */ + usbCrc16Append(&usbTxBuf[1], len); + len += 4; /* length including sync byte */ + if(len < 12) /* a partial package identifies end of message */ + usbMsgLen = USB_NO_MSG; + }else{ + len = USBPID_STALL; /* stall the endpoint */ + usbMsgLen = USB_NO_MSG; + } + usbTxLen = len; + DBG2(0x20, usbTxBuf, len-1); +} + +/* ------------------------------------------------------------------------- */ + +static inline void usbHandleResetHook(uchar notResetState) +{ +#ifdef USB_RESET_HOOK +static uchar wasReset; +uchar isReset = !notResetState; + + if(wasReset != isReset){ + USB_RESET_HOOK(isReset); + wasReset = isReset; + } +#else + notResetState = notResetState; // avoid compiler warning +#endif +} + +/* ------------------------------------------------------------------------- */ + +USB_PUBLIC void usbPoll(void) +{ +schar len; +uchar i; + + len = usbRxLen - 3; + if(len >= 0){ +/* We could check CRC16 here -- but ACK has already been sent anyway. If you + * need data integrity checks with this driver, check the CRC in your app + * code and report errors back to the host. Since the ACK was already sent, + * retries must be handled on application level. + * unsigned crc = usbCrc16(buffer + 1, usbRxLen - 3); + */ + usbProcessRx(usbRxBuf + USB_BUFSIZE + 1 - usbInputBufOffset, len); +#if USB_CFG_HAVE_FLOWCONTROL + if(usbRxLen > 0) /* only mark as available if not inactivated */ + usbRxLen = 0; +#else + usbRxLen = 0; /* mark rx buffer as available */ +#endif + } + if(usbTxLen & 0x10){ /* transmit system idle */ + if(usbMsgLen != USB_NO_MSG){ /* transmit data pending? */ + usbBuildTxBlock(); + } + } + for(i = 20; i > 0; i--){ + uchar usbLineStatus = USBIN & USBMASK; + if(usbLineStatus != 0) /* SE0 has ended */ + goto isNotReset; + } + /* RESET condition, called multiple times during reset */ + usbNewDeviceAddr = 0; + usbDeviceAddr = 0; + usbResetStall(); + DBG1(0xff, 0, 0); +isNotReset: + usbHandleResetHook(i); +} + +/* ------------------------------------------------------------------------- */ + +USB_PUBLIC void usbInit(void) +{ +#if USB_INTR_CFG_SET != 0 + USB_INTR_CFG |= USB_INTR_CFG_SET; +#endif +#if USB_INTR_CFG_CLR != 0 + USB_INTR_CFG &= ~(USB_INTR_CFG_CLR); +#endif + USB_INTR_ENABLE |= (1 << USB_INTR_ENABLE_BIT); + usbResetDataToggling(); +#if USB_CFG_HAVE_INTRIN_ENDPOINT && !USB_CFG_SUPPRESS_INTR_CODE + usbTxLen1 = USBPID_NAK; +#if USB_CFG_HAVE_INTRIN_ENDPOINT3 + usbTxLen3 = USBPID_NAK; +#endif +#endif +} + +/* ------------------------------------------------------------------------- */ diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrv.h b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrv.h new file mode 100644 index 00000000..cd0445cb --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrv.h @@ -0,0 +1,736 @@ +/* Name: usbdrv.h + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2004-12-29 + * Tabsize: 4 + * Copyright: (c) 2005 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id$ + */ + +#ifndef __usbdrv_h_included__ +#define __usbdrv_h_included__ +#include "usbconfig.h" +#include "usbportability.h" + +/* +Hardware Prerequisites: +======================= +USB lines D+ and D- MUST be wired to the same I/O port. We recommend that D+ +triggers the interrupt (best achieved by using INT0 for D+), but it is also +possible to trigger the interrupt from D-. If D- is used, interrupts are also +triggered by SOF packets. D- requires a pull-up of 1.5k to +3.5V (and the +device must be powered at 3.5V) to identify as low-speed USB device. A +pull-down or pull-up of 1M SHOULD be connected from D+ to +3.5V to prevent +interference when no USB master is connected. If you use Zener diodes to limit +the voltage on D+ and D-, you MUST use a pull-down resistor, not a pull-up. +We use D+ as interrupt source and not D- because it does not trigger on +keep-alive and RESET states. If you want to count keep-alive events with +USB_COUNT_SOF, you MUST use D- as an interrupt source. + +As a compile time option, the 1.5k pull-up resistor on D- can be made +switchable to allow the device to disconnect at will. See the definition of +usbDeviceConnect() and usbDeviceDisconnect() further down in this file. + +Please adapt the values in usbconfig.h according to your hardware! + +The device MUST be clocked at exactly 12 MHz, 15 MHz, 16 MHz or 20 MHz +or at 12.8 MHz resp. 16.5 MHz +/- 1%. See usbconfig-prototype.h for details. + + +Limitations: +============ +Robustness with respect to communication errors: +The driver assumes error-free communication. It DOES check for errors in +the PID, but does NOT check bit stuffing errors, SE0 in middle of a byte, +token CRC (5 bit) and data CRC (16 bit). CRC checks can not be performed due +to timing constraints: We must start sending a reply within 7 bit times. +Bit stuffing and misplaced SE0 would have to be checked in real-time, but CPU +performance does not permit that. The driver does not check Data0/Data1 +toggling, but application software can implement the check. + +Input characteristics: +Since no differential receiver circuit is used, electrical interference +robustness may suffer. The driver samples only one of the data lines with +an ordinary I/O pin's input characteristics. However, since this is only a +low speed USB implementation and the specification allows for 8 times the +bit rate over the same hardware, we should be on the safe side. Even the spec +requires detection of asymmetric states at high bit rate for SE0 detection. + +Number of endpoints: +The driver supports the following endpoints: + +- Endpoint 0, the default control endpoint. +- Any number of interrupt- or bulk-out endpoints. The data is sent to + usbFunctionWriteOut() and USB_CFG_IMPLEMENT_FN_WRITEOUT must be defined + to 1 to activate this feature. The endpoint number can be found in the + global variable 'usbRxToken'. +- One default interrupt- or bulk-in endpoint. This endpoint is used for + interrupt- or bulk-in transfers which are not handled by any other endpoint. + You must define USB_CFG_HAVE_INTRIN_ENDPOINT in order to activate this + feature and call usbSetInterrupt() to send interrupt/bulk data. +- One additional interrupt- or bulk-in endpoint. This was endpoint 3 in + previous versions of this driver but can now be configured to any endpoint + number. You must define USB_CFG_HAVE_INTRIN_ENDPOINT3 in order to activate + this feature and call usbSetInterrupt3() to send interrupt/bulk data. The + endpoint number can be set with USB_CFG_EP3_NUMBER. + +Please note that the USB standard forbids bulk endpoints for low speed devices! +Most operating systems allow them anyway, but the AVR will spend 90% of the CPU +time in the USB interrupt polling for bulk data. + +Maximum data payload: +Data payload of control in and out transfers may be up to 254 bytes. In order +to accept payload data of out transfers, you need to implement +'usbFunctionWrite()'. + +USB Suspend Mode supply current: +The USB standard limits power consumption to 500uA when the bus is in suspend +mode. This is not a problem for self-powered devices since they don't need +bus power anyway. Bus-powered devices can achieve this only by putting the +CPU in sleep mode. The driver does not implement suspend handling by itself. +However, the application may implement activity monitoring and wakeup from +sleep. The host sends regular SE0 states on the bus to keep it active. These +SE0 states can be detected by using D- as the interrupt source. Define +USB_COUNT_SOF to 1 and use the global variable usbSofCount to check for bus +activity. + +Operation without an USB master: +The driver behaves neutral without connection to an USB master if D- reads +as 1. To avoid spurious interrupts, we recommend a high impedance (e.g. 1M) +pull-down or pull-up resistor on D+ (interrupt). If Zener diodes are used, +use a pull-down. If D- becomes statically 0, the driver may block in the +interrupt routine. + +Interrupt latency: +The application must ensure that the USB interrupt is not disabled for more +than 25 cycles (this is for 12 MHz, faster clocks allow longer latency). +This implies that all interrupt routines must either have the "ISR_NOBLOCK" +attribute set (see "avr/interrupt.h") or be written in assembler with "sei" +as the first instruction. + +Maximum interrupt duration / CPU cycle consumption: +The driver handles all USB communication during the interrupt service +routine. The routine will not return before an entire USB message is received +and the reply is sent. This may be up to ca. 1200 cycles @ 12 MHz (= 100us) if +the host conforms to the standard. The driver will consume CPU cycles for all +USB messages, even if they address another (low-speed) device on the same bus. + +*/ + +/* ------------------------------------------------------------------------- */ +/* --------------------------- Module Interface ---------------------------- */ +/* ------------------------------------------------------------------------- */ + +#define USBDRV_VERSION 20120109 +/* This define uniquely identifies a driver version. It is a decimal number + * constructed from the driver's release date in the form YYYYMMDD. If the + * driver's behavior or interface changes, you can use this constant to + * distinguish versions. If it is not defined, the driver's release date is + * older than 2006-01-25. + */ + + +#ifndef USB_PUBLIC +#define USB_PUBLIC +#endif +/* USB_PUBLIC is used as declaration attribute for all functions exported by + * the USB driver. The default is no attribute (see above). You may define it + * to static either in usbconfig.h or from the command line if you include + * usbdrv.c instead of linking against it. Including the C module of the driver + * directly in your code saves a couple of bytes in flash memory. + */ + +#ifndef __ASSEMBLER__ +#ifndef uchar +#define uchar unsigned char +#endif +#ifndef schar +#define schar signed char +#endif +/* shortcuts for well defined 8 bit integer types */ + +#if USB_CFG_LONG_TRANSFERS /* if more than 254 bytes transfer size required */ +# define usbMsgLen_t unsigned +#else +# define usbMsgLen_t uchar +#endif +/* usbMsgLen_t is the data type used for transfer lengths. By default, it is + * defined to uchar, allowing a maximum of 254 bytes (255 is reserved for + * USB_NO_MSG below). If the usbconfig.h defines USB_CFG_LONG_TRANSFERS to 1, + * a 16 bit data type is used, allowing up to 16384 bytes (the rest is used + * for flags in the descriptor configuration). + */ +#define USB_NO_MSG ((usbMsgLen_t)-1) /* constant meaning "no message" */ + +struct usbRequest; /* forward declaration */ + +USB_PUBLIC void usbInit(void); +/* This function must be called before interrupts are enabled and the main + * loop is entered. We exepct that the PORT and DDR bits for D+ and D- have + * not been changed from their default status (which is 0). If you have changed + * them, set both back to 0 (configure them as input with no internal pull-up). + */ +USB_PUBLIC void usbPoll(void); +/* This function must be called at regular intervals from the main loop. + * Maximum delay between calls is somewhat less than 50ms (USB timeout for + * accepting a Setup message). Otherwise the device will not be recognized. + * Please note that debug outputs through the UART take ~ 0.5ms per byte + * at 19200 bps. + */ +extern uchar *usbMsgPtr; +/* This variable may be used to pass transmit data to the driver from the + * implementation of usbFunctionWrite(). It is also used internally by the + * driver for standard control requests. + */ +USB_PUBLIC usbMsgLen_t usbFunctionSetup(uchar data[8]); +/* This function is called when the driver receives a SETUP transaction from + * the host which is not answered by the driver itself (in practice: class and + * vendor requests). All control transfers start with a SETUP transaction where + * the host communicates the parameters of the following (optional) data + * transfer. The SETUP data is available in the 'data' parameter which can + * (and should) be casted to 'usbRequest_t *' for a more user-friendly access + * to parameters. + * + * If the SETUP indicates a control-in transfer, you should provide the + * requested data to the driver. There are two ways to transfer this data: + * (1) Set the global pointer 'usbMsgPtr' to the base of the static RAM data + * block and return the length of the data in 'usbFunctionSetup()'. The driver + * will handle the rest. Or (2) return USB_NO_MSG in 'usbFunctionSetup()'. The + * driver will then call 'usbFunctionRead()' when data is needed. See the + * documentation for usbFunctionRead() for details. + * + * If the SETUP indicates a control-out transfer, the only way to receive the + * data from the host is through the 'usbFunctionWrite()' call. If you + * implement this function, you must return USB_NO_MSG in 'usbFunctionSetup()' + * to indicate that 'usbFunctionWrite()' should be used. See the documentation + * of this function for more information. If you just want to ignore the data + * sent by the host, return 0 in 'usbFunctionSetup()'. + * + * Note that calls to the functions usbFunctionRead() and usbFunctionWrite() + * are only done if enabled by the configuration in usbconfig.h. + */ +USB_PUBLIC usbMsgLen_t usbFunctionDescriptor(struct usbRequest *rq); +/* You need to implement this function ONLY if you provide USB descriptors at + * runtime (which is an expert feature). It is very similar to + * usbFunctionSetup() above, but it is called only to request USB descriptor + * data. See the documentation of usbFunctionSetup() above for more info. + */ +#if USB_CFG_HAVE_INTRIN_ENDPOINT +USB_PUBLIC void usbSetInterrupt(uchar *data, uchar len); +/* This function sets the message which will be sent during the next interrupt + * IN transfer. The message is copied to an internal buffer and must not exceed + * a length of 8 bytes. The message may be 0 bytes long just to indicate the + * interrupt status to the host. + * If you need to transfer more bytes, use a control read after the interrupt. + */ +#define usbInterruptIsReady() (usbTxLen1 & 0x10) +/* This macro indicates whether the last interrupt message has already been + * sent. If you set a new interrupt message before the old was sent, the + * message already buffered will be lost. + */ +#if USB_CFG_HAVE_INTRIN_ENDPOINT3 +USB_PUBLIC void usbSetInterrupt3(uchar *data, uchar len); +#define usbInterruptIsReady3() (usbTxLen3 & 0x10) +/* Same as above for endpoint 3 */ +#endif +#endif /* USB_CFG_HAVE_INTRIN_ENDPOINT */ +#if USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH /* simplified interface for backward compatibility */ +#define usbHidReportDescriptor usbDescriptorHidReport +/* should be declared as: PROGMEM char usbHidReportDescriptor[]; */ +/* If you implement an HID device, you need to provide a report descriptor. + * The HID report descriptor syntax is a bit complex. If you understand how + * report descriptors are constructed, we recommend that you use the HID + * Descriptor Tool from usb.org, see http://www.usb.org/developers/hidpage/. + * Otherwise you should probably start with a working example. + */ +#endif /* USB_CFG_HID_REPORT_DESCRIPTOR_LENGTH */ +#if USB_CFG_IMPLEMENT_FN_WRITE +USB_PUBLIC uchar usbFunctionWrite(uchar *data, uchar len); +/* This function is called by the driver to provide a control transfer's + * payload data (control-out). It is called in chunks of up to 8 bytes. The + * total count provided in the current control transfer can be obtained from + * the 'length' property in the setup data. If an error occurred during + * processing, return 0xff (== -1). The driver will answer the entire transfer + * with a STALL token in this case. If you have received the entire payload + * successfully, return 1. If you expect more data, return 0. If you don't + * know whether the host will send more data (you should know, the total is + * provided in the usbFunctionSetup() call!), return 1. + * NOTE: If you return 0xff for STALL, 'usbFunctionWrite()' may still be called + * for the remaining data. You must continue to return 0xff for STALL in these + * calls. + * In order to get usbFunctionWrite() called, define USB_CFG_IMPLEMENT_FN_WRITE + * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. + */ +#endif /* USB_CFG_IMPLEMENT_FN_WRITE */ +#if USB_CFG_IMPLEMENT_FN_READ +USB_PUBLIC uchar usbFunctionRead(uchar *data, uchar len); +/* This function is called by the driver to ask the application for a control + * transfer's payload data (control-in). It is called in chunks of up to 8 + * bytes each. You should copy the data to the location given by 'data' and + * return the actual number of bytes copied. If you return less than requested, + * the control-in transfer is terminated. If you return 0xff, the driver aborts + * the transfer with a STALL token. + * In order to get usbFunctionRead() called, define USB_CFG_IMPLEMENT_FN_READ + * to 1 in usbconfig.h and return 0xff in usbFunctionSetup().. + */ +#endif /* USB_CFG_IMPLEMENT_FN_READ */ + +extern uchar usbRxToken; /* may be used in usbFunctionWriteOut() below */ +#if USB_CFG_IMPLEMENT_FN_WRITEOUT +USB_PUBLIC void usbFunctionWriteOut(uchar *data, uchar len); +/* This function is called by the driver when data is received on an interrupt- + * or bulk-out endpoint. The endpoint number can be found in the global + * variable usbRxToken. You must define USB_CFG_IMPLEMENT_FN_WRITEOUT to 1 in + * usbconfig.h to get this function called. + */ +#endif /* USB_CFG_IMPLEMENT_FN_WRITEOUT */ +#ifdef USB_CFG_PULLUP_IOPORTNAME +#define usbDeviceConnect() ((USB_PULLUP_DDR |= (1<device, 1=device->host + * t ..... type: 0=standard, 1=class, 2=vendor, 3=reserved + * r ..... recipient: 0=device, 1=interface, 2=endpoint, 3=other + */ + +/* USB setup recipient values */ +#define USBRQ_RCPT_MASK 0x1f +#define USBRQ_RCPT_DEVICE 0 +#define USBRQ_RCPT_INTERFACE 1 +#define USBRQ_RCPT_ENDPOINT 2 + +/* USB request type values */ +#define USBRQ_TYPE_MASK 0x60 +#define USBRQ_TYPE_STANDARD (0<<5) +#define USBRQ_TYPE_CLASS (1<<5) +#define USBRQ_TYPE_VENDOR (2<<5) + +/* USB direction values: */ +#define USBRQ_DIR_MASK 0x80 +#define USBRQ_DIR_HOST_TO_DEVICE (0<<7) +#define USBRQ_DIR_DEVICE_TO_HOST (1<<7) + +/* USB Standard Requests */ +#define USBRQ_GET_STATUS 0 +#define USBRQ_CLEAR_FEATURE 1 +#define USBRQ_SET_FEATURE 3 +#define USBRQ_SET_ADDRESS 5 +#define USBRQ_GET_DESCRIPTOR 6 +#define USBRQ_SET_DESCRIPTOR 7 +#define USBRQ_GET_CONFIGURATION 8 +#define USBRQ_SET_CONFIGURATION 9 +#define USBRQ_GET_INTERFACE 10 +#define USBRQ_SET_INTERFACE 11 +#define USBRQ_SYNCH_FRAME 12 + +/* USB descriptor constants */ +#define USBDESCR_DEVICE 1 +#define USBDESCR_CONFIG 2 +#define USBDESCR_STRING 3 +#define USBDESCR_INTERFACE 4 +#define USBDESCR_ENDPOINT 5 +#define USBDESCR_HID 0x21 +#define USBDESCR_HID_REPORT 0x22 +#define USBDESCR_HID_PHYS 0x23 + +//#define USBATTR_BUSPOWER 0x80 // USB 1.1 does not define this value any more +#define USBATTR_BUSPOWER 0 +#define USBATTR_SELFPOWER 0x40 +#define USBATTR_REMOTEWAKE 0x20 + +/* USB HID Requests */ +#define USBRQ_HID_GET_REPORT 0x01 +#define USBRQ_HID_GET_IDLE 0x02 +#define USBRQ_HID_GET_PROTOCOL 0x03 +#define USBRQ_HID_SET_REPORT 0x09 +#define USBRQ_HID_SET_IDLE 0x0a +#define USBRQ_HID_SET_PROTOCOL 0x0b + +/* ------------------------------------------------------------------------- */ + +#endif /* __usbdrv_h_included__ */ diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm.S b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm.S new file mode 100644 index 00000000..4e6158ca --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm.S @@ -0,0 +1,393 @@ +/* Name: usbdrvasm.S + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2007-06-13 + * Tabsize: 4 + * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * Revision: $Id$ + */ + +/* +General Description: +This module is the assembler part of the USB driver. This file contains +general code (preprocessor acrobatics and CRC computation) and then includes +the file appropriate for the given clock rate. +*/ + +#define __SFR_OFFSET 0 /* used by avr-libc's register definitions */ +#include "usbportability.h" +#include "usbdrv.h" /* for common defs */ + +/* register names */ +#define x1 r16 +#define x2 r17 +#define shift r18 +#define cnt r19 +#define x3 r20 +#define x4 r21 +#define x5 r22 +#define bitcnt x5 +#define phase x4 +#define leap x4 + +/* Some assembler dependent definitions and declarations: */ + +#ifdef __IAR_SYSTEMS_ASM__ + extern usbRxBuf, usbDeviceAddr, usbNewDeviceAddr, usbInputBufOffset + extern usbCurrentTok, usbRxLen, usbRxToken, usbTxLen + extern usbTxBuf, usbTxStatus1, usbTxStatus3 +# if USB_COUNT_SOF + extern usbSofCount +# endif + public usbCrc16 + public usbCrc16Append + + COMMON INTVEC +# ifndef USB_INTR_VECTOR + ORG INT0_vect +# else /* USB_INTR_VECTOR */ + ORG USB_INTR_VECTOR +# undef USB_INTR_VECTOR +# endif /* USB_INTR_VECTOR */ +# define USB_INTR_VECTOR usbInterruptHandler + rjmp USB_INTR_VECTOR + RSEG CODE + +#else /* __IAR_SYSTEMS_ASM__ */ + +# ifndef USB_INTR_VECTOR /* default to hardware interrupt INT0 */ +# ifdef INT0_vect +# define USB_INTR_VECTOR INT0_vect // this is the "new" define for the vector +# else +# define USB_INTR_VECTOR SIG_INTERRUPT0 // this is the "old" vector +# endif +# endif + .text + .global USB_INTR_VECTOR + .type USB_INTR_VECTOR, @function + .global usbCrc16 + .global usbCrc16Append +#endif /* __IAR_SYSTEMS_ASM__ */ + + +#if USB_INTR_PENDING < 0x40 /* This is an I/O address, use in and out */ +# define USB_LOAD_PENDING(reg) in reg, USB_INTR_PENDING +# define USB_STORE_PENDING(reg) out USB_INTR_PENDING, reg +#else /* It's a memory address, use lds and sts */ +# define USB_LOAD_PENDING(reg) lds reg, USB_INTR_PENDING +# define USB_STORE_PENDING(reg) sts USB_INTR_PENDING, reg +#endif + +#define usbTxLen1 usbTxStatus1 +#define usbTxBuf1 (usbTxStatus1 + 1) +#define usbTxLen3 usbTxStatus3 +#define usbTxBuf3 (usbTxStatus3 + 1) + + +;---------------------------------------------------------------------------- +; Utility functions +;---------------------------------------------------------------------------- + +#ifdef __IAR_SYSTEMS_ASM__ +/* Register assignments for usbCrc16 on IAR cc */ +/* Calling conventions on IAR: + * First parameter passed in r16/r17, second in r18/r19 and so on. + * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) + * Result is passed in r16/r17 + * In case of the "tiny" memory model, pointers are only 8 bit with no + * padding. We therefore pass argument 1 as "16 bit unsigned". + */ +RTMODEL "__rt_version", "3" +/* The line above will generate an error if cc calling conventions change. + * The value "3" above is valid for IAR 4.10B/W32 + */ +# define argLen r18 /* argument 2 */ +# define argPtrL r16 /* argument 1 */ +# define argPtrH r17 /* argument 1 */ + +# define resCrcL r16 /* result */ +# define resCrcH r17 /* result */ + +# define ptrL ZL +# define ptrH ZH +# define ptr Z +# define byte r22 +# define bitCnt r19 +# define polyL r20 +# define polyH r21 +# define scratch r23 + +#else /* __IAR_SYSTEMS_ASM__ */ +/* Register assignments for usbCrc16 on gcc */ +/* Calling conventions on gcc: + * First parameter passed in r24/r25, second in r22/23 and so on. + * Callee must preserve r1-r17, r28/r29 + * Result is passed in r24/r25 + */ +# define argLen r22 /* argument 2 */ +# define argPtrL r24 /* argument 1 */ +# define argPtrH r25 /* argument 1 */ + +# define resCrcL r24 /* result */ +# define resCrcH r25 /* result */ + +# define ptrL XL +# define ptrH XH +# define ptr x +# define byte r18 +# define bitCnt r19 +# define polyL r20 +# define polyH r21 +# define scratch r23 + +#endif + +#if USB_USE_FAST_CRC + +; This implementation is faster, but has bigger code size +; Thanks to Slawomir Fras (BoskiDialer) for this code! +; It implements the following C pseudo-code: +; unsigned table(unsigned char x) +; { +; unsigned value; +; +; value = (unsigned)x << 6; +; value ^= (unsigned)x << 7; +; if(parity(x)) +; value ^= 0xc001; +; return value; +; } +; unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen) +; { +; unsigned crc = 0xffff; +; +; while(argLen--) +; crc = table(lo8(crc) ^ *argPtr++) ^ hi8(crc); +; return ~crc; +; } + +; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen); +; argPtr r24+25 / r16+r17 +; argLen r22 / r18 +; temp variables: +; byte r18 / r22 +; scratch r23 +; resCrc r24+r25 / r16+r17 +; ptr X / Z +usbCrc16: + mov ptrL, argPtrL + mov ptrH, argPtrH + ldi resCrcL, 0xFF + ldi resCrcH, 0xFF + rjmp usbCrc16LoopTest +usbCrc16ByteLoop: + ld byte, ptr+ + eor resCrcL, byte ; resCrcL is now 'x' in table() + mov byte, resCrcL ; compute parity of 'x' + swap byte + eor byte, resCrcL + mov scratch, byte + lsr byte + lsr byte + eor byte, scratch + inc byte + lsr byte + andi byte, 1 ; byte is now parity(x) + mov scratch, resCrcL + mov resCrcL, resCrcH + eor resCrcL, byte ; low byte of if(parity(x)) value ^= 0xc001; + neg byte + andi byte, 0xc0 + mov resCrcH, byte ; high byte of if(parity(x)) value ^= 0xc001; + clr byte + lsr scratch + ror byte + eor resCrcH, scratch + eor resCrcL, byte + lsr scratch + ror byte + eor resCrcH, scratch + eor resCrcL, byte +usbCrc16LoopTest: + subi argLen, 1 + brsh usbCrc16ByteLoop + com resCrcL + com resCrcH + ret + +#else /* USB_USE_FAST_CRC */ + +; This implementation is slower, but has less code size +; +; extern unsigned usbCrc16(unsigned char *argPtr, unsigned char argLen); +; argPtr r24+25 / r16+r17 +; argLen r22 / r18 +; temp variables: +; byte r18 / r22 +; bitCnt r19 +; poly r20+r21 +; scratch r23 +; resCrc r24+r25 / r16+r17 +; ptr X / Z +usbCrc16: + mov ptrL, argPtrL + mov ptrH, argPtrH + ldi resCrcL, 0 + ldi resCrcH, 0 + ldi polyL, lo8(0xa001) + ldi polyH, hi8(0xa001) + com argLen ; argLen = -argLen - 1: modified loop to ensure that carry is set + ldi bitCnt, 0 ; loop counter with starnd condition = end condition + rjmp usbCrcLoopEntry +usbCrcByteLoop: + ld byte, ptr+ + eor resCrcL, byte +usbCrcBitLoop: + ror resCrcH ; carry is always set here (see brcs jumps to here) + ror resCrcL + brcs usbCrcNoXor + eor resCrcL, polyL + eor resCrcH, polyH +usbCrcNoXor: + subi bitCnt, 224 ; (8 * 224) % 256 = 0; this loop iterates 8 times + brcs usbCrcBitLoop +usbCrcLoopEntry: + subi argLen, -1 + brcs usbCrcByteLoop +usbCrcReady: + ret +; Thanks to Reimar Doeffinger for optimizing this CRC routine! + +#endif /* USB_USE_FAST_CRC */ + +; extern unsigned usbCrc16Append(unsigned char *data, unsigned char len); +usbCrc16Append: + rcall usbCrc16 + st ptr+, resCrcL + st ptr+, resCrcH + ret + +#undef argLen +#undef argPtrL +#undef argPtrH +#undef resCrcL +#undef resCrcH +#undef ptrL +#undef ptrH +#undef ptr +#undef byte +#undef bitCnt +#undef polyL +#undef polyH +#undef scratch + + +#if USB_CFG_HAVE_MEASURE_FRAME_LENGTH +#ifdef __IAR_SYSTEMS_ASM__ +/* Register assignments for usbMeasureFrameLength on IAR cc */ +/* Calling conventions on IAR: + * First parameter passed in r16/r17, second in r18/r19 and so on. + * Callee must preserve r4-r15, r24-r29 (r28/r29 is frame pointer) + * Result is passed in r16/r17 + * In case of the "tiny" memory model, pointers are only 8 bit with no + * padding. We therefore pass argument 1 as "16 bit unsigned". + */ +# define resL r16 +# define resH r17 +# define cnt16L r30 +# define cnt16H r31 +# define cntH r18 + +#else /* __IAR_SYSTEMS_ASM__ */ +/* Register assignments for usbMeasureFrameLength on gcc */ +/* Calling conventions on gcc: + * First parameter passed in r24/r25, second in r22/23 and so on. + * Callee must preserve r1-r17, r28/r29 + * Result is passed in r24/r25 + */ +# define resL r24 +# define resH r25 +# define cnt16L r24 +# define cnt16H r25 +# define cntH r26 +#endif +# define cnt16 cnt16L + +; extern unsigned usbMeasurePacketLength(void); +; returns time between two idle strobes in multiples of 7 CPU clocks +.global usbMeasureFrameLength +usbMeasureFrameLength: + ldi cntH, 6 ; wait ~ 10 ms for D- == 0 + clr cnt16L + clr cnt16H +usbMFTime16: + dec cntH + breq usbMFTimeout +usbMFWaitStrobe: ; first wait for D- == 0 (idle strobe) + sbiw cnt16, 1 ;[0] [6] + breq usbMFTime16 ;[2] + sbic USBIN, USBMINUS ;[3] + rjmp usbMFWaitStrobe ;[4] +usbMFWaitIdle: ; then wait until idle again + sbis USBIN, USBMINUS ;1 wait for D- == 1 + rjmp usbMFWaitIdle ;2 + ldi cnt16L, 1 ;1 represents cycles so far + clr cnt16H ;1 +usbMFWaitLoop: + in cntH, USBIN ;[0] [7] + adiw cnt16, 1 ;[1] + breq usbMFTimeout ;[3] + andi cntH, USBMASK ;[4] + brne usbMFWaitLoop ;[5] +usbMFTimeout: +#if resL != cnt16L + mov resL, cnt16L + mov resH, cnt16H +#endif + ret + +#undef resL +#undef resH +#undef cnt16 +#undef cnt16L +#undef cnt16H +#undef cntH + +#endif /* USB_CFG_HAVE_MEASURE_FRAME_LENGTH */ + +;---------------------------------------------------------------------------- +; Now include the clock rate specific code +;---------------------------------------------------------------------------- + +#ifndef USB_CFG_CLOCK_KHZ +# ifdef F_CPU +# define USB_CFG_CLOCK_KHZ (F_CPU/1000) +# else +# error "USB_CFG_CLOCK_KHZ not defined in usbconfig.h and no F_CPU set!" +# endif +#endif + +#if USB_CFG_CHECK_CRC /* separate dispatcher for CRC type modules */ +# if USB_CFG_CLOCK_KHZ == 18000 +# include "usbdrvasm18-crc.inc" +# else +# error "USB_CFG_CLOCK_KHZ is not one of the supported crc-rates!" +# endif +#else /* USB_CFG_CHECK_CRC */ +# if USB_CFG_CLOCK_KHZ == 12000 +# include "usbdrvasm12.inc" +# elif USB_CFG_CLOCK_KHZ == 12800 +# include "usbdrvasm128.inc" +# elif USB_CFG_CLOCK_KHZ == 15000 +# include "usbdrvasm15.inc" +# elif USB_CFG_CLOCK_KHZ == 16000 +# include "usbdrvasm16.inc" +# elif USB_CFG_CLOCK_KHZ == 16500 +# include "usbdrvasm165.inc" +# elif USB_CFG_CLOCK_KHZ == 20000 +# include "usbdrvasm20.inc" +# else +# error "USB_CFG_CLOCK_KHZ is not one of the supported non-crc-rates!" +# endif +#endif /* USB_CFG_CHECK_CRC */ diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm.asm b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm.asm new file mode 100644 index 00000000..9cc4e4d7 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm.asm @@ -0,0 +1,21 @@ +/* Name: usbdrvasm.asm + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2006-03-01 + * Tabsize: 4 + * Copyright: (c) 2006 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id$ + */ + +/* +General Description: +The IAR compiler/assembler system prefers assembler files with file extension +".asm". We simply provide this file as an alias for usbdrvasm.S. + +Thanks to Oleg Semyonov for his help with the IAR tools port! +*/ + +#include "usbdrvasm.S" + +end diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm12.inc b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm12.inc new file mode 100644 index 00000000..cb74ceb7 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm12.inc @@ -0,0 +1,393 @@ +/* Name: usbdrvasm12.inc + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Christian Starkjohann + * Creation Date: 2004-12-29 + * Tabsize: 4 + * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * This Revision: $Id$ + */ + +/* Do not link this file! Link usbdrvasm.S instead, which includes the + * appropriate implementation! + */ + +/* +General Description: +This file is the 12 MHz version of the asssembler part of the USB driver. It +requires a 12 MHz crystal (not a ceramic resonator and not a calibrated RC +oscillator). + +See usbdrv.h for a description of the entire driver. + +Since almost all of this code is timing critical, don't change unless you +really know what you are doing! Many parts require not only a maximum number +of CPU cycles, but even an exact number of cycles! + + +Timing constraints according to spec (in bit times): +timing subject min max CPUcycles +--------------------------------------------------------------------------- +EOP of OUT/SETUP to sync pattern of DATA0 (both rx) 2 16 16-128 +EOP of IN to sync pattern of DATA0 (rx, then tx) 2 7.5 16-60 +DATAx (rx) to ACK/NAK/STALL (tx) 2 7.5 16-60 +*/ + +;Software-receiver engine. Strict timing! Don't change unless you can preserve timing! +;interrupt response time: 4 cycles + insn running = 7 max if interrupts always enabled +;max allowable interrupt latency: 34 cycles -> max 25 cycles interrupt disable +;max stack usage: [ret(2), YL, SREG, YH, shift, x1, x2, x3, cnt, x4] = 11 bytes +;Numbers in brackets are maximum cycles since SOF. +USB_INTR_VECTOR: +;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt + push YL ;2 [35] push only what is necessary to sync with edge ASAP + in YL, SREG ;1 [37] + push YL ;2 [39] +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +;---------------------------------------------------------------------------- +;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +;sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +waitForK: +;The following code results in a sampling window of 1/4 bit which meets the spec. + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError +foundK: +;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] +;we have 1 bit time for setup purposes, then sample again. Numbers in brackets +;are cycles from center of first sync (double K) bit after the instruction + push YH ;2 [2] + lds YL, usbInputBufOffset;2 [4] + clr YH ;1 [5] + subi YL, lo8(-(usbRxBuf));1 [6] + sbci YH, hi8(-(usbRxBuf));1 [7] + + sbis USBIN, USBMINUS ;1 [8] we want two bits K [sample 1 cycle too early] + rjmp haveTwoBitsK ;2 [10] + pop YH ;2 [11] undo the push from before + rjmp waitForK ;2 [13] this was not the end of sync, retry +haveTwoBitsK: +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- + push shift ;2 [16] + push x1 ;2 [12] + push x2 ;2 [14] + + in x1, USBIN ;1 [17] <-- sample bit 0 + ldi shift, 0xff ;1 [18] + bst x1, USBMINUS ;1 [19] + bld shift, 0 ;1 [20] + push x3 ;2 [22] + push cnt ;2 [24] + + in x2, USBIN ;1 [25] <-- sample bit 1 + ser x3 ;1 [26] [inserted init instruction] + eor x1, x2 ;1 [27] + bst x1, USBMINUS ;1 [28] + bld shift, 1 ;1 [29] + ldi cnt, USB_BUFSIZE;1 [30] [inserted init instruction] + rjmp rxbit2 ;2 [32] + +;---------------------------------------------------------------------------- +; Receiver loop (numbers in brackets are cycles within byte after instr) +;---------------------------------------------------------------------------- + +unstuff0: ;1 (branch taken) + andi x3, ~0x01 ;1 [15] + mov x1, x2 ;1 [16] x2 contains last sampled (stuffed) bit + in x2, USBIN ;1 [17] <-- sample bit 1 again + ori shift, 0x01 ;1 [18] + rjmp didUnstuff0 ;2 [20] + +unstuff1: ;1 (branch taken) + mov x2, x1 ;1 [21] x1 contains last sampled (stuffed) bit + andi x3, ~0x02 ;1 [22] + ori shift, 0x02 ;1 [23] + nop ;1 [24] + in x1, USBIN ;1 [25] <-- sample bit 2 again + rjmp didUnstuff1 ;2 [27] + +unstuff2: ;1 (branch taken) + andi x3, ~0x04 ;1 [29] + ori shift, 0x04 ;1 [30] + mov x1, x2 ;1 [31] x2 contains last sampled (stuffed) bit + nop ;1 [32] + in x2, USBIN ;1 [33] <-- sample bit 3 + rjmp didUnstuff2 ;2 [35] + +unstuff3: ;1 (branch taken) + in x2, USBIN ;1 [34] <-- sample stuffed bit 3 [one cycle too late] + andi x3, ~0x08 ;1 [35] + ori shift, 0x08 ;1 [36] + rjmp didUnstuff3 ;2 [38] + +unstuff4: ;1 (branch taken) + andi x3, ~0x10 ;1 [40] + in x1, USBIN ;1 [41] <-- sample stuffed bit 4 + ori shift, 0x10 ;1 [42] + rjmp didUnstuff4 ;2 [44] + +unstuff5: ;1 (branch taken) + andi x3, ~0x20 ;1 [48] + in x2, USBIN ;1 [49] <-- sample stuffed bit 5 + ori shift, 0x20 ;1 [50] + rjmp didUnstuff5 ;2 [52] + +unstuff6: ;1 (branch taken) + andi x3, ~0x40 ;1 [56] + in x1, USBIN ;1 [57] <-- sample stuffed bit 6 + ori shift, 0x40 ;1 [58] + rjmp didUnstuff6 ;2 [60] + +; extra jobs done during bit interval: +; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs] +; bit 1: se0 check +; bit 2: overflow check +; bit 3: recovery from delay [bit 0 tasks took too long] +; bit 4: none +; bit 5: none +; bit 6: none +; bit 7: jump, eor +rxLoop: + eor x3, shift ;1 [0] reconstruct: x3 is 0 at bit locations we changed, 1 at others + in x1, USBIN ;1 [1] <-- sample bit 0 + st y+, x3 ;2 [3] store data + ser x3 ;1 [4] + nop ;1 [5] + eor x2, x1 ;1 [6] + bst x2, USBMINUS;1 [7] + bld shift, 0 ;1 [8] + in x2, USBIN ;1 [9] <-- sample bit 1 (or possibly bit 0 stuffed) + andi x2, USBMASK ;1 [10] + breq se0 ;1 [11] SE0 check for bit 1 + andi shift, 0xf9 ;1 [12] +didUnstuff0: + breq unstuff0 ;1 [13] + eor x1, x2 ;1 [14] + bst x1, USBMINUS;1 [15] + bld shift, 1 ;1 [16] +rxbit2: + in x1, USBIN ;1 [17] <-- sample bit 2 (or possibly bit 1 stuffed) + andi shift, 0xf3 ;1 [18] + breq unstuff1 ;1 [19] do remaining work for bit 1 +didUnstuff1: + subi cnt, 1 ;1 [20] + brcs overflow ;1 [21] loop control + eor x2, x1 ;1 [22] + bst x2, USBMINUS;1 [23] + bld shift, 2 ;1 [24] + in x2, USBIN ;1 [25] <-- sample bit 3 (or possibly bit 2 stuffed) + andi shift, 0xe7 ;1 [26] + breq unstuff2 ;1 [27] +didUnstuff2: + eor x1, x2 ;1 [28] + bst x1, USBMINUS;1 [29] + bld shift, 3 ;1 [30] +didUnstuff3: + andi shift, 0xcf ;1 [31] + breq unstuff3 ;1 [32] + in x1, USBIN ;1 [33] <-- sample bit 4 + eor x2, x1 ;1 [34] + bst x2, USBMINUS;1 [35] + bld shift, 4 ;1 [36] +didUnstuff4: + andi shift, 0x9f ;1 [37] + breq unstuff4 ;1 [38] + nop2 ;2 [40] + in x2, USBIN ;1 [41] <-- sample bit 5 + eor x1, x2 ;1 [42] + bst x1, USBMINUS;1 [43] + bld shift, 5 ;1 [44] +didUnstuff5: + andi shift, 0x3f ;1 [45] + breq unstuff5 ;1 [46] + nop2 ;2 [48] + in x1, USBIN ;1 [49] <-- sample bit 6 + eor x2, x1 ;1 [50] + bst x2, USBMINUS;1 [51] + bld shift, 6 ;1 [52] +didUnstuff6: + cpi shift, 0x02 ;1 [53] + brlo unstuff6 ;1 [54] + nop2 ;2 [56] + in x2, USBIN ;1 [57] <-- sample bit 7 + eor x1, x2 ;1 [58] + bst x1, USBMINUS;1 [59] + bld shift, 7 ;1 [60] +didUnstuff7: + cpi shift, 0x04 ;1 [61] + brsh rxLoop ;2 [63] loop control +unstuff7: + andi x3, ~0x80 ;1 [63] + ori shift, 0x80 ;1 [64] + in x2, USBIN ;1 [65] <-- sample stuffed bit 7 + nop ;1 [66] + rjmp didUnstuff7 ;2 [68] + +macro POP_STANDARD ; 12 cycles + pop cnt + pop x3 + pop x2 + pop x1 + pop shift + pop YH + endm +macro POP_RETI ; 5 cycles + pop YL + out SREG, YL + pop YL + endm + +#include "asmcommon.inc" + +;---------------------------------------------------------------------------- +; Transmitting data +;---------------------------------------------------------------------------- + +txByteLoop: +txBitloop: +stuffN1Delay: ; [03] + ror shift ;[-5] [11] [59] + brcc doExorN1 ;[-4] [60] + subi x4, 1 ;[-3] + brne commonN1 ;[-2] + lsl shift ;[-1] compensate ror after rjmp stuffDelay + nop ;[00] stuffing consists of just waiting 8 cycles + rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear + +sendNakAndReti: ;0 [-19] 19 cycles until SOP + ldi x3, USBPID_NAK ;1 [-18] + rjmp usbSendX3 ;2 [-16] +sendAckAndReti: ;0 [-19] 19 cycles until SOP + ldi x3, USBPID_ACK ;1 [-18] + rjmp usbSendX3 ;2 [-16] +sendCntAndReti: ;0 [-17] 17 cycles until SOP + mov x3, cnt ;1 [-16] +usbSendX3: ;0 [-16] + ldi YL, 20 ;1 [-15] 'x3' is R20 + ldi YH, 0 ;1 [-14] + ldi cnt, 2 ;1 [-13] +; rjmp usbSendAndReti fallthrough + +; USB spec says: +; idle = J +; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 +; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 +; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) + +;usbSend: +;pointer to data in 'Y' +;number of bytes in 'cnt' -- including sync byte +;uses: x1...x2, x4, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x4 = bitstuff cnt] +;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) +usbSendAndReti: + in x2, USBDDR ;[-12] 12 cycles until SOP + ori x2, USBMASK ;[-11] + sbi USBOUT, USBMINUS ;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) + out USBDDR, x2 ;[-8] <--- acquire bus + in x1, USBOUT ;[-7] port mirror for tx loop + ldi shift, 0x40 ;[-6] sync byte is first byte sent (we enter loop after ror) + ldi x2, USBMASK ;[-5] + push x4 ;[-4] +doExorN1: + eor x1, x2 ;[-2] [06] [62] + ldi x4, 6 ;[-1] [07] [63] +commonN1: +stuffN2Delay: + out USBOUT, x1 ;[00] [08] [64] <--- set bit + ror shift ;[01] + brcc doExorN2 ;[02] + subi x4, 1 ;[03] + brne commonN2 ;[04] + lsl shift ;[05] compensate ror after rjmp stuffDelay + rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear +doExorN2: + eor x1, x2 ;[04] [12] + ldi x4, 6 ;[05] [13] +commonN2: + nop ;[06] [14] + subi cnt, 171 ;[07] [15] trick: (3 * 171) & 0xff = 1 + out USBOUT, x1 ;[08] [16] <--- set bit + brcs txBitloop ;[09] [25] [41] + +stuff6Delay: + ror shift ;[42] [50] + brcc doExor6 ;[43] + subi x4, 1 ;[44] + brne common6 ;[45] + lsl shift ;[46] compensate ror after rjmp stuffDelay + nop ;[47] stuffing consists of just waiting 8 cycles + rjmp stuff6Delay ;[48] after ror, C bit is reliably clear +doExor6: + eor x1, x2 ;[45] [53] + ldi x4, 6 ;[46] +common6: +stuff7Delay: + ror shift ;[47] [55] + out USBOUT, x1 ;[48] <--- set bit + brcc doExor7 ;[49] + subi x4, 1 ;[50] + brne common7 ;[51] + lsl shift ;[52] compensate ror after rjmp stuffDelay + rjmp stuff7Delay ;[53] after ror, C bit is reliably clear +doExor7: + eor x1, x2 ;[51] [59] + ldi x4, 6 ;[52] +common7: + ld shift, y+ ;[53] + tst cnt ;[55] + out USBOUT, x1 ;[56] <--- set bit + brne txByteLoop ;[57] + +;make SE0: + cbr x1, USBMASK ;[58] prepare SE0 [spec says EOP may be 15 to 18 cycles] + lds x2, usbNewDeviceAddr;[59] + lsl x2 ;[61] we compare with left shifted address + subi YL, 2 + 20 ;[62] Only assign address on data packets, not ACK/NAK in x3 + sbci YH, 0 ;[63] + out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle +;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: +;set address only after data packet was sent, not after handshake + breq skipAddrAssign ;[01] + sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer +skipAddrAssign: +;end of usbDeviceAddress transfer + ldi x2, 1< 12.5625 MHz +max frequency: 69.286 cycles for 8 bit -> 12.99 MHz +nominal frequency: 12.77 MHz ( = sqrt(min * max)) + +sampling positions: (next even number in range [+/- 0.5]) +cycle index range: 0 ... 66 +bits: +.5, 8.875, 17.25, 25.625, 34, 42.375, 50.75, 59.125 +[0/1], [9], [17], [25/+26], [34], [+42/43], [51], [59] + +bit number: 0 1 2 3 4 5 6 7 +spare cycles 1 2 1 2 1 1 1 0 + +operations to perform: duration cycle + ---------------- + eor fix, shift 1 -> 00 + andi phase, USBMASK 1 -> 08 + breq se0 1 -> 16 (moved to 11) + st y+, data 2 -> 24, 25 + mov data, fix 1 -> 33 + ser data 1 -> 41 + subi cnt, 1 1 -> 49 + brcs overflow 1 -> 50 + +layout of samples and operations: +[##] = sample bit +<##> = sample phase +*##* = operation + +0: *00* [01] 02 03 04 <05> 06 07 +1: *08* [09] 10 11 12 <13> 14 15 *16* +2: [17] 18 19 20 <21> 22 23 +3: *24* *25* [26] 27 28 29 <30> 31 32 +4: *33* [34] 35 36 37 <38> 39 40 +5: *41* [42] 43 44 45 <46> 47 48 +6: *49* *50* [51] 52 53 54 <55> 56 57 58 +7: [59] 60 61 62 <63> 64 65 66 +*****************************************************************************/ + +/* we prefer positive expressions (do if condition) instead of negative + * (skip if condition), therefore use defines for skip instructions: + */ +#define ifioclr sbis +#define ifioset sbic +#define ifrclr sbrs +#define ifrset sbrc + +/* The registers "fix" and "data" swap their meaning during the loop. Use + * defines to keep their name constant. + */ +#define fix x2 +#define data x1 +#undef phase /* phase has a default definition to x4 */ +#define phase x3 + + +USB_INTR_VECTOR: +;order of registers pushed: YL, SREG [sofError], YH, shift, x1, x2, x3, cnt, r0 + push YL ;2 push only what is necessary to sync with edge ASAP + in YL, SREG ;1 + push YL ;2 +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +;---------------------------------------------------------------------------- +;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +;sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +waitForK: +;The following code results in a sampling window of 1/4 bit which meets the spec. + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS ;[0] + rjmp foundK ;[1] +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError + +foundK: +;{3, 5} after falling D- edge, average delay: 4 cycles [we want 4 for center sampling] +;we have 1 bit time for setup purposes, then sample again. Numbers in brackets +;are cycles from center of first sync (double K) bit after the instruction + push YH ;[2] + lds YL, usbInputBufOffset;[4] + clr YH ;[6] + subi YL, lo8(-(usbRxBuf));[7] + sbci YH, hi8(-(usbRxBuf));[8] + + sbis USBIN, USBMINUS ;[9] we want two bits K [we want to sample at 8 + 4 - 1.5 = 10.5] + rjmp haveTwoBitsK ;[10] + pop YH ;[11] undo the push from before + rjmp waitForK ;[13] this was not the end of sync, retry +haveTwoBitsK: +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- +#define fix x2 +#define data x1 + + push shift ;[12] + push x1 ;[14] + push x2 ;[16] + ldi shift, 0x80 ;[18] prevent bit-unstuffing but init low bits to 0 + ifioset USBIN, USBMINUS ;[19] [01] <--- bit 0 [10.5 + 8 = 18.5] + ori shift, 1<<0 ;[02] + push x3 ;[03] + push cnt ;[05] + push r0 ;[07] + ifioset USBIN, USBMINUS ;[09] <--- bit 1 + ori shift, 1<<1 ;[10] + ser fix ;[11] + ldi cnt, USB_BUFSIZE ;[12] + mov data, shift ;[13] + lsl shift ;[14] + nop2 ;[15] + ifioset USBIN, USBMINUS ;[17] <--- bit 2 + ori data, 3<<2 ;[18] store in bit 2 AND bit 3 + eor shift, data ;[19] do nrzi decoding + andi data, 1<<3 ;[20] + in phase, USBIN ;[21] <- phase + brne jumpToEntryAfterSet ;[22] if USBMINS at bit 3 was 1 + nop ;[23] + rjmp entryAfterClr ;[24] +jumpToEntryAfterSet: + rjmp entryAfterSet ;[24] + +;---------------------------------------------------------------------------- +; Receiver loop (numbers in brackets are cycles within byte after instr) +;---------------------------------------------------------------------------- +#undef fix +#define fix x1 +#undef data +#define data x2 + +bit7IsSet: + ifrclr phase, USBMINUS ;[62] check phase only if D- changed + lpm ;[63] + in phase, USBIN ;[64] <- phase (one cycle too late) + ori shift, 1 << 7 ;[65] + nop ;[66] +;;;;rjmp bit0AfterSet ; -> [00] == [67] moved block up to save jump +bit0AfterSet: + eor fix, shift ;[00] +#undef fix +#define fix x2 +#undef data +#define data x1 /* we now have result in data, fix is reset to 0xff */ + ifioclr USBIN, USBMINUS ;[01] <--- sample 0 + rjmp bit0IsClr ;[02] + andi shift, ~(7 << 0) ;[03] + breq unstuff0s ;[04] + in phase, USBIN ;[05] <- phase + rjmp bit1AfterSet ;[06] +unstuff0s: + in phase, USBIN ;[06] <- phase (one cycle too late) + andi fix, ~(1 << 0) ;[07] + ifioclr USBIN, USBMINUS ;[00] + ifioset USBIN, USBPLUS ;[01] + rjmp bit0IsClr ;[02] executed if first expr false or second true +se0AndStore: ; executed only if both bits 0 + st y+, x1 ;[15/17] cycles after start of byte + rjmp se0 ;[17/19] + +bit0IsClr: + ifrset phase, USBMINUS ;[04] check phase only if D- changed + lpm ;[05] + in phase, USBIN ;[06] <- phase (one cycle too late) + ori shift, 1 << 0 ;[07] +bit1AfterClr: + andi phase, USBMASK ;[08] + ifioset USBIN, USBMINUS ;[09] <--- sample 1 + rjmp bit1IsSet ;[10] + breq se0AndStore ;[11] if D- was 0 in bits 0 AND 1 and D+ was 0 in between, we have SE0 + andi shift, ~(7 << 1) ;[12] + in phase, USBIN ;[13] <- phase + breq unstuff1c ;[14] + rjmp bit2AfterClr ;[15] +unstuff1c: + andi fix, ~(1 << 1) ;[16] + nop2 ;[08] + nop2 ;[10] +bit1IsSet: + ifrclr phase, USBMINUS ;[12] check phase only if D- changed + lpm ;[13] + in phase, USBIN ;[14] <- phase (one cycle too late) + ori shift, 1 << 1 ;[15] + nop ;[16] +bit2AfterSet: + ifioclr USBIN, USBMINUS ;[17] <--- sample 2 + rjmp bit2IsClr ;[18] + andi shift, ~(7 << 2) ;[19] + breq unstuff2s ;[20] + in phase, USBIN ;[21] <- phase + rjmp bit3AfterSet ;[22] +unstuff2s: + in phase, USBIN ;[22] <- phase (one cycle too late) + andi fix, ~(1 << 2) ;[23] + nop2 ;[16] + nop2 ;[18] +bit2IsClr: + ifrset phase, USBMINUS ;[20] check phase only if D- changed + lpm ;[21] + in phase, USBIN ;[22] <- phase (one cycle too late) + ori shift, 1 << 2 ;[23] +bit3AfterClr: + st y+, data ;[24] +entryAfterClr: + ifioset USBIN, USBMINUS ;[26] <--- sample 3 + rjmp bit3IsSet ;[27] + andi shift, ~(7 << 3) ;[28] + breq unstuff3c ;[29] + in phase, USBIN ;[30] <- phase + rjmp bit4AfterClr ;[31] +unstuff3c: + in phase, USBIN ;[31] <- phase (one cycle too late) + andi fix, ~(1 << 3) ;[32] + nop2 ;[25] + nop2 ;[27] +bit3IsSet: + ifrclr phase, USBMINUS ;[29] check phase only if D- changed + lpm ;[30] + in phase, USBIN ;[31] <- phase (one cycle too late) + ori shift, 1 << 3 ;[32] +bit4AfterSet: + mov data, fix ;[33] undo this move by swapping defines +#undef fix +#define fix x1 +#undef data +#define data x2 + ifioclr USBIN, USBMINUS ;[34] <--- sample 4 + rjmp bit4IsClr ;[35] + andi shift, ~(7 << 4) ;[36] + breq unstuff4s ;[37] + in phase, USBIN ;[38] <- phase + rjmp bit5AfterSet ;[39] +unstuff4s: + in phase, USBIN ;[39] <- phase (one cycle too late) + andi fix, ~(1 << 4) ;[40] + nop2 ;[33] + nop2 ;[35] +bit4IsClr: + ifrset phase, USBMINUS ;[37] check phase only if D- changed + lpm ;[38] + in phase, USBIN ;[39] <- phase (one cycle too late) + ori shift, 1 << 4 ;[40] +bit5AfterClr: + ser data ;[41] + ifioset USBIN, USBMINUS ;[42] <--- sample 5 + rjmp bit5IsSet ;[43] + andi shift, ~(7 << 5) ;[44] + breq unstuff5c ;[45] + in phase, USBIN ;[46] <- phase + rjmp bit6AfterClr ;[47] +unstuff5c: + in phase, USBIN ;[47] <- phase (one cycle too late) + andi fix, ~(1 << 5) ;[48] + nop2 ;[41] + nop2 ;[43] +bit5IsSet: + ifrclr phase, USBMINUS ;[45] check phase only if D- changed + lpm ;[46] + in phase, USBIN ;[47] <- phase (one cycle too late) + ori shift, 1 << 5 ;[48] +bit6AfterSet: + subi cnt, 1 ;[49] + brcs jumpToOverflow ;[50] + ifioclr USBIN, USBMINUS ;[51] <--- sample 6 + rjmp bit6IsClr ;[52] + andi shift, ~(3 << 6) ;[53] + cpi shift, 2 ;[54] + in phase, USBIN ;[55] <- phase + brlt unstuff6s ;[56] + rjmp bit7AfterSet ;[57] + +jumpToOverflow: + rjmp overflow + +unstuff6s: + andi fix, ~(1 << 6) ;[50] + lpm ;[51] +bit6IsClr: + ifrset phase, USBMINUS ;[54] check phase only if D- changed + lpm ;[55] + in phase, USBIN ;[56] <- phase (one cycle too late) + ori shift, 1 << 6 ;[57] + nop ;[58] +bit7AfterClr: + ifioset USBIN, USBMINUS ;[59] <--- sample 7 + rjmp bit7IsSet ;[60] + andi shift, ~(1 << 7) ;[61] + cpi shift, 4 ;[62] + in phase, USBIN ;[63] <- phase + brlt unstuff7c ;[64] + rjmp bit0AfterClr ;[65] -> [00] == [67] +unstuff7c: + andi fix, ~(1 << 7) ;[58] + nop ;[59] + rjmp bit7IsSet ;[60] + +bit7IsClr: + ifrset phase, USBMINUS ;[62] check phase only if D- changed + lpm ;[63] + in phase, USBIN ;[64] <- phase (one cycle too late) + ori shift, 1 << 7 ;[65] + nop ;[66] +;;;;rjmp bit0AfterClr ; -> [00] == [67] moved block up to save jump +bit0AfterClr: + eor fix, shift ;[00] +#undef fix +#define fix x2 +#undef data +#define data x1 /* we now have result in data, fix is reset to 0xff */ + ifioset USBIN, USBMINUS ;[01] <--- sample 0 + rjmp bit0IsSet ;[02] + andi shift, ~(7 << 0) ;[03] + breq unstuff0c ;[04] + in phase, USBIN ;[05] <- phase + rjmp bit1AfterClr ;[06] +unstuff0c: + in phase, USBIN ;[06] <- phase (one cycle too late) + andi fix, ~(1 << 0) ;[07] + ifioclr USBIN, USBMINUS ;[00] + ifioset USBIN, USBPLUS ;[01] + rjmp bit0IsSet ;[02] executed if first expr false or second true + rjmp se0AndStore ;[03] executed only if both bits 0 +bit0IsSet: + ifrclr phase, USBMINUS ;[04] check phase only if D- changed + lpm ;[05] + in phase, USBIN ;[06] <- phase (one cycle too late) + ori shift, 1 << 0 ;[07] +bit1AfterSet: + andi shift, ~(7 << 1) ;[08] compensated by "ori shift, 1<<1" if bit1IsClr + ifioclr USBIN, USBMINUS ;[09] <--- sample 1 + rjmp bit1IsClr ;[10] + breq unstuff1s ;[11] + nop2 ;[12] do not check for SE0 if bit 0 was 1 + in phase, USBIN ;[14] <- phase (one cycle too late) + rjmp bit2AfterSet ;[15] +unstuff1s: + in phase, USBIN ;[13] <- phase + andi fix, ~(1 << 1) ;[14] + lpm ;[07] + nop2 ;[10] +bit1IsClr: + ifrset phase, USBMINUS ;[12] check phase only if D- changed + lpm ;[13] + in phase, USBIN ;[14] <- phase (one cycle too late) + ori shift, 1 << 1 ;[15] + nop ;[16] +bit2AfterClr: + ifioset USBIN, USBMINUS ;[17] <--- sample 2 + rjmp bit2IsSet ;[18] + andi shift, ~(7 << 2) ;[19] + breq unstuff2c ;[20] + in phase, USBIN ;[21] <- phase + rjmp bit3AfterClr ;[22] +unstuff2c: + in phase, USBIN ;[22] <- phase (one cycle too late) + andi fix, ~(1 << 2) ;[23] + nop2 ;[16] + nop2 ;[18] +bit2IsSet: + ifrclr phase, USBMINUS ;[20] check phase only if D- changed + lpm ;[21] + in phase, USBIN ;[22] <- phase (one cycle too late) + ori shift, 1 << 2 ;[23] +bit3AfterSet: + st y+, data ;[24] +entryAfterSet: + ifioclr USBIN, USBMINUS ;[26] <--- sample 3 + rjmp bit3IsClr ;[27] + andi shift, ~(7 << 3) ;[28] + breq unstuff3s ;[29] + in phase, USBIN ;[30] <- phase + rjmp bit4AfterSet ;[31] +unstuff3s: + in phase, USBIN ;[31] <- phase (one cycle too late) + andi fix, ~(1 << 3) ;[32] + nop2 ;[25] + nop2 ;[27] +bit3IsClr: + ifrset phase, USBMINUS ;[29] check phase only if D- changed + lpm ;[30] + in phase, USBIN ;[31] <- phase (one cycle too late) + ori shift, 1 << 3 ;[32] +bit4AfterClr: + mov data, fix ;[33] undo this move by swapping defines +#undef fix +#define fix x1 +#undef data +#define data x2 + ifioset USBIN, USBMINUS ;[34] <--- sample 4 + rjmp bit4IsSet ;[35] + andi shift, ~(7 << 4) ;[36] + breq unstuff4c ;[37] + in phase, USBIN ;[38] <- phase + rjmp bit5AfterClr ;[39] +unstuff4c: + in phase, USBIN ;[39] <- phase (one cycle too late) + andi fix, ~(1 << 4) ;[40] + nop2 ;[33] + nop2 ;[35] +bit4IsSet: + ifrclr phase, USBMINUS ;[37] check phase only if D- changed + lpm ;[38] + in phase, USBIN ;[39] <- phase (one cycle too late) + ori shift, 1 << 4 ;[40] +bit5AfterSet: + ser data ;[41] + ifioclr USBIN, USBMINUS ;[42] <--- sample 5 + rjmp bit5IsClr ;[43] + andi shift, ~(7 << 5) ;[44] + breq unstuff5s ;[45] + in phase, USBIN ;[46] <- phase + rjmp bit6AfterSet ;[47] +unstuff5s: + in phase, USBIN ;[47] <- phase (one cycle too late) + andi fix, ~(1 << 5) ;[48] + nop2 ;[41] + nop2 ;[43] +bit5IsClr: + ifrset phase, USBMINUS ;[45] check phase only if D- changed + lpm ;[46] + in phase, USBIN ;[47] <- phase (one cycle too late) + ori shift, 1 << 5 ;[48] +bit6AfterClr: + subi cnt, 1 ;[49] + brcs overflow ;[50] + ifioset USBIN, USBMINUS ;[51] <--- sample 6 + rjmp bit6IsSet ;[52] + andi shift, ~(3 << 6) ;[53] + cpi shift, 2 ;[54] + in phase, USBIN ;[55] <- phase + brlt unstuff6c ;[56] + rjmp bit7AfterClr ;[57] +unstuff6c: + andi fix, ~(1 << 6) ;[50] + lpm ;[51] +bit6IsSet: + ifrclr phase, USBMINUS ;[54] check phase only if D- changed + lpm ;[55] + in phase, USBIN ;[56] <- phase (one cycle too late) + ori shift, 1 << 6 ;[57] +bit7AfterSet: + ifioclr USBIN, USBMINUS ;[59] <--- sample 7 + rjmp bit7IsClr ;[60] + andi shift, ~(1 << 7) ;[61] + cpi shift, 4 ;[62] + in phase, USBIN ;[63] <- phase + brlt unstuff7s ;[64] + rjmp bit0AfterSet ;[65] -> [00] == [67] +unstuff7s: + andi fix, ~(1 << 7) ;[58] + nop ;[59] + rjmp bit7IsClr ;[60] + +macro POP_STANDARD ; 14 cycles + pop r0 + pop cnt + pop x3 + pop x2 + pop x1 + pop shift + pop YH + endm +macro POP_RETI ; 5 cycles + pop YL + out SREG, YL + pop YL + endm + +#include "asmcommon.inc" + +;---------------------------------------------------------------------------- +; Transmitting data +;---------------------------------------------------------------------------- + +txByteLoop: +txBitloop: +stuffN1Delay: ; [03] + ror shift ;[-5] [11] [63] + brcc doExorN1 ;[-4] [64] + subi x3, 1 ;[-3] + brne commonN1 ;[-2] + lsl shift ;[-1] compensate ror after rjmp stuffDelay + nop ;[00] stuffing consists of just waiting 8 cycles + rjmp stuffN1Delay ;[01] after ror, C bit is reliably clear + +sendNakAndReti: + ldi cnt, USBPID_NAK ;[-19] + rjmp sendCntAndReti ;[-18] +sendAckAndReti: + ldi cnt, USBPID_ACK ;[-17] +sendCntAndReti: + mov r0, cnt ;[-16] + ldi YL, 0 ;[-15] R0 address is 0 + ldi YH, 0 ;[-14] + ldi cnt, 2 ;[-13] +; rjmp usbSendAndReti fallthrough + +; USB spec says: +; idle = J +; J = (D+ = 0), (D- = 1) or USBOUT = 0x01 +; K = (D+ = 1), (D- = 0) or USBOUT = 0x02 +; Spec allows 7.5 bit times from EOP to SOP for replies (= 60 cycles) + +;usbSend: +;pointer to data in 'Y' +;number of bytes in 'cnt' -- including sync byte +;uses: x1...x3, shift, cnt, Y [x1 = mirror USBOUT, x2 = USBMASK, x3 = bitstuff cnt] +;Numbers in brackets are time since first bit of sync pattern is sent (start of instruction) +usbSendAndReti: + in x2, USBDDR ;[-10] 10 cycles until SOP + ori x2, USBMASK ;[-9] + sbi USBOUT, USBMINUS ;[-8] prepare idle state; D+ and D- must have been 0 (no pullups) + out USBDDR, x2 ;[-6] <--- acquire bus + in x1, USBOUT ;[-5] port mirror for tx loop + ldi shift, 0x40 ;[-4] sync byte is first byte sent (we enter loop after ror) + ldi x2, USBMASK ;[-3] +doExorN1: + eor x1, x2 ;[-2] [06] [62] + ldi x3, 6 ;[-1] [07] [63] +commonN1: +stuffN2Delay: + out USBOUT, x1 ;[00] [08] [64] <--- set bit + ror shift ;[01] + brcc doExorN2 ;[02] + subi x3, 1 ;[03] + brne commonN2 ;[04] + lsl shift ;[05] compensate ror after rjmp stuffDelay + rjmp stuffN2Delay ;[06] after ror, C bit is reliably clear +doExorN2: + eor x1, x2 ;[04] [12] + ldi x3, 6 ;[05] [13] +commonN2: + nop2 ;[06] [14] + subi cnt, 171 ;[08] [16] trick: (3 * 171) & 0xff = 1 + out USBOUT, x1 ;[09] [17] <--- set bit + brcs txBitloop ;[10] [27] [44] + +stuff6Delay: + ror shift ;[45] [53] + brcc doExor6 ;[46] + subi x3, 1 ;[47] + brne common6 ;[48] + lsl shift ;[49] compensate ror after rjmp stuffDelay + nop ;[50] stuffing consists of just waiting 8 cycles + rjmp stuff6Delay ;[51] after ror, C bit is reliably clear +doExor6: + eor x1, x2 ;[48] [56] + ldi x3, 6 ;[49] +common6: +stuff7Delay: + ror shift ;[50] [58] + out USBOUT, x1 ;[51] <--- set bit + brcc doExor7 ;[52] + subi x3, 1 ;[53] + brne common7 ;[54] + lsl shift ;[55] compensate ror after rjmp stuffDelay + rjmp stuff7Delay ;[56] after ror, C bit is reliably clear +doExor7: + eor x1, x2 ;[54] [62] + ldi x3, 6 ;[55] +common7: + ld shift, y+ ;[56] + nop ;[58] + tst cnt ;[59] + out USBOUT, x1 ;[60] [00]<--- set bit + brne txByteLoop ;[61] [01] +;make SE0: + cbr x1, USBMASK ;[02] prepare SE0 [spec says EOP may be 15 to 18 cycles] + lds x2, usbNewDeviceAddr;[03] + lsl x2 ;[05] we compare with left shifted address + subi YL, 2 + 0 ;[06] Only assign address on data packets, not ACK/NAK in r0 + sbci YH, 0 ;[07] + out USBOUT, x1 ;[00] <-- out SE0 -- from now 2 bits = 16 cycles until bus idle +;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: +;set address only after data packet was sent, not after handshake + breq skipAddrAssign ;[01] + sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer +skipAddrAssign: +;end of usbDeviceAddress transfer + ldi x2, 1< 0) + echo "$s\n"; + } +} + +function printBit($isAfterSet, $bitNum) +{ + ob_start(); + if($isAfterSet){ +?> + ifioclr USBIN, USBMINUS ;[00] <--- sample + rjmp bit#IsClr ;[01] + andi shift, ~(7 << #) ;[02] + breq unstuff#s ;[03] + in phase, USBIN ;[04] <- phase + rjmp bit@AfterSet ;[05] +unstuff#s: + in phase, USBIN ;[05] <- phase (one cycle too late) + andi fix, ~(1 << #) ;[06] + nop2 ;[-1] + nop2 ;[01] +bit#IsClr: + ifrset phase, USBMINUS ;[03] check phase only if D- changed + lpm ;[04] + in phase, USBIN ;[05] <- phase (one cycle too late) + ori shift, 1 << # ;[06] + + ifioset USBIN, USBMINUS ;[00] <--- sample + rjmp bit#IsSet ;[01] + andi shift, ~(7 << #) ;[02] + breq unstuff#c ;[03] + in phase, USBIN ;[04] <- phase + rjmp bit@AfterClr ;[05] +unstuff#c: + in phase, USBIN ;[05] <- phase (one cycle too late) + andi fix, ~(1 << #) ;[06] + nop2 ;[-1] + nop2 ;[01] +bit#IsSet: + ifrclr phase, USBMINUS ;[03] check phase only if D- changed + lpm ;[04] + in phase, USBIN ;[05] <- phase (one cycle too late) + ori shift, 1 << # ;[06] + +*****************************************************************************/ diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm15.inc b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm15.inc new file mode 100644 index 00000000..ce103916 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm15.inc @@ -0,0 +1,423 @@ +/* Name: usbdrvasm15.inc + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: contributed by V. Bosch + * Creation Date: 2007-08-06 + * Tabsize: 4 + * Copyright: (c) 2007 by OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * Revision: $Id$ + */ + +/* Do not link this file! Link usbdrvasm.S instead, which includes the + * appropriate implementation! + */ + +/* +General Description: +This file is the 15 MHz version of the asssembler part of the USB driver. It +requires a 15 MHz crystal (not a ceramic resonator and not a calibrated RC +oscillator). + +See usbdrv.h for a description of the entire driver. + +Since almost all of this code is timing critical, don't change unless you +really know what you are doing! Many parts require not only a maximum number +of CPU cycles, but even an exact number of cycles! +*/ + +;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes +;nominal frequency: 15 MHz -> 10.0 cycles per bit, 80.0 cycles per byte +; Numbers in brackets are clocks counted from center of last sync bit +; when instruction starts + +;---------------------------------------------------------------------------- +; order of registers pushed: +; YL, SREG [sofError] YH, shift, x1, x2, x3, bitcnt, cnt, x4 +;---------------------------------------------------------------------------- +USB_INTR_VECTOR: + push YL ;2 push only what is necessary to sync with edge ASAP + in YL, SREG ;1 + push YL ;2 +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +; +; sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +; sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +;------------------------------------------------------------------------------- +; The following code results in a sampling window of < 1/4 bit +; which meets the spec. +;------------------------------------------------------------------------------- +waitForK: ;- + sbis USBIN, USBMINUS ;1 [00] <-- sample + rjmp foundK ;2 [01] + sbis USBIN, USBMINUS ; <-- sample + rjmp foundK + sbis USBIN, USBMINUS ; <-- sample + rjmp foundK + sbis USBIN, USBMINUS ; <-- sample + rjmp foundK + sbis USBIN, USBMINUS ; <-- sample + rjmp foundK + sbis USBIN, USBMINUS ; <-- sample + rjmp foundK +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError +;------------------------------------------------------------------------------ +; {3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for +; center sampling] +; we have 1 bit time for setup purposes, then sample again. +; Numbers in brackets are cycles from center of first sync (double K) +; bit after the instruction +;------------------------------------------------------------------------------ +foundK: ;- [02] + lds YL, usbInputBufOffset;2 [03+04] tx loop + push YH ;2 [05+06] + clr YH ;1 [07] + subi YL, lo8(-(usbRxBuf)) ;1 [08] [rx loop init] + sbci YH, hi8(-(usbRxBuf)) ;1 [09] [rx loop init] + push shift ;2 [10+11] + ser shift ;1 [12] + sbis USBIN, USBMINUS ;1 [-1] [13] <--sample:we want two bits K (sample 1 cycle too early) + rjmp haveTwoBitsK ;2 [00] [14] + pop shift ;2 [15+16] undo the push from before + pop YH ;2 [17+18] undo the push from before + rjmp waitForK ;2 [19+20] this was not the end of sync, retry +; The entire loop from waitForK until rjmp waitForK above must not exceed two +; bit times (= 20 cycles). + +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- +haveTwoBitsK: ;- [01] + push x1 ;2 [02+03] + push x2 ;2 [04+05] + push x3 ;2 [06+07] + push bitcnt ;2 [08+09] + in x1, USBIN ;1 [00] [10] <-- sample bit 0 + bst x1, USBMINUS ;1 [01] + bld shift, 0 ;1 [02] + push cnt ;2 [03+04] + ldi cnt, USB_BUFSIZE ;1 [05] + push x4 ;2 [06+07] tx loop + rjmp rxLoop ;2 [08] +;---------------------------------------------------------------------------- +; Receiver loop (numbers in brackets are cycles within byte after instr) +;---------------------------------------------------------------------------- +unstuff0: ;- [07] (branch taken) + andi x3, ~0x01 ;1 [08] + mov x1, x2 ;1 [09] x2 contains last sampled (stuffed) bit + in x2, USBIN ;1 [00] [10] <-- sample bit 1 again + andi x2, USBMASK ;1 [01] + breq se0Hop ;1 [02] SE0 check for bit 1 + ori shift, 0x01 ;1 [03] 0b00000001 + nop ;1 [04] + rjmp didUnstuff0 ;2 [05] +;----------------------------------------------------- +unstuff1: ;- [05] (branch taken) + mov x2, x1 ;1 [06] x1 contains last sampled (stuffed) bit + andi x3, ~0x02 ;1 [07] + ori shift, 0x02 ;1 [08] 0b00000010 + nop ;1 [09] + in x1, USBIN ;1 [00] [10] <-- sample bit 2 again + andi x1, USBMASK ;1 [01] + breq se0Hop ;1 [02] SE0 check for bit 2 + rjmp didUnstuff1 ;2 [03] +;----------------------------------------------------- +unstuff2: ;- [05] (branch taken) + andi x3, ~0x04 ;1 [06] + ori shift, 0x04 ;1 [07] 0b00000100 + mov x1, x2 ;1 [08] x2 contains last sampled (stuffed) bit + nop ;1 [09] + in x2, USBIN ;1 [00] [10] <-- sample bit 3 + andi x2, USBMASK ;1 [01] + breq se0Hop ;1 [02] SE0 check for bit 3 + rjmp didUnstuff2 ;2 [03] +;----------------------------------------------------- +unstuff3: ;- [00] [10] (branch taken) + in x2, USBIN ;1 [01] [11] <-- sample stuffed bit 3 one cycle too late + andi x2, USBMASK ;1 [02] + breq se0Hop ;1 [03] SE0 check for stuffed bit 3 + andi x3, ~0x08 ;1 [04] + ori shift, 0x08 ;1 [05] 0b00001000 + rjmp didUnstuff3 ;2 [06] +;---------------------------------------------------------------------------- +; extra jobs done during bit interval: +; +; bit 0: store, clear [SE0 is unreliable here due to bit dribbling in hubs], +; overflow check, jump to the head of rxLoop +; bit 1: SE0 check +; bit 2: SE0 check, recovery from delay [bit 0 tasks took too long] +; bit 3: SE0 check, recovery from delay [bit 0 tasks took too long] +; bit 4: SE0 check, none +; bit 5: SE0 check, none +; bit 6: SE0 check, none +; bit 7: SE0 check, reconstruct: x3 is 0 at bit locations we changed, 1 at others +;---------------------------------------------------------------------------- +rxLoop: ;- [09] + in x2, USBIN ;1 [00] [10] <-- sample bit 1 (or possibly bit 0 stuffed) + andi x2, USBMASK ;1 [01] + brne SkipSe0Hop ;1 [02] +se0Hop: ;- [02] + rjmp se0 ;2 [03] SE0 check for bit 1 +SkipSe0Hop: ;- [03] + ser x3 ;1 [04] + andi shift, 0xf9 ;1 [05] 0b11111001 + breq unstuff0 ;1 [06] +didUnstuff0: ;- [06] + eor x1, x2 ;1 [07] + bst x1, USBMINUS ;1 [08] + bld shift, 1 ;1 [09] + in x1, USBIN ;1 [00] [10] <-- sample bit 2 (or possibly bit 1 stuffed) + andi x1, USBMASK ;1 [01] + breq se0Hop ;1 [02] SE0 check for bit 2 + andi shift, 0xf3 ;1 [03] 0b11110011 + breq unstuff1 ;1 [04] do remaining work for bit 1 +didUnstuff1: ;- [04] + eor x2, x1 ;1 [05] + bst x2, USBMINUS ;1 [06] + bld shift, 2 ;1 [07] + nop2 ;2 [08+09] + in x2, USBIN ;1 [00] [10] <-- sample bit 3 (or possibly bit 2 stuffed) + andi x2, USBMASK ;1 [01] + breq se0Hop ;1 [02] SE0 check for bit 3 + andi shift, 0xe7 ;1 [03] 0b11100111 + breq unstuff2 ;1 [04] +didUnstuff2: ;- [04] + eor x1, x2 ;1 [05] + bst x1, USBMINUS ;1 [06] + bld shift, 3 ;1 [07] +didUnstuff3: ;- [07] + andi shift, 0xcf ;1 [08] 0b11001111 + breq unstuff3 ;1 [09] + in x1, USBIN ;1 [00] [10] <-- sample bit 4 + andi x1, USBMASK ;1 [01] + breq se0Hop ;1 [02] SE0 check for bit 4 + eor x2, x1 ;1 [03] + bst x2, USBMINUS ;1 [04] + bld shift, 4 ;1 [05] +didUnstuff4: ;- [05] + andi shift, 0x9f ;1 [06] 0b10011111 + breq unstuff4 ;1 [07] + nop2 ;2 [08+09] + in x2, USBIN ;1 [00] [10] <-- sample bit 5 + andi x2, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for bit 5 + eor x1, x2 ;1 [03] + bst x1, USBMINUS ;1 [04] + bld shift, 5 ;1 [05] +didUnstuff5: ;- [05] + andi shift, 0x3f ;1 [06] 0b00111111 + breq unstuff5 ;1 [07] + nop2 ;2 [08+09] + in x1, USBIN ;1 [00] [10] <-- sample bit 6 + andi x1, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for bit 6 + eor x2, x1 ;1 [03] + bst x2, USBMINUS ;1 [04] + bld shift, 6 ;1 [05] +didUnstuff6: ;- [05] + cpi shift, 0x02 ;1 [06] 0b00000010 + brlo unstuff6 ;1 [07] + nop2 ;2 [08+09] + in x2, USBIN ;1 [00] [10] <-- sample bit 7 + andi x2, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for bit 7 + eor x1, x2 ;1 [03] + bst x1, USBMINUS ;1 [04] + bld shift, 7 ;1 [05] +didUnstuff7: ;- [05] + cpi shift, 0x04 ;1 [06] 0b00000100 + brlo unstuff7 ;1 [07] + eor x3, shift ;1 [08] reconstruct: x3 is 0 at bit locations we changed, 1 at others + nop ;1 [09] + in x1, USBIN ;1 [00] [10] <-- sample bit 0 + st y+, x3 ;2 [01+02] store data + eor x2, x1 ;1 [03] + bst x2, USBMINUS ;1 [04] + bld shift, 0 ;1 [05] + subi cnt, 1 ;1 [06] + brcs overflow ;1 [07] + rjmp rxLoop ;2 [08] +;----------------------------------------------------- +unstuff4: ;- [08] + andi x3, ~0x10 ;1 [09] + in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 4 + andi x1, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for stuffed bit 4 + ori shift, 0x10 ;1 [03] + rjmp didUnstuff4 ;2 [04] +;----------------------------------------------------- +unstuff5: ;- [08] + ori shift, 0x20 ;1 [09] + in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 5 + andi x2, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for stuffed bit 5 + andi x3, ~0x20 ;1 [03] + rjmp didUnstuff5 ;2 [04] +;----------------------------------------------------- +unstuff6: ;- [08] + andi x3, ~0x40 ;1 [09] + in x1, USBIN ;1 [00] [10] <-- sample stuffed bit 6 + andi x1, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for stuffed bit 6 + ori shift, 0x40 ;1 [03] + rjmp didUnstuff6 ;2 [04] +;----------------------------------------------------- +unstuff7: ;- [08] + andi x3, ~0x80 ;1 [09] + in x2, USBIN ;1 [00] [10] <-- sample stuffed bit 7 + andi x2, USBMASK ;1 [01] + breq se0 ;1 [02] SE0 check for stuffed bit 7 + ori shift, 0x80 ;1 [03] + rjmp didUnstuff7 ;2 [04] + +macro POP_STANDARD ; 16 cycles + pop x4 + pop cnt + pop bitcnt + pop x3 + pop x2 + pop x1 + pop shift + pop YH + endm +macro POP_RETI ; 5 cycles + pop YL + out SREG, YL + pop YL + endm + +#include "asmcommon.inc" + +;--------------------------------------------------------------------------- +; USB spec says: +; idle = J +; J = (D+ = 0), (D- = 1) +; K = (D+ = 1), (D- = 0) +; Spec allows 7.5 bit times from EOP to SOP for replies +;--------------------------------------------------------------------------- +bitstuffN: ;- [04] + eor x1, x4 ;1 [05] + clr x2 ;1 [06] + nop ;1 [07] + rjmp didStuffN ;1 [08] +;--------------------------------------------------------------------------- +bitstuff6: ;- [04] + eor x1, x4 ;1 [05] + clr x2 ;1 [06] + rjmp didStuff6 ;1 [07] +;--------------------------------------------------------------------------- +bitstuff7: ;- [02] + eor x1, x4 ;1 [03] + clr x2 ;1 [06] + nop ;1 [05] + rjmp didStuff7 ;1 [06] +;--------------------------------------------------------------------------- +sendNakAndReti: ;- [-19] + ldi x3, USBPID_NAK ;1 [-18] + rjmp sendX3AndReti ;1 [-17] +;--------------------------------------------------------------------------- +sendAckAndReti: ;- [-17] + ldi cnt, USBPID_ACK ;1 [-16] +sendCntAndReti: ;- [-16] + mov x3, cnt ;1 [-15] +sendX3AndReti: ;- [-15] + ldi YL, 20 ;1 [-14] x3==r20 address is 20 + ldi YH, 0 ;1 [-13] + ldi cnt, 2 ;1 [-12] +; rjmp usbSendAndReti fallthrough +;--------------------------------------------------------------------------- +;usbSend: +;pointer to data in 'Y' +;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] +;uses: x1...x4, btcnt, shift, cnt, Y +;Numbers in brackets are time since first bit of sync pattern is sent +;We need not to match the transfer rate exactly because the spec demands +;only 1.5% precision anyway. +usbSendAndReti: ;- [-13] 13 cycles until SOP + in x2, USBDDR ;1 [-12] + ori x2, USBMASK ;1 [-11] + sbi USBOUT, USBMINUS ;2 [-09-10] prepare idle state; D+ and D- must have been 0 (no pullups) + in x1, USBOUT ;1 [-08] port mirror for tx loop + out USBDDR, x2 ;1 [-07] <- acquire bus + ; need not init x2 (bitstuff history) because sync starts with 0 + ldi x4, USBMASK ;1 [-06] exor mask + ldi shift, 0x80 ;1 [-05] sync byte is first byte sent + ldi bitcnt, 6 ;1 [-04] +txBitLoop: ;- [-04] [06] + sbrs shift, 0 ;1 [-03] [07] + eor x1, x4 ;1 [-02] [08] + ror shift ;1 [-01] [09] +didStuffN: ;- [09] + out USBOUT, x1 ;1 [00] [10] <-- out N + ror x2 ;1 [01] + cpi x2, 0xfc ;1 [02] + brcc bitstuffN ;1 [03] + dec bitcnt ;1 [04] + brne txBitLoop ;1 [05] + sbrs shift, 0 ;1 [06] + eor x1, x4 ;1 [07] + ror shift ;1 [08] +didStuff6: ;- [08] + nop ;1 [09] + out USBOUT, x1 ;1 [00] [10] <-- out 6 + ror x2 ;1 [01] + cpi x2, 0xfc ;1 [02] + brcc bitstuff6 ;1 [03] + sbrs shift, 0 ;1 [04] + eor x1, x4 ;1 [05] + ror shift ;1 [06] + ror x2 ;1 [07] +didStuff7: ;- [07] + ldi bitcnt, 6 ;1 [08] + cpi x2, 0xfc ;1 [09] + out USBOUT, x1 ;1 [00] [10] <-- out 7 + brcc bitstuff7 ;1 [01] + ld shift, y+ ;2 [02+03] + dec cnt ;1 [04] + brne txBitLoop ;1 [05] +makeSE0: + cbr x1, USBMASK ;1 [06] prepare SE0 [spec says EOP may be 19 to 23 cycles] + lds x2, usbNewDeviceAddr;2 [07+08] + lsl x2 ;1 [09] we compare with left shifted address +;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: +;set address only after data packet was sent, not after handshake + out USBOUT, x1 ;1 [00] [10] <-- out SE0-- from now 2 bits==20 cycl. until bus idle + subi YL, 20 + 2 ;1 [01] Only assign address on data packets, not ACK/NAK in x3 + sbci YH, 0 ;1 [02] + breq skipAddrAssign ;1 [03] + sts usbDeviceAddr, x2 ;2 [04+05] if not skipped: SE0 is one cycle longer +;---------------------------------------------------------------------------- +;end of usbDeviceAddress transfer +skipAddrAssign: ;- [03/04] + ldi x2, 1< 10.6666666 cycles per bit, 85.333333333 cycles per byte +; Numbers in brackets are clocks counted from center of last sync bit +; when instruction starts + +USB_INTR_VECTOR: +;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt + push YL ;[-25] push only what is necessary to sync with edge ASAP + in YL, SREG ;[-23] + push YL ;[-22] + push YH ;[-20] +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +;---------------------------------------------------------------------------- +;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +;sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +waitForK: +;The following code results in a sampling window of < 1/4 bit which meets the spec. + sbis USBIN, USBMINUS ;[-15] + rjmp foundK ;[-14] + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError +foundK: ;[-12] +;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] +;we have 1 bit time for setup purposes, then sample again. Numbers in brackets +;are cycles from center of first sync (double K) bit after the instruction + push bitcnt ;[-12] +; [---] ;[-11] + lds YL, usbInputBufOffset;[-10] +; [---] ;[-9] + clr YH ;[-8] + subi YL, lo8(-(usbRxBuf));[-7] [rx loop init] + sbci YH, hi8(-(usbRxBuf));[-6] [rx loop init] + push shift ;[-5] +; [---] ;[-4] + ldi bitcnt, 0x55 ;[-3] [rx loop init] + sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) + rjmp haveTwoBitsK ;[-1] + pop shift ;[0] undo the push from before + pop bitcnt ;[2] undo the push from before + rjmp waitForK ;[4] this was not the end of sync, retry +; The entire loop from waitForK until rjmp waitForK above must not exceed two +; bit times (= 21 cycles). + +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- +haveTwoBitsK: + push x1 ;[1] + push x2 ;[3] + push x3 ;[5] + ldi shift, 0 ;[7] + ldi x3, 1<<4 ;[8] [rx loop init] first sample is inverse bit, compensate that + push x4 ;[9] == leap + + in x1, USBIN ;[11] <-- sample bit 0 + andi x1, USBMASK ;[12] + bst x1, USBMINUS ;[13] + bld shift, 7 ;[14] + push cnt ;[15] + ldi leap, 0 ;[17] [rx loop init] + ldi cnt, USB_BUFSIZE;[18] [rx loop init] + rjmp rxbit1 ;[19] arrives at [21] + +;---------------------------------------------------------------------------- +; Receiver loop (numbers in brackets are cycles within byte after instr) +;---------------------------------------------------------------------------- + +; duration of unstuffing code should be 10.66666667 cycles. We adjust "leap" +; accordingly to approximate this value in the long run. + +unstuff6: + andi x2, USBMASK ;[03] + ori x3, 1<<6 ;[04] will not be shifted any more + andi shift, ~0x80;[05] + mov x1, x2 ;[06] sampled bit 7 is actually re-sampled bit 6 + subi leap, -1 ;[07] total duration = 11 bits -> subtract 1/3 + rjmp didUnstuff6 ;[08] + +unstuff7: + ori x3, 1<<7 ;[09] will not be shifted any more + in x2, USBIN ;[00] [10] re-sample bit 7 + andi x2, USBMASK ;[01] + andi shift, ~0x80;[02] + subi leap, 2 ;[03] total duration = 10 bits -> add 1/3 + rjmp didUnstuff7 ;[04] + +unstuffEven: + ori x3, 1<<6 ;[09] will be shifted right 6 times for bit 0 + in x1, USBIN ;[00] [10] + andi shift, ~0x80;[01] + andi x1, USBMASK ;[02] + breq se0 ;[03] + subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3 + nop2 ;[05] + rjmp didUnstuffE ;[06] + +unstuffOdd: + ori x3, 1<<5 ;[09] will be shifted right 4 times for bit 1 + in x2, USBIN ;[00] [10] + andi shift, ~0x80;[01] + andi x2, USBMASK ;[02] + breq se0 ;[03] + subi leap, -1 ;[04] total duration = 11 bits -> subtract 1/3 + nop2 ;[05] + rjmp didUnstuffO ;[06] + +rxByteLoop: + andi x1, USBMASK ;[03] + eor x2, x1 ;[04] + subi leap, 1 ;[05] + brpl skipLeap ;[06] + subi leap, -3 ;1 one leap cycle every 3rd byte -> 85 + 1/3 cycles per byte + nop ;1 +skipLeap: + subi x2, 1 ;[08] + ror shift ;[09] +didUnstuff6: + cpi shift, 0xfc ;[10] + in x2, USBIN ;[00] [11] <-- sample bit 7 + brcc unstuff6 ;[01] + andi x2, USBMASK ;[02] + eor x1, x2 ;[03] + subi x1, 1 ;[04] + ror shift ;[05] +didUnstuff7: + cpi shift, 0xfc ;[06] + brcc unstuff7 ;[07] + eor x3, shift ;[08] reconstruct: x3 is 1 at bit locations we changed, 0 at others + st y+, x3 ;[09] store data +rxBitLoop: + in x1, USBIN ;[00] [11] <-- sample bit 0/2/4 + andi x1, USBMASK ;[01] + eor x2, x1 ;[02] + andi x3, 0x3f ;[03] topmost two bits reserved for 6 and 7 + subi x2, 1 ;[04] + ror shift ;[05] + cpi shift, 0xfc ;[06] + brcc unstuffEven ;[07] +didUnstuffE: + lsr x3 ;[08] + lsr x3 ;[09] +rxbit1: + in x2, USBIN ;[00] [10] <-- sample bit 1/3/5 + andi x2, USBMASK ;[01] + breq se0 ;[02] + eor x1, x2 ;[03] + subi x1, 1 ;[04] + ror shift ;[05] + cpi shift, 0xfc ;[06] + brcc unstuffOdd ;[07] +didUnstuffO: + subi bitcnt, 0xab;[08] == addi 0x55, 0x55 = 0x100/3 + brcs rxBitLoop ;[09] + + subi cnt, 1 ;[10] + in x1, USBIN ;[00] [11] <-- sample bit 6 + brcc rxByteLoop ;[01] + rjmp overflow + +macro POP_STANDARD ; 14 cycles + pop cnt + pop x4 + pop x3 + pop x2 + pop x1 + pop shift + pop bitcnt + endm +macro POP_RETI ; 7 cycles + pop YH + pop YL + out SREG, YL + pop YL + endm + +#include "asmcommon.inc" + +; USB spec says: +; idle = J +; J = (D+ = 0), (D- = 1) +; K = (D+ = 1), (D- = 0) +; Spec allows 7.5 bit times from EOP to SOP for replies + +bitstuffN: + eor x1, x4 ;[5] + ldi x2, 0 ;[6] + nop2 ;[7] + nop ;[9] + out USBOUT, x1 ;[10] <-- out + rjmp didStuffN ;[0] + +bitstuff6: + eor x1, x4 ;[5] + ldi x2, 0 ;[6] Carry is zero due to brcc + rol shift ;[7] compensate for ror shift at branch destination + rjmp didStuff6 ;[8] + +bitstuff7: + ldi x2, 0 ;[2] Carry is zero due to brcc + rjmp didStuff7 ;[3] + + +sendNakAndReti: + ldi x3, USBPID_NAK ;[-18] + rjmp sendX3AndReti ;[-17] +sendAckAndReti: + ldi cnt, USBPID_ACK ;[-17] +sendCntAndReti: + mov x3, cnt ;[-16] +sendX3AndReti: + ldi YL, 20 ;[-15] x3==r20 address is 20 + ldi YH, 0 ;[-14] + ldi cnt, 2 ;[-13] +; rjmp usbSendAndReti fallthrough + +;usbSend: +;pointer to data in 'Y' +;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] +;uses: x1...x4, btcnt, shift, cnt, Y +;Numbers in brackets are time since first bit of sync pattern is sent +;We don't match the transfer rate exactly (don't insert leap cycles every third +;byte) because the spec demands only 1.5% precision anyway. +usbSendAndReti: ; 12 cycles until SOP + in x2, USBDDR ;[-12] + ori x2, USBMASK ;[-11] + sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) + in x1, USBOUT ;[-8] port mirror for tx loop + out USBDDR, x2 ;[-7] <- acquire bus +; need not init x2 (bitstuff history) because sync starts with 0 + ldi x4, USBMASK ;[-6] exor mask + ldi shift, 0x80 ;[-5] sync byte is first byte sent +txByteLoop: + ldi bitcnt, 0x35 ;[-4] [6] binary 0011 0101 +txBitLoop: + sbrs shift, 0 ;[-3] [7] + eor x1, x4 ;[-2] [8] + out USBOUT, x1 ;[-1] [9] <-- out N + ror shift ;[0] [10] + ror x2 ;[1] +didStuffN: + cpi x2, 0xfc ;[2] + brcc bitstuffN ;[3] + lsr bitcnt ;[4] + brcc txBitLoop ;[5] + brne txBitLoop ;[6] + + sbrs shift, 0 ;[7] + eor x1, x4 ;[8] +didStuff6: + out USBOUT, x1 ;[-1] [9] <-- out 6 + ror shift ;[0] [10] + ror x2 ;[1] + cpi x2, 0xfc ;[2] + brcc bitstuff6 ;[3] + ror shift ;[4] +didStuff7: + ror x2 ;[5] + sbrs x2, 7 ;[6] + eor x1, x4 ;[7] + nop ;[8] + cpi x2, 0xfc ;[9] + out USBOUT, x1 ;[-1][10] <-- out 7 + brcc bitstuff7 ;[0] [11] + ld shift, y+ ;[1] + dec cnt ;[3] + brne txByteLoop ;[4] +;make SE0: + cbr x1, USBMASK ;[5] prepare SE0 [spec says EOP may be 21 to 25 cycles] + lds x2, usbNewDeviceAddr;[6] + lsl x2 ;[8] we compare with left shifted address + subi YL, 20 + 2 ;[9] Only assign address on data packets, not ACK/NAK in x3 + sbci YH, 0 ;[10] + out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle +;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: +;set address only after data packet was sent, not after handshake + breq skipAddrAssign ;[0] + sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer +skipAddrAssign: +;end of usbDeviceAddress transfer + ldi x2, 1< max 52 cycles interrupt disable +;max stack usage: [ret(2), r0, SREG, YL, YH, shift, x1, x2, x3, x4, cnt] = 12 bytes +;nominal frequency: 16.5 MHz -> 11 cycles per bit +; 16.3125 MHz < F_CPU < 16.6875 MHz (+/- 1.1%) +; Numbers in brackets are clocks counted from center of last sync bit +; when instruction starts + + +USB_INTR_VECTOR: +;order of registers pushed: YL, SREG [sofError], r0, YH, shift, x1, x2, x3, x4, cnt + push YL ;[-23] push only what is necessary to sync with edge ASAP + in YL, SREG ;[-21] + push YL ;[-20] +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +;---------------------------------------------------------------------------- +;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +;sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +waitForK: +;The following code results in a sampling window of < 1/4 bit which meets the spec. + sbis USBIN, USBMINUS ;[-15] + rjmp foundK ;[-14] + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError +foundK: ;[-12] +;{3, 5} after falling D- edge, average delay: 4 cycles [we want 5 for center sampling] +;we have 1 bit time for setup purposes, then sample again. Numbers in brackets +;are cycles from center of first sync (double K) bit after the instruction + push r0 ;[-12] +; [---] ;[-11] + push YH ;[-10] +; [---] ;[-9] + lds YL, usbInputBufOffset;[-8] +; [---] ;[-7] + clr YH ;[-6] + subi YL, lo8(-(usbRxBuf));[-5] [rx loop init] + sbci YH, hi8(-(usbRxBuf));[-4] [rx loop init] + mov r0, x2 ;[-3] [rx loop init] + sbis USBIN, USBMINUS ;[-2] we want two bits K (sample 2 cycles too early) + rjmp haveTwoBitsK ;[-1] + pop YH ;[0] undo the pushes from before + pop r0 ;[2] + rjmp waitForK ;[4] this was not the end of sync, retry +; The entire loop from waitForK until rjmp waitForK above must not exceed two +; bit times (= 22 cycles). + +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- +haveTwoBitsK: ;[1] + push shift ;[1] + push x1 ;[3] + push x2 ;[5] + push x3 ;[7] + ldi shift, 0xff ;[9] [rx loop init] + ori x3, 0xff ;[10] [rx loop init] == ser x3, clear zero flag + + in x1, USBIN ;[11] <-- sample bit 0 + bst x1, USBMINUS ;[12] + bld shift, 0 ;[13] + push x4 ;[14] == phase +; [---] ;[15] + push cnt ;[16] +; [---] ;[17] + ldi phase, 0 ;[18] [rx loop init] + ldi cnt, USB_BUFSIZE;[19] [rx loop init] + rjmp rxbit1 ;[20] +; [---] ;[21] + +;---------------------------------------------------------------------------- +; Receiver loop (numbers in brackets are cycles within byte after instr) +;---------------------------------------------------------------------------- +/* +byte oriented operations done during loop: +bit 0: store data +bit 1: SE0 check +bit 2: overflow check +bit 3: catch up +bit 4: rjmp to achieve conditional jump range +bit 5: PLL +bit 6: catch up +bit 7: jump, fixup bitstuff +; 87 [+ 2] cycles +------------------------------------------------------------------ +*/ +continueWithBit5: + in x2, USBIN ;[055] <-- bit 5 + eor r0, x2 ;[056] + or phase, r0 ;[057] + sbrc phase, USBMINUS ;[058] + lpm ;[059] optional nop3; modifies r0 + in phase, USBIN ;[060] <-- phase + eor x1, x2 ;[061] + bst x1, USBMINUS ;[062] + bld shift, 5 ;[063] + andi shift, 0x3f ;[064] + in x1, USBIN ;[065] <-- bit 6 + breq unstuff5 ;[066] *** unstuff escape + eor phase, x1 ;[067] + eor x2, x1 ;[068] + bst x2, USBMINUS ;[069] + bld shift, 6 ;[070] +didUnstuff6: ;[ ] + in r0, USBIN ;[071] <-- phase + cpi shift, 0x02 ;[072] + brlo unstuff6 ;[073] *** unstuff escape +didUnstuff5: ;[ ] + nop2 ;[074] +; [---] ;[075] + in x2, USBIN ;[076] <-- bit 7 + eor x1, x2 ;[077] + bst x1, USBMINUS ;[078] + bld shift, 7 ;[079] +didUnstuff7: ;[ ] + eor r0, x2 ;[080] + or phase, r0 ;[081] + in r0, USBIN ;[082] <-- phase + cpi shift, 0x04 ;[083] + brsh rxLoop ;[084] +; [---] ;[085] +unstuff7: ;[ ] + andi x3, ~0x80 ;[085] + ori shift, 0x80 ;[086] + in x2, USBIN ;[087] <-- sample stuffed bit 7 + nop ;[088] + rjmp didUnstuff7 ;[089] +; [---] ;[090] + ;[080] + +unstuff5: ;[067] + eor phase, x1 ;[068] + andi x3, ~0x20 ;[069] + ori shift, 0x20 ;[070] + in r0, USBIN ;[071] <-- phase + mov x2, x1 ;[072] + nop ;[073] + nop2 ;[074] +; [---] ;[075] + in x1, USBIN ;[076] <-- bit 6 + eor r0, x1 ;[077] + or phase, r0 ;[078] + eor x2, x1 ;[079] + bst x2, USBMINUS ;[080] + bld shift, 6 ;[081] no need to check bitstuffing, we just had one + in r0, USBIN ;[082] <-- phase + rjmp didUnstuff5 ;[083] +; [---] ;[084] + ;[074] + +unstuff6: ;[074] + andi x3, ~0x40 ;[075] + in x1, USBIN ;[076] <-- bit 6 again + ori shift, 0x40 ;[077] + nop2 ;[078] +; [---] ;[079] + rjmp didUnstuff6 ;[080] +; [---] ;[081] + ;[071] + +unstuff0: ;[013] + eor r0, x2 ;[014] + or phase, r0 ;[015] + andi x2, USBMASK ;[016] check for SE0 + in r0, USBIN ;[017] <-- phase + breq didUnstuff0 ;[018] direct jump to se0 would be too long + andi x3, ~0x01 ;[019] + ori shift, 0x01 ;[020] + mov x1, x2 ;[021] mov existing sample + in x2, USBIN ;[022] <-- bit 1 again + rjmp didUnstuff0 ;[023] +; [---] ;[024] + ;[014] + +unstuff1: ;[024] + eor r0, x1 ;[025] + or phase, r0 ;[026] + andi x3, ~0x02 ;[027] + in r0, USBIN ;[028] <-- phase + ori shift, 0x02 ;[029] + mov x2, x1 ;[030] + rjmp didUnstuff1 ;[031] +; [---] ;[032] + ;[022] + +unstuff2: ;[035] + eor r0, x2 ;[036] + or phase, r0 ;[037] + andi x3, ~0x04 ;[038] + in r0, USBIN ;[039] <-- phase + ori shift, 0x04 ;[040] + mov x1, x2 ;[041] + rjmp didUnstuff2 ;[042] +; [---] ;[043] + ;[033] + +unstuff3: ;[043] + in x2, USBIN ;[044] <-- bit 3 again + eor r0, x2 ;[045] + or phase, r0 ;[046] + andi x3, ~0x08 ;[047] + ori shift, 0x08 ;[048] + nop ;[049] + in r0, USBIN ;[050] <-- phase + rjmp didUnstuff3 ;[051] +; [---] ;[052] + ;[042] + +unstuff4: ;[053] + andi x3, ~0x10 ;[054] + in x1, USBIN ;[055] <-- bit 4 again + ori shift, 0x10 ;[056] + rjmp didUnstuff4 ;[057] +; [---] ;[058] + ;[048] + +rxLoop: ;[085] + eor x3, shift ;[086] reconstruct: x3 is 0 at bit locations we changed, 1 at others + in x1, USBIN ;[000] <-- bit 0 + st y+, x3 ;[001] +; [---] ;[002] + eor r0, x1 ;[003] + or phase, r0 ;[004] + eor x2, x1 ;[005] + in r0, USBIN ;[006] <-- phase + ser x3 ;[007] + bst x2, USBMINUS ;[008] + bld shift, 0 ;[009] + andi shift, 0xf9 ;[010] +rxbit1: ;[ ] + in x2, USBIN ;[011] <-- bit 1 + breq unstuff0 ;[012] *** unstuff escape + andi x2, USBMASK ;[013] SE0 check for bit 1 +didUnstuff0: ;[ ] Z only set if we detected SE0 in bitstuff + breq se0 ;[014] + eor r0, x2 ;[015] + or phase, r0 ;[016] + in r0, USBIN ;[017] <-- phase + eor x1, x2 ;[018] + bst x1, USBMINUS ;[019] + bld shift, 1 ;[020] + andi shift, 0xf3 ;[021] +didUnstuff1: ;[ ] + in x1, USBIN ;[022] <-- bit 2 + breq unstuff1 ;[023] *** unstuff escape + eor r0, x1 ;[024] + or phase, r0 ;[025] + subi cnt, 1 ;[026] overflow check + brcs overflow ;[027] + in r0, USBIN ;[028] <-- phase + eor x2, x1 ;[029] + bst x2, USBMINUS ;[030] + bld shift, 2 ;[031] + andi shift, 0xe7 ;[032] +didUnstuff2: ;[ ] + in x2, USBIN ;[033] <-- bit 3 + breq unstuff2 ;[034] *** unstuff escape + eor r0, x2 ;[035] + or phase, r0 ;[036] + eor x1, x2 ;[037] + bst x1, USBMINUS ;[038] + in r0, USBIN ;[039] <-- phase + bld shift, 3 ;[040] + andi shift, 0xcf ;[041] +didUnstuff3: ;[ ] + breq unstuff3 ;[042] *** unstuff escape + nop ;[043] + in x1, USBIN ;[044] <-- bit 4 + eor x2, x1 ;[045] + bst x2, USBMINUS ;[046] + bld shift, 4 ;[047] +didUnstuff4: ;[ ] + eor r0, x1 ;[048] + or phase, r0 ;[049] + in r0, USBIN ;[050] <-- phase + andi shift, 0x9f ;[051] + breq unstuff4 ;[052] *** unstuff escape + rjmp continueWithBit5;[053] +; [---] ;[054] + +macro POP_STANDARD ; 16 cycles + pop cnt + pop x4 + pop x3 + pop x2 + pop x1 + pop shift + pop YH + pop r0 + endm +macro POP_RETI ; 5 cycles + pop YL + out SREG, YL + pop YL + endm + +#include "asmcommon.inc" + + +; USB spec says: +; idle = J +; J = (D+ = 0), (D- = 1) +; K = (D+ = 1), (D- = 0) +; Spec allows 7.5 bit times from EOP to SOP for replies + +bitstuff7: + eor x1, x4 ;[4] + ldi x2, 0 ;[5] + nop2 ;[6] C is zero (brcc) + rjmp didStuff7 ;[8] + +bitstuffN: + eor x1, x4 ;[5] + ldi x2, 0 ;[6] + lpm ;[7] 3 cycle NOP, modifies r0 + out USBOUT, x1 ;[10] <-- out + rjmp didStuffN ;[0] + +#define bitStatus x3 + +sendNakAndReti: + ldi cnt, USBPID_NAK ;[-19] + rjmp sendCntAndReti ;[-18] +sendAckAndReti: + ldi cnt, USBPID_ACK ;[-17] +sendCntAndReti: + mov r0, cnt ;[-16] + ldi YL, 0 ;[-15] R0 address is 0 + ldi YH, 0 ;[-14] + ldi cnt, 2 ;[-13] +; rjmp usbSendAndReti fallthrough + +;usbSend: +;pointer to data in 'Y' +;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] +;uses: x1...x4, shift, cnt, Y +;Numbers in brackets are time since first bit of sync pattern is sent +usbSendAndReti: ; 12 cycles until SOP + in x2, USBDDR ;[-12] + ori x2, USBMASK ;[-11] + sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) + in x1, USBOUT ;[-8] port mirror for tx loop + out USBDDR, x2 ;[-7] <- acquire bus +; need not init x2 (bitstuff history) because sync starts with 0 + ldi x4, USBMASK ;[-6] exor mask + ldi shift, 0x80 ;[-5] sync byte is first byte sent + ldi bitStatus, 0xff ;[-4] init bit loop counter, works for up to 12 bytes +byteloop: +bitloop: + sbrs shift, 0 ;[8] [-3] + eor x1, x4 ;[9] [-2] + out USBOUT, x1 ;[10] [-1] <-- out + ror shift ;[0] + ror x2 ;[1] +didStuffN: + cpi x2, 0xfc ;[2] + brcc bitstuffN ;[3] + nop ;[4] + subi bitStatus, 37 ;[5] 256 / 7 ~=~ 37 + brcc bitloop ;[6] when we leave the loop, bitStatus has almost the initial value + sbrs shift, 0 ;[7] + eor x1, x4 ;[8] + ror shift ;[9] +didStuff7: + out USBOUT, x1 ;[10] <-- out + ror x2 ;[0] + cpi x2, 0xfc ;[1] + brcc bitstuff7 ;[2] + ld shift, y+ ;[3] + dec cnt ;[5] + brne byteloop ;[6] +;make SE0: + cbr x1, USBMASK ;[7] prepare SE0 [spec says EOP may be 21 to 25 cycles] + lds x2, usbNewDeviceAddr;[8] + lsl x2 ;[10] we compare with left shifted address + out USBOUT, x1 ;[11] <-- out SE0 -- from now 2 bits = 22 cycles until bus idle +;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: +;set address only after data packet was sent, not after handshake + subi YL, 2 ;[0] Only assign address on data packets, not ACK/NAK in r0 + sbci YH, 0 ;[1] + breq skipAddrAssign ;[2] + sts usbDeviceAddr, x2; if not skipped: SE0 is one cycle longer +skipAddrAssign: +;end of usbDeviceAddress transfer + ldi x2, 1< 12 cycles per bit +; Numbers in brackets are clocks counted from center of last sync bit +; when instruction starts +;register use in receive loop to receive the data bytes: +; shift assembles the byte currently being received +; x1 holds the D+ and D- line state +; x2 holds the previous line state +; cnt holds the number of bytes left in the receive buffer +; x3 holds the higher crc byte (see algorithm below) +; x4 is used as temporary register for the crc algorithm +; x5 is used for unstuffing: when unstuffing the last received bit is inverted in shift (to prevent further +; unstuffing calls. In the same time the corresponding bit in x5 is cleared to mark the bit as beening iverted +; zl lower crc value and crc table index +; zh used for crc table accesses + +;-------------------------------------------------------------------------------------------------------------- +; CRC mods: +; table driven crc checker, Z points to table in prog space +; ZL is the lower crc byte, x3 is the higher crc byte +; x4 is used as temp register to store different results +; the initialization of the crc register is not 0xFFFF but 0xFE54. This is because during the receipt of the +; first data byte an virtual zero data byte is added to the crc register, this results in the correct initial +; value of 0xFFFF at beginning of the second data byte before the first data byte is added to the crc. +; The magic number 0xFE54 results form the crc table: At tabH[0x54] = 0xFF = crcH (required) and +; tabL[0x54] = 0x01 -> crcL = 0x01 xor 0xFE = 0xFF +; bitcnt is renamed to x5 and is used for unstuffing purposes, the unstuffing works like in the 12MHz version +;-------------------------------------------------------------------------------------------------------------- +; CRC algorithm: +; The crc register is formed by x3 (higher byte) and ZL (lower byte). The algorithm uses a 'reversed' form +; i.e. that it takes the least significant bit first and shifts to the right. So in fact the highest order +; bit seen from the polynomial devision point of view is the lsb of ZL. (If this sounds strange to you i +; propose a research on CRC :-) ) +; Each data byte received is xored to ZL, the lower crc byte. This byte now builds the crc +; table index. Next the new high byte is loaded from the table and stored in x4 until we have space in x3 +; (its destination). +; Afterwards the lower table is loaded from the table and stored in ZL (the old index is overwritten as +; we don't need it anymore. In fact this is a right shift by 8 bits.) Now the old crc high value is xored +; to ZL, this is the second shift of the old crc value. Now x4 (the temp reg) is moved to x3 and the crc +; calculation is done. +; Prior to the first byte the two CRC register have to be initialized to 0xFFFF (as defined in usb spec) +; however the crc engine also runs during the receipt of the first byte, therefore x3 and zl are initialized +; to a magic number which results in a crc value of 0xFFFF after the first complete byte. +; +; This algorithm is split into the extra cycles of the different bits: +; bit7: XOR the received byte to ZL +; bit5: load the new high byte to x4 +; bit6: load the lower xor byte from the table, xor zl and x3, store result in zl (=the new crc low value) +; move x4 (the new high byte) to x3, the crc value is ready +; + + +macro POP_STANDARD ; 18 cycles + pop ZH + pop ZL + pop cnt + pop x5 + pop x3 + pop x2 + pop x1 + pop shift + pop x4 + endm +macro POP_RETI ; 7 cycles + pop YH + pop YL + out SREG, YL + pop YL + endm + +macro CRC_CLEANUP_AND_CHECK + ; the last byte has already been xored with the lower crc byte, we have to do the table lookup and xor + ; x3 is the higher crc byte, zl the lower one + ldi ZH, hi8(usbCrcTableHigh);[+1] get the new high byte from the table + lpm x2, Z ;[+2][+3][+4] + ldi ZH, hi8(usbCrcTableLow);[+5] get the new low xor byte from the table + lpm ZL, Z ;[+6][+7][+8] + eor ZL, x3 ;[+7] xor the old high byte with the value from the table, x2:ZL now holds the crc value + cpi ZL, 0x01 ;[+8] if the crc is ok we have a fixed remainder value of 0xb001 in x2:ZL (see usb spec) + brne ignorePacket ;[+9] detected a crc fault -> paket is ignored and retransmitted by the host + cpi x2, 0xb0 ;[+10] + brne ignorePacket ;[+11] detected a crc fault -> paket is ignored and retransmitted by the host + endm + + +USB_INTR_VECTOR: +;order of registers pushed: YL, SREG, YH, [sofError], x4, shift, x1, x2, x3, x5, cnt, ZL, ZH + push YL ;[-28] push only what is necessary to sync with edge ASAP + in YL, SREG ;[-26] + push YL ;[-25] + push YH ;[-23] +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +;---------------------------------------------------------------------------- +;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +;sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +waitForK: +;The following code results in a sampling window of < 1/4 bit which meets the spec. + sbis USBIN, USBMINUS ;[-17] + rjmp foundK ;[-16] + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError +foundK: ;[-15] +;{3, 5} after falling D- edge, average delay: 4 cycles +;bit0 should be at 30 (2.5 bits) for center sampling. Currently at 4 so 26 cylces till bit 0 sample +;use 1 bit time for setup purposes, then sample again. Numbers in brackets +;are cycles from center of first sync (double K) bit after the instruction + push x4 ;[-14] +; [---] ;[-13] + lds YL, usbInputBufOffset;[-12] used to toggle the two usb receive buffers +; [---] ;[-11] + clr YH ;[-10] + subi YL, lo8(-(usbRxBuf));[-9] [rx loop init] + sbci YH, hi8(-(usbRxBuf));[-8] [rx loop init] + push shift ;[-7] +; [---] ;[-6] + ldi shift, 0x80 ;[-5] the last bit is the end of byte marker for the pid receiver loop + clc ;[-4] the carry has to be clear for receipt of pid bit 0 + sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) + rjmp haveTwoBitsK ;[-2] + pop shift ;[-1] undo the push from before + pop x4 ;[1] + rjmp waitForK ;[3] this was not the end of sync, retry +; The entire loop from waitForK until rjmp waitForK above must not exceed two +; bit times (= 24 cycles). + +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- +haveTwoBitsK: + push x1 ;[0] + push x2 ;[2] + push x3 ;[4] crc high byte + ldi x2, 1< jump back and store the byte + ori shift, 0x01 ;[11] invert the last received bit to prevent furhter unstuffing + in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors + andi x5, 0xFE ;[1] mark this bit as inverted (will be corrected before storing shift) + eor x1, x2 ;[2] x1 and x2 have to be different because the stuff bit is always a zero + andi x1, USBMASK ;[3] mask the interesting bits + breq stuffErr ;[4] if the stuff bit is a 1-bit something went wrong + mov x1, x2 ;[5] the next bit expects the last state to be in x1 + rjmp didunstuff0 ;[6] + ;[7] jump delay of rjmp didunstuffX + +unstuff1: ;[11] this is the jump delay of breq unstuffX + in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors + ori shift, 0x02 ;[1] invert the last received bit to prevent furhter unstuffing + andi x5, 0xFD ;[2] mark this bit as inverted (will be corrected before storing shift) + eor x2, x1 ;[3] x1 and x2 have to be different because the stuff bit is always a zero + andi x2, USBMASK ;[4] mask the interesting bits + breq stuffErr ;[5] if the stuff bit is a 1-bit something went wrong + mov x2, x1 ;[6] the next bit expects the last state to be in x2 + nop2 ;[7] + ;[8] + rjmp didunstuff1 ;[9] + ;[10] jump delay of rjmp didunstuffX + +unstuff2: ;[9] this is the jump delay of breq unstuffX + ori shift, 0x04 ;[10] invert the last received bit to prevent furhter unstuffing + andi x5, 0xFB ;[11] mark this bit as inverted (will be corrected before storing shift) + in x2, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors + eor x1, x2 ;[1] x1 and x2 have to be different because the stuff bit is always a zero + andi x1, USBMASK ;[2] mask the interesting bits + breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong + mov x1, x2 ;[4] the next bit expects the last state to be in x1 + nop2 ;[5] + ;[6] + rjmp didunstuff2 ;[7] + ;[8] jump delay of rjmp didunstuffX + +unstuff3: ;[9] this is the jump delay of breq unstuffX + ori shift, 0x08 ;[10] invert the last received bit to prevent furhter unstuffing + andi x5, 0xF7 ;[11] mark this bit as inverted (will be corrected before storing shift) + in x1, USBIN ;[0] we have some free cycles so we could check for bit stuffing errors + eor x2, x1 ;[1] x1 and x2 have to be different because the stuff bit is always a zero + andi x2, USBMASK ;[2] mask the interesting bits + breq stuffErr ;[3] if the stuff bit is a 1-bit something went wrong + mov x2, x1 ;[4] the next bit expects the last state to be in x2 + nop2 ;[5] + ;[6] + rjmp didunstuff3 ;[7] + ;[8] jump delay of rjmp didunstuffX + + + +; the include has to be here due to branch distance restirctions +#define __USE_CRC__ +#include "asmcommon.inc" + + + +; USB spec says: +; idle = J +; J = (D+ = 0), (D- = 1) +; K = (D+ = 1), (D- = 0) +; Spec allows 7.5 bit times from EOP to SOP for replies +; 7.5 bit times is 90 cycles. ...there is plenty of time + + +sendNakAndReti: + ldi x3, USBPID_NAK ;[-18] + rjmp sendX3AndReti ;[-17] +sendAckAndReti: + ldi cnt, USBPID_ACK ;[-17] +sendCntAndReti: + mov x3, cnt ;[-16] +sendX3AndReti: + ldi YL, 20 ;[-15] x3==r20 address is 20 + ldi YH, 0 ;[-14] + ldi cnt, 2 ;[-13] +; rjmp usbSendAndReti fallthrough + +;usbSend: +;pointer to data in 'Y' +;number of bytes in 'cnt' -- including sync byte [range 2 ... 12] +;uses: x1...x4, btcnt, shift, cnt, Y +;Numbers in brackets are time since first bit of sync pattern is sent + +usbSendAndReti: ; 12 cycles until SOP + in x2, USBDDR ;[-12] + ori x2, USBMASK ;[-11] + sbi USBOUT, USBMINUS;[-10] prepare idle state; D+ and D- must have been 0 (no pullups) + in x1, USBOUT ;[-8] port mirror for tx loop + out USBDDR, x2 ;[-6] <- acquire bus + ldi x2, 0 ;[-6] init x2 (bitstuff history) because sync starts with 0 + ldi x4, USBMASK ;[-5] exor mask + ldi shift, 0x80 ;[-4] sync byte is first byte sent +txByteLoop: + ldi bitcnt, 0x40 ;[-3]=[9] binary 01000000 +txBitLoop: ; the loop sends the first 7 bits of the byte + sbrs shift, 0 ;[-2]=[10] if we have to send a 1 don't change the line state + eor x1, x4 ;[-1]=[11] + out USBOUT, x1 ;[0] + ror shift ;[1] + ror x2 ;[2] transfers the last sent bit to the stuffing history +didStuffN: + nop ;[3] + nop ;[4] + cpi x2, 0xfc ;[5] if we sent six consecutive ones + brcc bitstuffN ;[6] + lsr bitcnt ;[7] + brne txBitLoop ;[8] restart the loop while the 1 is still in the bitcount + +; transmit bit 7 + sbrs shift, 0 ;[9] + eor x1, x4 ;[10] +didStuff7: + ror shift ;[11] + out USBOUT, x1 ;[0] transfer bit 7 to the pins + ror x2 ;[1] move the bit into the stuffing history + cpi x2, 0xfc ;[2] + brcc bitstuff7 ;[3] + ld shift, y+ ;[4] get next byte to transmit + dec cnt ;[5] decrement byte counter + brne txByteLoop ;[7] if we have more bytes start next one + ;[8] branch delay + +;make SE0: + cbr x1, USBMASK ;[8] prepare SE0 [spec says EOP may be 25 to 30 cycles] + lds x2, usbNewDeviceAddr;[9] + lsl x2 ;[11] we compare with left shifted address + out USBOUT, x1 ;[0] <-- out SE0 -- from now 2 bits = 24 cycles until bus idle + subi YL, 20 + 2 ;[1] Only assign address on data packets, not ACK/NAK in x3 + sbci YH, 0 ;[2] +;2006-03-06: moved transfer of new address to usbDeviceAddr from C-Code to asm: +;set address only after data packet was sent, not after handshake + breq skipAddrAssign ;[3] + sts usbDeviceAddr, x2 ; if not skipped: SE0 is one cycle longer +skipAddrAssign: +;end of usbDeviceAddress transfer + ldi x2, 1< +int main (int argc, char **argv) +{ + int i, j; + for (i=0; i<512; i++){ + unsigned short crc = i & 0xff; + for(j=0; j<8; j++) crc = (crc >> 1) ^ ((crc & 1) ? 0xa001 : 0); + if((i & 7) == 0) printf("\n.byte "); + printf("0x%02x, ", (i > 0xff ? (crc >> 8) : crc) & 0xff); + if(i == 255) printf("\n"); + } + return 0; +} + +// Use the following algorithm to compute CRC values: +ushort computeCrc(uchar *msg, uchar msgLen) +{ + uchar i; + ushort crc = 0xffff; + for(i = 0; i < msgLen; i++) + crc = usbCrcTable16[lo8(crc) ^ msg[i]] ^ hi8(crc); + return crc; +} +*/ + +.balign 256 +usbCrcTableLow: +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x00, 0xC1, 0x81, 0x40, 0x01, 0xC0, 0x80, 0x41 +.byte 0x01, 0xC0, 0x80, 0x41, 0x00, 0xC1, 0x81, 0x40 + +; .balign 256 +usbCrcTableHigh: +.byte 0x00, 0xC0, 0xC1, 0x01, 0xC3, 0x03, 0x02, 0xC2 +.byte 0xC6, 0x06, 0x07, 0xC7, 0x05, 0xC5, 0xC4, 0x04 +.byte 0xCC, 0x0C, 0x0D, 0xCD, 0x0F, 0xCF, 0xCE, 0x0E +.byte 0x0A, 0xCA, 0xCB, 0x0B, 0xC9, 0x09, 0x08, 0xC8 +.byte 0xD8, 0x18, 0x19, 0xD9, 0x1B, 0xDB, 0xDA, 0x1A +.byte 0x1E, 0xDE, 0xDF, 0x1F, 0xDD, 0x1D, 0x1C, 0xDC +.byte 0x14, 0xD4, 0xD5, 0x15, 0xD7, 0x17, 0x16, 0xD6 +.byte 0xD2, 0x12, 0x13, 0xD3, 0x11, 0xD1, 0xD0, 0x10 +.byte 0xF0, 0x30, 0x31, 0xF1, 0x33, 0xF3, 0xF2, 0x32 +.byte 0x36, 0xF6, 0xF7, 0x37, 0xF5, 0x35, 0x34, 0xF4 +.byte 0x3C, 0xFC, 0xFD, 0x3D, 0xFF, 0x3F, 0x3E, 0xFE +.byte 0xFA, 0x3A, 0x3B, 0xFB, 0x39, 0xF9, 0xF8, 0x38 +.byte 0x28, 0xE8, 0xE9, 0x29, 0xEB, 0x2B, 0x2A, 0xEA +.byte 0xEE, 0x2E, 0x2F, 0xEF, 0x2D, 0xED, 0xEC, 0x2C +.byte 0xE4, 0x24, 0x25, 0xE5, 0x27, 0xE7, 0xE6, 0x26 +.byte 0x22, 0xE2, 0xE3, 0x23, 0xE1, 0x21, 0x20, 0xE0 +.byte 0xA0, 0x60, 0x61, 0xA1, 0x63, 0xA3, 0xA2, 0x62 +.byte 0x66, 0xA6, 0xA7, 0x67, 0xA5, 0x65, 0x64, 0xA4 +.byte 0x6C, 0xAC, 0xAD, 0x6D, 0xAF, 0x6F, 0x6E, 0xAE +.byte 0xAA, 0x6A, 0x6B, 0xAB, 0x69, 0xA9, 0xA8, 0x68 +.byte 0x78, 0xB8, 0xB9, 0x79, 0xBB, 0x7B, 0x7A, 0xBA +.byte 0xBE, 0x7E, 0x7F, 0xBF, 0x7D, 0xBD, 0xBC, 0x7C +.byte 0xB4, 0x74, 0x75, 0xB5, 0x77, 0xB7, 0xB6, 0x76 +.byte 0x72, 0xB2, 0xB3, 0x73, 0xB1, 0x71, 0x70, 0xB0 +.byte 0x50, 0x90, 0x91, 0x51, 0x93, 0x53, 0x52, 0x92 +.byte 0x96, 0x56, 0x57, 0x97, 0x55, 0x95, 0x94, 0x54 +.byte 0x9C, 0x5C, 0x5D, 0x9D, 0x5F, 0x9F, 0x9E, 0x5E +.byte 0x5A, 0x9A, 0x9B, 0x5B, 0x99, 0x59, 0x58, 0x98 +.byte 0x88, 0x48, 0x49, 0x89, 0x4B, 0x8B, 0x8A, 0x4A +.byte 0x4E, 0x8E, 0x8F, 0x4F, 0x8D, 0x4D, 0x4C, 0x8C +.byte 0x44, 0x84, 0x85, 0x45, 0x87, 0x47, 0x46, 0x86 +.byte 0x82, 0x42, 0x43, 0x83, 0x41, 0x81, 0x80, 0x40 + diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm20.inc b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm20.inc new file mode 100644 index 00000000..0c746795 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbdrv/usbdrvasm20.inc @@ -0,0 +1,360 @@ +/* Name: usbdrvasm20.inc + * Project: V-USB, virtual USB port for Atmel's(r) AVR(r) microcontrollers + * Author: Jeroen Benschop + * Based on usbdrvasm16.inc from Christian Starkjohann + * Creation Date: 2008-03-05 + * Tabsize: 4 + * Copyright: (c) 2008 by Jeroen Benschop and OBJECTIVE DEVELOPMENT Software GmbH + * License: GNU GPL v2 (see License.txt), GNU GPL v3 or proprietary (CommercialLicense.txt) + * Revision: $Id$ + */ + +/* Do not link this file! Link usbdrvasm.S instead, which includes the + * appropriate implementation! + */ + +/* +General Description: +This file is the 20 MHz version of the asssembler part of the USB driver. It +requires a 20 MHz crystal (not a ceramic resonator and not a calibrated RC +oscillator). + +See usbdrv.h for a description of the entire driver. + +Since almost all of this code is timing critical, don't change unless you +really know what you are doing! Many parts require not only a maximum number +of CPU cycles, but even an exact number of cycles! +*/ + +#define leap2 x3 +#ifdef __IAR_SYSTEMS_ASM__ +#define nextInst $+2 +#else +#define nextInst .+0 +#endif + +;max stack usage: [ret(2), YL, SREG, YH, bitcnt, shift, x1, x2, x3, x4, cnt] = 12 bytes +;nominal frequency: 20 MHz -> 13.333333 cycles per bit, 106.666667 cycles per byte +; Numbers in brackets are clocks counted from center of last sync bit +; when instruction starts +;register use in receive loop: +; shift assembles the byte currently being received +; x1 holds the D+ and D- line state +; x2 holds the previous line state +; x4 (leap) is used to add a leap cycle once every three bytes received +; X3 (leap2) is used to add a leap cycle once every three stuff bits received +; bitcnt is used to determine when a stuff bit is due +; cnt holds the number of bytes left in the receive buffer + +USB_INTR_VECTOR: +;order of registers pushed: YL, SREG YH, [sofError], bitcnt, shift, x1, x2, x3, x4, cnt + push YL ;[-28] push only what is necessary to sync with edge ASAP + in YL, SREG ;[-26] + push YL ;[-25] + push YH ;[-23] +;---------------------------------------------------------------------------- +; Synchronize with sync pattern: +;---------------------------------------------------------------------------- +;sync byte (D-) pattern LSb to MSb: 01010100 [1 = idle = J, 0 = K] +;sync up with J to K edge during sync pattern -- use fastest possible loops +;The first part waits at most 1 bit long since we must be in sync pattern. +;YL is guarenteed to be < 0x80 because I flag is clear. When we jump to +;waitForJ, ensure that this prerequisite is met. +waitForJ: + inc YL + sbis USBIN, USBMINUS + brne waitForJ ; just make sure we have ANY timeout +waitForK: +;The following code results in a sampling window of < 1/4 bit which meets the spec. + sbis USBIN, USBMINUS ;[-19] + rjmp foundK ;[-18] + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK + sbis USBIN, USBMINUS + rjmp foundK +#if USB_COUNT_SOF + lds YL, usbSofCount + inc YL + sts usbSofCount, YL +#endif /* USB_COUNT_SOF */ +#ifdef USB_SOF_HOOK + USB_SOF_HOOK +#endif + rjmp sofError +foundK: ;[-16] +;{3, 5} after falling D- edge, average delay: 4 cycles +;bit0 should be at 34 for center sampling. Currently at 4 so 30 cylces till bit 0 sample +;use 1 bit time for setup purposes, then sample again. Numbers in brackets +;are cycles from center of first sync (double K) bit after the instruction + push bitcnt ;[-16] +; [---] ;[-15] + lds YL, usbInputBufOffset;[-14] +; [---] ;[-13] + clr YH ;[-12] + subi YL, lo8(-(usbRxBuf));[-11] [rx loop init] + sbci YH, hi8(-(usbRxBuf));[-10] [rx loop init] + push shift ;[-9] +; [---] ;[-8] + ldi shift,0x40 ;[-7] set msb to "1" so processing bit7 can be detected + nop2 ;[-6] +; [---] ;[-5] + ldi bitcnt, 5 ;[-4] [rx loop init] + sbis USBIN, USBMINUS ;[-3] we want two bits K (sample 3 cycles too early) + rjmp haveTwoBitsK ;[-2] + pop shift ;[-1] undo the push from before + pop bitcnt ;[1] + rjmp waitForK ;[3] this was not the end of sync, retry +; The entire loop from waitForK until rjmp waitForK above must not exceed two +; bit times (= 27 cycles). + +;---------------------------------------------------------------------------- +; push more registers and initialize values while we sample the first bits: +;---------------------------------------------------------------------------- +haveTwoBitsK: + push x1 ;[0] + push x2 ;[2] + push x3 ;[4] (leap2) + ldi leap2, 0x55 ;[6] add leap cycle on 2nd,5th,8th,... stuff bit + push x4 ;[7] == leap + ldi leap, 0x55 ;[9] skip leap cycle on 2nd,5th,8th,... byte received + push cnt ;[10] + ldi cnt, USB_BUFSIZE ;[12] [rx loop init] + ldi x2, 1< +#ifndef __IAR_SYSTEMS_ASM__ +# include +#endif + +#define __attribute__(arg) /* not supported on IAR */ + +#ifdef __IAR_SYSTEMS_ASM__ +# define __ASSEMBLER__ /* IAR does not define standard macro for asm */ +#endif + +#ifdef __HAS_ELPM__ +# define PROGMEM __farflash +#else +# define PROGMEM __flash +#endif + +#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) + +/* The following definitions are not needed by the driver, but may be of some + * help if you port a gcc based project to IAR. + */ +#define cli() __disable_interrupt() +#define sei() __enable_interrupt() +#define wdt_reset() __watchdog_reset() +#define _BV(x) (1 << (x)) + +/* assembler compatibility macros */ +#define nop2 rjmp $+2 /* jump to next instruction */ +#define XL r26 +#define XH r27 +#define YL r28 +#define YH r29 +#define ZL r30 +#define ZH r31 +#define lo8(x) LOW(x) +#define hi8(x) (((x)>>8) & 0xff) /* not HIGH to allow XLINK to make a proper range check */ + +/* Depending on the device you use, you may get problems with the way usbdrv.h + * handles the differences between devices. Since IAR does not use #defines + * for MCU registers, we can't check for the existence of a particular + * register with an #ifdef. If the autodetection mechanism fails, include + * definitions for the required USB_INTR_* macros in your usbconfig.h. See + * usbconfig-prototype.h and usbdrv.h for details. + */ + +/* ------------------------------------------------------------------------- */ +#elif __CODEVISIONAVR__ /* check for CodeVision AVR */ +/* ------------------------------------------------------------------------- */ +/* This port is not working (yet) */ + +/* #define F_CPU _MCU_CLOCK_FREQUENCY_ seems to be defined automatically */ + +#include +#include + +#define __attribute__(arg) /* not supported on IAR */ + +#define PROGMEM __flash +#define USB_READ_FLASH(addr) (*(PROGMEM char *)(addr)) + +#ifndef __ASSEMBLER__ +static inline void cli(void) +{ + #asm("cli"); +} +static inline void sei(void) +{ + #asm("sei"); +} +#endif +#define _delay_ms(t) delay_ms(t) +#define _BV(x) (1 << (x)) +#define USB_CFG_USE_SWITCH_STATEMENT 1 /* macro for if() cascase fails for unknown reason */ + +#define macro .macro +#define endm .endmacro +#define nop2 rjmp .+0 /* jump to next instruction */ + +/* ------------------------------------------------------------------------- */ +#else /* default development environment is avr-gcc/avr-libc */ +/* ------------------------------------------------------------------------- */ + +#include +#ifdef __ASSEMBLER__ +# define _VECTOR(N) __vector_ ## N /* io.h does not define this for asm */ +#else +# include +#endif + +#if USB_CFG_DRIVER_FLASH_PAGE +# define USB_READ_FLASH(addr) pgm_read_byte_far(((long)USB_CFG_DRIVER_FLASH_PAGE << 16) | (long)(addr)) +#else +# define USB_READ_FLASH(addr) pgm_read_byte(addr) +#endif + +#define macro .macro +#define endm .endm +#define nop2 rjmp .+0 /* jump to next instruction */ + +#endif /* development environment */ + +/* for conveniecne, ensure that PRG_RDB exists */ +#ifndef PRG_RDB +# define PRG_RDB(addr) USB_READ_FLASH(addr) +#endif +#endif /* __usbportability_h_INCLUDED__ */ diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbtest.c b/trunk/AVRProjects/ATTiny2313-usb/usbtest.c new file mode 100644 index 00000000..1c42cda0 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313-usb/usbtest.c @@ -0,0 +1,168 @@ +/** + * Project: AVR ATtiny USB Tutorial at http://codeandlife.com/ + * Author: Joonas Pihlajamaa, joonas.pihlajamaa@iki.fi + * Based on V-USB example code by Christian Starkjohann + * Copyright: (C) 2012 by Joonas Pihlajamaa + * License: GNU GPL v3 (see License.txt) + */ +#include +#include +#include + +// this is libusb, see http://libusb.sourceforge.net/ +#include + +// same as in main.c +#define USB_LED_OFF 0 +#define USB_LED_ON 1 +#define USB_DATA_OUT 2 +#define USB_DATA_WRITE 3 +#define USB_DATA_IN 4 + +// used to get descriptor strings for device identification +static int usbGetDescriptorString(usb_dev_handle *dev, int index, int langid, + char *buf, int buflen) { + char buffer[256]; + int rval, i; + + // make standard request GET_DESCRIPTOR, type string and given index + // (e.g. dev->iProduct) + rval = usb_control_msg(dev, + USB_TYPE_STANDARD | USB_RECIP_DEVICE | USB_ENDPOINT_IN, + USB_REQ_GET_DESCRIPTOR, (USB_DT_STRING << 8) + index, langid, + buffer, sizeof(buffer), 1000); + + if(rval < 0) // error + return rval; + + // rval should be bytes read, but buffer[0] contains the actual response size + if((unsigned char)buffer[0] < rval) + rval = (unsigned char)buffer[0]; // string is shorter than bytes read + + if(buffer[1] != USB_DT_STRING) // second byte is the data type + return 0; // invalid return type + + // we're dealing with UTF-16LE here so actual chars is half of rval, + // and index 0 doesn't count + rval /= 2; + + // lossy conversion to ISO Latin1 + for(i = 1; i < rval && i < buflen; i++) { + if(buffer[2 * i + 1] == 0) + buf[i-1] = buffer[2 * i]; + else + buf[i-1] = '?'; // outside of ISO Latin1 range + } + buf[i-1] = 0; + + return i-1; +} + +static usb_dev_handle * usbOpenDevice(int vendor, char *vendorName, + int product, char *productName) { + struct usb_bus *bus; + struct usb_device *dev; + char devVendor[256], devProduct[256]; + + usb_dev_handle * handle = NULL; + + usb_init(); + usb_find_busses(); + usb_find_devices(); + + for(bus=usb_get_busses(); bus; bus=bus->next) { + for(dev=bus->devices; dev; dev=dev->next) { + if(dev->descriptor.idVendor != vendor || + dev->descriptor.idProduct != product) + continue; + + // we need to open the device in order to query strings + if(!(handle = usb_open(dev))) { + fprintf(stderr, "Warning: cannot open USB device: %s\n", + usb_strerror()); + continue; + } + + // get vendor name + if(usbGetDescriptorString(handle, dev->descriptor.iManufacturer, 0x0409, devVendor, sizeof(devVendor)) < 0) { + fprintf(stderr, + "Warning: cannot query manufacturer for device: %s\n", + usb_strerror()); + usb_close(handle); + continue; + } + + // get product name + if(usbGetDescriptorString(handle, dev->descriptor.iProduct, + 0x0409, devProduct, sizeof(devVendor)) < 0) { + fprintf(stderr, + "Warning: cannot query product for device: %s\n", + usb_strerror()); + usb_close(handle); + continue; + } + + if(strcmp(devVendor, vendorName) == 0 && + strcmp(devProduct, productName) == 0) + return handle; + else + usb_close(handle); + } + } + + return NULL; +} + +int main(int argc, char **argv) { + usb_dev_handle *handle = NULL; + int nBytes = 0; + char buffer[256]; + + if(argc < 2) { + printf("Usage:\n"); + printf("usbtext.exe on\n"); + printf("usbtext.exe off\n"); + printf("usbtext.exe out\n"); + printf("usbtext.exe write\n"); + printf("usbtext.exe in \n"); + exit(1); + } + + handle = usbOpenDevice(0x16C0, "codeandlife.com", 0x05DC, "USBexample"); + + if(handle == NULL) { + fprintf(stderr, "Could not find USB device!\n"); + exit(1); + } + + if(strcmp(argv[1], "on") == 0) { + nBytes = usb_control_msg(handle, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, + USB_LED_ON, 0, 0, (char *)buffer, sizeof(buffer), 5000); + } else if(strcmp(argv[1], "off") == 0) { + nBytes = usb_control_msg(handle, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, + USB_LED_OFF, 0, 0, (char *)buffer, sizeof(buffer), 5000); + } else if(strcmp(argv[1], "out") == 0) { + nBytes = usb_control_msg(handle, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, + USB_DATA_OUT, 0, 0, (char *)buffer, sizeof(buffer), 5000); + printf("Got %d bytes: %s\n", nBytes, buffer); + } else if(strcmp(argv[1], "write") == 0) { + nBytes = usb_control_msg(handle, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_IN, + USB_DATA_WRITE, 'T' + ('E' << 8), 'S' + ('T' << 8), + (char *)buffer, sizeof(buffer), 5000); + } else if(strcmp(argv[1], "in") == 0 && argc > 2) { + nBytes = usb_control_msg(handle, + USB_TYPE_VENDOR | USB_RECIP_DEVICE | USB_ENDPOINT_OUT, + USB_DATA_IN, 0, 0, argv[2], strlen(argv[2])+1, 5000); + } + + if(nBytes < 0) + fprintf(stderr, "USB error: %s\n", usb_strerror()); + + usb_close(handle); + + return 0; +} diff --git a/trunk/AVRProjects/ATTiny2313-usb/usbtest.exe b/trunk/AVRProjects/ATTiny2313-usb/usbtest.exe new file mode 100644 index 00000000..1bf4b641 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313-usb/usbtest.exe differ diff --git a/trunk/AVRProjects/ATTiny2313/.dep/main.o.d b/trunk/AVRProjects/ATTiny2313/.dep/main.o.d new file mode 100644 index 00000000..58825681 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/.dep/main.o.d @@ -0,0 +1,37 @@ +main.o: main.c \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/io.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/sfr_defs.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/inttypes.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/stdint.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/iotn2313.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/portpins.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/common.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/version.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/fuse.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/lock.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/util/delay.h \ + c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/util/delay_basic.h + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/io.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/sfr_defs.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/inttypes.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/stdint.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/iotn2313.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/portpins.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/common.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/version.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/fuse.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/avr/lock.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/util/delay.h: + +c:/program\ files/winavr-20100110/lib/gcc/../../avr/include/util/delay_basic.h: diff --git a/trunk/AVRProjects/ATTiny2313/main.c b/trunk/AVRProjects/ATTiny2313/main.c new file mode 100644 index 00000000..ef303b0b --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.c @@ -0,0 +1,41 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ +/* ******************************************************** * + ATtiny 2313/4313 Pin map + +-\/-+ + /Reset PA2 1|o |20 Vcc + RXD PD0 2| |19 PB7 SCK + TXD PD1 3| |18 PB6 MISO + PA1 4| |17 PB5 MOSI + PA0 5| |16 PB4 OC1B + PD2 6| |15 PB3 OC1A + PD3 7| |14 PB2 OC0A + PD4 8| |13 PB1 AIN1 + OC0B PD5 9| |12 PB0 AIN0 + GND 10| |11 PD6 + +----+ +* ******************************************************** */ + +//#define F_CPU = 8000000 +#include +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000001; + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + PORTB = zwischenspeicher; + _delay_ms(500); + } + return 0; +} + diff --git a/trunk/AVRProjects/ATTiny2313/main.eep b/trunk/AVRProjects/ATTiny2313/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATTiny2313/main.elf b/trunk/AVRProjects/ATTiny2313/main.elf new file mode 100644 index 00000000..da3c0533 Binary files /dev/null and b/trunk/AVRProjects/ATTiny2313/main.elf differ diff --git a/trunk/AVRProjects/ATTiny2313/main.hex b/trunk/AVRProjects/ATTiny2313/main.hex new file mode 100644 index 00000000..7ea9cca2 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.hex @@ -0,0 +1,7 @@ +:1000000012C017C016C015C014C013C012C011C052 +:1000100010C00FC00EC00DC00CC00BC00AC009C07C +:1000200008C007C006C011241FBECFEDCDBF02D04F +:1000300011C0E6CF81E087BB41E029E130E088B321 +:10004000842788BB88E893E1F9013197F1F701979C +:08005000D9F7F5CFF894FFCFBA +:00000001FF diff --git a/trunk/AVRProjects/ATTiny2313/main.lss b/trunk/AVRProjects/ATTiny2313/main.lss new file mode 100644 index 00000000..3e9e2d2a --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.lss @@ -0,0 +1,119 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 00000058 00000000 00000000 00000054 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .debug_aranges 00000020 00000000 00000000 000000ac 2**0 + CONTENTS, READONLY, DEBUGGING + 2 .debug_pubnames 0000001b 00000000 00000000 000000cc 2**0 + CONTENTS, READONLY, DEBUGGING + 3 .debug_info 0000011f 00000000 00000000 000000e7 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_abbrev 000000c1 00000000 00000000 00000206 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_line 00000150 00000000 00000000 000002c7 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_frame 00000020 00000000 00000000 00000418 2**2 + CONTENTS, READONLY, DEBUGGING + 7 .debug_str 000000c7 00000000 00000000 00000438 2**0 + CONTENTS, READONLY, DEBUGGING + 8 .debug_loc 0000003b 00000000 00000000 000004ff 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_ranges 00000048 00000000 00000000 0000053a 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 12 c0 rjmp .+36 ; 0x26 <__ctors_end> + 2: 17 c0 rjmp .+46 ; 0x32 <__bad_interrupt> + 4: 16 c0 rjmp .+44 ; 0x32 <__bad_interrupt> + 6: 15 c0 rjmp .+42 ; 0x32 <__bad_interrupt> + 8: 14 c0 rjmp .+40 ; 0x32 <__bad_interrupt> + a: 13 c0 rjmp .+38 ; 0x32 <__bad_interrupt> + c: 12 c0 rjmp .+36 ; 0x32 <__bad_interrupt> + e: 11 c0 rjmp .+34 ; 0x32 <__bad_interrupt> + 10: 10 c0 rjmp .+32 ; 0x32 <__bad_interrupt> + 12: 0f c0 rjmp .+30 ; 0x32 <__bad_interrupt> + 14: 0e c0 rjmp .+28 ; 0x32 <__bad_interrupt> + 16: 0d c0 rjmp .+26 ; 0x32 <__bad_interrupt> + 18: 0c c0 rjmp .+24 ; 0x32 <__bad_interrupt> + 1a: 0b c0 rjmp .+22 ; 0x32 <__bad_interrupt> + 1c: 0a c0 rjmp .+20 ; 0x32 <__bad_interrupt> + 1e: 09 c0 rjmp .+18 ; 0x32 <__bad_interrupt> + 20: 08 c0 rjmp .+16 ; 0x32 <__bad_interrupt> + 22: 07 c0 rjmp .+14 ; 0x32 <__bad_interrupt> + 24: 06 c0 rjmp .+12 ; 0x32 <__bad_interrupt> + +00000026 <__ctors_end>: + 26: 11 24 eor r1, r1 + 28: 1f be out 0x3f, r1 ; 63 + 2a: cf ed ldi r28, 0xDF ; 223 + 2c: cd bf out 0x3d, r28 ; 61 + 2e: 02 d0 rcall .+4 ; 0x34
+ 30: 11 c0 rjmp .+34 ; 0x54 <_exit> + +00000032 <__bad_interrupt>: + 32: e6 cf rjmp .-52 ; 0x0 <__vectors> + +00000034
: +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRA = 0b00000001; + 34: 81 e0 ldi r24, 0x01 ; 1 + 36: 8a bb out 0x1a, r24 ; 26 + while(1) + { + zwischenspeicher = PORTA; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + 38: 41 e0 ldi r20, 0x01 ; 1 + milliseconds can be achieved. + */ +void +_delay_loop_2(uint16_t __count) +{ + __asm__ volatile ( + 3a: 29 e1 ldi r18, 0x19 ; 25 + 3c: 30 e0 ldi r19, 0x00 ; 0 +{ + unsigned char zwischenspeicher; + DDRA = 0b00000001; + while(1) + { + zwischenspeicher = PORTA; + 3e: 8b b3 in r24, 0x1b ; 27 + zwischenspeicher = zwischenspeicher ^ 0b00000001; + 40: 84 27 eor r24, r20 + PORTA = zwischenspeicher; + 42: 8b bb out 0x1b, r24 ; 27 + 44: 88 e8 ldi r24, 0x88 ; 136 + 46: 93 e1 ldi r25, 0x13 ; 19 + 48: f9 01 movw r30, r18 + 4a: 31 97 sbiw r30, 0x01 ; 1 + 4c: f1 f7 brne .-4 ; 0x4a <__SREG__+0xb> + __ticks = (uint16_t) (__ms * 10.0); + while(__ticks) + { + // wait 1/10 ms + _delay_loop_2(((F_CPU) / 4e3) / 10); + __ticks --; + 4e: 01 97 sbiw r24, 0x01 ; 1 + __ticks = 1; + else if (__tmp > 65535) + { + // __ticks = requested delay in 1/10 ms + __ticks = (uint16_t) (__ms * 10.0); + while(__ticks) + 50: d9 f7 brne .-10 ; 0x48 <__SREG__+0x9> + 52: f5 cf rjmp .-22 ; 0x3e <__SP_H__> + +00000054 <_exit>: + 54: f8 94 cli + +00000056 <__stop_program>: + 56: ff cf rjmp .-2 ; 0x56 <__stop_program> diff --git a/trunk/AVRProjects/ATTiny2313/main.lst b/trunk/AVRProjects/ATTiny2313/main.lst new file mode 100644 index 00000000..8fe8212c --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.lst @@ -0,0 +1,77 @@ + 1 .file "main.c" + 2 __SREG__ = 0x3f + 3 __SP_H__ = 0x3e + 4 __SP_L__ = 0x3d + 5 __CCP__ = 0x34 + 6 __tmp_reg__ = 0 + 7 __zero_reg__ = 1 + 15 .Ltext0: + 16 .global main + 18 main: + 19 .LFB6: + 20 .LM1: + 21 /* prologue: function */ + 22 /* frame size = 0 */ + 23 .LM2: + 24 0000 81E0 ldi r24,lo8(1) + 25 0002 87BB out 55-32,r24 + 26 .LM3: + 27 0004 41E0 ldi r20,lo8(1) + 28 .LBB12: + 29 .LBB13: + 30 .LBB14: + 31 .LBB15: + 32 .LM4: + 33 0006 29E1 ldi r18,lo8(25) + 34 0008 30E0 ldi r19,hi8(25) + 35 .LVL0: + 36 .L3: + 37 .LBE15: + 38 .LBE14: + 39 .LBE13: + 40 .LBE12: + 41 .LM5: + 42 000a 88B3 in r24,56-32 + 43 .LVL1: + 44 .LM6: + 45 000c 8427 eor r24,r20 + 46 .LM7: + 47 000e 88BB out 56-32,r24 + 48 0010 88E8 ldi r24,lo8(5000) + 49 0012 93E1 ldi r25,hi8(5000) + 50 .LVL2: + 51 .L2: + 52 .LBB19: + 53 .LBB18: + 54 .LBB17: + 55 .LBB16: + 56 .LM8: + 57 0014 F901 movw r30,r18 + 58 /* #APP */ + 59 ; 105 "c:/program files/winavr-20100110/lib/gcc/../../avr/include/util/delay_basic.h" 1 + 60 0016 3197 1: sbiw r30,1 + 61 0018 01F4 brne 1b + 62 ; 0 "" 2 + 63 /* #NOAPP */ + 64 .LBE16: + 65 .LBE17: + 66 .LM9: + 67 001a 0197 sbiw r24,1 + 68 .LM10: + 69 001c 01F4 brne .L2 + 70 001e 00C0 rjmp .L3 + 71 .LBE18: + 72 .LBE19: + 73 .LFE6: + 99 .Letext0: +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:2 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:3 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:4 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:5 *ABS*:00000034 __CCP__ +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:6 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:7 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp/cctiMnOb.s:18 .text:00000000 main + +NO UNDEFINED SYMBOLS diff --git a/trunk/AVRProjects/ATTiny2313/main.map b/trunk/AVRProjects/ATTiny2313/main.map new file mode 100644 index 00000000..8ffa1941 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.map @@ -0,0 +1,378 @@ +Archive member included because of file (symbol) + +c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00002000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +LOAD c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +LOAD main.o +LOAD c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25\libm.a +LOAD c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a +LOAD c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25\libc.a +LOAD c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x58 + *(.vectors) + .vectors 0x00000000 0x26 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + 0x00000000 __vectors + 0x00000000 __vector_default + *(.vectors) + *(.progmem.gcc*) + *(.progmem*) + 0x00000026 . = ALIGN (0x2) + 0x00000026 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000026 0x0 linker stubs + *(.trampolines*) + 0x00000026 __trampolines_end = . + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000026 __ctors_start = . + *(.ctors) + 0x00000026 __ctors_end = . + 0x00000026 __dtors_start = . + *(.dtors) + 0x00000026 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000026 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + 0x00000026 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000026 0x8 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x0000002e 0x4 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + *(.init9) + *(.text) + .text 0x00000032 0x2 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + 0x00000032 __vector_1 + 0x00000032 __vector_12 + 0x00000032 __bad_interrupt + 0x00000032 __vector_6 + 0x00000032 __vector_3 + 0x00000032 __vector_11 + 0x00000032 __vector_13 + 0x00000032 __vector_17 + 0x00000032 __vector_7 + 0x00000032 __vector_5 + 0x00000032 __vector_4 + 0x00000032 __vector_9 + 0x00000032 __vector_2 + 0x00000032 __vector_15 + 0x00000032 __vector_8 + 0x00000032 __vector_14 + 0x00000032 __vector_10 + 0x00000032 __vector_16 + 0x00000032 __vector_18 + .text 0x00000034 0x20 main.o + 0x00000034 main + .text 0x00000054 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + 0x00000054 . = ALIGN (0x2) + *(.text.*) + .text.libgcc 0x00000054 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + 0x00000054 . = ALIGN (0x2) + *(.fini9) + .fini9 0x00000054 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + 0x00000054 exit + 0x00000054 _exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x00000054 0x4 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + *(.fini0) + 0x00000058 _etext = . + +.data 0x00800060 0x0 load address 0x00000058 + 0x00800060 PROVIDE (__data_start, .) + *(.data) + .data 0x00800060 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + .data 0x00800060 0x0 main.o + .data 0x00800060 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800060 . = ALIGN (0x2) + 0x00800060 _edata = . + 0x00800060 PROVIDE (__data_end, .) + +.bss 0x00800060 0x0 + 0x00800060 PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800060 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o + .bss 0x00800060 0x0 main.o + .bss 0x00800060 0x0 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + 0x00800060 PROVIDE (__bss_end, .) + 0x00000058 __data_load_start = LOADADDR (.data) + 0x00000058 __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800060 0x0 + 0x00800060 PROVIDE (__noinit_start, .) + *(.noinit*) + 0x00800060 PROVIDE (__noinit_end, .) + 0x00800060 _end = . + 0x00800060 PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment + *(.comment) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x20 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 main.o + +.debug_pubnames + 0x00000000 0x1b + *(.debug_pubnames) + .debug_pubnames + 0x00000000 0x1b main.o + +.debug_info 0x00000000 0x11f + *(.debug_info) + .debug_info 0x00000000 0x11f main.o + *(.gnu.linkonce.wi.*) + +.debug_abbrev 0x00000000 0xc1 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0xc1 main.o + +.debug_line 0x00000000 0x150 + *(.debug_line) + .debug_line 0x00000000 0x150 main.o + +.debug_frame 0x00000000 0x20 + *(.debug_frame) + .debug_frame 0x00000000 0x20 main.o + +.debug_str 0x00000000 0xc7 + *(.debug_str) + .debug_str 0x00000000 0xc7 main.o + 0xfb (size before relaxing) + +.debug_loc 0x00000000 0x3b + *(.debug_loc) + .debug_loc 0x00000000 0x3b main.o + +.debug_macinfo + *(.debug_macinfo) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +.debug_ranges 0x00000000 0x48 + .debug_ranges 0x00000000 0x48 main.o + +Cross Reference Table + +Symbol File +__bad_interrupt c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__heap_end c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__init c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__stack c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_1 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_10 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_11 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_12 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_13 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_14 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_15 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_16 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_17 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_18 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_2 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_3 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_4 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_5 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_6 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_7 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_8 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_9 c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vector_default c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +__vectors c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +_exit c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) +exit c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/avr25\libgcc.a(_exit.o) + c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o +main main.o + c:/program files/winavr-20100110/bin/../lib/gcc/avr/4.3.3/../../../../avr/lib/avr25/crttn2313.o diff --git a/trunk/AVRProjects/ATTiny2313/main.sym b/trunk/AVRProjects/ATTiny2313/main.sym new file mode 100644 index 00000000..88b359d4 --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/main.sym @@ -0,0 +1,46 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +00000026 T __ctors_end +00000026 T __ctors_start +00000026 T __dtors_end +00000026 T __dtors_start +00000026 W __init +00000026 T __trampolines_end +00000026 T __trampolines_start +00000032 T __bad_interrupt +00000032 W __vector_1 +00000032 W __vector_10 +00000032 W __vector_11 +00000032 W __vector_12 +00000032 W __vector_13 +00000032 W __vector_14 +00000032 W __vector_15 +00000032 W __vector_16 +00000032 W __vector_17 +00000032 W __vector_18 +00000032 W __vector_2 +00000032 W __vector_3 +00000032 W __vector_4 +00000032 W __vector_5 +00000032 W __vector_6 +00000032 W __vector_7 +00000032 W __vector_8 +00000032 W __vector_9 +00000034 a __CCP__ +00000034 T main +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003f a __SREG__ +00000054 T _exit +00000054 W exit +00000056 t __stop_program +00000058 A __data_load_end +00000058 A __data_load_start +00000058 T _etext +000000df W __stack +00800060 T _edata +00800060 N _end +00810000 N __eeprom_end diff --git a/trunk/AVRProjects/ATTiny2313/makefile b/trunk/AVRProjects/ATTiny2313/makefile new file mode 100644 index 00000000..d3d8993d --- /dev/null +++ b/trunk/AVRProjects/ATTiny2313/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny2313 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 1000000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.avr b/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.avr new file mode 100644 index 00000000..dc26f917 --- /dev/null +++ b/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.avr @@ -0,0 +1,40 @@ +;* ******************************************************** * +; ATtiny 13/45/85 Pin map +; +-\/-+ +; /Reset ADC0 PB5 1|o |8 Vcc +; ADC3 PB3 2| |7 PB2 ADC1 SCK +; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 +; GND 4| |5 PB0 OC0A MOSI AIN0 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny45 + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ;Reset + reti ;INT0 - External Int0 Vector + reti ;PCINT0 - Pin Change Interrupt handler + reti ;TIM1_COMPA - Timer1 Compare match A Handler + reti ;TIM1_OVF - Timer1 Overflow handler + reti ;TIM0_OVF - Timer0 Overflow handler + reti ;EE_RDY - EEPROM Ready Handler + reti ;ANA_COMP - Analog Comparator Handler + reti ;ADC - ADC Conversion Handler + reti ;TIM1_COMPB - Timer1 Compare match B Handler + reti ;TIM0_COMPA - Timer0 Compare match A Handler + reti ;TIM0_COMPB - Timer0 Compare match B Handler + reti ;WDT - Watchdog Overflow Handler + reti ;USI_START - USI Start + reti ;USI_OVF - USI Overflow + +.ORG $000F +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.hex b/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.hex new file mode 100644 index 00000000..b7212ee5 --- /dev/null +++ b/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.hex @@ -0,0 +1,5 @@ +:020000020000FC +:100000000EC0189518951895189518951895189567 +:100010001895189518951895189518951895F89499 +:060020000FE50DBFFFCF4C +:00000001FF diff --git a/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.lst b/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.lst new file mode 100644 index 00000000..fb6ad6f4 --- /dev/null +++ b/trunk/AVRProjects/ATTiny45-primo_asm/tiny45_primo.lst @@ -0,0 +1,55 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny45_primo.avr +Hex file: tiny45_primo.hex +Eeprom file: tiny45_primo.eep +Compiled: 26.07.2016, 11:33:17 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 13/45/85 Pin map + 3: ; +-\/-+ + 4: ; /Reset ADC0 PB5 1|o |8 Vcc + 5: ; ADC3 PB3 2| |7 PB2 ADC1 SCK + 6: ; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + 7: ; GND 4| |5 PB0 OC0A MOSI AIN0 + 8: ; +----+ + 9: ;* ******************************************************** */ + 10: + 11: ; Define processor type on top of the source code + 12: ; + 13: .DEVICE ATtiny45 + 14: + 15: ; Int-Vector area + 16: .CSEG + 17: .ORG $0000 + 18: 000000 C00E rjmp Setup ;Reset + 19: 000001 9518 reti ;INT0 - External Int0 Vector + 20: 000002 9518 reti ;PCINT0 - Pin Change Interrupt handler + 21: 000003 9518 reti ;TIM1_COMPA - Timer1 Compare match A Handler + 22: 000004 9518 reti ;TIM1_OVF - Timer1 Overflow handler + 23: 000005 9518 reti ;TIM0_OVF - Timer0 Overflow handler + 24: 000006 9518 reti ;EE_RDY - EEPROM Ready Handler + 25: 000007 9518 reti ;ANA_COMP - Analog Comparator Handler + 26: 000008 9518 reti ;ADC - ADC Conversion Handler + 27: 000009 9518 reti ;TIM1_COMPB - Timer1 Compare match B Handler + 28: 00000A 9518 reti ;TIM0_COMPA - Timer0 Compare match A Handler + 29: 00000B 9518 reti ;TIM0_COMPB - Timer0 Compare match B Handler + 30: 00000C 9518 reti ;WDT - Watchdog Overflow Handler + 31: 00000D 9518 reti ;USI_START - USI Start + 32: 00000E 9518 reti ;USI_OVF - USI Overflow + 33: + 34: .ORG $000F + 35: Setup: + 36: 00000F 94F8 cli ; Disable Interrupts + 37: 000010 E50F ldi r16, low(RAMEND) + 38: 000011 BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 39: Main: + 40: 000012 CFFF rjmp Main ; infinite loop + +Program : 19 words. +Constants : 0 words. +Total program memory: 19 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 26.07.2016, 11:33:17 diff --git a/trunk/AVRProjects/ATTiny84/.dep/main.o.d b/trunk/AVRProjects/ATTiny84/.dep/main.o.d new file mode 100644 index 00000000..978e11e0 --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/.dep/main.o.d @@ -0,0 +1,49 @@ +main.o: main.c \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotn84.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotnx4.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h \ + ../00_Lib/nokia_5110.h + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotn84.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotnx4.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: + +../00_Lib/nokia_5110.h: diff --git a/trunk/AVRProjects/ATTiny84/.dep/nokia_5110.o.d b/trunk/AVRProjects/ATTiny84/.dep/nokia_5110.o.d new file mode 100644 index 00000000..f3989687 --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/.dep/nokia_5110.o.d @@ -0,0 +1,49 @@ +../00_Lib/nokia_5110.o: ../00_Lib/nokia_5110.c \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotn84.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotnx4.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h \ + ../00_Lib/nokia_5110.h + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotn84.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotnx4.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: + +../00_Lib/nokia_5110.h: diff --git a/trunk/AVRProjects/ATTiny84/main.c b/trunk/AVRProjects/ATTiny84/main.c new file mode 100644 index 00000000..4ffe8a1f --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.c @@ -0,0 +1,72 @@ +/* ******************************************************** * + * * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 * + * Author: Paolo Iocco * + * ******************************************************** */ +/* ******************************************************** * + ATtiny 84 Pin map + +-\/-+ + GND 1|o |14 GND + PB0 2| |13 PA0 ADC0 + PB1 3| |12 PA1 ADC1 + /Reset PB3 4| |11 PA2 ADC2 + PB2 5| |10 PA3 ADC3 + ADC7 PA7 6| |9 PA4 ADC4 SCK + MOSI ADC6 PA6 7| |8 PA5 ADC5 MISO + +----+ +* ******************************************************** */ + +#define F_CPU 1000000L +#define CONFIG_DISPLAY + +#define __DELAY_BACKWARD_COMPATIBLE__ +#include +#include +#include "../00_Lib/nokia_5110.h" + + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000001; + DDRA = 0b00011111; + + LCD_init(); //LCD initialization + LCD_clear(); //clear the LCD + + LCD_write_char('*'); + LCD_write_byte(0,1); + LCD_write_byte(0,1); + LCD_write_char('L'); + LCD_write_char('o'); + LCD_write_char('v'); + LCD_write_char('e'); + LCD_write_byte(0,1); + LCD_write_byte(0,1); + LCD_write_byte(0,1); + LCD_write_byte(0,1); + LCD_write_byte(0,1); + LCD_write_char('S'); + LCD_write_char('i'); + LCD_write_char('l'); + LCD_write_char('v'); + LCD_write_char('i'); + LCD_write_char('a'); + LCD_write_byte(0,1); + LCD_write_byte(0,1); + LCD_write_char('*'); + + LCD_write_english_string(0,1,"LOVE"); + + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + PORTB = zwischenspeicher; + _delay_ms(500); + } + return 0; +} + diff --git a/trunk/AVRProjects/ATTiny84/main.eep b/trunk/AVRProjects/ATTiny84/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATTiny84/main.elf b/trunk/AVRProjects/ATTiny84/main.elf new file mode 100644 index 00000000..a8efd3f7 Binary files /dev/null and b/trunk/AVRProjects/ATTiny84/main.elf differ diff --git a/trunk/AVRProjects/ATTiny84/main.hex b/trunk/AVRProjects/ATTiny84/main.hex new file mode 100644 index 00000000..3fa30d67 --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.hex @@ -0,0 +1,132 @@ +:1000000010C022C021C020C01FC01EC01DC01CC007 +:100010001BC01AC019C018C017C016C015C014C024 +:1000200013C011241FBECFE5D2E0DEBFCDBF12E06A +:10003000A0E6B0E0ECEFF5E002C005900D92AE381E +:10004000B107D9F72BD1D8C2DBCF81E08A95F1F780 +:1000500008958AEF90E00197F1F708958F929F92AB +:10006000AF92BF92CF92DF92EF92FF92BC0180E0FD +:1000700090E090D14B015C0120E030E04AE753E48E +:1000800017D26B017C0120E030E040E85FE352D101 +:1000900087FD20C020E03FEF4FE757E4C701B601DE +:1000A00003D218169CF420E030E040E251E4C50190 +:1000B000B401FED143D129E130E06115710579F039 +:1000C000C9010197F1F761507109F7CFC701B60176 +:1000D00035D102C061E070E0CB010197F1F7FF90EC +:1000E000EF90DF90CF90BF90AF909F908F9008954A +:1000F000DB98611102C0DA9801C0DA9A98E087FFB4 +:1001000002C0D99A01C0D998D898880FD89A91502E +:10011000B1F7DB9A0895CF93DF9360E08CE0E8DFDE +:1001200060E080E8E5DFC8EFD1E061E080E0E0DF9B +:100130002197D9F7DF91CF9108958AB38F618ABB58 +:10014000DC9883DFDC9ADB9880DFDB9A7EDF60E07F +:1001500081E2CEDF60E088ECCBDF60E086E0C8DFE4 +:1001600060E083E1C5DF60E080E2C2DFD4DF60E011 +:100170008CE0BEDFDB980895CF93C82F862F60E018 +:100180008064B6DF60E08C2F8068CF91B1CF0F9391 +:100190001F93CF93DF93805290E066E070E01BD214 +:1001A0008C01005A1F4FC0E0D0E0F801EC0FFD1F9A +:1001B00061E080819DDF2196C630D105B1F7DF91E6 +:1001C000CF911F910F9108950F931F93CF93DF93BA +:1001D00000D0CDB7DEB749835A83CEDF4981042FE3 +:1001E0005A81152FF80181918F01882311F0CFDFFB +:1001F000F9CF0F900F90DF91CF911F910F9108953C +:100200006F927F928F929F92AF92BF92CF92DF9226 +:10021000EF92FF920F931F93CF93DF93682E762E6A +:10022000802F877006950695069581110F5FC22E67 +:10023000D12CEA01AA24BB24A41AB50AE12CF12C82 +:1002400010E0672D6E0DE016F106B8F4862D94DFF0 +:100250004E0194012A0D3B1D2C153D0530F461E043 +:10026000F40181914F0144DFF4CFFFEFEF1AFF0A51 +:10027000CC0DDD1DAC18BD08E4CFDF91CF911F91EF +:100280000F91FF90EF90DF90CF90BF90AF909F9035 +:100290008F907F906F9008950895089581E087BBB7 +:1002A0008FE18ABB4ADF37DF8AE271DF61E080E0FD +:1002B0001FDF61E080E01CDF8CE469DF8FE667DF31 +:1002C00086E765DF85E663DF61E080E011DF61E0FE +:1002D00080E00EDF61E080E00BDF61E080E008DFBE +:1002E00061E080E005DF83E552DF89E650DF8CE6E0 +:1002F0004EDF86E74CDF89E64ADF81E648DF61E0D2 +:1003000080E0F6DE61E080E0F3DE8AE240DF48E88C +:1003100052E061E080E058DF41E029E130E088B35D +:10032000842788BB88E893E1F9013197F1F70197B9 +:10033000D9F7F5CF6CD008F481E0089594D088F017 +:100340009F5790F0B92F9927B751A0F0D1F0660FC1 +:10035000771F881F991F1AF0BA95C9F712C0B130DC +:1003600081F09BD0B1E0089598C0672F782F88273F +:10037000B85F39F0B93FCCF3869577956795B3951B +:10038000D9F73EF490958095709561957F4F8F4F8A +:100390009F4F0895E89409C097FB3EF4909580958F +:1003A000709561957F4F8F4F9F4F9923A9F0F92F3B +:1003B00096E9BB279395F695879577956795B795B9 +:1003C000F111F8CFFAF4BB0F11F460FF1BC06F5F9F +:1003D0007F4F8F4F9F4F16C0882311F096E911C0B1 +:1003E000772321F09EE8872F762F05C0662371F0D2 +:1003F00096E8862F70E060E02AF09A95660F771FE6 +:10040000881FDAF7880F9695879597F90895990FC1 +:100410000008550FAA0BE0E8FEEF16161706E807CE +:10042000F907C0F012161306E407F50798F0621BEF +:10043000730B840B950B39F40A2661F0232B242BC4 +:10044000252B21F408950A2609F4A140A6958FEFE3 +:10045000811D811D089557FD9058440F551F59F077 +:100460005F3F71F04795880F97FB991F61F09F3FA1 +:1004700079F087950895121613061406551FF2CFCA +:100480004695F1DF08C0161617061806991FF1CF1A +:1004900086957105610508940895E894BB27662741 +:1004A0007727CB0197F90895B2DF08F48FEF08950D +:1004B0000AD080C071D028F076D018F0952309F0CA +:1004C00062C067C0EBCFC7DFA8F39923D9F35523E8 +:1004D000C9F3950F50E0551FAA27EE27FF27BB272A +:1004E00000240894679520F4E20FF31FB41F0A1E3E +:1004F000220F331F441FAA1F6695A9F7779530F482 +:10050000F30FB41F0A1E121E08F46395330F441F25 +:10051000AA1F221F769599F7879520F4B40F0A1E1B +:10052000121E631F440FAA1F221F331F8695A9F7AF +:10053000862F712D602D11249F5750408AF0E1F0D5 +:1005400088234AF0EE0FFF1FBB1F661F771F881F0F +:1005500091505040A9F79E3F510570F014C09ECFB6 +:100560005F3FECF3983EDCF3869577956795B795FA +:10057000F795E7959F5FC1F7FE2B880F911D969524 +:10058000879597F9089597F99F6780E870E060E094 +:1005900008959FEF80EC089500240A94161617061C +:1005A00018060906089500240A9412161306140664 +:1005B00005060895092E0394000C11F4882352F0C7 +:1005C000BB0F40F4BF2B11F460FF04C06F5F7F4F7F +:1005D0008F4F9F4F08950024552704C0080E591FC0 +:1005E000880F991F009729F076956795B8F37105E4 +:0C05F000B9F7802D952F0895F894FFCFE7 +:1005FC000000000000000000002F000000000700B9 +:10060C00070000147F147F1400242A7F2A12006232 +:10061C0064081323003649552250000005030000DE +:10062C0000001C224100000041221C000014083E66 +:10063C0008140008083E0808000000A0600000082C +:10064C000808080800006060000000201008040280 +:10065C00003E5149453E0000427F4000004261513E +:10066C004946002141454B31001814127F100027D8 +:10067C0045454539003C4A4949300001710905039B +:10068C0000364949493600064949291E00003636CC +:10069C00000000005636000000081422410000142F +:1006AC00141414140000412214080002015109060C +:1006BC0000324959513E007C1211127C007F49498D +:1006CC004936003E41414122007F4141221C007FBE +:1006DC0049494941007F09090901003E4149497ACC +:1006EC00007F0808087F0000417F41000020404146 +:1006FC003F01007F08142241007F40404040007FB2 +:10070C00020C027F007F0408107F003E4141413EF5 +:10071C00007F09090906003E4151215E007F09193D +:10072C0029460046494949310001017F0101003F3A +:10073C004040403F001F2040201F003F4038403FBA +:10074C00006314081463000708700807006151491E +:10075C00454300007F41410000552A552A550000B1 +:10076C0041417F000004020102040040404040402F +:10077C00000001020400002054545478007F4844C7 +:10078C00443800384444442000384444487F0038FE +:10079C005454541800087E0901020018A4A4A47C27 +:1007AC00007F080404780000447D400000408084F1 +:1007BC007D00007F102844000000417F4000007C39 +:1007CC0004180478007C0804047800384444443845 +:1007DC0000FC242424180018242418FC007C080491 +:1007EC00040800485454542000043F444020003C6A +:1007FC004040207C001C2040201C003C4030403CF1 +:10080C00004428102844001CA0A0A07C0044645480 +:0E081C004C441414141414144C4F5645000090 +:00000001FF diff --git a/trunk/AVRProjects/ATTiny84/main.lss b/trunk/AVRProjects/ATTiny84/main.lss new file mode 100644 index 00000000..ba20d959 --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.lss @@ -0,0 +1,1151 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .text 000005fc 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 1 .data 0000022e 00800060 000005fc 00000670 2**0 + CONTENTS, ALLOC, LOAD, DATA + 2 .comment 00000011 00000000 00000000 0000089e 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000040 00000000 00000000 000008af 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000a93 00000000 00000000 000008ef 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 000003a3 00000000 00000000 00001382 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000002df 00000000 00000000 00001725 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 000001c8 00000000 00000000 00001a04 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 00000252 00000000 00000000 00001bcc 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 0000074c 00000000 00000000 00001e1e 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000058 00000000 00000000 0000256a 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 10 c0 rjmp .+32 ; 0x22 <__ctors_end> + 2: 22 c0 rjmp .+68 ; 0x48 <__bad_interrupt> + 4: 21 c0 rjmp .+66 ; 0x48 <__bad_interrupt> + 6: 20 c0 rjmp .+64 ; 0x48 <__bad_interrupt> + 8: 1f c0 rjmp .+62 ; 0x48 <__bad_interrupt> + a: 1e c0 rjmp .+60 ; 0x48 <__bad_interrupt> + c: 1d c0 rjmp .+58 ; 0x48 <__bad_interrupt> + e: 1c c0 rjmp .+56 ; 0x48 <__bad_interrupt> + 10: 1b c0 rjmp .+54 ; 0x48 <__bad_interrupt> + 12: 1a c0 rjmp .+52 ; 0x48 <__bad_interrupt> + 14: 19 c0 rjmp .+50 ; 0x48 <__bad_interrupt> + 16: 18 c0 rjmp .+48 ; 0x48 <__bad_interrupt> + 18: 17 c0 rjmp .+46 ; 0x48 <__bad_interrupt> + 1a: 16 c0 rjmp .+44 ; 0x48 <__bad_interrupt> + 1c: 15 c0 rjmp .+42 ; 0x48 <__bad_interrupt> + 1e: 14 c0 rjmp .+40 ; 0x48 <__bad_interrupt> + 20: 13 c0 rjmp .+38 ; 0x48 <__bad_interrupt> + +00000022 <__ctors_end>: + 22: 11 24 eor r1, r1 + 24: 1f be out 0x3f, r1 ; 63 + 26: cf e5 ldi r28, 0x5F ; 95 + 28: d2 e0 ldi r29, 0x02 ; 2 + 2a: de bf out 0x3e, r29 ; 62 + 2c: cd bf out 0x3d, r28 ; 61 + +0000002e <__do_copy_data>: + 2e: 12 e0 ldi r17, 0x02 ; 2 + 30: a0 e6 ldi r26, 0x60 ; 96 + 32: b0 e0 ldi r27, 0x00 ; 0 + 34: ec ef ldi r30, 0xFC ; 252 + 36: f5 e0 ldi r31, 0x05 ; 5 + 38: 02 c0 rjmp .+4 ; 0x3e <__SP_H__> + 3a: 05 90 lpm r0, Z+ + 3c: 0d 92 st X+, r0 + 3e: ae 38 cpi r26, 0x8E ; 142 + 40: b1 07 cpc r27, r17 + 42: d9 f7 brne .-10 ; 0x3a <__do_copy_data+0xc> + 44: 2b d1 rcall .+598 ; 0x29c
+ 46: d8 c2 rjmp .+1456 ; 0x5f8 <_exit> + +00000048 <__bad_interrupt>: + 48: db cf rjmp .-74 ; 0x0 <__vectors> + +0000004a : + can be achieved. +*/ +void +_delay_loop_1(uint8_t __count) +{ + __asm__ volatile ( + 4a: 81 e0 ldi r24, 0x01 ; 1 + 4c: 8a 95 dec r24 + 4e: f1 f7 brne .-4 ; 0x4c + 50: 08 95 ret + +00000052 : + milliseconds can be achieved. + */ +void +_delay_loop_2(uint16_t __count) +{ + __asm__ volatile ( + 52: 8a ef ldi r24, 0xFA ; 250 + 54: 90 e0 ldi r25, 0x00 ; 0 + 56: 01 97 sbiw r24, 0x01 ; 1 + 58: f1 f7 brne .-4 ; 0x56 + 5a: 08 95 ret + +0000005c : +{ + _delay_ms(1); +} + +void delay_nms(unsigned int n) //delay nms +{ + 5c: 8f 92 push r8 + 5e: 9f 92 push r9 + 60: af 92 push r10 + 62: bf 92 push r11 + 64: cf 92 push r12 + 66: df 92 push r13 + 68: ef 92 push r14 + 6a: ff 92 push r15 + _delay_ms(n); + 6c: bc 01 movw r22, r24 + 6e: 80 e0 ldi r24, 0x00 ; 0 + 70: 90 e0 ldi r25, 0x00 ; 0 + 72: 90 d1 rcall .+800 ; 0x394 <__floatunsisf> + 74: 4b 01 movw r8, r22 + 76: 5c 01 movw r10, r24 + + __builtin_avr_delay_cycles(__ticks_dc); + +#else + uint16_t __ticks; + __tmp = ((F_CPU) / 4e3) * __ms; + 78: 20 e0 ldi r18, 0x00 ; 0 + 7a: 30 e0 ldi r19, 0x00 ; 0 + 7c: 4a e7 ldi r20, 0x7A ; 122 + 7e: 53 e4 ldi r21, 0x43 ; 67 + 80: 17 d2 rcall .+1070 ; 0x4b0 <__mulsf3> + 82: 6b 01 movw r12, r22 + 84: 7c 01 movw r14, r24 + if (__tmp < 1.0) + 86: 20 e0 ldi r18, 0x00 ; 0 + 88: 30 e0 ldi r19, 0x00 ; 0 + 8a: 40 e8 ldi r20, 0x80 ; 128 + 8c: 5f e3 ldi r21, 0x3F ; 63 + 8e: 52 d1 rcall .+676 ; 0x334 <__cmpsf2> + 90: 87 fd sbrc r24, 7 + 92: 20 c0 rjmp .+64 ; 0xd4 + __ticks = 1; + else if (__tmp > 65535) + 94: 20 e0 ldi r18, 0x00 ; 0 + 96: 3f ef ldi r19, 0xFF ; 255 + 98: 4f e7 ldi r20, 0x7F ; 127 + 9a: 57 e4 ldi r21, 0x47 ; 71 + 9c: c7 01 movw r24, r14 + 9e: b6 01 movw r22, r12 + a0: 03 d2 rcall .+1030 ; 0x4a8 <__gesf2> + a2: 18 16 cp r1, r24 + a4: 9c f4 brge .+38 ; 0xcc + { + // __ticks = requested delay in 1/10 ms + __ticks = (uint16_t) (__ms * 10.0); + a6: 20 e0 ldi r18, 0x00 ; 0 + a8: 30 e0 ldi r19, 0x00 ; 0 + aa: 40 e2 ldi r20, 0x20 ; 32 + ac: 51 e4 ldi r21, 0x41 ; 65 + ae: c5 01 movw r24, r10 + b0: b4 01 movw r22, r8 + b2: fe d1 rcall .+1020 ; 0x4b0 <__mulsf3> + b4: 43 d1 rcall .+646 ; 0x33c <__fixunssfsi> + b6: 29 e1 ldi r18, 0x19 ; 25 + b8: 30 e0 ldi r19, 0x00 ; 0 + while(__ticks) + ba: 61 15 cp r22, r1 + bc: 71 05 cpc r23, r1 + be: 79 f0 breq .+30 ; 0xde + c0: c9 01 movw r24, r18 + c2: 01 97 sbiw r24, 0x01 ; 1 + c4: f1 f7 brne .-4 ; 0xc2 + { + // wait 1/10 ms + _delay_loop_2(((F_CPU) / 4e3) / 10); + __ticks --; + c6: 61 50 subi r22, 0x01 ; 1 + c8: 71 09 sbc r23, r1 + ca: f7 cf rjmp .-18 ; 0xba + } + return; + } + else + __ticks = (uint16_t)__tmp; + cc: c7 01 movw r24, r14 + ce: b6 01 movw r22, r12 + d0: 35 d1 rcall .+618 ; 0x33c <__fixunssfsi> + d2: 02 c0 rjmp .+4 ; 0xd8 + +#else + uint16_t __ticks; + __tmp = ((F_CPU) / 4e3) * __ms; + if (__tmp < 1.0) + __ticks = 1; + d4: 61 e0 ldi r22, 0x01 ; 1 + d6: 70 e0 ldi r23, 0x00 ; 0 + d8: cb 01 movw r24, r22 + da: 01 97 sbiw r24, 0x01 ; 1 + dc: f1 f7 brne .-4 ; 0xda +} + de: ff 90 pop r15 + e0: ef 90 pop r14 + e2: df 90 pop r13 + e4: cf 90 pop r12 + e6: bf 90 pop r11 + e8: af 90 pop r10 + ea: 9f 90 pop r9 + ec: 8f 90 pop r8 + ee: 08 95 ret + +000000f0 : +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_write_byte(unsigned char dat, unsigned char command) +{ + unsigned char i; + LCD_CE_clr; + f0: db 98 cbi 0x1b, 3 ; 27 + + if (command == 0) + f2: 61 11 cpse r22, r1 + f4: 02 c0 rjmp .+4 ; 0xfa + LCD_DC_clr; + f6: da 98 cbi 0x1b, 2 ; 27 + f8: 01 c0 rjmp .+2 ; 0xfc + else + LCD_DC_set; + fa: da 9a sbi 0x1b, 2 ; 27 + command -> command (0) /data (1) + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_write_byte(unsigned char dat, unsigned char command) +{ + fc: 98 e0 ldi r25, 0x08 ; 8 + else + LCD_DC_set; + + for(i=0;i<8;i++) + { + if(dat&0x80) + fe: 87 ff sbrs r24, 7 + 100: 02 c0 rjmp .+4 ; 0x106 + SDIN_set; + 102: d9 9a sbi 0x1b, 1 ; 27 + 104: 01 c0 rjmp .+2 ; 0x108 + else + SDIN_clr; + 106: d9 98 cbi 0x1b, 1 ; 27 + SCLK_clr; + 108: d8 98 cbi 0x1b, 0 ; 27 + dat = dat << 1; + 10a: 88 0f add r24, r24 + //delay_1us(); + SCLK_set; + 10c: d8 9a sbi 0x1b, 0 ; 27 + 10e: 91 50 subi r25, 0x01 ; 1 + if (command == 0) + LCD_DC_clr; + else + LCD_DC_set; + + for(i=0;i<8;i++) + 110: b1 f7 brne .-20 ; 0xfe + dat = dat << 1; + //delay_1us(); + SCLK_set; + //delay_1us(); + } + LCD_CE_set; + 112: db 9a sbi 0x1b, 3 ; 27 + 114: 08 95 ret + +00000116 : +input parmenter: None + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_clear(void) +{ + 116: cf 93 push r28 + 118: df 93 push r29 + unsigned int i; + + LCD_write_byte(0x0c, 0); + 11a: 60 e0 ldi r22, 0x00 ; 0 + 11c: 8c e0 ldi r24, 0x0C ; 12 + 11e: e8 df rcall .-48 ; 0xf0 + LCD_write_byte(0x80, 0); + 120: 60 e0 ldi r22, 0x00 ; 0 + 122: 80 e8 ldi r24, 0x80 ; 128 + 124: e5 df rcall .-54 ; 0xf0 + 126: c8 ef ldi r28, 0xF8 ; 248 + 128: d1 e0 ldi r29, 0x01 ; 1 + + for (i=0; i<504; i++) + { + LCD_write_byte(0, 1); + 12a: 61 e0 ldi r22, 0x01 ; 1 + 12c: 80 e0 ldi r24, 0x00 ; 0 + 12e: e0 df rcall .-64 ; 0xf0 + 130: 21 97 sbiw r28, 0x01 ; 1 + unsigned int i; + + LCD_write_byte(0x0c, 0); + LCD_write_byte(0x80, 0); + + for (i=0; i<504; i++) + 132: d9 f7 brne .-10 ; 0x12a + { + LCD_write_byte(0, 1); + } +} + 134: df 91 pop r29 + 136: cf 91 pop r28 + 138: 08 95 ret + +0000013a : + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_init(void) +{ + DDRA|=0X1F; + 13a: 8a b3 in r24, 0x1a ; 26 + 13c: 8f 61 ori r24, 0x1F ; 31 + 13e: 8a bb out 0x1a, r24 ; 26 + + LCD_RST_clr; + 140: dc 98 cbi 0x1b, 4 ; 27 + delay_1us(); + 142: 83 df rcall .-250 ; 0x4a + LCD_RST_set; + 144: dc 9a sbi 0x1b, 4 ; 27 + + LCD_CE_clr; + 146: db 98 cbi 0x1b, 3 ; 27 + delay_1us(); + 148: 80 df rcall .-256 ; 0x4a + LCD_CE_set; + 14a: db 9a sbi 0x1b, 3 ; 27 + delay_1us(); + 14c: 7e df rcall .-260 ; 0x4a + + LCD_write_byte(0x21, 0); // set LCD mode + 14e: 60 e0 ldi r22, 0x00 ; 0 + 150: 81 e2 ldi r24, 0x21 ; 33 + 152: ce df rcall .-100 ; 0xf0 + LCD_write_byte(0xC8, 0); // set bias voltage + 154: 60 e0 ldi r22, 0x00 ; 0 + 156: 88 ec ldi r24, 0xC8 ; 200 + 158: cb df rcall .-106 ; 0xf0 + LCD_write_byte(0x06, 0); // temperature correction + 15a: 60 e0 ldi r22, 0x00 ; 0 + 15c: 86 e0 ldi r24, 0x06 ; 6 + 15e: c8 df rcall .-112 ; 0xf0 + LCD_write_byte(0x13, 0); // 1:48 + 160: 60 e0 ldi r22, 0x00 ; 0 + 162: 83 e1 ldi r24, 0x13 ; 19 + 164: c5 df rcall .-118 ; 0xf0 + LCD_write_byte(0x20, 0); // use bias command + 166: 60 e0 ldi r22, 0x00 ; 0 + 168: 80 e2 ldi r24, 0x20 ; 32 + 16a: c2 df rcall .-124 ; 0xf0 + LCD_clear(); // clear the LCD + 16c: d4 df rcall .-88 ; 0x116 + LCD_write_byte(0x0c, 0); // set LCD mode,display normally + 16e: 60 e0 ldi r22, 0x00 ; 0 + 170: 8c e0 ldi r24, 0x0C ; 12 + 172: be df rcall .-132 ; 0xf0 + + LCD_CE_clr; + 174: db 98 cbi 0x1b, 3 ; 27 + 176: 08 95 ret + +00000178 : + Y -> 0­5 + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_set_XY(unsigned char X, unsigned char Y) +{ + 178: cf 93 push r28 + 17a: c8 2f mov r28, r24 + 17c: 86 2f mov r24, r22 + LCD_write_byte(0x40 | Y, 0); // column + 17e: 60 e0 ldi r22, 0x00 ; 0 + 180: 80 64 ori r24, 0x40 ; 64 + 182: b6 df rcall .-148 ; 0xf0 + LCD_write_byte(0x80 | X, 0); // row + 184: 60 e0 ldi r22, 0x00 ; 0 + 186: 8c 2f mov r24, r28 + 188: 80 68 ori r24, 0x80 ; 128 +} + 18a: cf 91 pop r28 +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_set_XY(unsigned char X, unsigned char Y) +{ + LCD_write_byte(0x40 | Y, 0); // column + LCD_write_byte(0x80 | X, 0); // row + 18c: b1 cf rjmp .-158 ; 0xf0 + +0000018e : +input parameter: c -> char to display + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_write_char(unsigned char c) +{ + 18e: 0f 93 push r16 + 190: 1f 93 push r17 + 192: cf 93 push r28 + 194: df 93 push r29 + unsigned char line; + + c -= 32; + 196: 80 52 subi r24, 0x20 ; 32 + 198: 90 e0 ldi r25, 0x00 ; 0 + 19a: 66 e0 ldi r22, 0x06 ; 6 + 19c: 70 e0 ldi r23, 0x00 ; 0 + 19e: 1b d2 rcall .+1078 ; 0x5d6 <__mulhi3> + 1a0: 8c 01 movw r16, r24 + 1a2: 00 5a subi r16, 0xA0 ; 160 + 1a4: 1f 4f sbci r17, 0xFF ; 255 + 1a6: c0 e0 ldi r28, 0x00 ; 0 + 1a8: d0 e0 ldi r29, 0x00 ; 0 + 1aa: f8 01 movw r30, r16 + 1ac: ec 0f add r30, r28 + 1ae: fd 1f adc r31, r29 + for (line=0; line<6; line++) + LCD_write_byte(font6x8[c][line], 1); + 1b0: 61 e0 ldi r22, 0x01 ; 1 + 1b2: 80 81 ld r24, Z + 1b4: 9d df rcall .-198 ; 0xf0 + 1b6: 21 96 adiw r28, 0x01 ; 1 +void LCD_write_char(unsigned char c) +{ + unsigned char line; + + c -= 32; + for (line=0; line<6; line++) + 1b8: c6 30 cpi r28, 0x06 ; 6 + 1ba: d1 05 cpc r29, r1 + 1bc: b1 f7 brne .-20 ; 0x1aa + LCD_write_byte(font6x8[c][line], 1); +} + 1be: df 91 pop r29 + 1c0: cf 91 pop r28 + 1c2: 1f 91 pop r17 + 1c4: 0f 91 pop r16 + 1c6: 08 95 ret + +000001c8 : + s -> String to display + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_write_english_string(unsigned char X,unsigned char Y, unsigned char *s) +{ + 1c8: 0f 93 push r16 + 1ca: 1f 93 push r17 + 1cc: cf 93 push r28 + 1ce: df 93 push r29 + 1d0: 00 d0 rcall .+0 ; 0x1d2 + 1d2: cd b7 in r28, 0x3d ; 61 + 1d4: de b7 in r29, 0x3e ; 62 + LCD_set_XY(X,Y); + 1d6: 49 83 std Y+1, r20 ; 0x01 + 1d8: 5a 83 std Y+2, r21 ; 0x02 + 1da: ce df rcall .-100 ; 0x178 + 1dc: 49 81 ldd r20, Y+1 ; 0x01 + 1de: 04 2f mov r16, r20 + 1e0: 5a 81 ldd r21, Y+2 ; 0x02 + 1e2: 15 2f mov r17, r21 + while (*s) + 1e4: f8 01 movw r30, r16 + 1e6: 81 91 ld r24, Z+ + 1e8: 8f 01 movw r16, r30 + 1ea: 88 23 and r24, r24 + 1ec: 11 f0 breq .+4 ; 0x1f2 + { + LCD_write_char(*s); + 1ee: cf df rcall .-98 ; 0x18e + 1f0: f9 cf rjmp .-14 ; 0x1e4 + s++; + } +} + 1f2: 0f 90 pop r0 + 1f4: 0f 90 pop r0 + 1f6: df 91 pop r29 + 1f8: cf 91 pop r28 + 1fa: 1f 91 pop r17 + 1fc: 0f 91 pop r16 + 1fe: 08 95 ret + +00000200 : + Pix_y -> width + +created date 2014-01-08 +-----------------------------------------------------------------------*/ +void LCD_draw_bmp_pixel(unsigned char X,unsigned char Y,unsigned char *map, unsigned char Pix_x,unsigned char Pix_y) +{ + 200: 6f 92 push r6 + 202: 7f 92 push r7 + 204: 8f 92 push r8 + 206: 9f 92 push r9 + 208: af 92 push r10 + 20a: bf 92 push r11 + 20c: cf 92 push r12 + 20e: df 92 push r13 + 210: ef 92 push r14 + 212: ff 92 push r15 + 214: 0f 93 push r16 + 216: 1f 93 push r17 + 218: cf 93 push r28 + 21a: df 93 push r29 + 21c: 68 2e mov r6, r24 + 21e: 76 2e mov r7, r22 + unsigned int i,n; + unsigned char row; + + if (Pix_y%8==0) row=Pix_y/8; //calculate how many line are needed + 220: 80 2f mov r24, r16 + 222: 87 70 andi r24, 0x07 ; 7 + 224: 06 95 lsr r16 + 226: 06 95 lsr r16 + 228: 06 95 lsr r16 + 22a: 81 11 cpse r24, r1 + else row=Pix_y/8+1; + 22c: 0f 5f subi r16, 0xFF ; 255 + 22e: c2 2e mov r12, r18 + 230: d1 2c mov r13, r1 + 232: ea 01 movw r28, r20 + 234: aa 24 eor r10, r10 + 236: bb 24 eor r11, r11 + 238: a4 1a sub r10, r20 + 23a: b5 0a sbc r11, r21 + + for (n=0;n + { + LCD_set_XY(X,Y); + 24c: 86 2d mov r24, r6 + 24e: 94 df rcall .-216 ; 0x178 + for(i=0; i + { + LCD_write_byte(map[i+n*Pix_x], 1); + 25e: 61 e0 ldi r22, 0x01 ; 1 + 260: f4 01 movw r30, r8 + 262: 81 91 ld r24, Z+ + 264: 4f 01 movw r8, r30 + 266: 44 df rcall .-376 ; 0xf0 + 268: f4 cf rjmp .-24 ; 0x252 + unsigned char row; + + if (Pix_y%8==0) row=Pix_y/8; //calculate how many line are needed + else row=Pix_y/8+1; + + for (n=0;n + { + LCD_write_byte(map[i+n*Pix_x], 1); + } + Y++; // next line + } +} + 27a: df 91 pop r29 + 27c: cf 91 pop r28 + 27e: 1f 91 pop r17 + 280: 0f 91 pop r16 + 282: ff 90 pop r15 + 284: ef 90 pop r14 + 286: df 90 pop r13 + 288: cf 90 pop r12 + 28a: bf 90 pop r11 + 28c: af 90 pop r10 + 28e: 9f 90 pop r9 + 290: 8f 90 pop r8 + 292: 7f 90 pop r7 + 294: 6f 90 pop r6 + 296: 08 95 ret + +00000298 : + + Return value : None. + +--------------------------------------------------------------------------------------------------*/ +void LCD_pixel (unsigned char x, unsigned char y, LcdPixelMode mode) +{ + 298: 08 95 ret + +0000029a : + + Return value : None. + +--------------------------------------------------------------------------------------------------*/ +void LCD_line (unsigned char x1, unsigned char y1, unsigned char x2, unsigned char y2, LcdPixelMode mode) +{ + 29a: 08 95 ret + +0000029c
: + + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000001; + 29c: 81 e0 ldi r24, 0x01 ; 1 + 29e: 87 bb out 0x17, r24 ; 23 + DDRA = 0b00011111; + 2a0: 8f e1 ldi r24, 0x1F ; 31 + 2a2: 8a bb out 0x1a, r24 ; 26 + + LCD_init(); //LCD initialization + 2a4: 4a df rcall .-364 ; 0x13a + LCD_clear(); //clear the LCD + 2a6: 37 df rcall .-402 ; 0x116 + + LCD_write_char('*'); + 2a8: 8a e2 ldi r24, 0x2A ; 42 + 2aa: 71 df rcall .-286 ; 0x18e + LCD_write_byte(0,1); + 2ac: 61 e0 ldi r22, 0x01 ; 1 + 2ae: 80 e0 ldi r24, 0x00 ; 0 + 2b0: 1f df rcall .-450 ; 0xf0 + LCD_write_byte(0,1); + 2b2: 61 e0 ldi r22, 0x01 ; 1 + 2b4: 80 e0 ldi r24, 0x00 ; 0 + 2b6: 1c df rcall .-456 ; 0xf0 + LCD_write_char('L'); + 2b8: 8c e4 ldi r24, 0x4C ; 76 + 2ba: 69 df rcall .-302 ; 0x18e + LCD_write_char('o'); + 2bc: 8f e6 ldi r24, 0x6F ; 111 + 2be: 67 df rcall .-306 ; 0x18e + LCD_write_char('v'); + 2c0: 86 e7 ldi r24, 0x76 ; 118 + 2c2: 65 df rcall .-310 ; 0x18e + LCD_write_char('e'); + 2c4: 85 e6 ldi r24, 0x65 ; 101 + 2c6: 63 df rcall .-314 ; 0x18e + LCD_write_byte(0,1); + 2c8: 61 e0 ldi r22, 0x01 ; 1 + 2ca: 80 e0 ldi r24, 0x00 ; 0 + 2cc: 11 df rcall .-478 ; 0xf0 + LCD_write_byte(0,1); + 2ce: 61 e0 ldi r22, 0x01 ; 1 + 2d0: 80 e0 ldi r24, 0x00 ; 0 + 2d2: 0e df rcall .-484 ; 0xf0 + LCD_write_byte(0,1); + 2d4: 61 e0 ldi r22, 0x01 ; 1 + 2d6: 80 e0 ldi r24, 0x00 ; 0 + 2d8: 0b df rcall .-490 ; 0xf0 + LCD_write_byte(0,1); + 2da: 61 e0 ldi r22, 0x01 ; 1 + 2dc: 80 e0 ldi r24, 0x00 ; 0 + 2de: 08 df rcall .-496 ; 0xf0 + LCD_write_byte(0,1); + 2e0: 61 e0 ldi r22, 0x01 ; 1 + 2e2: 80 e0 ldi r24, 0x00 ; 0 + 2e4: 05 df rcall .-502 ; 0xf0 + LCD_write_char('S'); + 2e6: 83 e5 ldi r24, 0x53 ; 83 + 2e8: 52 df rcall .-348 ; 0x18e + LCD_write_char('i'); + 2ea: 89 e6 ldi r24, 0x69 ; 105 + 2ec: 50 df rcall .-352 ; 0x18e + LCD_write_char('l'); + 2ee: 8c e6 ldi r24, 0x6C ; 108 + 2f0: 4e df rcall .-356 ; 0x18e + LCD_write_char('v'); + 2f2: 86 e7 ldi r24, 0x76 ; 118 + 2f4: 4c df rcall .-360 ; 0x18e + LCD_write_char('i'); + 2f6: 89 e6 ldi r24, 0x69 ; 105 + 2f8: 4a df rcall .-364 ; 0x18e + LCD_write_char('a'); + 2fa: 81 e6 ldi r24, 0x61 ; 97 + 2fc: 48 df rcall .-368 ; 0x18e + LCD_write_byte(0,1); + 2fe: 61 e0 ldi r22, 0x01 ; 1 + 300: 80 e0 ldi r24, 0x00 ; 0 + 302: f6 de rcall .-532 ; 0xf0 + LCD_write_byte(0,1); + 304: 61 e0 ldi r22, 0x01 ; 1 + 306: 80 e0 ldi r24, 0x00 ; 0 + 308: f3 de rcall .-538 ; 0xf0 + LCD_write_char('*'); + 30a: 8a e2 ldi r24, 0x2A ; 42 + 30c: 40 df rcall .-384 ; 0x18e + + LCD_write_english_string(0,1,"LOVE"); + 30e: 48 e8 ldi r20, 0x88 ; 136 + 310: 52 e0 ldi r21, 0x02 ; 2 + 312: 61 e0 ldi r22, 0x01 ; 1 + 314: 80 e0 ldi r24, 0x00 ; 0 + 316: 58 df rcall .-336 ; 0x1c8 + + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000001; + 318: 41 e0 ldi r20, 0x01 ; 1 + 31a: 29 e1 ldi r18, 0x19 ; 25 + 31c: 30 e0 ldi r19, 0x00 ; 0 + + LCD_write_english_string(0,1,"LOVE"); + + while(1) + { + zwischenspeicher = PORTB; + 31e: 88 b3 in r24, 0x18 ; 24 + zwischenspeicher = zwischenspeicher ^ 0b00000001; + 320: 84 27 eor r24, r20 + PORTB = zwischenspeicher; + 322: 88 bb out 0x18, r24 ; 24 + 324: 88 e8 ldi r24, 0x88 ; 136 + 326: 93 e1 ldi r25, 0x13 ; 19 + 328: f9 01 movw r30, r18 + 32a: 31 97 sbiw r30, 0x01 ; 1 + 32c: f1 f7 brne .-4 ; 0x32a + 32e: 01 97 sbiw r24, 0x01 ; 1 + else if (__tmp > 65535) + { + // __ticks = requested delay in 1/10 ms + __ticks = (uint16_t) (__ms * 10.0); + while(__ticks) + 330: d9 f7 brne .-10 ; 0x328 + 332: f5 cf rjmp .-22 ; 0x31e + +00000334 <__cmpsf2>: + 334: 6c d0 rcall .+216 ; 0x40e <__fp_cmp> + 336: 08 f4 brcc .+2 ; 0x33a <__cmpsf2+0x6> + 338: 81 e0 ldi r24, 0x01 ; 1 + 33a: 08 95 ret + +0000033c <__fixunssfsi>: + 33c: 94 d0 rcall .+296 ; 0x466 <__fp_splitA> + 33e: 88 f0 brcs .+34 ; 0x362 <__fixunssfsi+0x26> + 340: 9f 57 subi r25, 0x7F ; 127 + 342: 90 f0 brcs .+36 ; 0x368 <__fixunssfsi+0x2c> + 344: b9 2f mov r27, r25 + 346: 99 27 eor r25, r25 + 348: b7 51 subi r27, 0x17 ; 23 + 34a: a0 f0 brcs .+40 ; 0x374 <__fixunssfsi+0x38> + 34c: d1 f0 breq .+52 ; 0x382 <__fixunssfsi+0x46> + 34e: 66 0f add r22, r22 + 350: 77 1f adc r23, r23 + 352: 88 1f adc r24, r24 + 354: 99 1f adc r25, r25 + 356: 1a f0 brmi .+6 ; 0x35e <__fixunssfsi+0x22> + 358: ba 95 dec r27 + 35a: c9 f7 brne .-14 ; 0x34e <__fixunssfsi+0x12> + 35c: 12 c0 rjmp .+36 ; 0x382 <__fixunssfsi+0x46> + 35e: b1 30 cpi r27, 0x01 ; 1 + 360: 81 f0 breq .+32 ; 0x382 <__fixunssfsi+0x46> + 362: 9b d0 rcall .+310 ; 0x49a <__fp_zero> + 364: b1 e0 ldi r27, 0x01 ; 1 + 366: 08 95 ret + 368: 98 c0 rjmp .+304 ; 0x49a <__fp_zero> + 36a: 67 2f mov r22, r23 + 36c: 78 2f mov r23, r24 + 36e: 88 27 eor r24, r24 + 370: b8 5f subi r27, 0xF8 ; 248 + 372: 39 f0 breq .+14 ; 0x382 <__fixunssfsi+0x46> + 374: b9 3f cpi r27, 0xF9 ; 249 + 376: cc f3 brlt .-14 ; 0x36a <__fixunssfsi+0x2e> + 378: 86 95 lsr r24 + 37a: 77 95 ror r23 + 37c: 67 95 ror r22 + 37e: b3 95 inc r27 + 380: d9 f7 brne .-10 ; 0x378 <__fixunssfsi+0x3c> + 382: 3e f4 brtc .+14 ; 0x392 <__fixunssfsi+0x56> + 384: 90 95 com r25 + 386: 80 95 com r24 + 388: 70 95 com r23 + 38a: 61 95 neg r22 + 38c: 7f 4f sbci r23, 0xFF ; 255 + 38e: 8f 4f sbci r24, 0xFF ; 255 + 390: 9f 4f sbci r25, 0xFF ; 255 + 392: 08 95 ret + +00000394 <__floatunsisf>: + 394: e8 94 clt + 396: 09 c0 rjmp .+18 ; 0x3aa <__floatsisf+0x12> + +00000398 <__floatsisf>: + 398: 97 fb bst r25, 7 + 39a: 3e f4 brtc .+14 ; 0x3aa <__floatsisf+0x12> + 39c: 90 95 com r25 + 39e: 80 95 com r24 + 3a0: 70 95 com r23 + 3a2: 61 95 neg r22 + 3a4: 7f 4f sbci r23, 0xFF ; 255 + 3a6: 8f 4f sbci r24, 0xFF ; 255 + 3a8: 9f 4f sbci r25, 0xFF ; 255 + 3aa: 99 23 and r25, r25 + 3ac: a9 f0 breq .+42 ; 0x3d8 <__floatsisf+0x40> + 3ae: f9 2f mov r31, r25 + 3b0: 96 e9 ldi r25, 0x96 ; 150 + 3b2: bb 27 eor r27, r27 + 3b4: 93 95 inc r25 + 3b6: f6 95 lsr r31 + 3b8: 87 95 ror r24 + 3ba: 77 95 ror r23 + 3bc: 67 95 ror r22 + 3be: b7 95 ror r27 + 3c0: f1 11 cpse r31, r1 + 3c2: f8 cf rjmp .-16 ; 0x3b4 <__floatsisf+0x1c> + 3c4: fa f4 brpl .+62 ; 0x404 <__floatsisf+0x6c> + 3c6: bb 0f add r27, r27 + 3c8: 11 f4 brne .+4 ; 0x3ce <__floatsisf+0x36> + 3ca: 60 ff sbrs r22, 0 + 3cc: 1b c0 rjmp .+54 ; 0x404 <__floatsisf+0x6c> + 3ce: 6f 5f subi r22, 0xFF ; 255 + 3d0: 7f 4f sbci r23, 0xFF ; 255 + 3d2: 8f 4f sbci r24, 0xFF ; 255 + 3d4: 9f 4f sbci r25, 0xFF ; 255 + 3d6: 16 c0 rjmp .+44 ; 0x404 <__floatsisf+0x6c> + 3d8: 88 23 and r24, r24 + 3da: 11 f0 breq .+4 ; 0x3e0 <__floatsisf+0x48> + 3dc: 96 e9 ldi r25, 0x96 ; 150 + 3de: 11 c0 rjmp .+34 ; 0x402 <__floatsisf+0x6a> + 3e0: 77 23 and r23, r23 + 3e2: 21 f0 breq .+8 ; 0x3ec <__floatsisf+0x54> + 3e4: 9e e8 ldi r25, 0x8E ; 142 + 3e6: 87 2f mov r24, r23 + 3e8: 76 2f mov r23, r22 + 3ea: 05 c0 rjmp .+10 ; 0x3f6 <__floatsisf+0x5e> + 3ec: 66 23 and r22, r22 + 3ee: 71 f0 breq .+28 ; 0x40c <__floatsisf+0x74> + 3f0: 96 e8 ldi r25, 0x86 ; 134 + 3f2: 86 2f mov r24, r22 + 3f4: 70 e0 ldi r23, 0x00 ; 0 + 3f6: 60 e0 ldi r22, 0x00 ; 0 + 3f8: 2a f0 brmi .+10 ; 0x404 <__floatsisf+0x6c> + 3fa: 9a 95 dec r25 + 3fc: 66 0f add r22, r22 + 3fe: 77 1f adc r23, r23 + 400: 88 1f adc r24, r24 + 402: da f7 brpl .-10 ; 0x3fa <__floatsisf+0x62> + 404: 88 0f add r24, r24 + 406: 96 95 lsr r25 + 408: 87 95 ror r24 + 40a: 97 f9 bld r25, 7 + 40c: 08 95 ret + +0000040e <__fp_cmp>: + 40e: 99 0f add r25, r25 + 410: 00 08 sbc r0, r0 + 412: 55 0f add r21, r21 + 414: aa 0b sbc r26, r26 + 416: e0 e8 ldi r30, 0x80 ; 128 + 418: fe ef ldi r31, 0xFE ; 254 + 41a: 16 16 cp r1, r22 + 41c: 17 06 cpc r1, r23 + 41e: e8 07 cpc r30, r24 + 420: f9 07 cpc r31, r25 + 422: c0 f0 brcs .+48 ; 0x454 <__fp_cmp+0x46> + 424: 12 16 cp r1, r18 + 426: 13 06 cpc r1, r19 + 428: e4 07 cpc r30, r20 + 42a: f5 07 cpc r31, r21 + 42c: 98 f0 brcs .+38 ; 0x454 <__fp_cmp+0x46> + 42e: 62 1b sub r22, r18 + 430: 73 0b sbc r23, r19 + 432: 84 0b sbc r24, r20 + 434: 95 0b sbc r25, r21 + 436: 39 f4 brne .+14 ; 0x446 <__fp_cmp+0x38> + 438: 0a 26 eor r0, r26 + 43a: 61 f0 breq .+24 ; 0x454 <__fp_cmp+0x46> + 43c: 23 2b or r18, r19 + 43e: 24 2b or r18, r20 + 440: 25 2b or r18, r21 + 442: 21 f4 brne .+8 ; 0x44c <__fp_cmp+0x3e> + 444: 08 95 ret + 446: 0a 26 eor r0, r26 + 448: 09 f4 brne .+2 ; 0x44c <__fp_cmp+0x3e> + 44a: a1 40 sbci r26, 0x01 ; 1 + 44c: a6 95 lsr r26 + 44e: 8f ef ldi r24, 0xFF ; 255 + 450: 81 1d adc r24, r1 + 452: 81 1d adc r24, r1 + 454: 08 95 ret + +00000456 <__fp_split3>: + 456: 57 fd sbrc r21, 7 + 458: 90 58 subi r25, 0x80 ; 128 + 45a: 44 0f add r20, r20 + 45c: 55 1f adc r21, r21 + 45e: 59 f0 breq .+22 ; 0x476 <__fp_splitA+0x10> + 460: 5f 3f cpi r21, 0xFF ; 255 + 462: 71 f0 breq .+28 ; 0x480 <__fp_splitA+0x1a> + 464: 47 95 ror r20 + +00000466 <__fp_splitA>: + 466: 88 0f add r24, r24 + 468: 97 fb bst r25, 7 + 46a: 99 1f adc r25, r25 + 46c: 61 f0 breq .+24 ; 0x486 <__fp_splitA+0x20> + 46e: 9f 3f cpi r25, 0xFF ; 255 + 470: 79 f0 breq .+30 ; 0x490 <__fp_splitA+0x2a> + 472: 87 95 ror r24 + 474: 08 95 ret + 476: 12 16 cp r1, r18 + 478: 13 06 cpc r1, r19 + 47a: 14 06 cpc r1, r20 + 47c: 55 1f adc r21, r21 + 47e: f2 cf rjmp .-28 ; 0x464 <__fp_split3+0xe> + 480: 46 95 lsr r20 + 482: f1 df rcall .-30 ; 0x466 <__fp_splitA> + 484: 08 c0 rjmp .+16 ; 0x496 <__fp_splitA+0x30> + 486: 16 16 cp r1, r22 + 488: 17 06 cpc r1, r23 + 48a: 18 06 cpc r1, r24 + 48c: 99 1f adc r25, r25 + 48e: f1 cf rjmp .-30 ; 0x472 <__fp_splitA+0xc> + 490: 86 95 lsr r24 + 492: 71 05 cpc r23, r1 + 494: 61 05 cpc r22, r1 + 496: 08 94 sec + 498: 08 95 ret + +0000049a <__fp_zero>: + 49a: e8 94 clt + +0000049c <__fp_szero>: + 49c: bb 27 eor r27, r27 + 49e: 66 27 eor r22, r22 + 4a0: 77 27 eor r23, r23 + 4a2: cb 01 movw r24, r22 + 4a4: 97 f9 bld r25, 7 + 4a6: 08 95 ret + +000004a8 <__gesf2>: + 4a8: b2 df rcall .-156 ; 0x40e <__fp_cmp> + 4aa: 08 f4 brcc .+2 ; 0x4ae <__gesf2+0x6> + 4ac: 8f ef ldi r24, 0xFF ; 255 + 4ae: 08 95 ret + +000004b0 <__mulsf3>: + 4b0: 0a d0 rcall .+20 ; 0x4c6 <__mulsf3x> + 4b2: 80 c0 rjmp .+256 ; 0x5b4 <__fp_round> + 4b4: 71 d0 rcall .+226 ; 0x598 <__fp_pscA> + 4b6: 28 f0 brcs .+10 ; 0x4c2 <__mulsf3+0x12> + 4b8: 76 d0 rcall .+236 ; 0x5a6 <__fp_pscB> + 4ba: 18 f0 brcs .+6 ; 0x4c2 <__mulsf3+0x12> + 4bc: 95 23 and r25, r21 + 4be: 09 f0 breq .+2 ; 0x4c2 <__mulsf3+0x12> + 4c0: 62 c0 rjmp .+196 ; 0x586 <__fp_inf> + 4c2: 67 c0 rjmp .+206 ; 0x592 <__fp_nan> + 4c4: eb cf rjmp .-42 ; 0x49c <__fp_szero> + +000004c6 <__mulsf3x>: + 4c6: c7 df rcall .-114 ; 0x456 <__fp_split3> + 4c8: a8 f3 brcs .-22 ; 0x4b4 <__mulsf3+0x4> + +000004ca <__mulsf3_pse>: + 4ca: 99 23 and r25, r25 + 4cc: d9 f3 breq .-10 ; 0x4c4 <__mulsf3+0x14> + 4ce: 55 23 and r21, r21 + 4d0: c9 f3 breq .-14 ; 0x4c4 <__mulsf3+0x14> + 4d2: 95 0f add r25, r21 + 4d4: 50 e0 ldi r21, 0x00 ; 0 + 4d6: 55 1f adc r21, r21 + 4d8: aa 27 eor r26, r26 + 4da: ee 27 eor r30, r30 + 4dc: ff 27 eor r31, r31 + 4de: bb 27 eor r27, r27 + 4e0: 00 24 eor r0, r0 + 4e2: 08 94 sec + 4e4: 67 95 ror r22 + 4e6: 20 f4 brcc .+8 ; 0x4f0 <__mulsf3_pse+0x26> + 4e8: e2 0f add r30, r18 + 4ea: f3 1f adc r31, r19 + 4ec: b4 1f adc r27, r20 + 4ee: 0a 1e adc r0, r26 + 4f0: 22 0f add r18, r18 + 4f2: 33 1f adc r19, r19 + 4f4: 44 1f adc r20, r20 + 4f6: aa 1f adc r26, r26 + 4f8: 66 95 lsr r22 + 4fa: a9 f7 brne .-22 ; 0x4e6 <__mulsf3_pse+0x1c> + 4fc: 77 95 ror r23 + 4fe: 30 f4 brcc .+12 ; 0x50c <__mulsf3_pse+0x42> + 500: f3 0f add r31, r19 + 502: b4 1f adc r27, r20 + 504: 0a 1e adc r0, r26 + 506: 12 1e adc r1, r18 + 508: 08 f4 brcc .+2 ; 0x50c <__mulsf3_pse+0x42> + 50a: 63 95 inc r22 + 50c: 33 0f add r19, r19 + 50e: 44 1f adc r20, r20 + 510: aa 1f adc r26, r26 + 512: 22 1f adc r18, r18 + 514: 76 95 lsr r23 + 516: 99 f7 brne .-26 ; 0x4fe <__mulsf3_pse+0x34> + 518: 87 95 ror r24 + 51a: 20 f4 brcc .+8 ; 0x524 <__mulsf3_pse+0x5a> + 51c: b4 0f add r27, r20 + 51e: 0a 1e adc r0, r26 + 520: 12 1e adc r1, r18 + 522: 63 1f adc r22, r19 + 524: 44 0f add r20, r20 + 526: aa 1f adc r26, r26 + 528: 22 1f adc r18, r18 + 52a: 33 1f adc r19, r19 + 52c: 86 95 lsr r24 + 52e: a9 f7 brne .-22 ; 0x51a <__mulsf3_pse+0x50> + 530: 86 2f mov r24, r22 + 532: 71 2d mov r23, r1 + 534: 60 2d mov r22, r0 + 536: 11 24 eor r1, r1 + 538: 9f 57 subi r25, 0x7F ; 127 + 53a: 50 40 sbci r21, 0x00 ; 0 + 53c: 8a f0 brmi .+34 ; 0x560 <__mulsf3_pse+0x96> + 53e: e1 f0 breq .+56 ; 0x578 <__mulsf3_pse+0xae> + 540: 88 23 and r24, r24 + 542: 4a f0 brmi .+18 ; 0x556 <__mulsf3_pse+0x8c> + 544: ee 0f add r30, r30 + 546: ff 1f adc r31, r31 + 548: bb 1f adc r27, r27 + 54a: 66 1f adc r22, r22 + 54c: 77 1f adc r23, r23 + 54e: 88 1f adc r24, r24 + 550: 91 50 subi r25, 0x01 ; 1 + 552: 50 40 sbci r21, 0x00 ; 0 + 554: a9 f7 brne .-22 ; 0x540 <__mulsf3_pse+0x76> + 556: 9e 3f cpi r25, 0xFE ; 254 + 558: 51 05 cpc r21, r1 + 55a: 70 f0 brcs .+28 ; 0x578 <__mulsf3_pse+0xae> + 55c: 14 c0 rjmp .+40 ; 0x586 <__fp_inf> + 55e: 9e cf rjmp .-196 ; 0x49c <__fp_szero> + 560: 5f 3f cpi r21, 0xFF ; 255 + 562: ec f3 brlt .-6 ; 0x55e <__mulsf3_pse+0x94> + 564: 98 3e cpi r25, 0xE8 ; 232 + 566: dc f3 brlt .-10 ; 0x55e <__mulsf3_pse+0x94> + 568: 86 95 lsr r24 + 56a: 77 95 ror r23 + 56c: 67 95 ror r22 + 56e: b7 95 ror r27 + 570: f7 95 ror r31 + 572: e7 95 ror r30 + 574: 9f 5f subi r25, 0xFF ; 255 + 576: c1 f7 brne .-16 ; 0x568 <__mulsf3_pse+0x9e> + 578: fe 2b or r31, r30 + 57a: 88 0f add r24, r24 + 57c: 91 1d adc r25, r1 + 57e: 96 95 lsr r25 + 580: 87 95 ror r24 + 582: 97 f9 bld r25, 7 + 584: 08 95 ret + +00000586 <__fp_inf>: + 586: 97 f9 bld r25, 7 + 588: 9f 67 ori r25, 0x7F ; 127 + 58a: 80 e8 ldi r24, 0x80 ; 128 + 58c: 70 e0 ldi r23, 0x00 ; 0 + 58e: 60 e0 ldi r22, 0x00 ; 0 + 590: 08 95 ret + +00000592 <__fp_nan>: + 592: 9f ef ldi r25, 0xFF ; 255 + 594: 80 ec ldi r24, 0xC0 ; 192 + 596: 08 95 ret + +00000598 <__fp_pscA>: + 598: 00 24 eor r0, r0 + 59a: 0a 94 dec r0 + 59c: 16 16 cp r1, r22 + 59e: 17 06 cpc r1, r23 + 5a0: 18 06 cpc r1, r24 + 5a2: 09 06 cpc r0, r25 + 5a4: 08 95 ret + +000005a6 <__fp_pscB>: + 5a6: 00 24 eor r0, r0 + 5a8: 0a 94 dec r0 + 5aa: 12 16 cp r1, r18 + 5ac: 13 06 cpc r1, r19 + 5ae: 14 06 cpc r1, r20 + 5b0: 05 06 cpc r0, r21 + 5b2: 08 95 ret + +000005b4 <__fp_round>: + 5b4: 09 2e mov r0, r25 + 5b6: 03 94 inc r0 + 5b8: 00 0c add r0, r0 + 5ba: 11 f4 brne .+4 ; 0x5c0 <__fp_round+0xc> + 5bc: 88 23 and r24, r24 + 5be: 52 f0 brmi .+20 ; 0x5d4 <__fp_round+0x20> + 5c0: bb 0f add r27, r27 + 5c2: 40 f4 brcc .+16 ; 0x5d4 <__fp_round+0x20> + 5c4: bf 2b or r27, r31 + 5c6: 11 f4 brne .+4 ; 0x5cc <__fp_round+0x18> + 5c8: 60 ff sbrs r22, 0 + 5ca: 04 c0 rjmp .+8 ; 0x5d4 <__fp_round+0x20> + 5cc: 6f 5f subi r22, 0xFF ; 255 + 5ce: 7f 4f sbci r23, 0xFF ; 255 + 5d0: 8f 4f sbci r24, 0xFF ; 255 + 5d2: 9f 4f sbci r25, 0xFF ; 255 + 5d4: 08 95 ret + +000005d6 <__mulhi3>: + 5d6: 00 24 eor r0, r0 + 5d8: 55 27 eor r21, r21 + 5da: 04 c0 rjmp .+8 ; 0x5e4 <__mulhi3+0xe> + 5dc: 08 0e add r0, r24 + 5de: 59 1f adc r21, r25 + 5e0: 88 0f add r24, r24 + 5e2: 99 1f adc r25, r25 + 5e4: 00 97 sbiw r24, 0x00 ; 0 + 5e6: 29 f0 breq .+10 ; 0x5f2 <__mulhi3+0x1c> + 5e8: 76 95 lsr r23 + 5ea: 67 95 ror r22 + 5ec: b8 f3 brcs .-18 ; 0x5dc <__mulhi3+0x6> + 5ee: 71 05 cpc r23, r1 + 5f0: b9 f7 brne .-18 ; 0x5e0 <__mulhi3+0xa> + 5f2: 80 2d mov r24, r0 + 5f4: 95 2f mov r25, r21 + 5f6: 08 95 ret + +000005f8 <_exit>: + 5f8: f8 94 cli + +000005fa <__stop_program>: + 5fa: ff cf rjmp .-2 ; 0x5fa <__stop_program> diff --git a/trunk/AVRProjects/ATTiny84/main.lst b/trunk/AVRProjects/ATTiny84/main.lst new file mode 100644 index 00000000..81b1917f --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.lst @@ -0,0 +1,536 @@ + 1 .file "main.c" + 2 __SP_H__ = 0x3e + 3 __SP_L__ = 0x3d + 4 __SREG__ = 0x3f + 5 __tmp_reg__ = 0 + 6 __zero_reg__ = 1 + 7 .text + 8 .Ltext0: + 9 .cfi_sections .debug_frame + 10 .section .rodata.str1.1,"aMS",@progbits,1 + 11 .LC0: + 12 0000 4C4F 5645 .string "LOVE" + 12 00 + 13 .section .text.startup,"ax",@progbits + 14 .global main + 16 main: + 17 .LFB6: + 18 .file 1 "main.c" + 1:main.c **** #define F_CPU 1000000L + 2:main.c **** #define CONFIG_DISPLAY + 3:main.c **** + 4:main.c **** #define __DELAY_BACKWARD_COMPATIBLE__ + 5:main.c **** #include + 6:main.c **** #include + 7:main.c **** #include "../00_Lib/nokia_5110.h" + 8:main.c **** + 9:main.c **** + 10:main.c **** int main (void) + 11:main.c **** { + 19 .loc 1 11 0 + 20 .cfi_startproc + 21 /* prologue: function */ + 22 /* frame size = 0 */ + 23 /* stack size = 0 */ + 24 .L__stack_usage = 0 + 12:main.c **** unsigned char zwischenspeicher; + 13:main.c **** DDRB = 0b00000001; + 25 .loc 1 13 0 + 26 0000 81E0 ldi r24,lo8(1) + 27 0002 87BB out 0x17,r24 + 14:main.c **** DDRA = 0b00011111; + 28 .loc 1 14 0 + 29 0004 8FE1 ldi r24,lo8(31) + 30 0006 8ABB out 0x1a,r24 + 15:main.c **** + 16:main.c **** LCD_init(); //LCD initialization + 31 .loc 1 16 0 + 32 0008 00D0 rcall LCD_init + 33 .LVL0: + 17:main.c **** LCD_clear(); //clear the LCD + 34 .loc 1 17 0 + 35 000a 00D0 rcall LCD_clear + 36 .LVL1: + 18:main.c **** + 19:main.c **** LCD_write_char('*'); + 37 .loc 1 19 0 + 38 000c 8AE2 ldi r24,lo8(42) + 39 000e 00D0 rcall LCD_write_char + 40 .LVL2: + 20:main.c **** LCD_write_byte(0,1); + 41 .loc 1 20 0 + 42 0010 61E0 ldi r22,lo8(1) + 43 0012 80E0 ldi r24,0 + 44 0014 00D0 rcall LCD_write_byte + 45 .LVL3: + 21:main.c **** LCD_write_byte(0,1); + 46 .loc 1 21 0 + 47 0016 61E0 ldi r22,lo8(1) + 48 0018 80E0 ldi r24,0 + 49 001a 00D0 rcall LCD_write_byte + 50 .LVL4: + 22:main.c **** LCD_write_char('L'); + 51 .loc 1 22 0 + 52 001c 8CE4 ldi r24,lo8(76) + 53 001e 00D0 rcall LCD_write_char + 54 .LVL5: + 23:main.c **** LCD_write_char('o'); + 55 .loc 1 23 0 + 56 0020 8FE6 ldi r24,lo8(111) + 57 0022 00D0 rcall LCD_write_char + 58 .LVL6: + 24:main.c **** LCD_write_char('v'); + 59 .loc 1 24 0 + 60 0024 86E7 ldi r24,lo8(118) + 61 0026 00D0 rcall LCD_write_char + 62 .LVL7: + 25:main.c **** LCD_write_char('e'); + 63 .loc 1 25 0 + 64 0028 85E6 ldi r24,lo8(101) + 65 002a 00D0 rcall LCD_write_char + 66 .LVL8: + 26:main.c **** LCD_write_byte(0,1); + 67 .loc 1 26 0 + 68 002c 61E0 ldi r22,lo8(1) + 69 002e 80E0 ldi r24,0 + 70 0030 00D0 rcall LCD_write_byte + 71 .LVL9: + 27:main.c **** LCD_write_byte(0,1); + 72 .loc 1 27 0 + 73 0032 61E0 ldi r22,lo8(1) + 74 0034 80E0 ldi r24,0 + 75 0036 00D0 rcall LCD_write_byte + 76 .LVL10: + 28:main.c **** LCD_write_byte(0,1); + 77 .loc 1 28 0 + 78 0038 61E0 ldi r22,lo8(1) + 79 003a 80E0 ldi r24,0 + 80 003c 00D0 rcall LCD_write_byte + 81 .LVL11: + 29:main.c **** LCD_write_byte(0,1); + 82 .loc 1 29 0 + 83 003e 61E0 ldi r22,lo8(1) + 84 0040 80E0 ldi r24,0 + 85 0042 00D0 rcall LCD_write_byte + 86 .LVL12: + 30:main.c **** LCD_write_byte(0,1); + 87 .loc 1 30 0 + 88 0044 61E0 ldi r22,lo8(1) + 89 0046 80E0 ldi r24,0 + 90 0048 00D0 rcall LCD_write_byte + 91 .LVL13: + 31:main.c **** LCD_write_char('S'); + 92 .loc 1 31 0 + 93 004a 83E5 ldi r24,lo8(83) + 94 004c 00D0 rcall LCD_write_char + 95 .LVL14: + 32:main.c **** LCD_write_char('i'); + 96 .loc 1 32 0 + 97 004e 89E6 ldi r24,lo8(105) + 98 0050 00D0 rcall LCD_write_char + 99 .LVL15: + 33:main.c **** LCD_write_char('l'); + 100 .loc 1 33 0 + 101 0052 8CE6 ldi r24,lo8(108) + 102 0054 00D0 rcall LCD_write_char + 103 .LVL16: + 34:main.c **** LCD_write_char('v'); + 104 .loc 1 34 0 + 105 0056 86E7 ldi r24,lo8(118) + 106 0058 00D0 rcall LCD_write_char + 107 .LVL17: + 35:main.c **** LCD_write_char('i'); + 108 .loc 1 35 0 + 109 005a 89E6 ldi r24,lo8(105) + 110 005c 00D0 rcall LCD_write_char + 111 .LVL18: + 36:main.c **** LCD_write_char('a'); + 112 .loc 1 36 0 + 113 005e 81E6 ldi r24,lo8(97) + 114 0060 00D0 rcall LCD_write_char + 115 .LVL19: + 37:main.c **** LCD_write_byte(0,1); + 116 .loc 1 37 0 + 117 0062 61E0 ldi r22,lo8(1) + 118 0064 80E0 ldi r24,0 + 119 0066 00D0 rcall LCD_write_byte + 120 .LVL20: + 38:main.c **** LCD_write_byte(0,1); + 121 .loc 1 38 0 + 122 0068 61E0 ldi r22,lo8(1) + 123 006a 80E0 ldi r24,0 + 124 006c 00D0 rcall LCD_write_byte + 125 .LVL21: + 39:main.c **** LCD_write_char('*'); + 126 .loc 1 39 0 + 127 006e 8AE2 ldi r24,lo8(42) + 128 0070 00D0 rcall LCD_write_char + 129 .LVL22: + 40:main.c **** + 41:main.c **** LCD_write_english_string(0,1,"LOVE"); + 130 .loc 1 41 0 + 131 0072 40E0 ldi r20,lo8(.LC0) + 132 0074 50E0 ldi r21,hi8(.LC0) + 133 0076 61E0 ldi r22,lo8(1) + 134 0078 80E0 ldi r24,0 + 135 007a 00D0 rcall LCD_write_english_string + 136 .LVL23: + 42:main.c **** + 43:main.c **** while(1) + 44:main.c **** { + 45:main.c **** zwischenspeicher = PORTB; + 46:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000001; + 137 .loc 1 46 0 + 138 007c 41E0 ldi r20,lo8(1) + 139 .LBB12: + 140 .LBB13: + 141 .LBB14: + 142 .LBB15: + 143 .file 2 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\util\\delay_basic.h" + 1:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** /* Copyright (c) 2002, Marek Michalkiewicz + 2:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Copyright (c) 2007 Joerg Wunsch + 3:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** All rights reserved. + 4:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 5:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Redistribution and use in source and binary forms, with or without + 6:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** modification, are permitted provided that the following conditions are met: + 7:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 8:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** * Redistributions of source code must retain the above copyright + 9:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** notice, this list of conditions and the following disclaimer. + 10:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 11:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** * Redistributions in binary form must reproduce the above copyright + 12:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** notice, this list of conditions and the following disclaimer in + 13:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** the documentation and/or other materials provided with the + 14:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** distribution. + 15:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 16:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** * Neither the name of the copyright holders nor the names of + 17:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** contributors may be used to endorse or promote products derived + 18:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** from this software without specific prior written permission. + 19:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 20:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + 21:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + 22:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + 23:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + 24:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + 25:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + 26:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + 27:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + 28:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 29:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + 30:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** POSSIBILITY OF SUCH DAMAGE. */ + 31:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 32:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** /* $Id$ */ + 33:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 34:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** #ifndef _UTIL_DELAY_BASIC_H_ + 35:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** #define _UTIL_DELAY_BASIC_H_ 1 + 36:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 37:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** #include + 38:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 39:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** #if !defined(__DOXYGEN__) + 40:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** static inline void _delay_loop_1(uint8_t __count) __attribute__((always_inline)); + 41:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** static inline void _delay_loop_2(uint16_t __count) __attribute__((always_inline)); + 42:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** #endif + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** /** \file */ + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** /** \defgroup util_delay_basic : Basic busy-wait delay loops + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** \code + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** #include + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** \endcode + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** The functions in this header file implement simple delay loops + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** that perform a busy-waiting. They are typically used to + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** facilitate short delays in the program execution. They are + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** implemented as count-down loops with a well-known CPU cycle + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** count per loop iteration. As such, no other processing can + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** occur simultaneously. It should be kept in mind that the + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** functions described here do not disable interrupts. + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** In general, for long delays, the use of hardware timers is + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** much preferrable, as they free the CPU, and allow for + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** concurrent processing of other events while the timer is + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** running. However, in particular for very short delays, the + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** overhead of setting up a hardware timer is too much compared + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** to the overall delay time. + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Two inline functions are provided for the actual delay algorithms. + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** */ + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** /** \ingroup util_delay_basic + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Delay loop using an 8-bit counter \c __count, so up to 256 + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** iterations are possible. (The value 256 would have to be passed + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** as 0.) The loop executes three CPU cycles per iteration, not + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** including the overhead the compiler needs to setup the counter + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** register. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Thus, at a CPU speed of 1 MHz, delays of up to 768 microseconds + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** can be achieved. + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** */ + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** void + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** _delay_loop_1(uint8_t __count) + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** { + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** __asm__ volatile ( + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** "1: dec %0" "\n\t" + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** "brne 1b" + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** : "=r" (__count) + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** : "0" (__count) + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** ); + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** } + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** /** \ingroup util_delay_basic + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Delay loop using a 16-bit counter \c __count, so up to 65536 + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** iterations are possible. (The value 65536 would have to be + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** passed as 0.) The loop executes four CPU cycles per iteration, + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** not including the overhead the compiler requires to setup the + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** counter register pair. + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** Thus, at a CPU speed of 1 MHz, delays of up to about 262.1 + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** milliseconds can be achieved. + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** */ + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** void + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** _delay_loop_2(uint16_t __count) + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** { + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h **** __asm__ volatile ( + 144 .loc 2 105 0 + 145 007e 29E1 ldi r18,lo8(25) + 146 0080 30E0 ldi r19,0 + 147 .L3: + 148 .LBE15: + 149 .LBE14: + 150 .LBE13: + 151 .LBE12: + 45:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000001; + 152 .loc 1 45 0 discriminator 1 + 153 0082 88B3 in r24,0x18 + 154 .LVL24: + 155 .loc 1 46 0 discriminator 1 + 156 0084 8427 eor r24,r20 + 157 .LVL25: + 47:main.c **** PORTB = zwischenspeicher; + 158 .loc 1 47 0 discriminator 1 + 159 0086 88BB out 0x18,r24 + 160 .LVL26: + 161 0088 88E8 ldi r24,lo8(-120) + 162 008a 93E1 ldi r25,lo8(19) + 163 .LVL27: + 164 .L4: + 165 .LBB19: + 166 .LBB18: + 167 .LBB17: + 168 .LBB16: + 169 .loc 2 105 0 + 170 008c F901 movw r30,r18 + 171 /* #APP */ + 172 ; 105 "e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h" 1 + 173 008e 3197 1: sbiw r30,1 + 174 0090 01F4 brne 1b + 175 ; 0 "" 2 + 176 .LVL28: + 177 /* #NOAPP */ + 178 0092 0197 sbiw r24,1 + 179 .LVL29: + 180 .LBE16: + 181 .LBE17: + 182 .file 3 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\util\\delay.h" + 1:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz + 2:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch + 3:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2007 Florin-Viorel Petrov + 4:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** All rights reserved. + 5:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 6:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Redistribution and use in source and binary forms, with or without + 7:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** modification, are permitted provided that the following conditions are met: + 8:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 9:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions of source code must retain the above copyright + 10:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer. + 11:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 12:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions in binary form must reproduce the above copyright + 13:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer in + 14:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the documentation and/or other materials provided with the + 15:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** distribution. + 16:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 17:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Neither the name of the copyright holders nor the names of + 18:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** contributors may be used to endorse or promote products derived + 19:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** from this software without specific prior written permission. + 20:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 21:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + 22:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + 23:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + 24:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + 25:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + 26:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + 27:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + 28:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + 29:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 30:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + 31:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** POSSIBILITY OF SUCH DAMAGE. */ + 32:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 33:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* $Id$ */ + 34:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 35:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef _UTIL_DELAY_H_ + 36:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define _UTIL_DELAY_H_ 1 + 37:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 38:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __HAS_DELAY_CYCLES + 39:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define __HAS_DELAY_CYCLES 1 + 40:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 41:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 42:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \file */ + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \code + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define F_CPU 1000000UL // 1 MHz + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //#define F_CPU 14.7456E6 + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \endcode + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note As an alternative method, it is possible to pass the + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU macro down to the compiler from the Makefile. + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Obviously, in that case, no \c \#define statement should be + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** used. + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions in this header file are wrappers around the basic + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** busy-wait functions from . They are meant as + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** convenience functions where actual time values can be specified + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** rather than a number of cycles to wait for. The idea behind is + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** that compile-time constant expressions will be eliminated by + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compiler optimization so floating-point expressions can be used + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to calculate the number of delay cycles needed based on the CPU + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** frequency passed by the macro F_CPU. + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note In order for these functions to work as intended, compiler + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** optimizations must be enabled, and the delay time + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** must be an expression that is a known constant at + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compile-time. If these requirements are not met, the resulting + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delay will be much longer (and basically unpredictable), and + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** applications that otherwise do not use floating-point calculations + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** will experience severe code bloat by the floating-point library + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** routines linked into the application. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions available allow the specification of microsecond, and + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** millisecond delays directly, using the application-supplied macro + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU as the CPU clock frequency (in Hertz). + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if !defined(__DOXYGEN__) + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef F_CPU + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* prevent compiler error by supplying a default */ + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "F_CPU not defined for " + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # define F_CPU 1000000UL + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __OPTIMIZE__ + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # include + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \ingroup util_delay + 106:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 107:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + 108:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 109:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The macro F_CPU is supposed to be defined to a + 110:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** constant defining the CPU clock frequency (in Hertz). + 111:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 112:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. + 113:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 114:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** When the user request delay which exceed the maximum possible one, + 115:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms() provides a decreased resolution functionality. In this + 116:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing + 117:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The + 118:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** user will not be informed about decreased resolution. + 119:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 120:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) + 121:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For + 122:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** values greater than the maximal possible delay, overflows results in + 123:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** no delay i.e., 0ms. + 124:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 125:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Conversion of __us into clock cycles may not always result in integer. + 126:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** By default, the clock cycles rounded up to next integer. This ensures that + 127:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the user gets atleast __us microseconds of delay. + 128:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 129:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ + 130:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to round down and round to closest integer. + 131:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 132:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Note: The new implementation of _delay_ms(double __ms) with + 133:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. + 134:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. + 135:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Also, the backward compatible + 136:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** algorithm will be chosen if the code is compiled in a freestanding + 137:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** environment (GCC option \c -ffreestanding), as the math functions + 138:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** required for rounding are not available to the compiler then. + 139:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 140:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 141:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** void + 142:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms(double __ms) + 143:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 144:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** double __tmp ; + 145:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 146:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 147:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 148:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint32_t __ticks_dc; + 149:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); + 150:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; + 151:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 152:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if defined(__DELAY_ROUND_DOWN__) + 153:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); + 154:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 155:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) + 156:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); + 157:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 158:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 159:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //round up by default + 160:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + 161:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 162:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 163:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(__ticks_dc); + 164:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 165:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 166:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint16_t __ticks; + 167:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 4e3) * __ms; + 168:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** if (__tmp < 1.0) + 169:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks = 1; + 170:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** else if (__tmp > 65535) + 171:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 172:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** // __ticks = requested delay in 1/10 ms + 173:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks = (uint16_t) (__ms * 10.0); + 174:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** while(__ticks) + 183 .loc 3 174 0 + 184 0094 01F4 brne .L4 + 185 0096 00C0 rjmp .L3 + 186 .LBE18: + 187 .LBE19: + 188 .cfi_endproc + 189 .LFE6: + 191 .text + 192 .Letext0: + 193 .file 4 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\stdint.h" + 194 .file 5 "../00_Lib/nokia_5110.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\ccq6mhBU.s:2 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp\ccq6mhBU.s:3 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\ccq6mhBU.s:4 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\ccq6mhBU.s:5 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\ccq6mhBU.s:6 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\ccq6mhBU.s:16 .text.startup:00000000 main + +UNDEFINED SYMBOLS +LCD_init +LCD_clear +LCD_write_char +LCD_write_byte +LCD_write_english_string +__do_copy_data diff --git a/trunk/AVRProjects/ATTiny84/main.map b/trunk/AVRProjects/ATTiny84/main.map new file mode 100644 index 00000000..9a1e5f7a --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.map @@ -0,0 +1,666 @@ +Archive member included to satisfy reference by file (symbol) + +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) + ../00_Lib/nokia_5110.o (__ltsf2) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) + ../00_Lib/nokia_5110.o (__fixunssfsi) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) + ../00_Lib/nokia_5110.o (__floatunsisf) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_cmp.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) (__fp_cmp) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) (__fp_splitA) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) (__fp_zero) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + ../00_Lib/nokia_5110.o (__gtsf2) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) + ../00_Lib/nokia_5110.o (__mulsf3) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) (__mulsf3x) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_inf.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) (__fp_inf) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_nan.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) (__fp_nan) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscA.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) (__fp_pscA) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscB.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) (__fp_pscB) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_round.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) (__fp_round) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + ../00_Lib/nokia_5110.o (__mulhi3) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o (exit) +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + main.o (__do_copy_data) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00002000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +LOAD main.o +LOAD ../00_Lib/nokia_5110.o +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a +START GROUP +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libc.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x5fc + *(.vectors) + .vectors 0x00000000 0x22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x00000022 . = ALIGN (0x2) + 0x00000022 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000022 0x0 linker stubs + *(.trampolines*) + 0x00000022 __trampolines_end = . + *(.progmem*) + 0x00000022 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000022 __ctors_start = . + *(.ctors) + 0x00000022 __ctors_end = . + 0x00000022 __dtors_start = . + *(.dtors) + 0x00000022 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000022 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + 0x00000022 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000022 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + .init4 0x0000002e 0x16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + 0x0000002e __do_copy_data + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x00000044 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + *(.init9) + *(.text) + .text 0x00000048 0x2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + 0x00000048 __vector_1 + 0x00000048 __vector_12 + 0x00000048 __bad_interrupt + 0x00000048 __vector_6 + 0x00000048 __vector_3 + 0x00000048 __vector_11 + 0x00000048 __vector_13 + 0x00000048 __vector_7 + 0x00000048 __vector_5 + 0x00000048 __vector_4 + 0x00000048 __vector_9 + 0x00000048 __vector_2 + 0x00000048 __vector_15 + 0x00000048 __vector_8 + 0x00000048 __vector_14 + 0x00000048 __vector_10 + 0x00000048 __vector_16 + .text 0x0000004a 0x0 main.o + .text 0x0000004a 0x252 ../00_Lib/nokia_5110.o + 0x0000004a delay_1us + 0x00000052 delay_1ms + 0x0000005c delay_nms + 0x000000f0 LCD_write_byte + 0x00000116 LCD_clear + 0x0000013a LCD_init + 0x00000178 LCD_set_XY + 0x0000018e LCD_write_char + 0x000001c8 LCD_write_english_string + 0x00000200 LCD_draw_bmp_pixel + 0x00000298 LCD_pixel + 0x0000029a LCD_line + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_cmp.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_inf.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_nan.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscA.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscB.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_round.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text 0x0000029c 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + 0x0000029c . = ALIGN (0x2) + *(.text.*) + .text.startup 0x0000029c 0x98 main.o + 0x0000029c main + .text.avr-libc.fplib + 0x00000334 0x8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) + 0x00000334 __nesf2 + 0x00000334 __eqsf2 + 0x00000334 __cmpsf2 + 0x00000334 __ltsf2 + 0x00000334 __lesf2 + .text.avr-libc.fplib + 0x0000033c 0x58 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) + 0x0000033c __fixunssfsi + .text.avr-libc.fplib + 0x00000394 0x7a e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) + 0x00000394 __floatunsisf + 0x00000398 __floatsisf + .text.avr-libc.fplib + 0x0000040e 0x48 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_cmp.o) + 0x0000040e __fp_cmp + .text.avr-libc.fplib + 0x00000456 0x44 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + 0x00000456 __fp_split3 + 0x00000466 __fp_splitA + .text.avr-libc.fplib + 0x0000049a 0xe e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + 0x0000049a __fp_zero + 0x0000049c __fp_szero + .text.avr-libc.fplib + 0x000004a8 0x8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + 0x000004a8 __gesf2 + 0x000004a8 __gtsf2 + .text.avr-libc.fplib + 0x000004b0 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) + 0x000004b0 __mulsf3 + .text.avr-libc.fplib + 0x000004b4 0xd2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) + 0x000004c6 __mulsf3x + 0x000004ca __mulsf3_pse + .text.avr-libc.fplib + 0x00000586 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_inf.o) + 0x00000586 __fp_inf + .text.avr-libc.fplib + 0x00000592 0x6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_nan.o) + 0x00000592 __fp_nan + .text.avr-libc.fplib + 0x00000598 0xe e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscA.o) + 0x00000598 __fp_pscA + .text.avr-libc.fplib + 0x000005a6 0xe e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscB.o) + 0x000005a6 __fp_pscB + .text.avr-libc.fplib + 0x000005b4 0x22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_round.o) + 0x000005b4 __fp_round + .text.libgcc.mul + 0x000005d6 0x22 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + 0x000005d6 __mulhi3 + .text.libgcc.div + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text.libgcc 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text.libgcc.prologue + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text.libgcc.builtins + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text.libgcc.fmul + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text.libgcc.fixed + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .text.libgcc.mul + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.div + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.mul + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + .text.libgcc.div + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + .text.libgcc 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + .text.libgcc.prologue + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + .text.libgcc.builtins + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + .text.libgcc.fmul + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + .text.libgcc.fixed + 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + 0x000005f8 . = ALIGN (0x2) + *(.fini9) + .fini9 0x000005f8 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + 0x000005f8 _exit + 0x000005f8 exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x000005f8 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + *(.fini0) + 0x000005fc _etext = . + +.data 0x00800060 0x22e load address 0x000005fc + 0x00800060 PROVIDE (__data_start, .) + *(.data) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + .data 0x00800060 0x0 main.o + .data 0x00800060 0x0 ../00_Lib/nokia_5110.o + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_cmp.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_inf.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_nan.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscA.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscB.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_round.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .data 0x00800060 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + *(.data*) + *(.rodata) + .rodata 0x00800060 0x228 ../00_Lib/nokia_5110.o + *(.rodata*) + .rodata.str1.1 + 0x00800288 0x5 main.o + *(.gnu.linkonce.d*) + 0x0080028e . = ALIGN (0x2) + *fill* 0x0080028d 0x1 + 0x0080028e _edata = . + 0x0080028e PROVIDE (__data_end, .) + +.bss 0x0080028e 0x0 + 0x0080028e PROVIDE (__bss_start, .) + *(.bss) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o + .bss 0x0080028e 0x0 main.o + .bss 0x0080028e 0x0 ../00_Lib/nokia_5110.o + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_cmp.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_inf.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_nan.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscA.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscB.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_round.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .bss 0x0080028e 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + *(.bss*) + *(COMMON) + 0x0080028e PROVIDE (__bss_end, .) + 0x000005fc __data_load_start = LOADADDR (.data) + 0x0000082a __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x0080028e 0x0 + 0x0080028e PROVIDE (__noinit_start, .) + *(.noinit*) + 0x0080028e PROVIDE (__noinit_end, .) + 0x0080028e _end = . + 0x0080028e PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + .comment 0x00000011 0x12 ../00_Lib/nokia_5110.o + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x40 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 main.o + .debug_aranges + 0x00000020 0x20 ../00_Lib/nokia_5110.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0xa93 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x3a6 main.o + .debug_info 0x000003a6 0x6ed ../00_Lib/nokia_5110.o + +.debug_abbrev 0x00000000 0x3a3 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0x13d main.o + .debug_abbrev 0x0000013d 0x266 ../00_Lib/nokia_5110.o + +.debug_line 0x00000000 0x2df + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0x127 main.o + .debug_line 0x00000127 0x1b8 ../00_Lib/nokia_5110.o + +.debug_frame 0x00000000 0x1c8 + *(.debug_frame) + .debug_frame 0x00000000 0x24 main.o + .debug_frame 0x00000024 0x1a4 ../00_Lib/nokia_5110.o + +.debug_str 0x00000000 0x252 + *(.debug_str) + .debug_str 0x00000000 0x174 main.o + 0x1a8 (size before relaxing) + .debug_str 0x00000174 0xde ../00_Lib/nokia_5110.o + 0x26e (size before relaxing) + +.debug_loc 0x00000000 0x74c + *(.debug_loc) + .debug_loc 0x00000000 0x76 main.o + .debug_loc 0x00000076 0x6d6 ../00_Lib/nokia_5110.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x58 + *(.debug_ranges) + .debug_ranges 0x00000000 0x40 main.o + .debug_ranges 0x00000040 0x18 ../00_Lib/nokia_5110.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +LCD_clear ../00_Lib/nokia_5110.o + main.o +LCD_draw_bmp_pixel ../00_Lib/nokia_5110.o +LCD_init ../00_Lib/nokia_5110.o + main.o +LCD_line ../00_Lib/nokia_5110.o +LCD_pixel ../00_Lib/nokia_5110.o +LCD_set_XY ../00_Lib/nokia_5110.o +LCD_write_byte ../00_Lib/nokia_5110.o + main.o +LCD_write_char ../00_Lib/nokia_5110.o + main.o +LCD_write_english_string ../00_Lib/nokia_5110.o + main.o +__bad_interrupt e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__cmpsf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) +__data_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) +__data_load_start e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) +__data_start e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) +__do_copy_data e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_copy_data.o) + ../00_Lib/nokia_5110.o + main.o +__eqsf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) +__fixunssfsi e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) + ../00_Lib/nokia_5110.o +__floatsisf e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) +__floatunsisf e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(floatsisf.o) + ../00_Lib/nokia_5110.o +__fp_cmp e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_cmp.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) +__fp_inf e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_inf.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__fp_nan e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_nan.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__fp_pscA e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscA.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__fp_pscB e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_pscB.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__fp_round e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_round.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) +__fp_split3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__fp_splitA e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_split3.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) +__fp_szero e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__fp_zero e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fp_zero.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(fixunssfsi.o) +__gesf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) +__gtsf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(gesf2.o) + ../00_Lib/nokia_5110.o +__heap_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__init e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__lesf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) +__ltsf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) + ../00_Lib/nokia_5110.o +__mulhi3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_mulhi3.o) + ../00_Lib/nokia_5110.o +__mulsf3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) + ../00_Lib/nokia_5110.o +__mulsf3_pse e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) +__mulsf3x e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3x.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(mulsf3.o) +__nesf2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a(cmpsf2.o) +__stack e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_1 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_10 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_11 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_12 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_13 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_14 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_15 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_5 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_7 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_9 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vector_default e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +__vectors e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +_exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) +delay_1ms ../00_Lib/nokia_5110.o +delay_1us ../00_Lib/nokia_5110.o +delay_nms ../00_Lib/nokia_5110.o +exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o +main main.o + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn84.o diff --git a/trunk/AVRProjects/ATTiny84/main.sym b/trunk/AVRProjects/ATTiny84/main.sym new file mode 100644 index 00000000..aeca4d5b --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/main.sym @@ -0,0 +1,88 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +00000001 a __zero_reg__ +00000022 T __ctors_end +00000022 T __ctors_start +00000022 T __dtors_end +00000022 T __dtors_start +00000022 W __init +00000022 T __trampolines_end +00000022 T __trampolines_start +0000002e T __do_copy_data +0000003d a __SP_L__ +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003e a __SP_H__ +0000003f a __SREG__ +0000003f a __SREG__ +00000048 T __bad_interrupt +00000048 W __vector_1 +00000048 W __vector_10 +00000048 W __vector_11 +00000048 W __vector_12 +00000048 W __vector_13 +00000048 W __vector_14 +00000048 W __vector_15 +00000048 W __vector_16 +00000048 W __vector_2 +00000048 W __vector_3 +00000048 W __vector_4 +00000048 W __vector_5 +00000048 W __vector_6 +00000048 W __vector_7 +00000048 W __vector_8 +00000048 W __vector_9 +0000004a T delay_1us +00000052 T delay_1ms +0000005c T delay_nms +000000f0 T LCD_write_byte +00000116 T LCD_clear +0000013a T LCD_init +00000178 T LCD_set_XY +0000018e T LCD_write_char +000001c8 T LCD_write_english_string +00000200 T LCD_draw_bmp_pixel +0000025f W __stack +00000298 T LCD_pixel +0000029a T LCD_line +0000029c T main +00000334 T __cmpsf2 +00000334 T __eqsf2 +00000334 T __lesf2 +00000334 T __ltsf2 +00000334 T __nesf2 +0000033c T __fixunssfsi +00000394 T __floatunsisf +00000398 T __floatsisf +0000040e T __fp_cmp +00000456 T __fp_split3 +00000466 T __fp_splitA +0000049a T __fp_zero +0000049c T __fp_szero +000004a8 T __gesf2 +000004a8 T __gtsf2 +000004b0 T __mulsf3 +000004c6 T __mulsf3x +000004ca T __mulsf3_pse +00000586 T __fp_inf +00000592 T __fp_nan +00000598 T __fp_pscA +000005a6 T __fp_pscB +000005b4 T __fp_round +000005d6 T __mulhi3 +000005f8 T _exit +000005f8 W exit +000005fa t __stop_program +000005fc A __data_load_start +000005fc T _etext +0000082a A __data_load_end +00800060 D __data_start +00800060 d font6x8 +0080028e D __data_end +0080028e D _edata +0080028e D _end +00810000 D __eeprom_end diff --git a/trunk/AVRProjects/ATTiny84/makefile b/trunk/AVRProjects/ATTiny84/makefile new file mode 100644 index 00000000..a506afe6 --- /dev/null +++ b/trunk/AVRProjects/ATTiny84/makefile @@ -0,0 +1,444 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny84 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + +#ifeq ($(CONFIG_DISPLAY),y) + SRC += ../00_Lib/nokia_5110.c +#endif + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.avr b/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.avr new file mode 100644 index 00000000..66d1f76d --- /dev/null +++ b/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.avr @@ -0,0 +1,40 @@ +;* ******************************************************** * +; ATtiny 13/45/85 Pin map +; +-\/-+ +; /Reset ADC0 PB5 1|o |8 Vcc +; ADC3 PB3 2| |7 PB2 ADC1 SCK +; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 +; GND 4| |5 PB0 OC0A MOSI AIN0 +; +----+ +;* ******************************************************** */ + +; Define processor type on top of the source code +; +.DEVICE ATtiny85 + +; Int-Vector area +.CSEG +.ORG $0000 + rjmp Setup ;Reset + reti ;INT0 - External Int0 Vector + reti ;PCINT0 - Pin Change Interrupt handler + reti ;TIM1_COMPA - Timer1 Compare match A Handler + reti ;TIM1_OVF - Timer1 Overflow handler + reti ;TIM0_OVF - Timer0 Overflow handler + reti ;EE_RDY - EEPROM Ready Handler + reti ;ANA_COMP - Analog Comparator Handler + reti ;ADC - ADC Conversion Handler + reti ;TIM1_COMPB - Timer1 Compare match B Handler + reti ;TIM0_COMPA - Timer0 Compare match A Handler + reti ;TIM0_COMPB - Timer0 Compare match B Handler + reti ;WDT - Watchdog Overflow Handler + reti ;USI_START - USI Start + reti ;USI_OVF - USI Overflow + +.ORG $000F +Setup: + cli ; Disable Interrupts + ldi r16, low(RAMEND) + out SPL,r16 ;Set Stack Pointer to top of RAM +Main: + rjmp Main ; infinite loop diff --git a/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.hex b/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.hex new file mode 100644 index 00000000..b7212ee5 --- /dev/null +++ b/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.hex @@ -0,0 +1,5 @@ +:020000020000FC +:100000000EC0189518951895189518951895189567 +:100010001895189518951895189518951895F89499 +:060020000FE50DBFFFCF4C +:00000001FF diff --git a/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.lst b/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.lst new file mode 100644 index 00000000..56b2f763 --- /dev/null +++ b/trunk/AVRProjects/ATTiny85-primo_asm/tiny85_primo.lst @@ -0,0 +1,55 @@ +gavrasm Gerd's AVR assembler version 3.5 (C)2015 by DG4FAC +---------------------------------------------------------- +Source file: tiny85_primo.avr +Hex file: tiny85_primo.hex +Eeprom file: tiny85_primo.eep +Compiled: 26.07.2016, 11:33:50 +Pass: 2 + 1: ;* ******************************************************** * + 2: ; ATtiny 13/45/85 Pin map + 3: ; +-\/-+ + 4: ; /Reset ADC0 PB5 1|o |8 Vcc + 5: ; ADC3 PB3 2| |7 PB2 ADC1 SCK + 6: ; ADC2 PB4 3| |6 PB1 OC0B MISO AIN1 + 7: ; GND 4| |5 PB0 OC0A MOSI AIN0 + 8: ; +----+ + 9: ;* ******************************************************** */ + 10: + 11: ; Define processor type on top of the source code + 12: ; + 13: .DEVICE ATtiny85 + 14: + 15: ; Int-Vector area + 16: .CSEG + 17: .ORG $0000 + 18: 000000 C00E rjmp Setup ;Reset + 19: 000001 9518 reti ;INT0 - External Int0 Vector + 20: 000002 9518 reti ;PCINT0 - Pin Change Interrupt handler + 21: 000003 9518 reti ;TIM1_COMPA - Timer1 Compare match A Handler + 22: 000004 9518 reti ;TIM1_OVF - Timer1 Overflow handler + 23: 000005 9518 reti ;TIM0_OVF - Timer0 Overflow handler + 24: 000006 9518 reti ;EE_RDY - EEPROM Ready Handler + 25: 000007 9518 reti ;ANA_COMP - Analog Comparator Handler + 26: 000008 9518 reti ;ADC - ADC Conversion Handler + 27: 000009 9518 reti ;TIM1_COMPB - Timer1 Compare match B Handler + 28: 00000A 9518 reti ;TIM0_COMPA - Timer0 Compare match A Handler + 29: 00000B 9518 reti ;TIM0_COMPB - Timer0 Compare match B Handler + 30: 00000C 9518 reti ;WDT - Watchdog Overflow Handler + 31: 00000D 9518 reti ;USI_START - USI Start + 32: 00000E 9518 reti ;USI_OVF - USI Overflow + 33: + 34: .ORG $000F + 35: Setup: + 36: 00000F 94F8 cli ; Disable Interrupts + 37: 000010 E50F ldi r16, low(RAMEND) + 38: 000011 BF0D out SPL,r16 ;Set Stack Pointer to top of RAM + 39: Main: + 40: 000012 CFFF rjmp Main ; infinite loop + +Program : 19 words. +Constants : 0 words. +Total program memory: 19 words. +Eeprom space : 0 bytes. +Data segment : 0 bytes. +Compilation completed, no errors. +Compilation endet 26.07.2016, 11:33:50 diff --git a/trunk/AVRProjects/ATTiny88/.dep/main.o.d b/trunk/AVRProjects/ATTiny88/.dep/main.o.d new file mode 100644 index 00000000..6afa47e0 --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/.dep/main.o.d @@ -0,0 +1,43 @@ +main.o: main.c \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotn88.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h \ + e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\io.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\sfr_defs.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\inttypes.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\lib\gcc\avr\4.8.1\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\stdint.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\iotn88.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\portpins.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\common.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\version.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\fuse.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\avr\lock.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay_basic.h: + +e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\math.h: diff --git a/trunk/AVRProjects/ATTiny88/main.c b/trunk/AVRProjects/ATTiny88/main.c new file mode 100644 index 00000000..9d1b2c72 --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.c @@ -0,0 +1,44 @@ +/* ******************************************************** * + * + * Simple Template for ATMEL Microcontroller * + * -------------------------------------------------------- * + * Created on: 25.07.2016 + * Author: Paolo Iocco + * ******************************************************** */ +/* ******************************************************** * + ATtiny 88 / Mega 168 / Mega 328 Pin map + +-\/-+ + /Reset PC6 1|o |28 PC5 ADC5 + RXD PD0 2| |27 PC4 ADC4 + TXD PD1 3| |26 PC3 ADC3 + PD2 4| |25 PC2 ADC2 + OC2B PD3 5| |24 PC1 ADC1 + PD4 6| |23 PC0 ADC0 + VCC 7| |22 GND + GND 8| |21 AREF + OSC1 PB6 9| |20 VCC + OSC2 PB7 10| |19 PB5 SCK + OC0B PD5 11| |18 PB4 MISO + AIN0 OC0A PD6 12| |17 PB3 OC2A MOSI + AIN1 PD7 13| |16 PB2 OC1B + PB0 14| |15 PB1 OC1A + +----+ +* ******************************************************** */ + +#include +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000100; + PORTB = zwischenspeicher; + _delay_ms(500); + } + return 0; +} + diff --git a/trunk/AVRProjects/ATTiny88/main.eep b/trunk/AVRProjects/ATTiny88/main.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/ATTiny88/main.elf b/trunk/AVRProjects/ATTiny88/main.elf new file mode 100644 index 00000000..a8dee2d3 Binary files /dev/null and b/trunk/AVRProjects/ATTiny88/main.elf differ diff --git a/trunk/AVRProjects/ATTiny88/main.hex b/trunk/AVRProjects/ATTiny88/main.hex new file mode 100644 index 00000000..f7e115a4 --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.hex @@ -0,0 +1,7 @@ +:1000000013C01AC019C018C017C016C015C014C03C +:1000100013C012C011C010C00FC00EC00DC00CC064 +:100020000BC00AC009C008C011241FBECFEFD2E028 +:10003000DEBFCDBF02D011C0E3CF84E084B994E02D +:1000400085B1892785B92FE936E881E02150304014 +:0E0050008040E1F700C00000F3CFF894FFCF2E +:00000001FF diff --git a/trunk/AVRProjects/ATTiny88/main.lss b/trunk/AVRProjects/ATTiny88/main.lss new file mode 100644 index 00000000..cc104ccb --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.lss @@ -0,0 +1,112 @@ + +main.elf: file format elf32-avr + +Sections: +Idx Name Size VMA LMA File off Algn + 0 .data 00000000 00800100 0000005e 000000d2 2**0 + CONTENTS, ALLOC, LOAD, DATA + 1 .text 0000005e 00000000 00000000 00000074 2**1 + CONTENTS, ALLOC, LOAD, READONLY, CODE + 2 .comment 00000011 00000000 00000000 000000d2 2**0 + CONTENTS, READONLY + 3 .debug_aranges 00000020 00000000 00000000 000000e3 2**0 + CONTENTS, READONLY, DEBUGGING + 4 .debug_info 00000119 00000000 00000000 00000103 2**0 + CONTENTS, READONLY, DEBUGGING + 5 .debug_abbrev 000000d1 00000000 00000000 0000021c 2**0 + CONTENTS, READONLY, DEBUGGING + 6 .debug_line 000000d7 00000000 00000000 000002ed 2**0 + CONTENTS, READONLY, DEBUGGING + 7 .debug_frame 00000024 00000000 00000000 000003c4 2**2 + CONTENTS, READONLY, DEBUGGING + 8 .debug_str 00000132 00000000 00000000 000003e8 2**0 + CONTENTS, READONLY, DEBUGGING + 9 .debug_loc 0000001f 00000000 00000000 0000051a 2**0 + CONTENTS, READONLY, DEBUGGING + 10 .debug_ranges 00000010 00000000 00000000 00000539 2**0 + CONTENTS, READONLY, DEBUGGING + +Disassembly of section .text: + +00000000 <__vectors>: + 0: 13 c0 rjmp .+38 ; 0x28 <__ctors_end> + 2: 1a c0 rjmp .+52 ; 0x38 <__bad_interrupt> + 4: 19 c0 rjmp .+50 ; 0x38 <__bad_interrupt> + 6: 18 c0 rjmp .+48 ; 0x38 <__bad_interrupt> + 8: 17 c0 rjmp .+46 ; 0x38 <__bad_interrupt> + a: 16 c0 rjmp .+44 ; 0x38 <__bad_interrupt> + c: 15 c0 rjmp .+42 ; 0x38 <__bad_interrupt> + e: 14 c0 rjmp .+40 ; 0x38 <__bad_interrupt> + 10: 13 c0 rjmp .+38 ; 0x38 <__bad_interrupt> + 12: 12 c0 rjmp .+36 ; 0x38 <__bad_interrupt> + 14: 11 c0 rjmp .+34 ; 0x38 <__bad_interrupt> + 16: 10 c0 rjmp .+32 ; 0x38 <__bad_interrupt> + 18: 0f c0 rjmp .+30 ; 0x38 <__bad_interrupt> + 1a: 0e c0 rjmp .+28 ; 0x38 <__bad_interrupt> + 1c: 0d c0 rjmp .+26 ; 0x38 <__bad_interrupt> + 1e: 0c c0 rjmp .+24 ; 0x38 <__bad_interrupt> + 20: 0b c0 rjmp .+22 ; 0x38 <__bad_interrupt> + 22: 0a c0 rjmp .+20 ; 0x38 <__bad_interrupt> + 24: 09 c0 rjmp .+18 ; 0x38 <__bad_interrupt> + 26: 08 c0 rjmp .+16 ; 0x38 <__bad_interrupt> + +00000028 <__ctors_end>: + 28: 11 24 eor r1, r1 + 2a: 1f be out 0x3f, r1 ; 63 + 2c: cf ef ldi r28, 0xFF ; 255 + 2e: d2 e0 ldi r29, 0x02 ; 2 + 30: de bf out 0x3e, r29 ; 62 + 32: cd bf out 0x3d, r28 ; 61 + 34: 02 d0 rcall .+4 ; 0x3a
+ 36: 11 c0 rjmp .+34 ; 0x5a <_exit> + +00000038 <__bad_interrupt>: + 38: e3 cf rjmp .-58 ; 0x0 <__vectors> + +0000003a
: +#include + +int main (void) +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + 3a: 84 e0 ldi r24, 0x04 ; 4 + 3c: 84 b9 out 0x04, r24 ; 4 + while(1) + { + zwischenspeicher = PORTB; + zwischenspeicher = zwischenspeicher ^ 0b00000100; + 3e: 94 e0 ldi r25, 0x04 ; 4 +{ + unsigned char zwischenspeicher; + DDRB = 0b00000100; + while(1) + { + zwischenspeicher = PORTB; + 40: 85 b1 in r24, 0x05 ; 5 + zwischenspeicher = zwischenspeicher ^ 0b00000100; + 42: 89 27 eor r24, r25 + PORTB = zwischenspeicher; + 44: 85 b9 out 0x05, r24 ; 5 + #else + //round up by default + __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + #endif + + __builtin_avr_delay_cycles(__ticks_dc); + 46: 2f e9 ldi r18, 0x9F ; 159 + 48: 36 e8 ldi r19, 0x86 ; 134 + 4a: 81 e0 ldi r24, 0x01 ; 1 + 4c: 21 50 subi r18, 0x01 ; 1 + 4e: 30 40 sbci r19, 0x00 ; 0 + 50: 80 40 sbci r24, 0x00 ; 0 + 52: e1 f7 brne .-8 ; 0x4c <__SREG__+0xd> + 54: 00 c0 rjmp .+0 ; 0x56 <__SREG__+0x17> + 56: 00 00 nop + 58: f3 cf rjmp .-26 ; 0x40 <__SREG__+0x1> + +0000005a <_exit>: + 5a: f8 94 cli + +0000005c <__stop_program>: + 5c: ff cf rjmp .-2 ; 0x5c <__stop_program> diff --git a/trunk/AVRProjects/ATTiny88/main.lst b/trunk/AVRProjects/ATTiny88/main.lst new file mode 100644 index 00000000..dff2c4fb --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.lst @@ -0,0 +1,243 @@ + 1 .file "main.c" + 2 __SP_H__ = 0x3e + 3 __SP_L__ = 0x3d + 4 __SREG__ = 0x3f + 5 __tmp_reg__ = 0 + 6 __zero_reg__ = 1 + 7 .text + 8 .Ltext0: + 9 .cfi_sections .debug_frame + 10 .section .text.startup,"ax",@progbits + 11 .global main + 13 main: + 14 .LFB6: + 15 .file 1 "main.c" + 1:main.c **** #include + 2:main.c **** #include + 3:main.c **** + 4:main.c **** int main (void) + 5:main.c **** { + 16 .loc 1 5 0 + 17 .cfi_startproc + 18 /* prologue: function */ + 19 /* frame size = 0 */ + 20 /* stack size = 0 */ + 21 .L__stack_usage = 0 + 6:main.c **** unsigned char zwischenspeicher; + 7:main.c **** DDRB = 0b00000100; + 22 .loc 1 7 0 + 23 0000 84E0 ldi r24,lo8(4) + 24 0002 84B9 out 0x4,r24 + 8:main.c **** while(1) + 9:main.c **** { + 10:main.c **** zwischenspeicher = PORTB; + 11:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000100; + 25 .loc 1 11 0 + 26 0004 94E0 ldi r25,lo8(4) + 27 .L2: + 10:main.c **** zwischenspeicher = zwischenspeicher ^ 0b00000100; + 28 .loc 1 10 0 discriminator 1 + 29 0006 85B1 in r24,0x5 + 30 .LVL0: + 31 .loc 1 11 0 discriminator 1 + 32 0008 8927 eor r24,r25 + 33 .LVL1: + 12:main.c **** PORTB = zwischenspeicher; + 34 .loc 1 12 0 discriminator 1 + 35 000a 85B9 out 0x5,r24 + 36 .LVL2: + 37 .LBB4: + 38 .LBB5: + 39 .file 2 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\util\\delay.h" + 1:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* Copyright (c) 2002, Marek Michalkiewicz + 2:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2004,2005,2007 Joerg Wunsch + 3:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Copyright (c) 2007 Florin-Viorel Petrov + 4:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** All rights reserved. + 5:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 6:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Redistribution and use in source and binary forms, with or without + 7:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** modification, are permitted provided that the following conditions are met: + 8:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 9:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions of source code must retain the above copyright + 10:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer. + 11:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 12:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Redistributions in binary form must reproduce the above copyright + 13:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** notice, this list of conditions and the following disclaimer in + 14:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the documentation and/or other materials provided with the + 15:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** distribution. + 16:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 17:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** * Neither the name of the copyright holders nor the names of + 18:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** contributors may be used to endorse or promote products derived + 19:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** from this software without specific prior written permission. + 20:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 21:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" + 22:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE + 23:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE + 24:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE + 25:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR + 26:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF + 27:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS + 28:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN + 29:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) + 30:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE + 31:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** POSSIBILITY OF SUCH DAMAGE. */ + 32:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 33:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* $Id$ */ + 34:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 35:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef _UTIL_DELAY_H_ + 36:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define _UTIL_DELAY_H_ 1 + 37:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 38:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __HAS_DELAY_CYCLES + 39:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define __HAS_DELAY_CYCLES 1 + 40:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 41:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 42:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 43:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 44:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 45:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 46:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \file */ + 47:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** \defgroup util_delay : Convenience functions for busy-wait delay loops + 48:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \code + 49:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #define F_CPU 1000000UL // 1 MHz + 50:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //#define F_CPU 14.7456E6 + 51:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #include + 52:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \endcode + 53:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 54:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note As an alternative method, it is possible to pass the + 55:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU macro down to the compiler from the Makefile. + 56:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Obviously, in that case, no \c \#define statement should be + 57:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** used. + 58:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 59:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions in this header file are wrappers around the basic + 60:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** busy-wait functions from . They are meant as + 61:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** convenience functions where actual time values can be specified + 62:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** rather than a number of cycles to wait for. The idea behind is + 63:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** that compile-time constant expressions will be eliminated by + 64:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compiler optimization so floating-point expressions can be used + 65:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to calculate the number of delay cycles needed based on the CPU + 66:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** frequency passed by the macro F_CPU. + 67:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 68:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \note In order for these functions to work as intended, compiler + 69:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** optimizations must be enabled, and the delay time + 70:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** must be an expression that is a known constant at + 71:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** compile-time. If these requirements are not met, the resulting + 72:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delay will be much longer (and basically unpredictable), and + 73:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** applications that otherwise do not use floating-point calculations + 74:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** will experience severe code bloat by the floating-point library + 75:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** routines linked into the application. + 76:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 77:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The functions available allow the specification of microsecond, and + 78:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** millisecond delays directly, using the application-supplied macro + 79:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** F_CPU as the CPU clock frequency (in Hertz). + 80:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 81:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 82:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 83:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if !defined(__DOXYGEN__) + 84:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_us(double __us) __attribute__((always_inline)); + 85:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** static inline void _delay_ms(double __ms) __attribute__((always_inline)); + 86:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 87:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 88:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef F_CPU + 89:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /* prevent compiler error by supplying a default */ + 90:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "F_CPU not defined for " + 91:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # define F_CPU 1000000UL + 92:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 93:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 94:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #ifndef __OPTIMIZE__ + 95:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # warning "Compiler optimizations disabled; functions from won't work as designed" + 96:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 97:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 98:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 99:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 100:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 101:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** # include + 102:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 103:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 104:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** /** + 105:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** \ingroup util_delay + 106:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 107:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Perform a delay of \c __ms milliseconds, using _delay_loop_2(). + 108:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 109:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The macro F_CPU is supposed to be defined to a + 110:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** constant defining the CPU clock frequency (in Hertz). + 111:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 112:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** The maximal possible delay is 262.14 ms / F_CPU in MHz. + 113:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 114:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** When the user request delay which exceed the maximum possible one, + 115:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms() provides a decreased resolution functionality. In this + 116:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** mode _delay_ms() will work with a resolution of 1/10 ms, providing + 117:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** delays up to 6.5535 seconds (independent from CPU frequency). The + 118:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** user will not be informed about decreased resolution. + 119:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 120:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** If the avr-gcc toolchain has __builtin_avr_delay_cycles(unsigned long) + 121:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** support, maximal possible delay is 4294967.295 ms/ F_CPU in MHz. For + 122:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** values greater than the maximal possible delay, overflows results in + 123:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** no delay i.e., 0ms. + 124:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 125:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Conversion of __us into clock cycles may not always result in integer. + 126:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** By default, the clock cycles rounded up to next integer. This ensures that + 127:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** the user gets atleast __us microseconds of delay. + 128:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 129:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Alternatively, user can define __DELAY_ROUND_DOWN__ and __DELAY_ROUND_CLOSEST__ + 130:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** to round down and round to closest integer. + 131:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 132:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Note: The new implementation of _delay_ms(double __ms) with + 133:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(unsigned long) support is not backward compatible. + 134:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** User can define __DELAY_BACKWARD_COMPATIBLE__ to get a backward compatible delay. + 135:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** Also, the backward compatible + 136:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** algorithm will be chosen if the code is compiled in a freestanding + 137:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** environment (GCC option \c -ffreestanding), as the math functions + 138:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** required for rounding are not available to the compiler then. + 139:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 140:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** */ + 141:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** void + 142:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** _delay_ms(double __ms) + 143:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** { + 144:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** double __tmp ; + 145:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if __HAS_DELAY_CYCLES && defined(__OPTIMIZE__) && \ + 146:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** !defined(__DELAY_BACKWARD_COMPATIBLE__) && \ + 147:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __STDC_HOSTED__ + 148:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** uint32_t __ticks_dc; + 149:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** extern void __builtin_avr_delay_cycles(unsigned long); + 150:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __tmp = ((F_CPU) / 1e3) * __ms; + 151:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 152:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #if defined(__DELAY_ROUND_DOWN__) + 153:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)fabs(__tmp); + 154:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 155:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #elif defined(__DELAY_ROUND_CLOSEST__) + 156:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(fabs(__tmp)+0.5); + 157:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 158:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #else + 159:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** //round up by default + 160:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __ticks_dc = (uint32_t)(ceil(fabs(__tmp))); + 161:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** #endif + 162:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** + 163:e:\progs\arduino-1.7.4\hardware\tools\avr\avr\include\util\delay.h **** __builtin_avr_delay_cycles(__ticks_dc); + 40 .loc 2 163 0 discriminator 1 + 41 000c 2FE9 ldi r18,lo8(99999) + 42 000e 36E8 ldi r19,hi8(99999) + 43 0010 81E0 ldi r24,hlo8(99999) + 44 0012 2150 1: subi r18,1 + 45 0014 3040 sbci r19,0 + 46 0016 8040 sbci r24,0 + 47 0018 01F4 brne 1b + 48 .LVL3: + 49 001a 00C0 rjmp . + 50 001c 0000 nop + 51 001e 00C0 rjmp .L2 + 52 .LBE5: + 53 .LBE4: + 54 .cfi_endproc + 55 .LFE6: + 57 .text + 58 .Letext0: + 59 .file 3 "e:\\progs\\arduino-1.7.4\\hardware\\tools\\avr\\avr\\include\\stdint.h" +DEFINED SYMBOLS + *ABS*:00000000 main.c +C:\Users\q242695\AppData\Local\Temp\ccXYyRJn.s:2 *ABS*:0000003e __SP_H__ +C:\Users\q242695\AppData\Local\Temp\ccXYyRJn.s:3 *ABS*:0000003d __SP_L__ +C:\Users\q242695\AppData\Local\Temp\ccXYyRJn.s:4 *ABS*:0000003f __SREG__ +C:\Users\q242695\AppData\Local\Temp\ccXYyRJn.s:5 *ABS*:00000000 __tmp_reg__ +C:\Users\q242695\AppData\Local\Temp\ccXYyRJn.s:6 *ABS*:00000001 __zero_reg__ +C:\Users\q242695\AppData\Local\Temp\ccXYyRJn.s:13 .text.startup:00000000 main + +NO UNDEFINED SYMBOLS diff --git a/trunk/AVRProjects/ATTiny88/main.map b/trunk/AVRProjects/ATTiny88/main.map new file mode 100644 index 00000000..6852b22e --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.map @@ -0,0 +1,417 @@ +Archive member included to satisfy reference by file (symbol) + +e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o (exit) + +Memory Configuration + +Name Origin Length Attributes +text 0x00000000 0x00002000 xr +data 0x00800060 0x0000ffa0 rw !x +eeprom 0x00810000 0x00010000 rw !x +fuse 0x00820000 0x00000400 rw !x +lock 0x00830000 0x00000400 rw !x +signature 0x00840000 0x00000400 rw !x +*default* 0x00000000 0xffffffff + +Linker script and memory map + +Address of section .data set to 0x800100 +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +LOAD main.o +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a +START GROUP +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libm.a +LOAD e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25\libc.a +END GROUP + +.hash + *(.hash) + +.dynsym + *(.dynsym) + +.dynstr + *(.dynstr) + +.gnu.version + *(.gnu.version) + +.gnu.version_d + *(.gnu.version_d) + +.gnu.version_r + *(.gnu.version_r) + +.rel.init + *(.rel.init) + +.rela.init + *(.rela.init) + +.rel.text + *(.rel.text) + *(.rel.text.*) + *(.rel.gnu.linkonce.t*) + +.rela.text + *(.rela.text) + *(.rela.text.*) + *(.rela.gnu.linkonce.t*) + +.rel.fini + *(.rel.fini) + +.rela.fini + *(.rela.fini) + +.rel.rodata + *(.rel.rodata) + *(.rel.rodata.*) + *(.rel.gnu.linkonce.r*) + +.rela.rodata + *(.rela.rodata) + *(.rela.rodata.*) + *(.rela.gnu.linkonce.r*) + +.rel.data + *(.rel.data) + *(.rel.data.*) + *(.rel.gnu.linkonce.d*) + +.rela.data + *(.rela.data) + *(.rela.data.*) + *(.rela.gnu.linkonce.d*) + +.rel.ctors + *(.rel.ctors) + +.rela.ctors + *(.rela.ctors) + +.rel.dtors + *(.rel.dtors) + +.rela.dtors + *(.rela.dtors) + +.rel.got + *(.rel.got) + +.rela.got + *(.rela.got) + +.rel.bss + *(.rel.bss) + +.rela.bss + *(.rela.bss) + +.rel.plt + *(.rel.plt) + +.rela.plt + *(.rela.plt) + +.text 0x00000000 0x5e + *(.vectors) + .vectors 0x00000000 0x28 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + 0x00000000 __vector_default + 0x00000000 __vectors + *(.vectors) + *(.progmem.gcc*) + 0x00000028 . = ALIGN (0x2) + 0x00000028 __trampolines_start = . + *(.trampolines) + .trampolines 0x00000028 0x0 linker stubs + *(.trampolines*) + 0x00000028 __trampolines_end = . + *(.progmem*) + 0x00000028 . = ALIGN (0x2) + *(.jumptables) + *(.jumptables*) + *(.lowtext) + *(.lowtext*) + 0x00000028 __ctors_start = . + *(.ctors) + 0x00000028 __ctors_end = . + 0x00000028 __dtors_start = . + *(.dtors) + 0x00000028 __dtors_end = . + SORT(*)(.ctors) + SORT(*)(.dtors) + *(.init0) + .init0 0x00000028 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + 0x00000028 __init + *(.init0) + *(.init1) + *(.init1) + *(.init2) + .init2 0x00000028 0xc e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + *(.init2) + *(.init3) + *(.init3) + *(.init4) + *(.init4) + *(.init5) + *(.init5) + *(.init6) + *(.init6) + *(.init7) + *(.init7) + *(.init8) + *(.init8) + *(.init9) + .init9 0x00000034 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + *(.init9) + *(.text) + .text 0x00000038 0x2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + 0x00000038 __vector_1 + 0x00000038 __vector_12 + 0x00000038 __bad_interrupt + 0x00000038 __vector_6 + 0x00000038 __vector_3 + 0x00000038 __vector_11 + 0x00000038 __vector_13 + 0x00000038 __vector_17 + 0x00000038 __vector_19 + 0x00000038 __vector_7 + 0x00000038 __vector_5 + 0x00000038 __vector_4 + 0x00000038 __vector_9 + 0x00000038 __vector_2 + 0x00000038 __vector_15 + 0x00000038 __vector_8 + 0x00000038 __vector_14 + 0x00000038 __vector_10 + 0x00000038 __vector_16 + 0x00000038 __vector_18 + .text 0x0000003a 0x0 main.o + .text 0x0000003a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + 0x0000003a . = ALIGN (0x2) + *(.text.*) + .text.startup 0x0000003a 0x20 main.o + 0x0000003a main + .text.libgcc.mul + 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.div + 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.prologue + 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.builtins + 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.fmul + 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + .text.libgcc.fixed + 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + 0x0000005a . = ALIGN (0x2) + *(.fini9) + .fini9 0x0000005a 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + 0x0000005a _exit + 0x0000005a exit + *(.fini9) + *(.fini8) + *(.fini8) + *(.fini7) + *(.fini7) + *(.fini6) + *(.fini6) + *(.fini5) + *(.fini5) + *(.fini4) + *(.fini4) + *(.fini3) + *(.fini3) + *(.fini2) + *(.fini2) + *(.fini1) + *(.fini1) + *(.fini0) + .fini0 0x0000005a 0x4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + *(.fini0) + 0x0000005e _etext = . + +.data 0x00800100 0x0 load address 0x0000005e + 0x00800100 PROVIDE (__data_start, .) + *(.data) + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + .data 0x00800100 0x0 main.o + .data 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + *(.data*) + *(.rodata) + *(.rodata*) + *(.gnu.linkonce.d*) + 0x00800100 . = ALIGN (0x2) + 0x00800100 _edata = . + 0x00800100 PROVIDE (__data_end, .) + +.bss 0x00800100 0x0 + 0x00800100 PROVIDE (__bss_start, .) + *(.bss) + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o + .bss 0x00800100 0x0 main.o + .bss 0x00800100 0x0 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + *(.bss*) + *(COMMON) + 0x00800100 PROVIDE (__bss_end, .) + 0x0000005e __data_load_start = LOADADDR (.data) + 0x0000005e __data_load_end = (__data_load_start + SIZEOF (.data)) + +.noinit 0x00800100 0x0 + 0x00800100 PROVIDE (__noinit_start, .) + *(.noinit*) + 0x00800100 PROVIDE (__noinit_end, .) + 0x00800100 _end = . + 0x00800100 PROVIDE (__heap_start, .) + +.eeprom 0x00810000 0x0 + *(.eeprom*) + 0x00810000 __eeprom_end = . + +.fuse + *(.fuse) + *(.lfuse) + *(.hfuse) + *(.efuse) + +.lock + *(.lock*) + +.signature + *(.signature*) + +.stab + *(.stab) + +.stabstr + *(.stabstr) + +.stab.excl + *(.stab.excl) + +.stab.exclstr + *(.stab.exclstr) + +.stab.index + *(.stab.index) + +.stab.indexstr + *(.stab.indexstr) + +.comment 0x00000000 0x11 + *(.comment) + .comment 0x00000000 0x11 main.o + 0x12 (size before relaxing) + +.note.gnu.build-id + *(.note.gnu.build-id) + +.debug + *(.debug) + +.line + *(.line) + +.debug_srcinfo + *(.debug_srcinfo) + +.debug_sfnames + *(.debug_sfnames) + +.debug_aranges 0x00000000 0x20 + *(.debug_aranges) + .debug_aranges + 0x00000000 0x20 main.o + +.debug_pubnames + *(.debug_pubnames) + +.debug_info 0x00000000 0x119 + *(.debug_info .gnu.linkonce.wi.*) + .debug_info 0x00000000 0x119 main.o + +.debug_abbrev 0x00000000 0xd1 + *(.debug_abbrev) + .debug_abbrev 0x00000000 0xd1 main.o + +.debug_line 0x00000000 0xd7 + *(.debug_line .debug_line.* .debug_line_end) + .debug_line 0x00000000 0xd7 main.o + +.debug_frame 0x00000000 0x24 + *(.debug_frame) + .debug_frame 0x00000000 0x24 main.o + +.debug_str 0x00000000 0x132 + *(.debug_str) + .debug_str 0x00000000 0x132 main.o + 0x166 (size before relaxing) + +.debug_loc 0x00000000 0x1f + *(.debug_loc) + .debug_loc 0x00000000 0x1f main.o + +.debug_macinfo + *(.debug_macinfo) + +.debug_weaknames + *(.debug_weaknames) + +.debug_funcnames + *(.debug_funcnames) + +.debug_typenames + *(.debug_typenames) + +.debug_varnames + *(.debug_varnames) + +.debug_pubtypes + *(.debug_pubtypes) + +.debug_ranges 0x00000000 0x10 + *(.debug_ranges) + .debug_ranges 0x00000000 0x10 main.o + +.debug_macro + *(.debug_macro) +OUTPUT(main.elf elf32-avr) +LOAD linker stubs + +Cross Reference Table + +Symbol File +__bad_interrupt e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__heap_end e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__init e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__stack e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_1 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_10 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_11 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_12 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_13 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_14 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_15 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_16 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_17 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_18 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_19 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_2 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_3 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_4 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_5 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_6 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_7 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_8 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_9 e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vector_default e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +__vectors e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +_exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) +exit e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/avr25\libgcc.a(_exit.o) + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o +main main.o + e:/progs/arduino-1.7.4/hardware/tools/avr/bin/../lib/gcc/avr/4.8.1/../../../../avr/lib/avr25/crttn88.o diff --git a/trunk/AVRProjects/ATTiny88/main.sym b/trunk/AVRProjects/ATTiny88/main.sym new file mode 100644 index 00000000..78895fdd --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/main.sym @@ -0,0 +1,46 @@ +00000000 W __heap_end +00000000 a __tmp_reg__ +00000000 W __vector_default +00000000 T __vectors +00000001 a __zero_reg__ +00000028 T __ctors_end +00000028 T __ctors_start +00000028 T __dtors_end +00000028 T __dtors_start +00000028 W __init +00000028 T __trampolines_end +00000028 T __trampolines_start +00000038 T __bad_interrupt +00000038 W __vector_1 +00000038 W __vector_10 +00000038 W __vector_11 +00000038 W __vector_12 +00000038 W __vector_13 +00000038 W __vector_14 +00000038 W __vector_15 +00000038 W __vector_16 +00000038 W __vector_17 +00000038 W __vector_18 +00000038 W __vector_19 +00000038 W __vector_2 +00000038 W __vector_3 +00000038 W __vector_4 +00000038 W __vector_5 +00000038 W __vector_6 +00000038 W __vector_7 +00000038 W __vector_8 +00000038 W __vector_9 +0000003a T main +0000003d a __SP_L__ +0000003e a __SP_H__ +0000003f a __SREG__ +0000005a T _exit +0000005a W exit +0000005c t __stop_program +0000005e A __data_load_end +0000005e A __data_load_start +0000005e T _etext +000002ff W __stack +00800100 D _edata +00800100 T _end +00810000 T __eeprom_end diff --git a/trunk/AVRProjects/ATTiny88/makefile b/trunk/AVRProjects/ATTiny88/makefile new file mode 100644 index 00000000..be7d56cf --- /dev/null +++ b/trunk/AVRProjects/ATTiny88/makefile @@ -0,0 +1,441 @@ +# Hey Emacs, this is a -*- makefile -*- +# +# WinAVR makefile written by Eric B. Weddington, Jörg Wunsch, et al. +# Released to the Public Domain +# Please read the make user manual! +# +# Additional material for this makefile was submitted by: +# Tim Henigan +# Peter Fleury +# Reiner Patommel +# Sander Pool +# Frederik Rouleau +# Markus Pfaff +# +# On command line: +# +# make all = Make software. +# +# make clean = Clean out built project files. +# +# make coff = Convert ELF to AVR COFF (for use with AVR Studio 3.x or VMLAB). +# +# make extcoff = Convert ELF to AVR Extended COFF (for use with AVR Studio +# 4.07 or greater). +# +# make program = Download the hex file to the device, using avrdude. Please +# customize the avrdude settings below first! +# +# make filename.s = Just compile filename.c into the assembler code only +# +# To rebuild project do "make clean" then "make all". +# + +# mth 2004/09 +# Differences from WinAVR 20040720 sample: +# - DEPFLAGS according to Eric Weddingtion's fix (avrfreaks/gcc-forum) +# - F_OSC Define in CFLAGS and AFLAGS + + +# MCU name +MCU = attiny88 + +# Main Oscillator Frequency +# This is only used to define F_OSC in all assembler and c-sources. +F_OSC = 4190000 + +# Output format. (can be srec, ihex, binary) +FORMAT = ihex + +# Target file name (without extension). +TARGET = main + + +# List C source files here. (C dependencies are automatically generated.) +SRC = $(TARGET).c + + +# List Assembler source files here. +# Make them always end in a capital .S. Files ending in a lowercase .s +# will not be considered source files but generated files (assembler +# output from the compiler), and will be deleted upon "make clean"! +# Even though the DOS/Win* filesystem matches both .s and .S the same, +# it will preserve the spelling of the filenames, and gcc itself does +# care about how the name is spelled on its command-line. +ASRC = + + + +# Optimization level, can be [0, 1, 2, 3, s]. +# 0 = turn off optimization. s = optimize for size. +# (Note: 3 is not always the best optimization level. See avr-libc FAQ.) +OPT = s + +# Debugging format. +# Native formats for AVR-GCC's -g are stabs [default], or dwarf-2. +# AVR (extended) COFF requires stabs, plus an avr-objcopy run. +#DEBUG = stabs +DEBUG = dwarf-2 + +# List any extra directories to look for include files here. +# Each directory must be seperated by a space. +EXTRAINCDIRS = + + +# Compiler flag to set the C Standard level. +# c89 - "ANSI" C +# gnu89 - c89 plus GCC extensions +# c99 - ISO C99 standard (not yet fully implemented) +# gnu99 - c99 plus GCC extensions +CSTANDARD = -std=gnu99 + +# Place -D or -U options here +CDEFS = + +# Place -I options here +CINCS = + + +# Compiler flags. +# -g*: generate debugging information +# -O*: optimization level +# -f...: tuning, see GCC manual and avr-libc documentation +# -Wall...: warning level +# -Wa,...: tell GCC to pass this to the assembler. +# -adhlns...: create assembler listing +CFLAGS = -g$(DEBUG) +CFLAGS += $(CDEFS) $(CINCS) +CFLAGS += -O$(OPT) +CFLAGS += -funsigned-char -funsigned-bitfields -fpack-struct -fshort-enums +CFLAGS += -Wall -Wstrict-prototypes +CFLAGS += -Wa,-adhlns=$(<:.c=.lst) +CFLAGS += $(patsubst %,-I%,$(EXTRAINCDIRS)) +CFLAGS += $(CSTANDARD) +CFLAGS += -DF_OSC=$(F_OSC) + + + +# Assembler flags. +# -Wa,...: tell GCC to pass this to the assembler. +# -ahlms: create listing +# -gstabs: have the assembler create line number information; note that +# for use in COFF files, additional information about filenames +# and function names needs to be present in the assembler source +# files -- see avr-libc docs [FIXME: not yet described there] +ASFLAGS = -Wa,-adhlns=$(<:.S=.lst),-gstabs +ASFLAGS += -DF_OSC=$(F_OSC) + + +#Additional libraries. + +# Minimalistic printf version +PRINTF_LIB_MIN = -Wl,-u,vfprintf -lprintf_min + +# Floating point printf version (requires MATH_LIB = -lm below) +PRINTF_LIB_FLOAT = -Wl,-u,vfprintf -lprintf_flt + +PRINTF_LIB = + +# Minimalistic scanf version +SCANF_LIB_MIN = -Wl,-u,vfscanf -lscanf_min + +# Floating point + %[ scanf version (requires MATH_LIB = -lm below) +SCANF_LIB_FLOAT = -Wl,-u,vfscanf -lscanf_flt + +SCANF_LIB = + +MATH_LIB = -lm + +# External memory options + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# used for variables (.data/.bss) and heap (malloc()). +#EXTMEMOPTS = -Wl,-Tdata=0x801100,--defsym=__heap_end=0x80ffff + +# 64 KB of external RAM, starting after internal RAM (ATmega128!), +# only used for heap (malloc()). +#EXTMEMOPTS = -Wl,--defsym=__heap_start=0x801100,--defsym=__heap_end=0x80ffff + +EXTMEMOPTS = + +# Linker flags. +# -Wl,...: tell GCC to pass this to linker. +# -Map: create map file +# --cref: add cross reference to map file +LDFLAGS = -Wl,-Map=$(TARGET).map,--cref +LDFLAGS += $(EXTMEMOPTS) +LDFLAGS += $(PRINTF_LIB) $(SCANF_LIB) $(MATH_LIB) + + + + +# Programming support using avrdude. Settings and variables. + +# Programming hardware: alf avr910 avrisp bascom bsd +# dt006 pavr picoweb pony-stk200 sp12 stk200 stk500 +# +# Type: avrdude -c ? +# to get a full listing. +# +#AVRDUDE_PROGRAMMER = stk500 +AVRDUDE_PROGRAMMER = usbasp + +# com1 = serial port. Use lpt1 to connect to parallel port. +AVRDUDE_PORT = usb # programmer connected to serial device + +AVRDUDE_WRITE_FLASH = -U flash:w:$(TARGET).hex +#AVRDUDE_WRITE_EEPROM = -U eeprom:w:$(TARGET).eep + + +# Uncomment the following if you want avrdude's erase cycle counter. +# Note that this counter needs to be initialized first using -Yn, +# see avrdude manual. +#AVRDUDE_ERASE_COUNTER = -y + +# Uncomment the following if you do /not/ wish a verification to be +# performed after programming the device. +#AVRDUDE_NO_VERIFY = -V + +# Increase verbosity level. Please use this when submitting bug +# reports about avrdude. See +# to submit bug reports. +#AVRDUDE_VERBOSE = -v -v + +AVRDUDE_FLAGS = -p $(MCU) -P $(AVRDUDE_PORT) -c $(AVRDUDE_PROGRAMMER) +AVRDUDE_FLAGS += $(AVRDUDE_NO_VERIFY) +AVRDUDE_FLAGS += $(AVRDUDE_VERBOSE) +AVRDUDE_FLAGS += $(AVRDUDE_ERASE_COUNTER) + + + +# --------------------------------------------------------------------------- + +# Define directories, if needed. +DIRAVR = c:/winavr +DIRAVRBIN = $(DIRAVR)/bin +DIRAVRUTILS = $(DIRAVR)/utils/bin +DIRINC = . +DIRLIB = $(DIRAVR)/avr/lib + + +# Define programs and commands. +SHELL = sh +CC = avr-gcc +OBJCOPY = avr-objcopy +OBJDUMP = avr-objdump +SIZE = avr-size +NM = avr-nm +AVRDUDE = avrdude +REMOVE = rm -f +COPY = cp + + + + +# Define Messages +# English +MSG_ERRORS_NONE = Errors: none +MSG_BEGIN = -------- begin -------- +MSG_END = -------- end -------- +MSG_SIZE_BEFORE = Size before: +MSG_SIZE_AFTER = Size after: +MSG_COFF = Converting to AVR COFF: +MSG_EXTENDED_COFF = Converting to AVR Extended COFF: +MSG_FLASH = Creating load file for Flash: +MSG_EEPROM = Creating load file for EEPROM: +MSG_EXTENDED_LISTING = Creating Extended Listing: +MSG_SYMBOL_TABLE = Creating Symbol Table: +MSG_LINKING = Linking: +MSG_COMPILING = Compiling: +MSG_ASSEMBLING = Assembling: +MSG_CLEANING = Cleaning project: + + + + +# Define all object files. +OBJ = $(SRC:.c=.o) $(ASRC:.S=.o) + +# Define all listing files. +LST = $(ASRC:.S=.lst) $(SRC:.c=.lst) + + +# Compiler flags to generate dependency files. +### GENDEPFLAGS = -Wp,-M,-MP,-MT,$(*F).o,-MF,.dep/$(@F).d +GENDEPFLAGS = -MD -MP -MF .dep/$(@F).d + +# Combine all necessary flags and optional flags. +# Add target processor to flags. +ALL_CFLAGS = -mmcu=$(MCU) -I. $(CFLAGS) $(GENDEPFLAGS) +ALL_ASFLAGS = -mmcu=$(MCU) -I. -x assembler-with-cpp $(ASFLAGS) + + + + + +# Default target. +#all: begin gccversion sizebefore build sizeafter finished end +all: begin gccversion build size finished end + +build: elf hex eep lss sym + +elf: $(TARGET).elf +hex: $(TARGET).hex +eep: $(TARGET).eep +lss: $(TARGET).lss +sym: $(TARGET).sym + + + +# Eye candy. +# AVR Studio 3.x does not check make's exit code but relies on +# the following magic strings to be generated by the compile job. +begin: + @echo + @echo $(MSG_BEGIN) + +finished: + @echo $(MSG_ERRORS_NONE) + +end: + @echo $(MSG_END) + @echo + + +# Display size of file. +HEXSIZE = $(SIZE) --target=$(FORMAT) $(TARGET).hex +ELFSIZE = $(SIZE) -A $(TARGET).elf +sizebefore: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_BEFORE); $(ELFSIZE); echo; fi + +sizeafter: + @if [ -f $(TARGET).elf ]; then echo; echo $(MSG_SIZE_AFTER); $(ELFSIZE); echo; fi + +size: + $(SIZE) -C --mcu=$(MCU) $(TARGET).elf + +# Display compiler version information. +gccversion : + @$(CC) --version + + + +# Program the device. +program: $(TARGET).hex $(TARGET).eep + $(AVRDUDE) $(AVRDUDE_FLAGS) $(AVRDUDE_WRITE_FLASH) $(AVRDUDE_WRITE_EEPROM) + + + + +# Convert ELF to COFF for use in debugging / simulating in AVR Studio or VMLAB. +COFFCONVERT=$(OBJCOPY) --debugging \ +--change-section-address .data-0x800000 \ +--change-section-address .bss-0x800000 \ +--change-section-address .noinit-0x800000 \ +--change-section-address .eeprom-0x810000 + + +coff: $(TARGET).elf + @echo + @echo $(MSG_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-avr $< $(TARGET).cof + + +extcoff: $(TARGET).elf + @echo + @echo $(MSG_EXTENDED_COFF) $(TARGET).cof + $(COFFCONVERT) -O coff-ext-avr $< $(TARGET).cof + + + +# Create final output files (.hex, .eep) from ELF output file. +%.hex: %.elf + @echo + @echo $(MSG_FLASH) $@ + $(OBJCOPY) -O $(FORMAT) -R .eeprom $< $@ + +%.eep: %.elf + @echo + @echo $(MSG_EEPROM) $@ + -$(OBJCOPY) -j .eeprom --set-section-flags=.eeprom="alloc,load" \ + --change-section-lma .eeprom=0 -O $(FORMAT) $< $@ + +# Create extended listing file from ELF output file. +%.lss: %.elf + @echo + @echo $(MSG_EXTENDED_LISTING) $@ + $(OBJDUMP) -h -S $< > $@ + +# Create a symbol table from ELF output file. +%.sym: %.elf + @echo + @echo $(MSG_SYMBOL_TABLE) $@ + $(NM) -n $< > $@ + + + +# Link: create ELF output file from object files. +.SECONDARY : $(TARGET).elf +.PRECIOUS : $(OBJ) +%.elf: $(OBJ) + @echo + @echo $(MSG_LINKING) $@ + $(CC) $(ALL_CFLAGS) $(OBJ) --output $@ $(LDFLAGS) + + +# Compile: create object files from C source files. +%.o : %.c + @echo + @echo $(MSG_COMPILING) $< + $(CC) -c $(ALL_CFLAGS) $< -o $@ + + +# Compile: create assembler files from C source files. +%.s : %.c + $(CC) -S $(ALL_CFLAGS) $< -o $@ + + +# Assemble: create object files from assembler source files. +%.o : %.S + @echo + @echo $(MSG_ASSEMBLING) $< + $(CC) -c $(ALL_ASFLAGS) $< -o $@ + + + +# Target: clean project. +clean: begin clean_list finished end + +clean_list : + @echo + @echo $(MSG_CLEANING) + $(REMOVE) $(TARGET).hex + $(REMOVE) $(TARGET).eep + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).cof + $(REMOVE) $(TARGET).elf + $(REMOVE) $(TARGET).map + $(REMOVE) $(TARGET).obj + $(REMOVE) $(TARGET).a90 + $(REMOVE) $(TARGET).sym + $(REMOVE) $(TARGET).lnk + $(REMOVE) $(TARGET).lss + $(REMOVE) $(OBJ) + $(REMOVE) $(LST) + $(REMOVE) $(SRC:.c=.s) + $(REMOVE) $(SRC:.c=.d) + $(REMOVE) .dep/* + + + +# Include the dependency files. +-include $(shell mkdir .dep 2>/dev/null) $(wildcard .dep/*) + + +# Listing of phony targets. +.PHONY : all begin finish end sizebefore sizeafter gccversion \ +build elf hex eep lss sym coff extcoff \ +clean clean_list program + + + diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu.asm b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu.asm new file mode 100644 index 00000000..76b198a5 --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu.asm @@ -0,0 +1,3187 @@ +; +; +; 6 5 0 2 E M U L A T O R +; +; An AVR emulates a 6502 with >2MHz speed +; +; Copyright (C) 2013-2015 Klaus Dormann +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . +; +; contact info at http://2m5.de or email K@2m5.de +; +#define version "0.83b" ;makes a printable version number +; +; version history: +; 0.8 24-jan-13 1st version distributed for testing +; 0.81 04-mar-13 added binary load/save/autoload support for applications +; added 6502_Emu_config.inc for all reconfigurable items. +; split cpu core into 6502_Emu_NMOS.inc to support change to CMOS +; added timer 1 access, tested and fixed all interrupts +; added countdown timer & interrupt vector register +; added optional software flow control to rx buffer +; improved terminal support for backspace and delete key +; 0.82 20-jul-13 added CMOS core (65C02 instructions and disassembly) +; 0.83 17-may-14 added breakpoint support to debugger +; added SPI support to IO module, DMA for SPI & I2C +; 0.83a 17-aug-14 changed interrupt disabled in real mode to honor NMI & single step +; fixed diag stop continuing until 10ms interrupt, now immediate +; fixed invalid opcode message broken by check for breakpoint +; 0.83b 24-jan-15 fixed ATMega32 interrupt table, fixed break hanging on some terminals +; reduced interrupt latency caused by the monitor waiting for tx buffer +; +; +; ATMEGA16 & ATMEGA32 fuse settings: +; 16 MHz crystal +; JTAGEN unprogrammed +; BOD enabled - 4,0V +; Preserve EEPROM - protect non volatile program memory, else clears all saved programs +; +; related docs: http://2m5.de/6502_Emu/index.htm +; +; description of hardware: +; porta0:7 -> address bus high : IO chip select latches +; portb0:7 -> address bus low : IO address & IO R/W : SPI & slave select latch +; portc0:7 <> data bus : I2C bus switch +; portd0:1 RS232 monitor & ACIA emulation +; portd2 <- ~NMI (INT0) / optional IO-select 3 +; portd3 <- ~IRQ (INT1) +; portd4 -> ~RD_RAM (/OE at SRAM) +; portd5 -> ~WR_RAM (/WE at SRAM) +; /CE tied low at SRAM +; portd6 -> IO-select 1 +; portd7 -> phi2 (OC2) / optional IO-select 2 +; +; pullups required for MNI, IRQ, weak pullups for WR_RAM, RD_RAM +; +; optional weak pullups or pulldowns on IO selects and +; IO busses to reset external hardware during high-Z +; +; timer0 debugger 20ms timer: ctc interrupt +; debugger single step: overflow interrupt +; timer2 optional 1 MHz phase 2 output on OC2 +; + +; The following notes apply to the NMOS emulation core: +; +; Emulation is documented instructions only ! +; +; Invalid 6502 instructions will cause a halt with message. +; +; Decimal mode emulation will emulate documented behavior only: +; a decimal result & carry-flag is valid if both operands were valid BCD +; +; negative, overflow & zero-flags may be altered after a decimal add +; or subtract, but have no valid meaning and may not be identical to real +; hardware. The result of a decimal operation with non decimal operands +; (any nibble >9) may not match the result of a hardware 6502 +; +; In the CMOS emulation core all instructions are valid and if not defined +; otherwise, will be executed as NOP instructions of various length in bytes +; and cycles depending on the decode mechanism in the original CMOS core. +; +; A decimal operation with valid decimal numbers will have a valid result +; and valid NZC flags. The result and flags of decimal add or subtract with +; invalid BCD operands may not match a real 65C02. + + + .NOLIST + .include "sam.inc" + .LIST + + +;**************************** +; +; C O N F I G U R A T I O N +; +;**************************** +.set config_part=1 +.include "6502_Emu_config.inc" + +;configuration based clock constants +.equ cycle_time_tns = (10000000000 / Osc_Hz) ;1/10 ns cpu clock duration +.equ ten_ms = ((Osc_Hz - 51200) / 102400) ;10ms OCR0 value rounded + +;configuration based baudrate constants and error checking +.equ UBRR_value = ((Osc_Hz + Baud * 8) / (Baud * 16) - 1) ; rounded +.equ Baud_error = ((1000 * Osc_Hz / (16 * (UBRR_value + 1)) / Baud) - 1000) ;0/00 deviation +.if ((Baud_error > 10) || (Baud_error < -10)) ; +/-10 0/00 acceptable + .error "Unsafe baudrate - at current cpu clock the deviation is > 1%!" +.endif + +;configuration based serial EEPROM constants +.ifdef eep_adr + .if eep_adr < 8 + .ifdef spi_sel + .ifdef spi_vat + .equ spi_eep_adr = spi_idle^(1< 15) + .error "MACRO wait_ns - too many cycles to burn" + .else + .if (cycles > 0) + .if (cycles & 8) + rjmp pc+1 + rjmp pc+1 + rjmp pc+1 + rjmp pc+1 + .endif + .if (cycles & 4) + rjmp pc+1 + rjmp pc+1 + .endif + .if (cycles & 2) + rjmp pc+1 + .endif + .if (cycles & 1) + nop + .endif + .endif + .endif +.endmacro +; wait_data_valid cycles already used +#define wait_data_valid wait_ns data_valid_ns, + +; print string - debugger +.macro PrintStr ;@0 = message pointer + ldi zl,low(@0*2) + ldi zh,high(@0*2) + rcall prtstr +.endmacro +.macro PrintStr_far ;@0 = message pointer + ldi zl,low(@0*2) + ldi zh,high(@0*2) + call prtstr +.endmacro + + +;***************************************************************** +; +; reset and interrupt vectors according to µc type +; +;***************************************************************** + +#ifdef _M16DEF_INC_ + jmp reset ; Reset handler + rjmp NMI ; INT0 handler + nop + rjmp IRQ ; INT1 handler + nop + jmp illegalint ; Timer2 compare match + jmp illegalint ; Timer2 overflow + .ifdef iomap + jmp t1_icr ; Timer1 capture event + jmp t1_ocra ; Timer1 compare match A + jmp t1_ocrb ; Timer1 compare match B + jmp t1_ovi ; Timer1 overflow handler + .else + jmp illegalint ; Timer1 capture event + jmp illegalint ; Timer1 compare match A + jmp illegalint ; Timer1 compare match B + jmp illegalint ; Timer1 overflow handler + .endif + jmp t0_ovi ; Timer0 overflow handler - debugger single step + jmp illegalint ; SPI - Serial transfer complete + rjmp rx_int ; USART - RX complete + nop + rjmp tx_udre ; USART - data register empty + nop + jmp illegalint ; USART - TX complete + jmp illegalint ; ADC conversion complete + jmp illegalint ; EEPROM ready + jmp illegalint ; Analog comparator + jmp illegalint ; TWI serial interface + jmp illegalint ; INT2 handler + jmp t0_cmi ; Timer0 compare match - debugger 10ms timer + jmp illegalint ; SPM ready +#endif +#ifdef _M32DEF_INC_ + jmp reset ; Reset handler + rjmp NMI ; INT0 handler + nop + rjmp IRQ ; INT1 handler + nop + jmp illegalint ; INT2 handler + jmp illegalint ; Timer2 compare match + jmp illegalint ; Timer2 overflow + .ifdef iomap + jmp t1_icr ; Timer1 capture event + jmp t1_ocra ; Timer1 compare match A + jmp t1_ocrb ; Timer1 compare match B + jmp t1_ovi ; Timer1 overflow handler + .else + jmp illegalint ; Timer1 capture event + jmp illegalint ; Timer1 compare match A + jmp illegalint ; Timer1 compare match B + jmp illegalint ; Timer1 overflow handler + .endif + jmp t0_cmi ; Timer0 compare match - debugger 10ms timer + jmp t0_ovi ; Timer0 overflow handler - debugger single step + jmp illegalint ; SPI - Serial transfer complete + rjmp rx_int ; USART - RX complete + nop + rjmp tx_udre ; USART - data register empty + nop + jmp illegalint ; USART - TX complete + jmp illegalint ; ADC conversion complete + jmp illegalint ; EEPROM ready + jmp illegalint ; Analog comparator + jmp illegalint ; TWI serial interface + jmp illegalint ; SPM ready +#endif +.if pc < 0x2a + .error "unknown device - interrupt vectors could not be built!" +.endif + +;***************************************************************** +; +; RS232 buffer +; +;***************************************************************** +; +; RX complete interrupt - rx fifo input +; +rx_int: + in s,sreg + push xl + push xh + in k,ucsra + in i,udr + sbrs k,fe ;no stop bit = possible break + ifs_and rx_break + cpi i,0 ;break should have all bits 0 + ifeq rx_break + sbr flags,(1< ;## +;.ifdef cmos_core +;stp_instr: .db "STP - Emulator halted",0 ; X +;.else +;inv_instr: .db "Illegal Opcode ",0 ; X +;.endif +;emu_msg: .db 13,10,13,10,core_string," Emulator V",version,0 ; X +;built_msg: .db " built ",__DATE__," ",__TIME__,0 ;14 +load_wait: .db 13,10,"Loading, to abort",13,10,0 ;14 +load_abort: .db " Load aborted",0 ; 7 +;err_chksum: .db " Checksum failed",0,0 ; 9 +rs_vect_empty: .db 13,10,"Check reset vector",0,0 ;11 +reset_msg: .db " Reset",0 ; 4 +bpt_clrd_msg: .db 10,13,"All breakpoints cleared",0 ;13 +bpt_info: .db 10,13,"Breakpoints (slot#:address)",13,10,0,0 ;17 +;bpt_info_none: .db 10,13,"No breakpoints active",0 ;12 +bpt_slot_full: .db 10,13,"No more breakpoint slots available",0,0 ;19 +.ifndef irq_dis_real ;+53 words available (6 less for NMOS) +load_ok: .db 13,"Load OK",0,0 ; 5 +err_nonhex: .db " Non-Hex data in record",0 ;12 +err_func: .db " Invalid function or count in record",0,0 ;19 +illegal_int: .db 13,10,"AVR Illegal Interrupt",0 ;12 +back_line: .db 13,27,91,"K",27,91,"1A",0,0 ; 5 +.endif + +;************************************************** +; +; 6502 emulation core +; +;************************************************** + .ifdef cmos_core + .include "6502_Emu_CMOS.inc" + .else + .include "6502_Emu_NMOS.inc" + .endif + +;************************************************** +; +; I/O page (iomap) address decode - emulated I/O +; +;************************************************** + .ifdef iomap + .include "6502_Emu_IO.inc" + .endif + +;************************************************** +; +; Monitor / Debugger Interrupts +; +;************************************************** + +; +; an illegal interrupt has occured +; +illegalint: + PrintStr illegal_int + do i_stop + loop i_stop ; reset required + +; +; Timer 0 compare match A - 10ms CTC interrupt +; +t0_cmi: + in s,sreg + lds i,cmd_esc_timer ;service esc sequence timer + mov k,i + andi i,0x7f + ifne t0_esc_expired + dec k + sts cmd_esc_timer,k + end t0_esc_expired + lds i,cmd_reg_timer ;service register refresh timer + tst i + ifne t0_reg_expired + dec i + sts cmd_reg_timer,i + end t0_reg_expired + + lds i,irq_flag ;check 10 ms timer + sbr i,1 ;set tick flag + lds k,tcdn_count ;update tcdn count + dec k ;expired? + ifeq t0_tcdn_expired + lds k,tcdn_top ;reset tcdn count + sbr i,2 ;set tcdn flag + end t0_tcdn_expired + sts tcdn_count,k ;save count + sts irq_flag,i ;save flags + lds k,irq_mask ;tick or tcdn IRQ enabled? + and i,k + ifne t0_tcdn_irq + sbi cbusddr,3 ;set IRQ + end t0_tcdn_irq + + sbrc flags,deb_act ;no debugger instance active + ifs_and debug_start + sbrs flags,deb_on ;debug mode + ifs debug_start + .if defined(spi_sel) || defined(i2c_sel) + sbrs flags,dma_rpt ;interupt during dma transfer? + ifs t0_dma + cbr flags,(1< based on timer + lds yl,cmd_esc_timer ;test escape timer expired + tst yl + ifeq deb_true_esc + ldi yl,0x80 ;flag line cleared + sts cmd_esc_timer,yl + cbr flags,(1< + cpi a,34 ;test for string input + ifeq deb_string_mark + ldi b,(1< + cpi a,27 ;test for escape + ifeq deb_esc + ifid deb_esc_disabled + ldi yh,0b10 ;reset t0 compare match + out tifr,yh ;if disabled + end deb_esc_disabled + ldi yh,6 ;further chars within 50-60ms + sts cmd_esc_timer,yh ;discarded as esc sequence + end deb_esc +; + cpi a,9 ;test for tab (step 1 instruction) + ifeq_and deb_step + sbrc flags,emu_run ;must be stopped + ifs deb_step + rcall show_regs ;show command to be executed + movw y,pch:pcl + rcall disasm + .ifndef cmos_core + cpi b,7 ;invalid opcode? + ifeq deb_step_inv + rjmp end_command + end deb_step_inv + .endif + cli ;force t0 overflow at end of instruction + out tcnt0,allon ;overflow next count + ldi a,0b00001001 ;timer 0 ctc, clock / 1 + out tccr0,a + ldi a,0b00001101 ;timer 0 ctc, clock / 1024 + out tccr0,a + rjmp emu_start ;executes also breakpointed opcodes + end deb_step +; + cpi a,13 ;test for carriage return + ifeq_far deb_cr + cpi yl,low(cmd_buf) ;test empty commandline + ifeq deb_empty + ld a,y ;test for previous M or D + cpi a,'M' + ifeq_or deb_shortcut + cpi a,'D' + ifeq deb_shortcut + PrintStr back_line ;seamless output + adiw y,1 ;keep M or D + ldi a,'+' + st y+,a + end deb_shortcut + end deb_empty + st y,zero ;mark end of commandline + cbr flags,(1<|APwwww +; r = register A X Y P S F +; accu indexX indexY PC SP flags(proc.status) +; bb = hex byte of data +; wwww = hex word of data, leading zeroes can be omitted +; + cpi a,'A' + ifeq alter_reg + ld a,y+ ;get register +;alter accumulator + cpi a,'A' ;accumulator + ifeq alter_rega + rcall get_byte + mov rega,a + rjmp end_command + end alter_rega +;alter X index register + cpi a,'X' ;index register X + ifeq alter_regx + rcall get_byte + mov regx,a + rjmp end_command + end alter_regx +;alter Y index register + cpi a,'Y' ;index register Y + ifeq alter_regy + rcall get_byte + mov regy,a + rjmp end_command + end alter_regy +;alter stack pointer + cpi a,'S' ;stack pointer + ifeq alter_spointer + rcall get_byte + mov spointer,a + rjmp end_command + end alter_spointer +;alter flags (prcocessor status) + cpi a,'F' ;flags = processor status + ifeq alter_status + rcall get_byte + mov stat2,a + mov stat,stat2 ;restore AVR format + andi stat,0b11 ;------ZC + bst stat2,7 ;>----> + bld stat,2 ;-----N-- + ori stat2,0b0100000 ; 1 (always 1) + andi stat2,0b1101100 ;-V1BDI-- (Break cleared) + rjmp end_command + end alter_status +;alter program counter + cpi a,'P' ;program counter + ifeq alter_pc + rcall get_adr + movw pch:pcl,z + rjmp end_command + end alter_pc + rjmp invalid_command + end alter_reg +; +; B = breakpoint utility +; BI = information - list active breakpoints by slot number +; BSaaaa = set breakpoint at address aaaa, leading zeros can be omitted +; BC# = clear breakpoint slot #, #=0-9, #=A for all +; + cpi a,'B' + ifeq_far br_util + ld a,y+ + cpi a,'I' + ifeq br_info + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + rcall brkpt_info + rjmp end_command + end br_info + cpi a,'S' + ifeq br_set + rcall get_adr + ldi yl,low(brkpt_lo) ;address already set? + ldi yh,high(brkpt_lo) + do br_set_already + ld a,y+ + cp a,zl + ifeq_and br_already_set + ldd a,y+9 + cp a,zh + ifeq br_already_set + rcall brkpt_info + rjmp end_command + end br_already_set + cpi yl,low(brkpt_hi) + loopne br_set_already + ldi yl,low(brkpt_lo) ;free slot? + do br_set_free + ld a,y+ + cp a,allon + ifeq_and br_set_slot + ldd a,y+9 + cp a,allon + ifeq br_set_slot + sbiw y,1 + st y,zl ;set new breakpoint address + std y+10,zh + out abuslo,zl ;fetch original opcode + out abushi,zh + wait_data_valid 0 ;0ns minimum @ 16MHz + in a,dbusin + std y+20,a ;set original opcode + ldi a,0xdb ;replace with STP opcode + out cbus,writemem ;WE, ~OE + out dbusout,a ;precharge write + out dbusddr,allon ;dbus = output + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + out dbusddr,zero ;dbus = input + out cbus,readmem ;OE / read mode back on + rcall brkpt_info + rjmp end_command + end br_set_slot + cpi yl,low(brkpt_hi) + loopne br_set_free + PrintStr bpt_slot_full ;10,13,"No more breakpoint slots available" + rcall brkpt_info + rjmp end_command + end br_set + cpi a,'C' + ifeq br_clr ;get slot# or all + do br_clr_parse + ld a,y+ + tst a ;premature end of input + breq br_inv_cmd + cpi a,32 ;skip blanks + loopeq br_clr_parse + ld c,y+ ;check validity (1 parameter) + cpse c,zero + rjmp invalid_command + sbiw y,1 + cpi a,'A' + ifeq br_clr_all + rcall brkpt_clr_all + tst c + ifeq br_clr_none_msg + PrintStr bpt_info_none ;10,13,"No breakpoints active" + end br_clr_none_msg + rjmp end_command + end br_clr_all + subi a,'0' ;0-9? + cpi a,10 + iflo br_clr_slot + ldi yl,low(brkpt_lo) ;select breakpoint + add yl,a + ldi yh,high(brkpt_lo) + adc yh,zero + rcall brkpt_clr_one + rcall brkpt_info + rjmp end_command + end br_clr_slot + end br_clr +br_inv_cmd: rjmp invalid_command + end br_util + + +; +; D = disassemble memory Syntax: D(aaaa|+) +; aaaa = address, leading zeros can be omitted +; + = next, disassembles 20 instructions +; + cpi a,'D' + ifeq show_disasm + ld a,y+ + cpi a,'+' + ifeq dis_next + ld a,y+ ;no parameter after + + cpse a,zero + rjmp invalid_command + lds yl,lmem_disas ;load previous address + lds yh,lmem_disas+1 + else dis_next + sbiw y,1 ;allow immediate hex + rcall get_adr ;get Address + movw y,z + end dis_next + ldi a,10 ;count + sbrc flags,emu_run + ldi a,6 ;reduce count if running + do dis_loop + push a + rcall crlf + mov a,yh ;show address + rcall PrintHex + mov a,yl + rcall PrintHex + rcall space + rcall disasm + pop a + dec a + loopne dis_loop + sts lmem_disas,yl ;load previous address + sts lmem_disas+1,yh + rjmp end_command + end show_disasm + .ifdef eep_vld +; +; E = I2C EEPROM non volatile program storage utility +; EI = information on programs stored and free slots +; ESpp = save program from RS232 input to EEPROM +; ELpp = load program from EEPROM to RAM +; EDpp = delete program in EEPROM +; EApp"C\rLOAD $xx\rRUN\r" +; = autoload program, send string on power on +; either parameter may be omitted +; FF = no autoload, "" (empty string) = send nothing +; pp = program number 00 - FE +; + cpi a,'E' + ifeq_far eep_util + ld a,y+ +;EEPROM information + cpi a,'I' + ifeq eep_info + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + rcall eep_auto_info + rcall eep_cmd_info + rjmp end_command + end eep_info +;EEPROM save + cpi a,'S' + ifeq_far eep_save + rcall get_byte ;get prog# + cpi a,0xff + ifeq eep_save_inv_cmd + rjmp invalid_command + end eep_save_inv_cmd + sts prog_num,a + rcall eep_open + ldi yl,0 ;initial slot allocation + ldi yh,0 + out eearh,one ;upper bytes in internal EEPROM + PrintStr save_wait ;13,10,"Saving, to abort",13,10 + do eep_save_record + do eep_wait_colon ;wait for start of record + rcall read_serial_esc + cpi a,':' + loopne eep_wait_colon + clr xh ;checksum + rcall read_byte_esc ;read & save count + mov xl,a + rcall eep_write + ldi a,13 + rcall PrintChr + rcall read_byte_esc ;read address high + tst xl ;count 0? + ifne eep_save_adr ;show & save address for count >0 + rcall eep_prsv ;address high, read next + rcall eep_prsv ;address low, read function + cpi a,0 ;load function? + ifeq eep_save_data + do eep_save_data_loop + rcall read_byte_esc ;read & save data + rcall eep_write + dec xl + loopne eep_save_data_loop + rcall read_byte_esc ;test checksum + tst xh + ifne eep_save_error_checksum + PrintStr err_chksum ;" Checksum failed" + rjmp eep_write_err + end eep_save_error_checksum + else eep_save_data + PrintStr err_func ;" Invalid function or count in record" + rjmp eep_write_err + end eep_save_data + else eep_save_adr ;show & save PC + rcall eep_prsv ;PCH, read next + rcall eep_prsv ;PCL, read function + cpi a,1 ;end of record function? + ifeq eep_save_complete + PrintStr save_ok ;13,"Save OK" + rjmp eep_write_close + else eep_save_complete + PrintStr err_func ;" Invalid function or count in record" + rjmp eep_write_err + end eep_save_complete + end eep_save_adr + loop eep_save_record +eep_prsv: ; Output to RS232 & EEP + push a + rcall PrintHex ;show address + pop a + rcall eep_write ;save address + rjmp read_byte_esc ;get next byte + end eep_save +;EEPROM load + cpi a,'L' + ifeq eep_load + rcall get_byte + cpi a,0xff + breq eep_inv_cmd + sts prog_num,a + rcall brkpt_clr_all ;clear all breakpoints + rcall eep_load_prog + rjmp end_command +eep_inv_cmd: rjmp invalid_command + end eep_load +;EEPROM delete + cpi a,'D' + ifeq eep_del + rcall get_byte + cpi a,0xff + breq eep_inv_cmd + clr c ;loopcount 256 slots + clr b ;slotcount + out eearh,one + do eep_del_loop + out eearl,c ;find prog# + out eecr,one + in d,eedr + cp d,a + ifeq eep_del_slot + out eedr,allon ;mark free + in d,sreg ;atomic write sequence + cli + sbi eecr,eemwe + sbi eecr,eewe + out sreg,d + inc b ;count slots + do eep_del_wait ;write complete? + sbic eecr,eewe + loop eep_del_wait + end eep_del_slot + inc c ;all slots done? + loopne eep_del_loop + out eearl,zero ;set to unused address + out eearh,zero + tst b ;count? + ifne eep_del_free + rcall crlf + mov a,b + rcall PrintHex ;slotcount + PrintStr eep_info3 ;" slots free" + ldi a,'d' + rcall PrintChr + else eep_del_free + mov b,a + PrintStr eep_prog ;10,13,"Program " + mov a,b + rcall PrintHex ;prog# + PrintStr eep_notfound ;" not found" + end eep_del_free + rjmp end_command + end eep_del +;EEPROM autoload + cpi a,'A' + ifeq eep_autoload + out eearh,zero ;write eep lower page + do eep_auto_parse + ld a,y+ + tst a ;end of input + breq eep_inv_cmd ;needs at least 1 parameter + cpi a,' ' ;skip blanks + loopeq eep_auto_parse + cpi a,34 ;begin of string + ifne eep_auto_number + rcall get_wbyte + out eearl,allon + rcall eep_auto_write + do eep_auto_parse2 + ld a,y+ + cpi a,' ' ;skip blanks + loopeq eep_auto_parse2 + end eep_auto_number + tst a ;end of input + ifne eep_auto_next + cpi a,34 + brne eep_auto_invalid ;only valid input is string + ldi b,eep_string + do eep_auto_string + ld a,y+ + tst a ;end of command? + ifeq_or eep_string_end + cpi a,34 ;closing quotes + ifeq eep_string_end + ldi a,0xff ;end of string marker + end eep_string_end + out eearl,b + rcall eep_auto_write + inc b ;next EEPROM address + cpi a,0xff ;end marker? + loopne eep_auto_string + end eep_auto_next + rcall eep_auto_info + out eearl,zero ;protect eep from unintentional writes + rjmp end_command +eep_auto_invalid: rjmp invalid_command + end eep_autoload + end eep_util + .endif +; +; M = show memory Syntax: M(aaaa|+|-|) +; aaaa = address, leading zeros can be omitted +; + = next block, - = previous block, = same block +; displays 0x100 (0x40) Bytes at full line address +; + cpi a,'M' + ifeq_far show_mem + out cbus,readmem ;prepare to read + lds zl,lmem_display ;load previous address + lds zh,lmem_display+1 + ld a,y+ + tst a ;no address - show same + breq skip_get_adr + cpi a,'+' + ifeq show_next + sbrc flags,emu_run + ifs show_nxt_100 + inc zh + else show_nxt_100 + addiw z,0x40 ;reduce bytes if running + end show_nxt_100 + ld a,y+ ;no parameter after + + tst a + breq skip_get_adr + rjmp invalid_command + end show_next + cpi a,'-' + ifeq show_previous + sbrc flags,emu_run + ifs show_prev_100 + dec zh + else show_prev_100 + subi zl,0x40 ;reduce bytes if running + sbc zh,zero + end show_prev_100 + mov d,a + ld a,y+ ;no parameter after - + tst a + breq skip_get_adr + rjmp invalid_command + end show_previous + sbiw y,1 ;allow immediate hex + rcall get_adr ;get Address +skip_get_adr: + andi zl,0xe0 ;mask full lines only + mov a,zl + sbrc flags,emu_run + addi a,0x40 ;reduce bytes if running + mov d,a + sts lmem_display,zl + sts lmem_display+1,zh + do show_mem_line + rcall crlf + mov a,zh ;show address + rcall PrintHex + mov a,zl + rcall PrintHex + rcall colon + do show_mem_data + out abuslo,zl ;memory fetch + out abushi,zh + clt ;clear reverse video + wait_data_valid 1 ;60ns minimum @ 16MHz + in a,dbusin + cpi a,0xdb ;is potential breakpoint? + ifeq show_mem_brk + rcall brkpt_chk + end show_mem_brk + rcall RevHex + adiw z,1 + ldi a,3 ;seperate words with spaces + and a,zl + loopne show_mem_data + rcall space + ldi a,31 ;new line after 32 bytes + and a,zl + loopne show_mem_data + cp zl,d ;0x100 bytes displayed? + loopne show_mem_line + rjmp end_command + end show_mem +; +; W = Write memory Syntax: W(aaaa|+) bb..bb +; aaaa = address, leading zeros can be omitted +; + = write next byte(s) +; bb = bytes of data, may be separated with spaces +; + cpi a,'W' + ifeq write_mem + ld a,y+ + cpi a,'+' + ifeq write_next + lds zl,lmem_write ;load previous next address + lds zh,lmem_write+1 + else write_next + sbiw y,1 ;allow immediate hex + rcall get_wadr ;get write address + sts lmem_display,zl ;save for next display + sts lmem_display+1,zh + end write_next + mov d,yl + do write_mem_dryrun ;syntax check before write + ld a,y+ + tst a ;end of write + exiteq write_mem_dryrun + cpi a,32 ;skip space + loopeq write_mem_dryrun + rcall get_wbyte ;get data + loop write_mem_dryrun + mov yl,d + out cbus,clear ;readmode off + out dbusddr,allon ;dbus = output + do write_mem_realrun ;real write + ld a,y+ + tst a ;end of write + exiteq write_mem_realrun + cpi a,32 ;skip space + loopeq write_mem_realrun + rcall get_wbyte ;get data + rcall brkpt_chk_write ;check write to breakpoint + out abuslo,zl + out abushi,zh + out cbus,writemem ;WE, ~OE + out dbusout,a ;dbus write + adiw z,1 + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + loop write_mem_realrun + out dbusddr,zero ;dbus = input + out cbus,readmem ;OE / read mode back on + sts lmem_write,zl + sts lmem_write+1,zh + rjmp end_command + end write_mem +; +; L = Load Intel Hex Record Syntax: L +; loads records to memory, to abort +; + cpi a,'L' + ifeq_far load_mem + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + cbr flags,(1< 0 + ifne load_mem_data + out cbus,clear ;readmode off + out dbusddr,allon ;dbus = output + do load_data + rcall read_byte_esc ;read data + out abuslo,zl + out abushi,zh + out cbus,writemem ;WE, ~OE + out dbusout,a ;dbus write + adiw z,1 + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + dec xl + loopne load_data + out dbusddr,zero ;dbus = input + out cbus,readmem ;OE / read mode back on + rcall read_byte_esc ;read checksum + tst xh + ifne load_error_checksum + PrintStr err_chksum ;" Checksum failed" + rjmp discard_serial_stream + end load_error_checksum + else load_mem_data + cpi a,1 ;end of record function + ifeq load_complete + tst zh ;address is valid PC? + ifne load_pc + movw pcl:pch,z ;set PC + end load_pc + PrintStr load_ok ;13,"Load OK" + rjmp discard_serial_stream ;OK message - wait for eol + else load_complete + PrintStr err_func ;" Invalid function or count in record" + rjmp discard_serial_stream + end load_complete + end load_mem_data + loop load_mem_record + rjmp end_command + end load_mem +; +; H = Halt Emulator execution Syntax: H +; + cpi a,'H' + ifeq halt_emu + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + cbr flags,(1< +; + cpi a,'G' + ifeq start_emu + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + ldi yl,low(cmd_buf) + sts cmd_inx,yl + ldi a,10 ;linefeed + rcall PrintChr + rcall show_regs + sbr flags,(1< op low + out abuslo,pcl ;operand address low prefetch + out abushi,pch + wait_data_valid 5 ;300ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode + end start_emu +; +; X = Exit Debugger / start Emulator execution Syntax: X +; + cpi a,'X' + ifeq exit_deb + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + rcall crlf + cli + ldi flags,(1< +; + cpi a,'R' + ifeq deb_reset + ld a,y+ ;check validity (no parms) + cpse a,zero + rjmp invalid_command + rcall soft_reset + rjmp end_command + end deb_reset + +;************************************************** +; +; end parsing & executing commandline +; +;************************************************** + +; Invalid command + +invalid_command: + sbiw y,1 ;caused by? + ld a,y + cpse a,zero ;end of line? + adiw y,1 ;last character not eol + ldi a,'?' ;mark invalid commannd + st y,a + ldi yl,low(cmd_buf) + rcall show_regs + rcall show_prompt + do deb_invalid + ld a,y+ + rcall PrintChr + cpi a,34 ;test for string input + ifeq inv_string_mark + ldi b,(1< adr high + in pcl,dbusin ;save low pointer to pc + out abuslo,oplow ;fetch high pointer to pc + wait_data_valid 0 ;0ns minimum @ 16MHz + in pch,dbusin ;point to new pc + ret +;***************************************************************** +; +; show 6502 registers +; +; shows register, sets refresh to 500ms +; output: 1ss pppp aa Xxx Yyy ffffffff r> +; ss = stack pointer, pppp = program counter, aa = accumulator +; xx = Index X, yy = Index Y, ffffffff = bitwise processor status +; r = runmode (1 = reverse video) +; +;***************************************************************** + +show_regs: + ldi a,50 ;refresh timer 500ms (50 * 10) + sts cmd_reg_timer,a + ldi a,13 ;return + rcall PrintChr + ldi a,'1' ;stackpointer + rcall PrintChr + mov a,spointer + rcall PrintHex + rcall space + sbrs flags,emu_run + ifs show_reg_run ;show breakpoint if halted + clt + else show_reg_run + rcall brkpt_chk_pc + end show_reg_run + mov a,pch ;program counter + rcall RevHex + mov a,pcl + rcall RevHex + rcall space + mov a,rega ;accumulator + rcall PrintHex + rcall space + ldi a,'x' ;index register X + rcall PrintChr + mov a,regx + rcall PrintHex + rcall space + ldi a,'y' ;index register y + rcall PrintChr + mov a,regy + rcall PrintHex + rcall space + ldi a,'N' ;processor status + bst stat,2 + rcall RevChr + ldi a,'V' + bst stat2,6 + rcall RevChr + ldi a,'-' ;don´t care + rcall PrintChr + ldi a,'B' ;only on stack + rcall PrintChr + ldi a,'D' + bst stat2,3 + rcall RevChr + ldi a,'I' + bst stat2,2 + rcall RevChr + ldi a,'Z' + bst stat,1 + rcall RevChr + ldi a,'C' + bst stat,0 + rcall RevChr + rjmp space + +show_prompt: + sbrs flags,emu_run + ifs show_runmode + ldi a,'G' ;go / running + else show_runmode + ldi a,'H' ;halted / stopped + end show_runmode + rcall PrintChr + ldi a,'>' + rjmp PrintChr + +;***************************************************************** +; +; disassemble instruction +; +; expects addresss in y +; returns b = 7 if invalid instruction +; uses a c d z +; +;***************************************************************** + +disasm: + out abuslo,yl ;memory fetch + out abushi,yh + clr d ;load index to opcode table + clt ;clear reverse video + movw z,y + wait_data_valid 3 ;180ns minimum @ 16MHz + in a,dbusin + cpi a,0xdb ;is potential breakpoint? + ifeq show_dis_brk + rcall brkpt_chk + movw y,z + end show_dis_brk + mov c,a ;opcode + adiw y,1 ;next byte + lsl c ;*4 / each entry 4 bytes + rol d + lsl c + rol d + ldi zl,low(dis_opcode<<1) + ldi zh,high(dis_opcode<<1) + add zl,c + adc zh,d + lpm a,z+ ;show mnemonics + rcall RevChr + lpm a,z+ + rcall RevChr + lpm a,z+ + rcall RevChr + rcall space + lpm b,z ;show addressing + andi b,0b1100000 ;mask prefix + cpi b,0b0100000 + ifeq dis_immediate + ldi a,'#' + rcall PrintChr + end dis_immediate + cpi b,0b1000000 + ifeq dis_pre_indirect + ldi a,'(' + rcall PrintChr + end dis_pre_indirect + cpi b,0b1100000 + ifeq dis_bitnum + in a,dbusin ;opcode -> bitnum + swap a + andi a,7 + addi a,'0' + rcall PrintChr + ldi a,',' + rcall PrintChr + end dis_bitnum + lpm b,z + andi b,0b0011000 ;mask op addressing + cpi b,0b0001000 + ifeq dis_data_one ;zero page or immediate + out abuslo,yl ;memory fetch + out abushi,yh + adiw y,1 + wait_data_valid 1 ;60ns minimum @ 16MHz + in a,dbusin + rcall PrintHex + end dis_data_one + cpi b,0b0010000 + ifeq dis_data_abs ;2 Byte absolute (reverse order) + out abuslo,yl ;memory fetch + out abushi,yh + adiw y,1 + wait_data_valid 1 ;60ns minimum @ 16MHz + in c,dbusin + out abuslo,yl ;memory fetch + out abushi,yh + adiw y,1 + wait_data_valid 1 ;60ns minimum @ 16MHz + in a,dbusin + rcall PrintHex + mov a,c + rcall PrintHex + end dis_data_abs + cpi b,0b0011000 + ifeq dis_data_rel ;1 Byte relative (calculated absolute) + rcall dis_rel + end dis_data_rel + lpm b,z + andi b,0b0000111 ;mask suffix + cpi b,0b001 ;,X + ifeq dis_x + ldi a,',' + rcall PrintChr + ldi a,'X' + rcall PrintChr + end dis_x + cpi b,0b010 ;,Y + ifeq dis_y + ldi a,',' + rcall PrintChr + ldi a,'Y' + rcall PrintChr + end dis_y + cpi b,0b011 ;) + ifeq dis_i + ldi a,')' + rcall PrintChr + end dis_i + cpi b,0b100 ;,X) + ifeq dis_xi + ldi a,',' + rcall PrintChr + ldi a,'X' + rcall PrintChr + ldi a,')' + rcall PrintChr + end dis_xi + cpi b,0b101 ;),Y + ifeq dis_iy + ldi a,')' + rcall PrintChr + ldi a,',' + rcall PrintChr + ldi a,'Y' + rcall PrintChr + end dis_iy + cpi b,0b110 ;A + ifeq dis_a + ldi a,'A' + rcall PrintChr + end dis_a + cpi b,0b111 ;invalid instruction or BBR/BBS + ifeq dis_nv + .ifdef cmos_core + ldi a,',' + rcall PrintChr + rcall dis_rel + .else + PrintStr inv_instr + .endif + end dis_nv + ret + +;fetch relative address and display as absolute +dis_rel: + out abuslo,yl ;memory fetch + out abushi,yh + adiw y,1 + clr a + wait_data_valid 2 ;120ns minimum @ 16MHz + in c,dbusin + tst c + ifmi dis_rel_sign + dec a ;extend sign to high + end dis_rel_sign + add c,yl ;calculate & show absolute + adc a,yh + rcall PrintHex + mov a,c + rjmp PrintHex + +;***************************************************************** +; +; get hex parameters +; +;***************************************************************** + +;ASCII to hex nibble conversion +get_hex: + subi a,'0' ;hex 0-9 + cpi a,10 + ifsh hex_a_f + cpi a,17 ;non hex >0 F + brsh inv_cmd + end hex_a_f + ret +; +; get 1 hex byte from commandline +; expects 2 Hex digits, eol +; returns hex byte in a +; +get_byte: + do byte_parse + ld a,y+ + tst a ;premature end of input + breq inv_cmd + cpi a,32 ;skip blanks + loopeq byte_parse + rcall get_hex ;high nibble + mov c,a + swap c + ld a,y+ + tst a + breq inv_cmd + rcall get_hex ;low nibble + or a,c + ld d,y+ ;end of line? + tst d + brne inv_cmd + ret +; +; get nth hex byte from commandline +; expects 2 Hex digits +; returns hex byte in a +; +get_wbyte: + rcall get_hex ;high nibble + mov c,a + swap c + ld a,y+ + tst a + breq inv_cmd + rcall get_hex ;low nibble + or a,c + ret + +inv_cmd: + lds a,sp_save ;restore sp to main loop + out spl,a + lds a,sp_save+1 + out sph,a + rjmp invalid_command ;immediate end of command + +; +; get hex address from commandline, single parameter +; expects y pointing to 1-4 hex digits, end of line +; uses a b +; returns address in z +; +get_adr: + do adr_parse + ld a,y+ + tst a ;premature end of input + breq inv_cmd + cpi a,32 ;skip blanks + loopeq adr_parse + rcall get_hex ;1st nibble + clr zh + mov zl,a + do adr_nibble + ld a,y+ ;next nibble + tst a + exiteq adr_nibble + rcall get_hex + ldi b,4 + do adr_shift_nibble + lsl zl + rol zh + brcs inv_cmd ;exceeds 16bit + dec b + loopne adr_shift_nibble + or zl,a + loop adr_nibble + ret +; +; get hex address from commandline, multiple parameter +; expects 1-4 hex digits, space +; returns address in z +; +get_wadr: + do wadr_parse + ld a,y+ + tst a ;premature end of input + breq inv_cmd + cpi a,32 ;skip blanks + loopeq wadr_parse + rcall get_hex ;1st nibble + clr zh + mov zl,a + do wadr_nibble + ld a,y+ ;next nibble + cpi a,32 + exiteq wadr_nibble + rcall get_hex + ldi b,4 + do wadr_shift_nibble + lsl zl + rol zh + brcs inv_cmd ;exceeds 16bit + dec b + loopne wadr_shift_nibble + or zl,a + loop wadr_nibble + ret + +;***************************************************************** +; +; breakpoint utilities +; +;***************************************************************** +; +; breakpoint info - list active breakpoints +; uses a c y z +; +brkpt_info: + ldi yl,low(brkpt_lo) ;any breakpoints active? + ldi yh,high(brkpt_lo) + clr c + do br_find_actv + ldd zh,y+10 ;brkpt_hi set? + cpse zh,allon + inc c + ld zl,y+ ;brkpt_lo set? + cpse zl,allon + inc c + cpi yl,low(brkpt_hi) + loopne br_find_actv + cpse c,zero + ifs br_info_none + PrintStr bpt_info_none ;10,13,"No breakpoints active" + else br_info_none + PrintStr bpt_info ;10,13,"Breakpoints (slot#:address)",13,10 + ldi yl,low(brkpt_lo) ;find breakpoints + do br_info_all + ld zl,y ;brkpt_lo set? + ldd zh,y+10 ;brkpt_hi set? + cp zl,allon + ifne_or br_info_slot + cp zh,allon + ifne br_info_slot + rcall space + mov a,yl ;slot# + subi a,low(brkpt_lo) - '0' + rcall PrintChr + rcall colon + mov a,zh ;address + rcall PrintHex + mov a,zl + rcall PrintHex + end br_info_slot + adiw y,1 ;next slot + cpi yl,low(brkpt_hi) + loopne br_info_all + end br_info_none + ret +; +; clear all breakpoints +; uses a y z +; returns c = count of slots cleared +; +brkpt_clr_all: + ldi yl,low(brkpt_lo) ;find breakpoints + ldi yh,high(brkpt_lo) + clr c + do br_clr_all_slots + rcall brkpt_clr_one + adiw y,1 ;next slot + cpi yl,low(brkpt_hi) + loopne br_clr_all_slots + tst c + ifne br_clr_all_msg + PrintStr bpt_clrd_msg ;10,13,"All breakpoints cleared" + end br_clr_all_msg + ret +; +; clear 1 breakpoint slot +; uses a y z +; returns c+1 if slot was active / got cleared +; +brkpt_clr_one: + ld zl,y ;brkpt_lo set? + ldd zh,y+10 ;brkpt_hi set? + cp zl,allon + ifne_or br_clr_one_slot + cp zh,allon + ifne br_clr_one_slot + ;write original opcode back to its RAM location + ldd a,y+20 ;brkpt_op + out abuslo,zl + out abushi,zh + out cbus,writemem ;WE, ~OE + out dbusout,a ;dbus write + out dbusddr,allon ;dbus = output + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + out dbusddr,zero ;dbus = input + out cbus,readmem ;OE / read mode back on + st y,allon ;reset brkpt_lo + std y+10,allon ;reset brkpt_hi + inc c + end br_clr_one_slot + ret +; +; check STP is breakpoint +; expects current address in z +; on match replace a with original opcode +; " " set T flag to signal reverse video +; uses c y +; +brkpt_chk: + ldi yl,low(brkpt_lo) ;match breakpoint address + ldi yh,high(brkpt_lo) + do br_chk_adr + ld c,y+ ;brkpt_lo match? + cp c,zl + ifeq_and br_slot_match + ldd c,y+9 ;brkpt_hi match? + cp c,zh + ifeq br_slot_match + cp zl,allon + ifne_or br_slot_valid + cp zh,allon + ifne br_slot_valid + ldd a,y+19 ;show original opcode + set ;signal breakpoint = reverse video + end br_slot_valid + ret + end br_slot_match + cpi yl,low(brkpt_hi) + loopne br_chk_adr + ret +; +; check PC is breakpoint +; expects current address in pcl:pch +; on match replace opcode with original opcode +; T flag = breakpoint true/false +; uses c +; +brkpt_chk_pc: + push yl + push yh + ldi yl,low(brkpt_lo) ;match breakpoint address + ldi yh,high(brkpt_lo) + clt + do br_pc_adr + ld c,y+ ;brkpt_lo match? + cp c,pcl + ifeq_and br_pc_match + ldd c,y+9 ;brkpt_hi match? + cp c,pch + ifeq br_pc_match + cp pcl,allon + ifne_or br_pc_valid + cp pch,allon + ifne br_pc_valid + ldd opcode,y+19 ;show original opcode + set ;signal breakpoint = reverse video + end br_pc_valid + rjmp br_chkp_exit + end br_pc_match + cpi yl,low(brkpt_hi) + loopne br_pc_adr +br_chkp_exit: + pop yh + pop yl + ret +; +; check write memory to breakpoint address +; expects current address in z +; on match saves a as original opcode +; " " replaces a with STP opcode +; uses c +; +brkpt_chk_write: + push yl + push yh + ldi yl,low(brkpt_lo) ;match breakpoint address + ldi yh,high(brkpt_lo) + do br_chkw_adr + ld c,y+ ;brkpt_lo match? + cp c,zl + ifeq_and br_slotw_match + ldd c,y+9 ;brkpt_hi match? + cp c,zh + ifeq br_slotw_match + cp zl,allon + ifne_or br_slotw_valid + cp zh,allon + ifne br_slotw_valid + std y+19,a ;save original opcode + ldi a,0xdb ;write STP opcode to memory + end br_slotw_valid + rjmp br_chkw_exit + end br_slotw_match + cpi yl,low(brkpt_hi) + loopne br_chkw_adr +br_chkw_exit: + pop yh + pop yl + ret +; +;***************************************************************** +; +; load and EEPROM save +; +;***************************************************************** +; +; RS232 read from RX fifo or direct and exit on +; uses d, (i with cli) +; updates checksum in xh +; returns data in a +; +read_serial_esc: + push yl + push yh +; push c + do wait_ser_data + in d,sreg ;preserve sreg interrupt enable + cli + lds i,rx_fill ;check buffer + tst i + ifne esc_read_buf + lds yl,rx_inx ;prepare address to read rx fifo + ldi yh,high(rx_buf) + sub yl,i + ld a,y ;read + dec i ;update pointer + sts rx_fill,i + .ifdef flowlo +; mov i,c + cpi i,flowlo ;buffer lower watermark? + iflo esc_flow + lds i,flow_cmd + cpi i,0x91 ;xon done? + ifne esc_send_xon + ldi i,0x11 ;post xon pending + sts flow_cmd,i + ldi i,usart_txi_ena ;notify transmitter + out ucsrb,i + .ifdef irq_dis_real + sts usart_ena,i + .endif + end esc_send_xon + end esc_flow + .endif + out sreg,d + exit wait_ser_data + else esc_read_buf + out sreg,d + ifid_and esc_read_direct + sbis ucsra,rxc + ifs esc_read_direct + in a,udr ;read direct if disabled & buffer empty + exit wait_ser_data + end esc_read_direct + end esc_read_buf + loop wait_ser_data +; pop c + pop yh + pop yl + cpi a,27 + ifeq read_abort + .ifdef eep_vld + lds a,prog_num ;I2C close required? + cpi a,0xff + ifeq esc_read_load + PrintStr load_abort ;" Load aborted" + rjmp skip_main + else esc_read_load + PrintStr save_abort ;" Save aborted" +eep_close_err: ;close SPI/I2C after abort or error + jmp eep_write_err + end esc_read_load + .else + PrintStr load_abort ;" Load aborted" + rjmp skip_main + .endif + end read_abort +ret + +;load hex nibble +load_hex: + rcall read_serial_esc + subi a,'0' ;hex 0-9 + cpi a,10 + ifsh load_a_f + cpi a,17 ;non hex >0 F + brsh inv_hex + end load_a_f + ret +;non hex message +inv_hex: + PrintStr err_nonhex ;" Non-Hex data in record" +.ifdef eep_vld + lds a,prog_num ;SPI/I2C close required? + cpi a,0xff + brne eep_close_err +.endif +; +; RS232 discard from RX fifo or direct with escape timer +; uses a, d, (i with cli) +; +; wait for eof (skip remaining records) +discard_serial_stream: + ldi yl,6 ;continuous data within 50ms will be discarded + sts cmd_esc_timer,yl + do discard_serial + in d,sreg ;preserve sreg interrupt enable + cli + lds i,rx_fill ;check buffer + tst i + ifne disc_read_buf + lds yl,rx_inx ;prepare address to read rx fifo + ldi yh,high(rx_buf) + sub yl,c + ld a,y ;read + dec i ;update pointer + sts rx_fill,i + .ifdef flowlo +; mov i,c + cpi i,flowlo ;buffer lower watermark? + iflo disc_flow + lds i,flow_cmd + cpi i,0x91 ;xon done? + ifne disc_send_xon + ldi i,0x11 ;post xon pending + sts flow_cmd,i + ldi i,usart_txi_ena ;notify transmitter + out ucsrb,i + .ifdef irq_dis_real + sts usart_ena,i + .endif + end disc_send_xon + end disc_flow + .endif + out sreg,d + ldi yl,6 ;further characters + sts cmd_esc_timer,yl + cpi a,13 ;EOL + ifeq disc_read_keepalive + ldi a,0 + rcall PrintChr + end disc_read_keepalive + else disc_read_buf + out sreg,d + ifid_and disc_read_direct + sbis ucsra,rxc + ifs disc_read_direct + in a,udr ;read direct if disabled & buffer empty + ldi yl,6 ;further characters + sts cmd_esc_timer,yl + cpi a,13 + ifeq disc_read_keepalive2 + ldi a,0 + rcall PrintChr + end disc_read_keepalive2 + end disc_read_direct + end disc_read_buf + ifid_and disc_timer_update ;disabled timer update + in yh,tifr + sbrs yh,ocf0 + ifs disc_timer_update + ldi yh,0b10 ;clear t1 oc flag + out tifr,yh + lds yl,cmd_esc_timer ;test escape timer expired + andi yl,0x7f + ifne disc_esc_timer_update + lds yl,cmd_esc_timer + dec yl + sts cmd_esc_timer,yl + end disc_esc_timer_update + end disc_timer_update + lds yl,cmd_esc_timer + tst yl + exiteq discard_serial + loop discard_serial + ldi yl,0x80 ;re-init + sts cmd_esc_timer,yl +; return to mainloop +skip_main: + .ifdef eep_vld + call eep_close + .else + out dbusddr,zero ;dbus = input + out cbus,readmem ;OE / read mode back on + .endif + lds a,sp_save ;restore sp to main loop + out spl,a + lds a,sp_save+1 + out sph,a + sbrc flags,deb_act ;on error + rjmp end_command ;debugger or + rcall crlf + rjmp end_exit ;next instruction +; +; Read Hex Byte from RX fifo or direct and exit on +read_byte_esc: + ;push c + rcall load_hex ;high nibble + swap a + mov c,a + rcall load_hex ;low nibble + or a,c + ;pop c + add xh,a ;update checksum + ret + +.ifdef eep_vld +; EEPROM info - show directory +eep_cmd_info: + PrintStr eep_info2 ;" - " + clr c ;count free slots + clr a + out eearh,one + do eep_get_free + out eearl,c + out eecr,one + in b,eedr + cp b,allon + ifeq eep_inc_free + inc a ;+1 for every free block + ifeq eep_100_free + ldi a,'1' ;0x100 free slots + rcall PrintChr + clr a + end eep_100_free + end eep_inc_free + inc c + loopne eep_get_free + rcall PrintHex ;2 digits free slots + PrintStr eep_info3 ;" slots free" + ldi zl,1 ;progs/line, next index + clr b ;lowest prog# not listed + do eep_list + ldi a,0xff ;prog#, max to init + do eep_pslots + out eearl,c ;scan all slots + out eecr,one + in d,eedr + cp d,b ;not already listed? + ifsh eep_next + cp d,a ;count same, new if lower + ifeq eep_inc_same + inc yl ;count slots + end eep_inc_same + iflo eep_find_low + ldi yl,1 ;1st slot + mov a,d ;new lowest prog# to list + end eep_find_low + end eep_next + inc c ;loop for 256 slots + loopne eep_pslots + cpi a,0xff ;no more progs to list + exiteq eep_list + mov b,a + dec zl ;max progs per line? + ifeq eep_list_index + PrintStr eep_info4 ;"prog#/slots " + ldi zl,10 ;next 10 progs on this line + mov a,b ;restore a + end eep_list_index + inc b ;next lowest prog# + rcall PrintHex ;prog# + ldi a,'/' + rcall PrintChr + mov a,yl + rcall PrintHex ;slotcount + rcall space + loop eep_list + out eearh,zero ;protect eep from unintentional writes + out eearl,zero + ret + +eep_auto_info: + PrintStr eep_info1 ;crlf,"EEPROM autoload " + out eearh,zero ;read eep autoload byte + out eearl,allon + out eecr,one + in a,eedr + cpi a,0xff ;test autoload program set + ifeq eep_no_auto + PrintStr eep_none ;"none" + else eep_no_auto + rcall PrintHex ;program number + mov c,one ;beginning of string + out eearl,c + out eecr,one + in b,eedr + cpi b,0xff ;string present? + ifne eep_auto_info_string + rcall space + ldi a,34 ;quote + rcall PrintChr + mov a,b + do eep_auto_info_str2 + rcall PrintChr + inc c + out eearl,c + out eecr,one + in a,eedr + cpi a,0xff ;string end? + loopne eep_auto_info_str2 + ldi a,34 + rcall PrintChr + end eep_auto_info_string + end eep_no_auto + ret + +; internal EEPROM write byte +eep_auto_write: + out eedr,a + in c,sreg ;atomic write sequence + cli + sbi eecr,eemwe + sbi eecr,eewe + out sreg,c + do eep_auto_wait ;write complete? + sbic eecr,eewe + loop eep_auto_wait + ret +.endif + +; Messages part 2 (part 1 moved before opcode table to reduce empty space) +; word count, X = don't use in part 1 ---> ;## +.ifdef cmos_core +stp_instr: .db "STP - Emulator halted",0 ; X +.else +inv_instr: .db "Illegal Opcode ",0 ; X +.endif +emu_msg: .db 13,10,13,10,core_string," Emulator V",version,0 ; X +built_msg: .db " built ",__DATE__," ",__TIME__,0 ;14 +;load_wait: .db 13,10,"Loading, to abort",13,10,0 ;14 +;load_abort: .db " Load aborted",0 ; 7 +err_chksum: .db " Checksum failed",0,0 ; 9 +;rs_vect_empty: .db 13,10,"Check reset vector",0,0 ;11 +;reset_msg: .db " Reset",0 ; 4 +;bpt_clrd_msg: .db 10,13,"All breakpoints cleared",0 ;13 +;bpt_info: .db 10,13,"Breakpoints (slot#:address)",13,10,0,0 ;17 +bpt_info_none: .db 10,13,"No breakpoints active",0 ;12 +;bpt_slot_full: .db 10,13,"No more breakpoint slots available",0,0 ;19 +.ifdef irq_dis_real ;more messages not in part 1 +load_ok: .db 13,"Load OK",0,0 ; 5 +err_nonhex: .db " Non-Hex data in record",0 ;12 +err_func: .db " Invalid function or count in record",0,0 ;19 +illegal_int: .db 13,10,"AVR Illegal Interrupt",0 ;12 +back_line: .db 13,27,91,"K",27,91,"1A",0,0 ; 5 +.endif + + +;verify minimum versions of includes +;required versions +.if io_version < 831 + .error "6502_Emu_IO.inc is below the required minimum version!" +.endif +.ifdef cmos_core + .if core_version < 831 + .error "6502_Emu_CMOS.inc is below the required minimum version!" + .endif +.else + .if core_version < 831 + .error "6502_Emu_NMOS.inc is below the required minimum version!" + .endif +.endif +.if config_version < 830 + .error "6502_Emu_config.inc is below the required minimum version!" +.endif +.if sam_version < 810 + .error "sam.inc is below the required minimum version!" +.endif +;above base versions +.if io_version > 832 + .error "6502_Emu_IO.inc is above the base version!" +.endif +.ifdef cmos_core + .if core_version > 832 + .error "6502_Emu_CMOS.inc is above the base version!" + .endif +.else + .if core_version > 832 + .error "6502_Emu_NMOS.inc is above the base version!" + .endif +.endif +.if config_version > 832 +; .error "6502_Emu_config.inc is above the base version!" +.endif +.if sam_version > 832 + .error "sam.inc is above the base version!" +.endif +;recommended versions +.if io_version < 832 + .warning "6502_Emu_IO.inc is below the recommended minimum version!" +.endif +.ifdef cmos_core + .if core_version < 831 + .warning "6502_Emu_CMOS.inc is below the recommended minimum version!" + .endif +.else + .if core_version < 831 + .warning "6502_Emu_NMOS.inc is below the recommended minimum version!" + .endif +.endif +.if config_version < 830 + .warning "6502_Emu_config.inc is below the recommended minimum version!" +.endif +.if sam_version < 810 + .warning "sam.inc is below the recommended minimum version!" +.endif diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_CMOS.inc b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_CMOS.inc new file mode 100644 index 00000000..b40ef47b --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_CMOS.inc @@ -0,0 +1,2298 @@ +; +; 6502 EMULATOR include +; +; C M O S c o r e a.k.a. 65C02 +; +; Copyright (C) 2013-2014 Klaus Dormann +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . +; +; +.set core_version = 831 +#define core_string "65C02" ;identify CMOS core in version message + +;***************************************************************** +; +; 6502 emulation disassembly table +; +;***************************************************************** +;addressing modes +.equ op_s = 0b0000000 ;single (implied) - TAX +.equ op_a = 0b0010000 ;absolute - LDA abs +.equ op_x = 0b0010001 ;absolute indexed X - LDA abs,x +.equ op_y = 0b0010010 ;absolute indexed Y - LDA abs,y +.equ op_i = 0b1010011 ;absolute indirect - JMP (abs) +.equ op_m = 0b0101000 ;immediate - LDA # +.equ op_r = 0b0011000 ;relative to PC - BEQ rel +.equ op_z = 0b0001000 ;zero page - LDA zp +.equ op_zxi = 0b1001100 ;zero page indexed X indirect LDA (zp,x) +.equ op_zx = 0b0001001 ;zero page indexed X - LDA zp,x +.equ op_zy = 0b0001010 ;zero page indexed Y - LDA zp,y +.equ op_ziy = 0b1001101 ;zero page indidrect indexed Y - LDA (zp),y +.equ op_sa = 0b0000110 ;single accumulator - ASL A +; additional CMOS addressing modes +.equ op_zi = 0b1001011 ;zero page indidrect - LDA (zp) +.equ op_xi = 0b1010100 ;absolute indexed X indirect - JMP (abs,x) +.equ op_bz = 0b1101000 ;bitnum, zero page - RMB bit,zp +.equ op_bzr = 0b1101111 ;bitnum, zero page, relative - BBR bit,zp,rel +; 0b00_____ no prefix +; 0b01_____ # - immediate +; 0b10_____ ( - opening indirect +; 0b11_____ bitnumber, - SMB, RMB, BBS, BBR +; 0b__00___ no data - implied +; 0b__01___ 1 Byte - zero page or immediate +; 0b__10___ 2 Bytes - absolute +; 0b__11___ 1 Byte relative - calculated absolute +; 0b____000 no suffix +; 0b____001 ,X - indexed X +; 0b____010 ,Y - indexed Y +; 0b____011 ) - closing indirect +; 0b____100 ,X) - indexed X indirect +; 0b____101 ),Y - indirect indexed Y +; 0b____110 A - implied accumulator +; 0b____111 ,1 Byte relative - calculated absolute (BBS, BBR) + +dis_opcode: .db "BRK",op_s + .db "ORA",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "TSB",op_z + .db "ORA",op_z + .db "ASL",op_z + .db "RMB",op_bz + .db "PHP",op_s + .db "ORA",op_m + .db "ASL",op_sa + .db "NOP",op_s + .db "TSB",op_a + .db "ORA",op_a + .db "ASL",op_a + .db "BBR",op_bzr + + .db "BPL",op_r + .db "ORA",op_ziy + .db "ORA",op_zi + .db "NOP",op_s + .db "TRB",op_z + .db "ORA",op_zx + .db "ASL",op_zx + .db "RMB",op_bz + .db "CLC",op_s + .db "ORA",op_y + .db "INC",op_sa + .db "NOP",op_s + .db "TRB",op_a + .db "ORA",op_x + .db "ASL",op_x + .db "BBR",op_bzr + + .db "JSR",op_a + .db "AND",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "BIT",op_z + .db "AND",op_z + .db "ROL",op_z + .db "RMB",op_bz + .db "PLP",op_s + .db "AND",op_m + .db "ROL",op_sa + .db "NOP",op_s + .db "BIT",op_a + .db "AND",op_a + .db "ROL",op_a + .db "BBR",op_bzr + + .db "BMI",op_r + .db "AND",op_ziy + .db "AND",op_zi + .db "NOP",op_s + .db "BIT",op_zx + .db "AND",op_zx + .db "ROL",op_zx + .db "RMB",op_bz + .db "SEC",op_s + .db "AND",op_y + .db "DEC",op_sa + .db "NOP",op_s + .db "BIT",op_x + .db "AND",op_x + .db "ROL",op_x + .db "BBR",op_bzr + + .db "RTI",op_s + .db "EOR",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "NOP",op_z + .db "EOR",op_z + .db "LSR",op_z + .db "RMB",op_bz + .db "PHA",op_s + .db "EOR",op_m + .db "LSR",op_sa + .db "NOP",op_s + .db "JMP",op_a + .db "EOR",op_a + .db "LSR",op_a + .db "BBR",op_bzr + + .db "BVC",op_r + .db "EOR",op_ziy + .db "EOR",op_zi + .db "NOP",op_s + .db "NOP",op_z + .db "EOR",op_zx + .db "LSR",op_zx + .db "RMB",op_bz + .db "CLI",op_s + .db "EOR",op_y + .db "PHY",op_s + .db "NOP",op_s + .db "NOP",op_a + .db "EOR",op_x + .db "LSR",op_x + .db "BBR",op_bzr + + .db "RTS",op_s + .db "ADC",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "STZ",op_z + .db "ADC",op_z + .db "ROR",op_z + .db "RMB",op_bz + .db "PLA",op_s + .db "ADC",op_m + .db "ROR",op_sa + .db "NOP",op_s + .db "JMP",op_i + .db "ADC",op_a + .db "ROR",op_a + .db "BBR",op_bzr + + .db "BVS",op_r + .db "ADC",op_ziy + .db "ADC",op_zi + .db "NOP",op_s + .db "STZ",op_zx + .db "ADC",op_zx + .db "ROR",op_zx + .db "RMB",op_bz + .db "SEI",op_s + .db "ADC",op_y + .db "PLY",op_s + .db "NOP",op_s + .db "JMP",op_xi + .db "ADC",op_x + .db "ROR",op_x + .db "BBR",op_bzr + + .db "BRA",op_r + .db "STA",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "STY",op_z + .db "STA",op_z + .db "STX",op_z + .db "SMB",op_bz + .db "DEY",op_s + .db "BIT",op_m + .db "TXA",op_s + .db "NOP",op_s + .db "STY",op_a + .db "STA",op_a + .db "STX",op_a + .db "BBS",op_bzr + + .db "BCC",op_r + .db "STA",op_ziy + .db "STA",op_zi + .db "NOP",op_s + .db "STY",op_zx + .db "STA",op_zx + .db "STX",op_zy + .db "SMB",op_bz + .db "TYA",op_s + .db "STA",op_y + .db "TXS",op_s + .db "NOP",op_s + .db "STZ",op_a + .db "STA",op_x + .db "STZ",op_x + .db "BBS",op_bzr + + .db "LDY",op_m + .db "LDA",op_zxi + .db "LDX",op_m + .db "NOP",op_s + .db "LDY",op_z + .db "LDA",op_z + .db "LDX",op_z + .db "SMB",op_bz + .db "TAY",op_s + .db "LDA",op_m + .db "TAX",op_s + .db "NOP",op_s + .db "LDY",op_a + .db "LDA",op_a + .db "LDX",op_a + .db "BBS",op_bzr + + .db "BCS",op_r + .db "LDA",op_ziy + .db "LDA",op_zi + .db "NOP",op_s + .db "LDY",op_zx + .db "LDA",op_zx + .db "LDX",op_zy + .db "SMB",op_bz + .db "CLV",op_s + .db "LDA",op_y + .db "TSX",op_s + .db "NOP",op_s + .db "LDY",op_x + .db "LDA",op_x + .db "LDX",op_y + .db "BBS",op_bzr + + .db "CPY",op_m + .db "CMP",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "CPY",op_z + .db "CMP",op_z + .db "DEC",op_z + .db "SMB",op_bz + .db "INY",op_s + .db "CMP",op_m + .db "DEX",op_s + .db "WAI",op_s + .db "CPY",op_a + .db "CMP",op_a + .db "DEC",op_a + .db "BBS",op_bzr + + .db "BNE",op_r + .db "CMP",op_ziy + .db "CMP",op_zi + .db "NOP",op_s + .db "NOP",op_z + .db "CMP",op_zx + .db "DEC",op_zx + .db "SMB",op_bz + .db "CLD",op_s + .db "CMP",op_y + .db "PHX",op_s + .db "STP",op_s + .db "NOP",op_a + .db "CMP",op_x + .db "DEC",op_x + .db "BBS",op_bzr + + .db "CPX",op_m + .db "SBC",op_zxi + .db "NOP",op_z + .db "NOP",op_s + .db "CPX",op_z + .db "SBC",op_z + .db "INC",op_z + .db "SMB",op_bz + .db "INX",op_s + .db "SBC",op_m + .db "NOP",op_s + .db "NOP",op_s + .db "CPX",op_a + .db "SBC",op_a + .db "INC",op_a + .db "BBS",op_bzr + + .db "BEQ",op_r + .db "SBC",op_ziy + .db "SBC",op_zi + .db "NOP",op_s + .db "NOP",op_z + .db "SBC",op_zx + .db "INC",op_zx + .db "SMB",op_bz + .db "SED",op_s + .db "SBC",op_y + .db "PLX",op_s + .db "NOP",op_s + .db "NOP",op_a + .db "SBC",op_x + .db "INC",op_x + .db "BBS",op_bzr + +;***************************************************************** +; +; 6 5 0 2 e m u l a t i o n m a c r o s +; +;***************************************************************** + +; +; op_decode +; +; opcode fetch and decode, prefetch low operand +.macro op_decode + out abuslo,pcl ;opcode fetch + out abushi,pch + sei ;allow emulation INT, NMI + adiw pch:pcl,1 ;pc -> op low + cli + wait_data_valid 4 ;240 minimum @ 16MHz + in opcode,dbusin + + out abuslo,pcl ;operand address low prefetch + out abushi,pch + wait_data_valid 6 ;360ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode +.endmacro + +;op decode after single, opcode already fetched +.macro op_decode_single + sei ;allow emulation INT, NMI + out abuslo,pcl ;operand address low prefetch + cli + out abushi,pch + wait_data_valid 6 ;360ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode +.endmacro + +; address generate relative +.macro adgen_r + rjmp no_branch ;condition false + .ifndef BRA_r + .equ BRA_r = pc + .endif + in operand,dbusin + clr a ;expand sign bit + sbrc operand,7 ;negative? + dec a + add pcl,operand ;set new PC + adc pch,a +no_branch: op_decode +.endmacro + +; address generate absolute +.macro adgen_a + in oplow,dbusin + out abuslo,pcl ;operand high address fetch + out abushi,pch + adiw pch:pcl,1 ;pc -> next instruction + cbr flags,(1< next instruction + cbr flags,(1< next instruction + cbr flags,(1<----> + bld stat,2 ;-----N-- + + andi stat2,0b1101100 ;-V1BDI-- (Break cleared) + ori stat2,0b0100000 ; ^=1 (set unused) + + op_decode_single ;next instruction + +; opcode: ROL A +ROL_s: in opcode,dbusin ;next opcode + + out sreg,stat ;get C + rol rega ;AVR emulated OP + in stat,sreg ;save NZC + + op_decode_single ;next instruction + +; opcode: ROR A +ROR_s: in opcode,dbusin ;next opcode + + out sreg,stat ;get C + ror rega ;AVR emulated OP + in stat,sreg ;save NZC + + op_decode_single ;next instruction + +; opcode: SEC +SEC_s: in opcode,dbusin ;next opcode + + sbr stat,1 ;AVR emulated OP + + op_decode_single ;next instruction + +; opcode: SED +SED_s: in opcode,dbusin ;next opcode + + sbr stat2,0b1000 ;AVR emulated OP + + op_decode_single ;next instruction + +; opcode: SEI +SEI_s: in opcode,dbusin ;next opcode + + sbr stat2,0b100 ;AVR emulated OP + ldi a,IRQ_dis + out ibus,a + .ifdef irq_dis_real ;+3 + out timsk,one ;only TOV0 (single step) stays enabled + ldi a,0b11000 ;no USART interrupts, only RX & TX enable + out ucsrb,a + .endif + + op_decode_single ;next instruction + +; opcode: STP +STP_s: jmp deb_stop ;halt execution & display registers + +; opcode: TAX +TAX_s: in opcode,dbusin ;next opcode + + mov regx,rega ;AVR emulated OP + flags_gen_nz regx + + op_decode_single ;next instruction + +; opcode: TAY +TAY_s: in opcode,dbusin ;next opcode + + mov regy,rega ;AVR emulated OP + flags_gen_nz regy + + op_decode_single ;next instruction + +; opcode: TSX +TSX_s: in opcode,dbusin ;next opcode + + mov regx,spointer ;AVR emulated OP + flags_gen_nz regx + + op_decode_single ;next instruction + +; opcode: TXA +TXA_s: in opcode,dbusin ;next opcode + + mov rega,regx ;AVR emulated OP + flags_gen_nz rega + + op_decode_single ;next instruction + +; opcode: TXS +TXS_s: in opcode,dbusin ;next opcode + + mov spointer,regx ;AVR emulated OP + ;flags are not changed + + op_decode_single ;next instruction + +; opcode: TYA +TYA_s: in opcode,dbusin ;next opcode + + mov rega,regy ;AVR emulated OP + flags_gen_nz rega + + op_decode_single ;next instruction + +; opcode: WAI +WAI_s: in opcode,dbusin ;get ready for next instruction + out abuslo,pcl ;operand address low prefetch + out abushi,pch + wait_data_valid 10 ;600ns minimum @ 16MHz + adiw pch:pcl,1 + + sbrs stat2,2 ;if interrupts disabled + rjmp WAI_hold + + sbis cbusin,3 ;no IRQ pending + ijmp ;execute next opcode + + .ifdef irq_dis_real + do WAI_loop_dis + sbic cbusin,3 ;wait direct IRQ + loop WAI_loop_dis + ijmp ;execute next opcode + .endif + +WAI_hold: sei ;wait for interrupts + sbiw pch:pcl,2 ;discard prefetch on interrupt + do WAI_loop + sbic cbusin,3 ;or direct IRQ + loop WAI_loop + cli + adiw pch:pcl,2 ;use prefetch on direct IRQ + +WAI_direct: ijmp ;execute next opcode + +;***************************************************************** +; +; Program counter +; instructions modifying the PC +; +;***************************************************************** + +; opcode: BBR +BBR0_zr: fetch_z_BBR 0 +BBR1_zr: fetch_z_BBR 1 +BBR2_zr: fetch_z_BBR 2 +BBR3_zr: fetch_z_BBR 3 +BBR4_zr: fetch_z_BBR 4 +BBR5_zr: fetch_z_BBR 5 +BBR6_zr: fetch_z_BBR 6 +BBR7_zr: fetch_z_BBR 7 + +BBR_o: in operand,dbusin + out abuslo,pcl ;relative branch address fetch + out abushi,pch + adiw pch:pcl,1 ;pc -> next instruction + and a,operand ;test masked bit + brne BBR_n ;skip branch if 1 + wait_data_valid 4 ;240ns minimum @ 16MHz + + in operand,dbusin + clr a ;expand sign bit + sbrc operand,7 ;negative? + dec a + add pcl,operand ;set new PC + adc pch,a + +BBR_n: op_decode + +; opcode: BBS +BBS0_zr: fetch_z_BBS 0 +BBS1_zr: fetch_z_BBS 1 +BBS2_zr: fetch_z_BBS 2 +BBS3_zr: fetch_z_BBS 3 +BBS4_zr: fetch_z_BBS 4 +BBS5_zr: fetch_z_BBS 5 +BBS6_zr: fetch_z_BBS 6 +BBS7_zr: fetch_z_BBS 7 + +BBS_o: in operand,dbusin + out abuslo,pcl ;relative branch address fetch + out abushi,pch + adiw pch:pcl,1 ;pc -> next instruction + and a,operand ;test masked bit + breq BBS_n ;skip branch if 0 + wait_data_valid 4 ;240ns minimum @ 16MHz + + in operand,dbusin + clr a ;expand sign bit + sbrc operand,7 ;negative? + dec a + add pcl,operand ;set new PC + adc pch,a + +BBS_n: op_decode + +; opcode: BCC +BCC_r: sbrc stat,0 + adgen_r ;branch if skip + +; opcode: BCS +BCS_r: sbrs stat,0 + adgen_r ;branch if skip + +; opcode: BEQ +BEQ_r: sbrs stat,1 + adgen_r ;branch if skip + +; opcode: BMI +BMI_r: sbrs stat,2 + adgen_r ;branch if skip + +; opcode: BNE +BNE_r: sbrc stat,1 + adgen_r ;branch if skip + +; opcode: BPL +BPL_r: sbrc stat,2 + adgen_r ;branch if skip + +; opcode: BVC +BVC_r: sbrc stat2,6 + adgen_r ;branch if skip + +; opcode: BVS +BVS_r: sbrs stat2,6 + adgen_r ;branch if skip + +; opcode: JMP +JMP_xi: in oplow,dbusin ;save low pointer to pc + out abuslo,pcl ;fetch high pointer to pc + out abushi,pch + mov pcl,oplow + add pcl,regx + wait_data_valid 2 ;120ns minimum @ 16MHz + in pch,dbusin ;point to new pc + adc pch,zero + out abuslo,pcl ;fetch pc low + out abushi,pch + wait_data_valid 4 ;240ns minimum @ 16MHz + adiw pch:pcl,1 + rjmp JMP_a + +JMP_i: in oplow,dbusin ;save low pointer to pc + out abuslo,pcl ;fetch high pointer to pc + out abushi,pch + mov pcl,oplow + wait_data_valid 1 ;60ns minimum @ 16MHz + in pch,dbusin ;point to new pc + + out abuslo,pcl ;fetch pc low + out abushi,pch + adiw pch:pcl,1 + wait_data_valid 2 ;120ns minimum @ 16MHz + +JMP_a: in oplow,dbusin ;save pc low + out abuslo,pcl ;fetch pc high + out abushi,pch + mov pcl,oplow + wait_data_valid 1 ;60ns minimum @ 16MHz + in pch,dbusin ;load new pc + + op_decode ;next instruction + +; opcode: JSR +JSR_a: in oplow,dbusin ;save new PC as operand address + out abuslo,pcl ;new PC high fetch + out abushi,pch + ;pc++ skipped + wait_data_valid 0 ;0ns minimum @ 16MHz + in ophigh,dbusin + + out abuslo,spointer ;push pch + out abushi,one + dec spointer + out cbus,writemem ;WE, ~OE + out dbusout,pch ;precharge write + out dbusddr,allon ;output data valid + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + + out abuslo,spointer ;push pcl + dec spointer + out cbus,writemem ;WE + out dbusout,pcl ;precharge write + out cbus,clear ;~WE / write cycle ends 120ns/16MHz + out dbusddr,zero ;data hold ends after 60ns + out cbus,readmem ;OE / read mode back on + + movw pcl,oplow ;load new PC + + op_decode ;next instruction + +; opcode: RTS +RTS_s: inc spointer + out abuslo,spointer ;pull pcl + out abushi,one + inc spointer + wait_data_valid 1 ;60ns minimum @ 16MHz + in pcl,dbusin + out abuslo,spointer ;pull pch + wait_data_valid 0 ;0ns minimum @ 16MHz + in pch,dbusin + adiw pch:pcl,1 ;point to next instruction + +RTI_skip_WAI: + op_decode ;next instruction + +; opcode: RTI +RTI_s: inc spointer + out abuslo,spointer ;pull status + out abushi,one + inc spointer + wait_data_valid 1 ;60ns minimum @ 16MHz + in stat2,dbusin + out abuslo,spointer ;pull pcl + inc spointer + ;status restore while we are waiting for data + IRQ_restore + mov stat,stat2 ;restore AVR format + wait_data_valid 6 ;360ns minimum @ 16MHz + in pcl,dbusin + out abuslo,spointer ;pull pch + ;status restore while we are waiting for data + andi stat,0b11 ;------ZC + bst stat2,7 ;>----> + bld stat,2 ;-----N-- + andi stat2,0b1101100 ;-V1BDI-- (Break cleared) + ori stat2,0b0100000 ; ^=1 (set unused) + wait_data_valid 5 ;300ns minimum @ 16MHz + in pch,dbusin + + out abuslo,pcl ;opcode fetch + out abushi,pch + adiw pch:pcl,1 ;pc -> op low + wait_data_valid 2 ;120ns minimum @ 16MHz + in opcode,dbusin + cpi opcode,0xcb ;wait? + breq RTI_skip_WAI + + op_decode_single + +; opcode: BRK +BRK_s: ;save new PC as operand address + out abuslo,allon ;new PC high fetch from irq vector + out abushi,allon + ldi zl,0xfe ;preload vector low + ldi a,IRQ_dis + out ibus,a + .ifdef irq_dis_real ;+3 + out timsk,one ;only TOV0 (single step) stays enabled + ldi a,0b11000 ;no USART interrupts, only RX & TX enable + out ucsrb,a + .endif + ;status merge while we are waiting for data + mov a,stat ;merge status in 6502 format + andi a,0b11 ;------ZC + wait_data_valid 5 ;300ns minimum @ 16MHz + in ophigh,dbusin + out abuslo,zl ;new PC low fetch from irq vector + ;status merge while we are waiting for data + bst stat,2 ;<----< + bld a,7 ;N------- + or a,stat2 ;-V1BDI-- + sbr a,0b110000 ; ^^=1 (pushed by Break) + sbr stat2,0b100 ;I=1 (IRQ disabled) + cbr stat2,0b1000 ;D=0 (clear decimal mode) + wait_data_valid 6 ;360ns minimum @ 16MHz + in oplow,dbusin + + out abuslo,spointer ;push pch + out abushi,one + dec spointer + out cbus,writemem ;WE, ~OE + out dbusout,pch ;precharge write + out dbusddr,allon ;output data valid + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + + out abuslo,spointer ;push pcl + dec spointer + out cbus,writemem ;WE + out dbusout,pcl ;write + out cbus,clear ;~WE / write cycle ends 120ns/16MHz + + out abuslo,spointer ;push status + dec spointer + out cbus,writemem ;WE + out dbusout,a ;write + out cbus,clear ;~WE / write cycle ends 120ns/16MHz + out dbusddr,zero ;data hold ends after 60ns + out cbus,readmem ;OE / read mode back on + + movw pcl,oplow ;load new PC + + op_decode ;next instruction + + +; +; instruction decode vector table +; + align 8 ;align to page boundary + +oc_tab: rjmp BRK_s ;0x00 + rjmp ORA_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp TSB_z + rjmp ORA_z + rjmp ASL_z + rjmp RMB0_z + rjmp PHP_s + rjmp ORA_m + rjmp ASL_s + rjmp NOP11_s + rjmp TSB_a + rjmp ORA_a + rjmp ASL_a + rjmp BBR0_zr + rjmp BPL_r ;0x10 + rjmp ORA_ziy + rjmp ORA_zi + rjmp NOP11_s + rjmp TRB_z + rjmp ORA_zx + rjmp ASL_zx + rjmp RMB1_z + rjmp CLC_s + rjmp ORA_y + rjmp INC_s + rjmp NOP11_s + rjmp TRB_a + rjmp ORA_x + rjmp ASL_x + rjmp BBR1_zr + rjmp JSR_a ;0x20 + rjmp AND_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp BIT_z + rjmp AND_z + rjmp ROL_z + rjmp RMB2_z + rjmp PLP_s + rjmp AND_m + rjmp ROL_s + rjmp NOP11_s + rjmp BIT_a + rjmp AND_a + rjmp ROL_a + rjmp BBR2_zr + rjmp BMI_r ;0x30 + rjmp AND_ziy + rjmp AND_zi + rjmp NOP11_s + rjmp BIT_zx + rjmp AND_zx + rjmp ROL_zx + rjmp RMB3_z + rjmp SEC_s + rjmp AND_y + rjmp DEC_s + rjmp NOP11_s + rjmp BIT_x + rjmp AND_x + rjmp ROL_x + rjmp BBR3_zr + rjmp RTI_s ;0x40 + rjmp EOR_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp NOP23_s + rjmp EOR_z + rjmp LSR_z + rjmp RMB4_z + rjmp PHA_s + rjmp EOR_m + rjmp LSR_s + rjmp NOP11_s + rjmp JMP_a + rjmp EOR_a + rjmp LSR_a + rjmp BBR4_zr + rjmp BVC_r ;0x50 + rjmp EOR_ziy + rjmp EOR_zi + rjmp NOP11_s + rjmp NOP24_s + rjmp EOR_zx + rjmp LSR_zx + rjmp RMB5_z + rjmp CLI_s + rjmp EOR_y + rjmp PHY_s + rjmp NOP11_s + rjmp NOP38_s + rjmp EOR_x + rjmp LSR_x + rjmp BBR5_zr + rjmp RTS_s ;0x60 + rjmp ADC_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp STZ_z + rjmp ADC_z + rjmp ROR_z + rjmp RMB6_z + rjmp PLA_s + rjmp ADC_m + rjmp ROR_s + rjmp NOP11_s + rjmp JMP_i + rjmp ADC_a + rjmp ROR_a + rjmp BBR6_zr + rjmp BVS_r ;0x70 + rjmp ADC_ziy + rjmp ADC_zi + rjmp NOP11_s + rjmp STZ_zx + rjmp ADC_zx + rjmp ROR_zx + rjmp RMB7_z + rjmp SEI_s + rjmp ADC_y + rjmp PLY_s + rjmp NOP11_s + rjmp JMP_xi + rjmp ADC_x + rjmp ROR_x + rjmp BBR7_zr + rjmp BRA_r ;0x80 + rjmp STA_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp STY_z + rjmp STA_z + rjmp STX_z + rjmp SMB0_z + rjmp DEY_s + rjmp BIT_m2 ;flags anomaly! + rjmp TXA_s + rjmp NOP11_s + rjmp STY_a + rjmp STA_a + rjmp STX_a + rjmp BBS0_zr + rjmp BCC_r ;0x90 + rjmp STA_ziy + rjmp STA_zi + rjmp NOP11_s + rjmp STY_zx + rjmp STA_zx + rjmp STX_zy + rjmp SMB1_z + rjmp TYA_s + rjmp STA_y + rjmp TXS_s + rjmp NOP11_s + rjmp STZ_a + rjmp STA_x + rjmp STZ_x + rjmp BBS1_zr + rjmp LDY_m ;0xa0 + rjmp LDA_zxi + rjmp LDX_m + rjmp NOP11_s + rjmp LDY_z + rjmp LDA_z + rjmp LDX_z + rjmp SMB2_z + rjmp TAY_s + rjmp LDA_m + rjmp TAX_s + rjmp NOP11_s + rjmp LDY_a + rjmp LDA_a + rjmp LDX_a + rjmp BBS2_zr + rjmp BCS_r ;0xb0 + rjmp LDA_ziy + rjmp LDA_zi + rjmp NOP11_s + rjmp LDY_zx + rjmp LDA_zx + rjmp LDX_zy + rjmp SMB3_z + rjmp CLV_s + rjmp LDA_y + rjmp TSX_s + rjmp NOP11_s + rjmp LDY_x + rjmp LDA_x + rjmp LDX_y + rjmp BBS3_zr + rjmp CPY_m ;0xc0 + rjmp CMP_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp CPY_z + rjmp CMP_z + rjmp DEC_z + rjmp SMB4_z + rjmp INY_s + rjmp CMP_m + rjmp DEX_s + rjmp WAI_s + rjmp CPY_a + rjmp CMP_a + rjmp DEC_a + rjmp BBS4_zr + rjmp BNE_r ;0xd0 + rjmp CMP_ziy + rjmp CMP_zi + rjmp NOP11_s + rjmp NOP24_s + rjmp CMP_zx + rjmp DEC_zx + rjmp SMB5_z + rjmp CLD_s + rjmp CMP_y + rjmp PHX_s + rjmp STP_s + rjmp NOP34_s + rjmp CMP_x + rjmp DEC_x + rjmp BBS5_zr + rjmp CPX_m ;0xe0 + rjmp SBC_zxi + rjmp NOP22_s + rjmp NOP11_s + rjmp CPX_z + rjmp SBC_z + rjmp INC_z + rjmp SMB6_z + rjmp INX_s + rjmp SBC_m + rjmp NOP_s + rjmp NOP11_s + rjmp CPX_a + rjmp SBC_a + rjmp INC_a + rjmp BBS6_zr + rjmp BEQ_r ;0xf0 + rjmp SBC_ziy + rjmp SBC_zi + rjmp NOP11_s + rjmp NOP24_s + rjmp SBC_zx + rjmp INC_zx + rjmp SMB7_z + rjmp SED_s + rjmp SBC_y + rjmp PLX_s + rjmp NOP11_s + rjmp NOP34_s + rjmp SBC_x + rjmp INC_x + rjmp BBS7_zr + + +;***************************************************************** +; +; Memory read instructions +; Load, arithmetic & logical +; +;***************************************************************** + +; opcode: ADC + adgen_x ADC_ ;abs,X + adgen_y ADC_ ;abs,Y + adgen_zi ADC_ ;(ZP) indirect + adgen_zxi ADC_ ;(ZP,X) indexed indirect + adgen_ziy ADC_ ;(ZP),Y indirect indexed + adgen_zx ADC_ ;ZP,X + adgen_z ADC_ ;ZP absolute +ADC_a: adgen_a ;absolute + +ADC_o: op_fetch ;common entry after address generate +ADC_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + sbrc stat2,3 ;test decimal flag + rjmp ADC_d + out sreg,stat ;get C + adc rega,operand ;AVR emulated OP + in stat,sreg ;save NZC + bst stat,3 ;save V + bld stat2,6 + + op_decode ;next instruction + +ADC_d: addi rega,0x66 ;decimal correction + out sreg,stat + adc rega,operand + in stat,sreg + brcs ADC_d2 ;MSD + subi rega,0x60 + out sreg,stat +ADC_d2: brhs ADC_d3 ;LSD + subi rega,0x06 +ADC_d3: flags_gen_nz rega ;CMOS requires NZC to be valid in BCD mode + ;V is absolutely useless in BCD mode + ;so V is not valid anyway + op_decode ;next instruction + +; opcode: AND + adgen_x AND_ ;abs,X + adgen_y AND_ ;abs,Y + adgen_zi AND_ ;(ZP) indirect + adgen_zxi AND_ ;(ZP,X) indexed indirect + adgen_ziy AND_ ;(ZP),Y indirect indexed + adgen_zx AND_ ;ZP,X + adgen_z AND_ ;ZP absolute +AND_a: adgen_a ;absolute + +AND_o: op_fetch ;common entry after address generate +AND_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + and rega,operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + op_decode ;next instruction + +; opcode: BIT + adgen_x BIT_ ;abs,X + adgen_zx BIT_ ;ZP,X + adgen_z BIT_ ;ZP absolute +BIT_a: adgen_a ;absolute + +BIT_o: op_fetch ;common entry after address generate +BIT_m: in operand,dbusin + + mov a,rega ;keep A + out sreg,stat ;keep C + and a,operand ;A & M -> Z + in stat,sreg + bst operand,6 ;M6 -> V + bld stat2,6 + bst operand,7 ;M7 -> N + bld stat,2 + + op_decode ;next instruction + +BIT_m2: in operand,dbusin ;true immediate op will not modify VN + + and operand,rega ;A & M -> Z + in a,sreg + bst a,1 ;save Z + bld stat,1 + + op_decode ;next instruction + + +; opcode: CMP +; a compare in a 6502 works with reversed carry opposed to an AVR +; the reason: a 6502 performs an add with complemented operand as a compare + adgen_x CMP_ ;abs,X + adgen_y CMP_ ;abs,Y + adgen_zi CMP_ ;(ZP) indirect + adgen_zxi CMP_ ;(ZP,X) indexed indirect + adgen_ziy CMP_ ;(ZP),Y indirect indexed + adgen_zx CMP_ ;ZP,X + adgen_z CMP_ ;ZP absolute +CMP_a: adgen_a ;absolute + +CMP_o: op_fetch ;common entry after address generate +CMP_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + cp rega,operand ;AVR emulated OP + in stat,sreg ;save NZC + eor stat,one ;invert C + + op_decode ;next instruction + +; opcode: CPX +; a compare in a 6502 works with reversed carry opposed to an AVR +; the reason: a 6502 performs an add with complemented operand as a compare + adgen_z CPX_ ;ZP absolute +CPX_a: adgen_a ;absolute + +CPX_o: op_fetch ;common entry after address generate +CPX_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + cp regx,operand ;AVR emulated OP + in stat,sreg ;save NZC + eor stat,one ;invert C + + op_decode ;next instruction + +; opcode: CPY +; a compare in a 6502 works with reversed carry opposed to an AVR +; the reason: a 6502 performs an add with complemented operand as a compare + adgen_z CPY_ ;ZP absolute +CPY_a: adgen_a ;absolute + +CPY_o: op_fetch ;common entry after address generate +CPY_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + cp regy,operand ;AVR emulated OP + in stat,sreg ;save NZC + eor stat,one ;invert C + + op_decode ;next instruction + +; opcode: EOR + adgen_x EOR_ ;abs,X + adgen_y EOR_ ;abs,Y + adgen_zi EOR_ ;(ZP) indirect + adgen_zxi EOR_ ;(ZP,X) indexed indirect + adgen_ziy EOR_ ;(ZP),Y indirect indexed + adgen_zx EOR_ ;ZP,X + adgen_z EOR_ ;ZP absolute +EOR_a: adgen_a ;absolute + +EOR_o: op_fetch ;common entry after address generate +EOR_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + eor rega,operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + op_decode ;next instruction + +; opcode: LDA + adgen_x LDA_ ;abs,X + adgen_y LDA_ ;abs,Y + adgen_zi LDA_ ;(ZP) indirect + adgen_zxi LDA_ ;(ZP,X) indexed indirect + adgen_ziy LDA_ ;(ZP),Y indirect indexed + adgen_zx LDA_ ;ZP,X + adgen_z LDA_ ;ZP absolute +LDA_a: adgen_a ;absolute + +LDA_o: reg_fetch rega ;common entry after address generate +LDA_m: in rega,dbusin ;same for immediate + + flags_gen_nz rega + + op_decode ;next instruction + +; opcode: LDX + adgen_y LDX_ ;abs,Y + adgen_zy LDX_ ;ZP,Y + adgen_z LDX_ ;ZP absolute +LDX_a: adgen_a ;absolute + +LDX_o: reg_fetch regx ;common entry after address generate +LDX_m: in regx,dbusin ;same for immediate + + flags_gen_nz regx + + op_decode ;next instruction + +; opcode: LDY + adgen_x LDY_ ;abs,X + adgen_zx LDY_ ;ZP,X + adgen_z LDY_ ;ZP absolute +LDY_a: adgen_a ;absolute + +LDY_o: reg_fetch regy ;common entry after address generate +LDY_m: in regy,dbusin ;same for immediate + + flags_gen_nz regy + + op_decode ;next instruction + +; opcode: ORA + adgen_x ORA_ ;abs,X + adgen_y ORA_ ;abs,Y + adgen_zi ORA_ ;(ZP) indirect + adgen_zxi ORA_ ;(ZP,X) indexed indirect + adgen_ziy ORA_ ;(ZP),Y indirect indexed + adgen_zx ORA_ ;ZP,X + adgen_z ORA_ ;ZP absolute +ORA_a: adgen_a ;absolute + +ORA_o: op_fetch ;common entry after address generate +ORA_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + or rega,operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + op_decode ;next instruction + +; opcode: SBC +; subtraction in a 6502 works with reversed carry, borrow = !carry +; the reason: a 6502 performs an add with complemented operand during subtract + adgen_x SBC_ ;abs,X + adgen_y SBC_ ;abs,Y + adgen_zi SBC_ ;(ZP) indirect + adgen_zxi SBC_ ;(ZP,X) indexed indirect + adgen_ziy SBC_ ;(ZP),Y indirect indexed + adgen_zx SBC_ ;ZP,X + adgen_z SBC_ ;ZP absolute +SBC_a: adgen_a ;absolute + +SBC_o: op_fetch ;common entry after address generate +SBC_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + com operand + out sreg,stat ;get C + adc rega,operand ;AVR emulated OP + in stat,sreg ;save NZC + bst stat,3 ;save V + bld stat2,6 + + sbrs stat2,3 ;test decimal flag + rjmp SBC_d ;skip decimal mode correction + + brcs SBC_d2 ;MSD correction + subi rega,0x60 + out sreg,stat +SBC_d2: brhs SBC_d3 ;LSD correction + subi rega,0x06 +SBC_d3: flags_gen_nz rega ;CMOS requires NZC to be valid in BCD mode + ;V is absolutely useless in BCD mode + ;so V is not valid anyway +SBC_d: op_decode ;next instruction + + +;***************************************************************** +; +; Modify memory instructions +; Shift, increment & decrement, test & (re)set bits +; +;***************************************************************** + +; opcode: ASL + adgen_x ASL_ ;abs,X + adgen_zx ASL_ ;ZP,X + adgen_z ASL_ ;ZP absolute +ASL_a: adgen_a ;absolute + +ASL_o: op_fetch_modify ;common entry after address generate +ASL_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + lsl operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: LSR + adgen_x LSR_ ;abs,X + adgen_zx LSR_ ;ZP,X + adgen_z LSR_ ;ZP absolute +LSR_a: adgen_a ;absolute + +LSR_o: op_fetch_modify ;common entry after address generate +LSR_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + lsr operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: ROL + adgen_x ROL_ ;abs,X + adgen_zx ROL_ ;ZP,X + adgen_z ROL_ ;ZP absolute +ROL_a: adgen_a ;absolute + +ROL_o: op_fetch_modify ;common entry after address generate +ROL_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;get C + rol operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: ROR + adgen_x ROR_ ;abs,X + adgen_zx ROR_ ;ZP,X + adgen_z ROR_ ;ZP absolute +ROR_a: adgen_a ;absolute + +ROR_o: op_fetch_modify ;common entry after address generate +ROR_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;get C + ror operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: DEC + adgen_x DEC_ ;abs,X + adgen_zx DEC_ ;ZP,X + adgen_z DEC_ ;ZP absolute +DEC_a: adgen_a ;absolute + +DEC_o: op_fetch_modify ;common entry after address generate +DEC_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + dec operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + store_modify + +; opcode: INC + adgen_x INC_ ;abs,X + adgen_zx INC_ ;ZP,X + adgen_z INC_ ;ZP absolute +INC_a: adgen_a ;absolute + +INC_o: op_fetch_modify ;common entry after address generate +INC_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + inc operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + store_modify + +; opcode: RMB +RMB0_z: fetch_z_RMB 0 +RMB1_z: fetch_z_RMB 1 +RMB2_z: fetch_z_RMB 2 +RMB3_z: fetch_z_RMB 3 +RMB4_z: fetch_z_RMB 4 +RMB5_z: fetch_z_RMB 5 +RMB6_z: fetch_z_RMB 6 +RMB7_z: fetch_z_RMB 7 + +RMB_o: in operand,dbusin ;clear bit not in bitmask + and operand,a + ;no need to check for IO/ROM + out cbus,writemem ;WE, ~OE + out dbusout,operand ;precharge write + out dbusddr,allon ;output data valid + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + out dbusddr,zero ;data hold ends after 60ns + out cbus,readmem ;OE / read mode back on + + op_decode ;next instruction + +; opcode: SMB +SMB0_z: fetch_z_SMB 0 +SMB1_z: fetch_z_SMB 1 +SMB2_z: fetch_z_SMB 2 +SMB3_z: fetch_z_SMB 3 +SMB4_z: fetch_z_SMB 4 +SMB5_z: fetch_z_SMB 5 +SMB6_z: fetch_z_SMB 6 +SMB7_z: fetch_z_SMB 7 + +SMB_o: in operand,dbusin ;set bit in bitmask + or operand,a + ;no need to check for IO/ROM + out cbus,writemem ;WE, ~OE + out dbusout,operand ;precharge write + out dbusddr,allon ;output data valid + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + out dbusddr,zero ;data hold ends after 60ns + out cbus,readmem ;OE / read mode back on + + op_decode ;next instruction + +; opcode: TRB + adgen_z TRB_ ;ZP absolute +TRB_a: adgen_a ;absolute + +TRB_o: op_fetch_modify ;common entry after address generate +TRB_m: in operand,dbusin + + mov a,rega ;test A bits with memory + and a,operand ;A & M -> Z + in a,sreg ;move only Z to flags + bst a,1 + bld stat,1 + + mov a,rega ;clear A bits in memory + eor a,allon + and operand,a + + store_modify + +; opcode: TSB + adgen_z TSB_ ;ZP absolute +TSB_a: adgen_a ;absolute + +TSB_o: op_fetch_modify ;common entry after address generate +TSB_m: in operand,dbusin + + mov a,rega ;test A bits with memory + and a,operand ;A & M -> Z + in a,sreg ;move only Z to flags + bst a,1 + bld stat,1 + + mov a,rega ;clear A bits in memory + or operand,a + + store_modify + + +;***************************************************************** +; +; Memory write instructions +; Store register +; +;***************************************************************** + +; opcode: STA + adgen_x STA_ ;abs,X + adgen_y STA_ ;abs,Y + adgen_zi STA_ ;(ZP) indirect + adgen_zxi STA_ ;(ZP,X) indexed indirect + adgen_ziy STA_ ;(ZP),Y indirect indexed + adgen_zx STA_ ;ZP,X + adgen_z STA_ ;ZP absolute +STA_a: adgen_a ;absolute + +STA_o: store_reg rega,STA_m ;common entry after address generate + +; opcode: STX + adgen_zy STX_ ;ZP,y + adgen_z STX_ ;ZP absolute +STX_a: adgen_a ;absolute + +STX_o: store_reg regx,STX_m ;common entry after address generate + +; opcode: STY + adgen_s_zx STY_ ;ZP,x + adgen_s_z STY_ ;ZP absolute +STY_a: adgen_a ;absolute + +STY_o: store_reg regy,STY_m ;common entry after address generate + +; opcode: STZ + adgen_x STZ_ ;abs,X + adgen_s_zx STZ_ ;ZP,x + adgen_s_z STZ_ ;ZP absolute +STZ_a: adgen_a ;absolute + +STZ_o: store_reg zero,STZ_m ;common entry after address generate + diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_IO.inc b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_IO.inc new file mode 100644 index 00000000..638246f5 --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_IO.inc @@ -0,0 +1,2807 @@ +; +; 6502 EMULATOR include +; I/O page (iomap) address decode & emulated I/O +; +; Copyright (C) 2013-2015 Klaus Dormann +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . +; +.set io_version = 832 +;***************************************************************** +; +; IO macros +; +;***************************************************************** + +;I/O address least significant nibble address decode +; +;@0 = table of 16 addresses for decoded nibble (0x0 - 0xf) +.macro io_adr_dec + .if (@0 & 0xff) > 0xf0 + .error "Address decode table @0 crosses a page boundary!" + .endif + ldi zh,high(@0) ;register address decode + mov zl,oplow ;lower byte + andi zl,0xf ;lower 4 bits + addi zl,low(@0) ;add offset + ijmp ;address specific code +.endmacro + +;macro set IO select pin +; +;@0 = io_strobe pin direct (1-3) or extended (10-17, 20-27, 30-37) +.macro set_io_select + out cbus,clear ;turn off -OE to RAM + .set io_select = @0 + .if io_select > 3 ;generate strobe + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios1_default ;precharge IO-select register + .set io_strobe_pol = !((ios1_default >> io_select) & 1) + .set io_sel_direct = 6 ;bit to enable extension register + .else + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios2_default ;precharge IO-select register + .set io_strobe_pol = !((ios2_default >> io_select) & 1) + .set io_sel_direct = 7 ;bit to enable extension register + .else + .set io_select = io_select -10 + ldi b,ios3_default ;precharge IO-select register + .set io_strobe_pol = !((ios3_default >> io_select) & 1) + .set io_sel_direct = 2 ;bit to enable extension register + .endif + .endif + out abushi,b + sbi cbus,io_sel_direct ;make register transparent + .else + .set io_sel_direct = 0 + .if (io_select == 3) ;translate to pin + .set io_select = 2 + .else + .set io_select = io_select + 5 + .endif + .endif +.endmacro + +;macro set IO selectpin and keep reset pin low +; +;@0 io_strobe pin direct (1-3) or extended (10-17, 20-27, 30-37) +.macro set_io_reset + out cbus,clear ;turn off -OE to RAM + .set io_select = @0 + .if io_select > 3 ;generate strobe + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios1_default ;precharge IO-select register + .set io_strobe_pol = !((ios1_default >> io_select) & 1) + .set io_sel_direct = 6 ;bit to enable extension register + .else + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios2_default ;precharge IO-select register + .set io_strobe_pol = !((ios2_default >> io_select) & 1) + .set io_sel_direct = 7 ;bit to enable extension register + .else + .set io_select = io_select -10 + ldi b,ios3_default ;precharge IO-select register + .set io_strobe_pol = !((ios3_default >> io_select) & 1) + .set io_sel_direct = 2 ;bit to enable extension register + .endif + .endif + .ifdef io_reset_pin + .if (@0 & 0x30) == (io_reset_pin & 0x30) + cbr b,(1 << (io_reset_pin & 7)) + .endif + .endif + out abushi,b + sbi cbus,io_sel_direct ;make register transparent + .else + .set io_sel_direct = 0 + .if (io_select == 3) ;translate to pin + .set io_select = 2 + .else + .set io_select = io_select + 5 + .endif + .endif +.endmacro + +;macro prepare IO select pin +;use with make_io_select, precharges yl & yh with strobe +; +;@0 = io_strobe pin direct (1-3) or extended (10-17, 20-27, 30-37) +.macro prep_io_select + .set io_select = @0 + .if io_select > 3 ;generate strobe + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios1_default ;precharge IO-select register + ldi yl,ios1_default^(1<> io_select) & 1) + .set io_sel_direct = 6 ;bit to enable extension register + .else + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios2_default ;precharge IO-select register + ldi yl,ios2_default^(1<> io_select) & 1) + .set io_sel_direct = 7 ;bit to enable extension register + .else + .set io_select = io_select -10 + ldi b,ios3_default ;precharge IO-select register + ldi yl,ios3_default^(1<> io_select) & 1) + .set io_sel_direct = 2 ;bit to enable extension register + .endif + .endif + ldi yh,0x30|(1< 0) + out abushi,yl + .endif + out cbus,yh +.endmacro + +;macro enable IO select pin +; +.macro ena_io_select + .if (io_sel_direct > 0) + .if io_strobe_pol + sbi abushi,io_select ;strobe high + .else + cbi abushi,io_select ;strobe low + .endif + .else + sbi cbus,io_select ;strobe high + .endif +.endmacro + +;macro disable IO select pin +; +.macro dis_io_select + .if (io_sel_direct > 0) + out abushi,b ;end strobe + .else + out cbus,clear ;end strobe + .endif +.endmacro + +;macro disable SPI select pin +; +.macro dis_spi_select + .if (io_sel_direct > 0) + out abushi,b ;end strobe if io extension + .endif +;must be followed by +; out cbus,{readmem|clear} +.endmacro + +;macro SPI wait for spdr complete +; +.macro wait_spi +wait_spdr: + sbis spsr,spif + rjmp wait_spdr +.endmacro + +;macro out @0 to SPI and wait for spdr complete +; +.macro out_spi + out spdr,@0 +wait_spdr: + sbis spsr,spif + rjmp wait_spdr +.endmacro + +;macro in @0 from SPI and wait for data ready +; +.macro in_spi + out spdr,allon +wait_spdr: + sbis spsr,spif + rjmp wait_spdr + in @0,spdr +.endmacro + +;macro parallel read +; +;@0 minimum read strobe in ns, max 800ns +; maximum time to data valid is @0 -1/2 clock, -32ns +.macro par_rd + sbi abuslo,7 ;generate R/-W if needed + ena_io_select + wait_ns @0,1 + dis_io_select + in operand,dbusin ;data latched during previous cycle + out cbus,readmem ;IO-select off & read mode back on + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret +.endmacro + +;macro parallel write +; +;@0 minimum write strobe duration in ns, max 800ns +.macro par_wrt + cbi abuslo,7 ;generate R/-W if needed + out dbusout,operand ;precharge data to be written + out dbusddr,allon ;data write mode + ena_io_select + wait_ns @0,1 + dis_io_select + out dbusddr,zero ;data hold ends +.endmacro + +;parallel pre read macro - data to a, no return +; +;@0 minimum read strobe in ns, max 800ns +; maximum time to data valid is @0 -1/2 clock, -32ns +.macro par_pre_rd + sbi abuslo,7 ;generate R/-W + ena_io_select + wait_ns @0,1 + dis_io_select + in a,dbusin ;data latched during previous cycle +.endmacro + +;phase 2 synchronisation macro +; next instruction after macro is at tcnt=7, OC2=1 +; +; you are here | at end of macro +; _ _ _ _ _ _ _V_ _ _ +; Phi2 _ _| |_ _ _ _ _ _ _ _| +; +; tcnt 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 +; +; 500ns/phase, 62.5ns/count + +.macro phi2_sync +phi2_syncloop: + in zl,tcnt2 + sbic pind,7 ;wait for phi2 low + rjmp phi2_syncloop + clr zh + subi zl,low(-phi2_synctable) ;calculate offset cycles + sbci zh,high(-phi2_synctable) + ijmp + +; .if (PC & 0xff) > 0xf8 ;keep table on same page - avoid adc zh,zero +; .org (PC + 0x100) & 0xff00 +; .endif +phi2_synctable: ;delay -1 cycle for each count in tcnt + nop ;0/1 - tcnt=0/OC2=1 + nop ;1/1 + nop ;2/1 + nop ;3/1 + nop ;4/1 + nop ;5/1 + nop ;6/1 +; next 7/1 - output to next cycle, input from previous cycle +.endmacro + +.macro nop2 ;2 cycle nop + rjmp pc+1 +.endmacro + +;macro phase 2 synchronized read +; +; +; data latched 1/2 clock ahead of IN + +; address valid + | +; after sync + | | +; | | _ _ _ _ _ _ _ _ _ _ _ _ | _ _ +; chip select _ _|_ _|_ _| | |_ _ +; _ _ _ _V_ | _ _ _ _ _ _ _ V +; Phi2 |_V_ _ _ _ _ _ _| |_ _ _ _ +; +; tcnt 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 +; +.macro phi2_rd + phi2_sync + sbi abuslo,7 ;7/1 generate R/-W - tcnt=7/OC2=1 + ena_io_select ;1/0 CS strobe >300ns before phi2 + nop2 ;3/0 + nop2 ;5/0 + nop2 ;7/0 + nop2 ;1/1 + nop2 ;3/1 + nop2 ;5/1 + nop ;7/1 + in operand,dbusin ;0/0 input latched at 7/1 +30ns + dis_io_select ;1/0 end strobe 125ns after phi2 te + out cbus,readmem ;IO-select off & read mode back on + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret +.endmacro + +;macro phase 2 synchronized write +; +; output data valid + +; address valid + | +; after sync + | | +; | | _ _ _ _ _ _ _|_ _ _ _ _ _ _ +; chip select _ _|_ _|_ _| | |_ _ _ +; _ _ _ _V_ | _ _V_ _ _ _ _ _ +; Phi2 |_V_ _ _ _ _ _ _| |_ _ _ _ +; +; tcnt 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 +; +.macro phi2_wrt + phi2_sync + cbi abuslo,7 ;7/1 generate R/-W - tcnt=7/OC2=1 + ena_io_select ;1/0 CS strobe high >300ns before phi2 + nop2 ;3/0 + nop2 ;5/0 + nop ;7/0 + out dbusout,operand ;0/1 precharge data to be written + out dbusddr,allon ;1/1 write data valid 125 ns after phi2 le + nop2 ;2/1 + nop2 ;4/1 + nop2 ;6/1 + dis_io_select ;0/0 end strobe 60ns after phi2 te + out dbusddr,zero ;data hold ends + rjmp iw_exit ;next instruction +.endmacro + +;**************************************************************** +; +; Begin IO address decode after load, store or modify instruction +; +;**************************************************************** + +;address decode for higher nibble of internally mapped address +iomodify: + sbr flags,(1<10ms? + ifeq lcd_rs_timeout + sts lcd_flags,zero + ret + end lcd_rs_timeout + par_pre_rd 450 + sbrc a,7 ;test status busy + loop lcd_rs_busy + ldi a,32 ;delay 96 cycles = 6µs + do lcd_rs_adr ; for older hd44780 requiring + dec a ; extra time after busy + loopne lcd_rs_adr ; to increment RAM address +lcd_rs_fwrt: + out abuslo,oplow ;set register + par_wrt 450 ;write with 450ns strobe + ret + +lcd_rs_rd: ;read from lcd with timeout on busy + out tcnt0,zero + cbi abuslo,0 ;set status register + do lcd_rs_rd_busy + in a,tcnt0 ;busy timeout? + cpi a,0x9c ;>10ms? + ifeq lcd_rs_rd_timeout + sts lcd_flags,zero + ret + end lcd_rs_rd_timeout + par_pre_rd 450 + sbrc a,7 ;test status busy + loop lcd_rs_rd_busy + ldi a,32 ;delay 96 cycles = 6µs + do lcd_rs_rd_adr ; for older hd44780 requiring + dec a ; extra time after busy + loopne lcd_rs_rd_adr ; to increment RAM address + out abuslo,oplow ;set register + par_pre_rd 450 ;read with 450ns strobe + mov operand,a + ret +.endif + +;***************************************************************** +; +; emulated 6551 ACIA - data register only +; +; ACIA is not available, when the debugger is using the RS232 interface +; use exit command (X) to enable ACIA, use break to return to the debugger +; +;data register, TX on write, RX on read both with 256 byte FIFO buffer +acia_rx: + lds a,irq_flag + cbr a,0b01000000 ;clear rdrf + lds c,irq_mask ;other interrupts pending & enabled? + and c,a + ifeq rx_irq_clear + .ifdef ena_diag + lds c,selftest + sbrs c,0 ;forced IRQ by selftest + .endif + cbi cbusddr,3 ;clear IRQ + end rx_irq_clear + clr operand ;default response + sbrc flags,deb_on ;acia disconnected? + ifs acia_rx_ena + lds c,rx_fill ;precharge rx level + .ifdef irq_dis_real + sbrs stat2,2 ;interrupts disabled? + ifs acia_rx_bypass + sbis ucsra,udre ;UDR available? + ifs_and acia_rx_tx + lds d,tx_fill ;empty buffer? + tst d + ifne acia_rx_tx + ldi xh,high(tx_buf) + lds xl,tx_inx ;calc output index + sub xl,d + ld b,x ;load from fifo head + out udr,b + dec d ;update pointer + ifeq acia_rx_tx_empty + ldi b,usart_txi_dis ;tx buffer now empty + out ucsrb,b + sts usart_ena,b + end acia_rx_tx_empty + sts tx_fill,d + end acia_rx_tx + lds b,irq_mask ;check TDRE IRQ enabled + andi b,0b10000000 + ifne acia_rx_tx_int_ena + sbi cbusddr,3 ;set IRQ + end acia_rx_tx_int_ena + lds b,irq_flag + sbr b,0b10000000 ;set TDRE + sts irq_flag,b ;store status + tst c ;buffer empty? + ifeq acia_rx_direct + sbic ucsra,rxc ;data waiting in UDR? + in operand,udr ;read direct if disabled & buffer empty + end acia_rx_direct + end acia_rx_bypass + .endif + tst c ;buffer empty? + ifne acia_rx_empty + lds xl,rx_inx ;prepare address to read rx fifo + ldi xh,high(rx_buf) + sub xl,c + ld operand,x ;read + dec c ;update pointer + sts rx_fill,c + ifne acia_rx_more + lds b,irq_mask ;check acia irq enabled + andi b,0b01000000 ;RDRF IRQ enabled ? + ifne acia_rx_int + sbi cbusddr,3 ;set IRQ + end acia_rx_int + sbr a,0b01000000 ;set rdrf - more rx data + end acia_rx_more + .ifdef flowlo + mov i,c + cpi i,flowlo ;buffer lower watermark? + iflo acia_flow + lds i,flow_cmd + cpi i,0x91 ;xon done? + ifne acia_send_xon + ldi i,0x11 ;post xon pending + sts flow_cmd,i + ldi i,usart_txi_ena ;notify transmitter + out ucsrb,i + .ifdef irq_dis_real + sts usart_ena,i + .endif + end acia_send_xon + end acia_flow + .endif + end acia_rx_empty + sts irq_flag,a + end acia_rx_ena + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret + +acia_tx: + lds c,tx_fill ;precharge level + .ifdef irq_dis_real + sbrs stat2,2 ;interrupts disabled? + ifs_and acia_tx_bypass + sbis ucsra,udre ;UDR empty? + ifs acia_tx_bypass + cbr flags,(1<= 0.83 (has DMA) +; + debugger currently running, ACIA disconnected +ir_diag: + lds operand,selftest ;respond with saved selftest flags + ldi a,0b1000000 ;mark current IO version + sbrc flags,deb_on ;mark debugger is running + sbr a,0b10000000 + or operand,a + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret + +iw_diag: + sbrs operand,7 ;test enter diag + ifs iw_diag_enter + andi flags,(1<-----------------------v +;SPSR [ 0 | 0 | 0 | 0 | 0 | 0 | 0 |SPI2X] +; +;SPCR [ 0 | 0 |DORD | 1 |CPOL |CPHA |SPR1 |SPR0 ] +; --> [SPIE | SPE |DORD |MSTR |CPOL |CPHA |SPR1 |SPR0 ] +spw_cmd: + sbrc operand,6 ;test clearing sshld + ifs_and spw_cmd_sshld + lds a,spi_cmd + sbrs a,6 ;test sshld not already clear + ifs spw_cmd_sshld + ldi a,spi_idle ;turn off ss + out abuslo,a + sbi spcr,spe ;enable SPI + set_io_select spi_sel + ena_io_select + dis_spi_select ;latch spi interface + cbi spcr,spe ;stop spi + out cbus,readmem ;clear IO ext select & set read mode + end spw_cmd_sshld + sts spi_cmd,operand ;save slave select hold + mov a,operand ;charge with forced bits + sbr a,(1<------------------+ | +; TWI activate +; o +; optional Interrupt | -INT only +; | +; | +; <---------------------->|--+ +; -IRQ or -NMI in Schottky +; +;define your I2C interface +;i2c_sel defined in main file +.EQU i2c_in =dbusin ; I2C input +.EQU i2c_ddr =dbusddr ; I2C DDR +.EQU i2c_out =dbusout ; I2C output +.EQU i2c_scl =0 ; clock i/o +.EQU i2c_sda =1 ; data i/o +.EQU i2c_int =2 ; -interrupt input (optional to detect i2c int) +.EQU i2c_res =3 ; -reset output (optional to reset i2c slaves) +; # of clocks for 400kHz SCL phase (1/2 clock) @ Osc_Hz rounded up +.EQU i2c_clk =((Osc_Hz / 2 - 1) / 400000) + 1 +#define i2c_data a +;used registers a (data), b (timing), zl (status), e (io select default) + +; +; open i2c interface +; +i2c_open: + set_io_select i2c_sel +i2c_open_rs: + out dbusout,allon ;float all outputs high + out dbusddr,allon ;(discharge low cap) + mov e,b + out dbusddr,zero + out dbusout,zero ;open collector drive via ddr + ena_io_select + ret + +; +; read i2c data +; +; send ack before reading except on 1st read +i2c_data_rd: + lds zl,i2c_statreg ;load parameters + sbrc zl,0 ;test interface stopped + ifs i2c_read_ok + rcall i2c_open + bst zl,2 ;set speed + clc ;ack + sbrc zl,3 ;read ack required? + rcall i2c_putack + rcall i2c_read + mov operand,i2c_data + sbr zl,0b1000 ;set read ack required + sts i2c_statreg,zl ;save status + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + else i2c_read_ok + mov operand,zero + end i2c_read_ok + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret +; +; write i2c data if not stopped or previous read +; write i2c address if start condition +; +; if nak response (slave not ready/present) send stop +i2c_data_wrt: + lds zl,i2c_statreg ;load parameters + bst zl,2 ;set speed + sbrs zl,1 ;start pending? + ifs i2c_adr + mov a,operand + rcall i2c_open + sec ;nak + sbrc zl,3 ;read ack outstanding? + rcall i2c_putack + mov i2c_data,operand + .ifdef i2c_eep_adr + cpi i2c_data,eep_adr ;protect nv program EEPROM + ifeq i2c_eep_protect + sec + else i2c_eep_protect + rcall i2c_start + end i2c_eep_protect + .else + rcall i2c_start + .endif + andi zl,0b100 ;keep speed, clear the rest + ifcc i2c_start_ack + sbr zl,0b1000000 ;set ack + else i2c_start_ack + cbr zl,0b1000000 ;clear ack + sbr zl,0b1 ;set stop + rcall i2c_stop + end i2c_start_ack + sts i2c_statreg,zl + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + rjmp iw_exit + end i2c_adr + mov a,zl + andi a,0b1001 ;not stopped and not read? + ifeq i2_wrt_ok + rcall i2c_open + mov i2c_data,operand + rcall i2c_write + andi zl,0b100 ;keep speed, clear the rest + ifcc i2c_write_ack + sbr zl,0b1000000 ;set ack + else i2c_write_ack + cbr zl,0b1000000 ;clear ack + sbr zl,0b1 ;set stop + rcall i2c_stop + end i2c_write_ack + sts i2c_statreg,zl + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + rjmp iw_exit + end i2_wrt_ok + rjmp iw_exit + +; +; write i2c command +; +;0=send stop, nak & stop if pending read +;1=set start(next data write = address), speed 100kHz +;2=set start(next data write = address), speed 400kHz +;3=send reset (9 naks), optional hw reset +; allow sufficient time after resetting hardware +; +i2c_cmd: + lds zl,i2c_statreg + mov a,operand + cpi a,3 + iflo i2c_cmd_012 + cpi a,1 + iflo i2c_cmd_stop ;command code 0 - send stop + rcall i2c_send_stop + rjmp i2c_cmd_exit + end i2c_cmd_stop + ifeq i2c_start_100 ;command code 1 - set start 100kHz + cbr zl,0b100 ;speed 100 kHz + sbrc zl,5 ;bus not stuck? + rcall i2c_reset ;stuck bus requires a reset + sbrs zl,5 ;bus still stuck? + sbr zl,0b10 ;OK to start + rjmp i2c_cmd_exit + end i2c_start_100 ;command code 2 - set start 400kHz + cbr zl,0b100 ;speed 100 kHz for reset + sbrc zl,5 ;bus not stuck? + rcall i2c_reset ;stuck bus requires a reset + sbrs zl,5 ;bus still stuck? + sbr zl,0b110 ;OK to start with 400kHz + rjmp i2c_cmd_exit + end i2c_cmd_012 + ifeq i2c_cmd_reset ;command code 3 - reset i2c bus + rcall i2c_reset + end i2c_cmd_reset +i2c_cmd_exit: + sts i2c_statreg,zl + rjmp iw_exit + +;stop i2c +i2c_send_stop: + sbrc zl,0 ;not already stopped? + ifs i2c_not_stop + rcall i2c_open + bst zl,2 ;set speed + sec ;nak + sbrc zl,3 ;read ack outstanding? + rcall i2c_putack + andi zl,0b100 ;keep speed, clear the rest + sbr zl,0b1 ;set stop + rcall i2c_stop + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + end i2c_not_stop + ret + +; +; read i2c status +; +; [ IRQ | ACK |Stuck| 0 |Read |Speed|Start|Stop ] +;IRQ: 1=I2C Interrupt pending +;ACK: 1=slave acknowledge - device present/ready +;Stuck: 1=SCL or SDA stuck - interface needs reset +; 0 +;Read: 1=Send read acknowledge pending +;Speed: 1=400kHz, 0=100kHz +;Start: 1=next write = address +;Stop: 1=interface stopped +i2c_stat: + lds zl,i2c_statreg ;load status + rcall i2c_open + sbis i2c_in,i2c_int ;skip if no interrupt + sbr zl,0b10000000 ;merge interrupt to status + mov operand,zl + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret + +; +; I2C reset - mark unusable if stuck +; +i2c_rs: + set_io_reset i2c_sel + rcall i2c_open_rs + rcall i2c_reset_rs + sts i2c_statreg,zl + sbrs zl,5 ;message, if I2C stuck + ifs i2c_rs_fail + PrintStr_far i2c_fail + end i2c_rs_fail + ret +i2c_fail: .db 13,10,"I2C bus stuck",0 + +;DMA I2C read block +dma_i2c_rb: + lds a,dma_last_cmd + lds b,dma_tab_index + cpi a,5 ;current i2c read block (retry)? + ifeq i2c_drb_retry + lds xl,dma_tab+5 ;load in progress block count + lds xh,dma_tab+6 + rjmp dma_i2c_rb1 + end i2c_drb_retry + cpi a,0x15 ;previous i2c read block? + ifeq_or i2c_drb + cpi a,1 ;previous set block address table? + ifeq_and i2c_drb + cpi b,5 ;block address table valid? + ifeq i2c_drb + lds xl,dma_tab+3 ;load block count + lds xh,dma_tab+4 + rjmp dma_i2c_rb1 + end i2c_drb +dma_i2c_rbfail: + sts dma_last_cmd,allon ;mark invalid sequence of command + rjmp iw_exit +dma_i2c_rb1: + sts dma_last_cmd,operand ;mark command in progress + lds zl,dma_tab+1 ;load memory address + lds zh,dma_tab+2 + + lds yl,i2c_statreg ;load current I2C status + sbrc yl,0 ;test interface stopped + rjmp dma_i2c_rbfail + out cbus,clear ;readmode off + rcall i2c_open + in c,cbus ;save I2C register enable + in d,abushi ;save I2C enable + bst yl,2 ;set speed + clc ;ack + sbrc yl,3 ;read ack required? + rcall i2c_putack + sbr yl,0b1000 ;set read ack required + sts i2c_statreg,yl ;save status + in a,timsk ;block single step on retry + cbr a,1< 0) + out abushi,e ;close i2c interface + .endif + out cbus,clear ;clear IO select + ;write memory + out dbusddr,allon ;prepare to write mem + out abuslo,zl ;set memory address + out abushi,zh + out cbus,writemem ;WE, ~OE + out dbusout,a ;dbus write + adiw z,1 + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + sbiw x,1 + exiteq i2c_drb_loop + ;read i2c + out dbusout,allon ;float all outputs high +; .ifdef irq_dis_real +; sbrs stat2,2 ;all interrupts disable +; .endif + sei + out dbusddr,zero + cli + out dbusout,zero ;open collector drive via ddr + out abushi,d ;reenable I2C bus + out cbus,c + clc + bst yl,2 ;set speed + rcall i2c_putack + loop i2c_drb_loop + out dbusddr,zero ;end writing to memory + sts dma_tab+1,zl ;save next memory address + sts dma_tab+2,zh + ldi a,0x15 ;last successful command was read + sts dma_last_cmd,a + in a,timsk ;undo block single step + sbr a,1< 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + sbiw x,1 + loopne i2c_dwb_loop + ldi a,0x14 ;last successful command was read + else i2c_dwb_ack + andi yl,0b100 ;keep speed, clear ack & the rest + sbr yl,0b1 ;set stop + sts i2c_statreg,yl + rcall i2c_stop + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem + mov a,allon ;mark dma failed unless... + sbiw x,1 + ifeq i2c_dwb_end_nak ;...it is at the end of the block + ldi a,0x14 + end i2c_dwb_end_nak + end i2c_dwb_ack + sts dma_last_cmd,a + sts dma_tab+1,zl ;save next memory address + sts dma_tab+2,zh + in a,timsk ;undo block single step + sbr a,1< 2) + .set loop_cycles = (cycles / 3) + ldi b,loop_cycles + brts i2c_400kHz + ldi b,loop_cycles + @0 ;add 3* delay (100 kHz)) +i2c_400kHz: + dec b + brne pc-1 + .set cycles = (cycles - (loop_cycles * 3)) + .else + .set loop_cycles = @0 + brts i2c_400kHz + ldi b,loop_cycles ;add 3* delay (100 kHz) + dec b + brne pc-1 + nop ;compensate branch not taken +i2c_400kHz: + .endif + .if (cycles > 0) + .if (cycles & 4) + rjmp pc+1 + rjmp pc+1 + .endif + .if (cycles & 2) + rjmp pc+1 + .endif + .if (cycles & 1) + nop + .endif + .endif +.endmacro +; +; i2c macros - single master +; allow clock stretching but no collision detection +; +.macro sda1 ;set sda high, single master + cbi i2c_ddr,i2c_sda +.endmacro +.macro scl1 ;set scl high, wait scl high + cbi i2c_ddr,i2c_scl + sbis i2c_in,i2c_scl ;subtract 2 clocks + rjmp pc-1 ;in next wait_ns +.endmacro +.macro sda0 ;set sda low + sbi i2c_ddr,i2c_sda +.endmacro +.macro scl0 ;set scl low + sbi i2c_ddr,i2c_scl +.endmacro + +; +; i2c interface reset & check for stuck bus +; +i2c_reset: + rcall i2c_open +i2c_reset_rs: + sbi i2c_ddr,i2c_res ;optional hw reset + wait_i2c 190,0 ;allow reset to disengage slaves + clr zl ;clear all + sbic i2c_in,i2c_scl ;SCL stuck low? + ifs i2c_stuck ;set interface not usable status + sbr zl,0b100001 ;set stop & stuck + else i2c_stuck ;reset for devices without hw-reset + clt ;set low speed + ldi i2c_data,0xff ;9 clocks with nak + rcall i2c_write + sbic i2c_in,i2c_sda ;SDA stuck low? + ifs i2c_sda_stuck + sbr zl,0b100001 ;set stop & stuck + else i2c_sda_stuck + sbr zl,0b1 ;set stop + end i2c_sda_stuck + rcall i2c_stop + end i2c_stuck + cbi i2c_ddr,i2c_res ;end optional hw reset + .if (io_sel_direct > 0) + out abushi,e ;close i2c interface + .endif + out cbus,readmem ;clear IO select & set read mode + ret + +; +; i2c start with address +; +; start -> slave, i2c_data -> slave address +; slave ack -> SREG.C +; +i2c_start: sbic i2c_in,i2c_sda ;clock previous ack + ifs start_prev_ack + scl0 + wait_i2c i2c_clk,2 ;scl1 + scl1 + wait_i2c i2c_clk/2,4 ;scl1-sda0 + end start_prev_ack + sda0 + wait_i2c i2c_clk/2,4 ;sec-rol-scl0 +; +; i2c write: i2c_data -> slave data, slave ack -> SREG,C +; +i2c_write: sec ;mark incomplete + rol i2c_data +i_wrtloop: scl0 + wait_i2c i2c_clk/2,4 ;brcc-(nop)-sdax + brcc i_wrt0 ;data bit = 0 + nop ;sda set after 4 clocks + sda1 + rjmp i_wrt1 +i_wrt0: sda0 + rjmp i_wrt1 ;nop 2 clocks +i_wrt1: wait_i2c i2c_clk/2,4 ;rjmp-scl1 + scl1 + wait_i2c i2c_clk,7 ;scl1-lsl-brne-(nop)-scl0 + lsl i2c_data + brne i_wrtloop + nop + +i2c_getack: scl0 + wait_i2c i2c_clk/2,2 ;sda1 + sda1 ;release sda after write + wait_i2c i2c_clk/2,2 ;scl1 + scl1 + wait_i2c i2c_clk/2,3 ;scl1-clc + clc + sbic i2c_in,i2c_sda + sec + ret +; +; i2c read: slave data -> i2c_data, +; +i2c_read: ldi i2c_data,1 ;precharge register full marker +i_rdloop: wait_i2c i2c_clk/2,7 ;sbic-(sec)-rol-brcc-scl0 + scl0 + wait_i2c i2c_clk/2,2 ;sda1 + sda1 ;clear sda out from prev. putack + wait_i2c i2c_clk/2,2 ;scl1 + scl1 + wait_i2c i2c_clk/2,3 ;scl1-clc + clc + sbic i2c_in,i2c_sda + sec + rol i2c_data + brcc i_rdloop ;precharged bit hasn't arrived + ret +; +; i2c putack: SREG,C -> slave ack +; +i2c_putack: scl0 + wait_i2c i2c_clk/2,4 ;brcc-(nop)-sdax + brcc i_pack1 + nop ;compensate brcc + sda1 + rjmp i_pack2 +i_pack1: sda0 + rjmp i_pack2 ;nop 2 clocks +i_pack2: wait_i2c i2c_clk/2,4 ;rjmp-scl1 + scl1 + wait_i2c i2c_clk/2,5 ;scl1-ret-rcall-ldi+wait(-7)-scl0 + ret +; +; i2c stop +; +i2c_stop: wait_i2c i2c_clk/2,6 ;scl1+wait(-5)-ret-rcall-scl0 + scl0 + wait_i2c i2c_clk/2,2 ;sda0 + sda0 + wait_i2c i2c_clk/2,2 ;scl1 + scl1 + wait_i2c i2c_clk/2,4 ;scl1-sda1 + sda1 + ret +.else + .equ i2c_data_wrt = iw_exit + .equ i2c_cmd = iw_exit + .equ i2c_data_rd = ir_exit + .equ i2c_stat = ir_exit + .equ i2c_rs = rs_exit + .equ dma_i2c_wb = dma_cmd_inv + .equ dma_i2c_rb = dma_cmd_inv +.endif + +.ifdef eep_vld +;***************************************************** +; +; external SPI/I2C EEPROM as non volatile program storage +; +;***************************************************** +; +; EEP open - check spi/i2c bus & EEPROM presence +eep_open: + .ifdef spi_eep_adr + out spsr,one ;speed 8MHz, mode 0, enabled + ldi a,0x50 + out spcr,a + ldi a,spi_eep_adr + out spi_out,a + set_io_select spi_sel + ena_io_select + mov e,b ;deselcted IO (abushi) + ldi a,5 ;command: read status register + out_spi a + in_spi a + in f,spi_out ;selected slave (abuslo a.k.a. spi_out) + ldi b,spi_idle ;stop slave select + out spi_out,b + cpi a,0xff ;MISO open? + breq eep_no_device + .else + set ;speed 400kHz + rcall i2c_open + sbis i2c_in,i2c_scl ;SCL stuck low? + rjmp eep_no_device + ldi i2c_data,0xff ;9 clocks with nak + rcall i2c_write + sbis i2c_in,i2c_sda ;SDA stuck low? + rjmp eep_no_device + rcall i2c_stop + ldi a,eep_adr ;test device present + rcall i2c_start + brcs eep_no_device + rcall i2c_stop + .endif + .if (io_sel_direct > 0) + in d,abushi ;selected IO exp. (abushi) + .endif + in c,cbus ;selected IO (cbus) + ret +eep_no_device: + PrintStr err_no_eep ;" SPI/I2C EEPROM not found" + jmp skip_main +; +; EEPROM write 1 Byte, select new slot if necessary +; +eep_write: + tst yl ;need new slot? + ifeq eep_new_slot + lds yl,prog_num + do eep_find_slot + do eep_write_wait ;previous write complete? + sbic eecr,eewe + loop eep_write_wait + out eearl,yh ;read slot to find prog# + out eecr,one + in b,eedr + cp b,yl ;overwrite same + exiteq eep_find_slot + inc b ;new free slot + ifeq eep_slot_allocate + out eedr,yl ;write prog# + in b,sreg ;atomic write sequence + cli + sbi eecr,eemwe + sbi eecr,eewe + out sreg,b + exit eep_find_slot + end eep_slot_allocate + inc yh ;all slots done? + breq eep_full + loop eep_find_slot + ldi yl,0 + end eep_new_slot + cpi yl,0 ;new slot? + ifeq_or eep_write_open + cpi yl,128 ;new page_write? + ifeq eep_write_open + push a + ;open next eeprom page for write + .ifdef spi_eep_adr + ldi b,spi_idle + do eep_write_ready + out spi_out,f ;set slave select + ldi a,5 ;command: read status + out_spi a + in_spi a ;get status + out spi_out,b ;end slave select + andi a,1 ;write in progress + loopne eep_write_ready + out spi_out,f ;set slave select + ldi a,6 ;command: write enable + out_spi a + out spi_out,b ;end slave select + out spi_out,f ;set slave select + ldi a,2 ;command: write + out_spi a + out_spi yh ;send write address + out_spi yl + .else + do eep_write_ready + ldi a,eep_adr + rcall i2c_start ;may need timeout if dead EEPROM + loopcs eep_write_ready + mov a,yh ;send write address + rcall i2c_write + mov a,yl + rcall i2c_write + .endif + pop a + end eep_write_open + ;write data + .ifdef spi_eep_adr + out_spi a + .else + rcall i2c_write + .endif + cpi yl,127 ;EEP write buffer filled? + ifeq_or eep_write_buf + cpi yl,255 ;EEP write buffer filled? + ifeq eep_write_buf + ;end of page - internal eep write + .ifdef spi_eep_adr + ldi a,spi_idle ;stop slave select + out spi_out,a + .else + rcall i2c_stop ;write buffer + .endif + end eep_write_buf + adiw y,1 + breq eep_full + ret + +eep_full: ;no more slots + PrintStr err_eep_full ;" EEPROM full" +; +; EEP error during save +; +eep_write_err: ;close after errors + .ifdef spi_eep_adr + ldi a,spi_idle ;stop slave select + out spi_out,a + .else + rcall i2c_stop + .endif + ldi yh,0 ;free all slots for this prog# + rcall eep_int_close + jmp discard_serial_stream ;skip remaining input, end of command +; +; EEP write close +; +eep_write_close: + .ifdef spi_eep_adr + ldi a,spi_idle ;close spi interface + out spi_out,a + .else + rcall i2c_stop + .endif + tst yl ;slot already incremented? + ifne eep_close_nxt_slot + inc yh + end eep_close_nxt_slot + tst yh ;was last slot? + ifne eep_close_last_slot + rcall eep_int_close + end eep_close_last_slot + sbrc flags,deb_act ;outside debugger + jmp discard_serial_stream ;skip remaining input, end of command + +;general close SPI/I2C EEPROM +eep_close: + ;disconnect SPI/I2C, connect RAM + .ifdef spi_eep_adr + out dbusddr,zero ;dbus = output + .endif + .if (io_sel_direct > 0) + out abushi,e + .endif + out cbus,readmem ;clear IO select & set read mode + out eearl,zero ;set to unused address + out eearh,zero + sts prog_num,allon ;load/save ended + ;restore SPI parameters from last spi_cmd + .ifdef spi_eep_adr + lds b,spi_cmd + out spsr,zero + sbrc b,4 ;test SPI2X + out spsr,one ;SPI2X is set + sbr b,(1< 0) + out abushi,e ;disable IO select + .endif + out cbus,clear ;disable IO select + .ifdef spi_eep_adr + cbi spcr,spe + .else + out dbusddr,allon ;dbus = output + .endif + out abuslo,zl + out abushi,zh + out cbus,writemem ;WE, ~OE + out dbusout,a ;dbus write + adiw z,1 + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + ;connect SPI/I2C + .if (io_sel_direct > 0) + out abushi,d ;prepare IO select + .endif + .ifdef spi_eep_adr + out spi_out,f ;set slave select + sbi spcr,spe + .else + out dbusout,allon ;float all outputs high + out dbusddr,zero + out dbusout,zero ;open collector drive via ddr + .endif + out cbus,c ;activate IO select + dec xl ;record counter expired + loopne eep_load_byte + rcall eep_read ;read count + mov xl,a + tst xl + loopne eep_load_loop + rcall eep_read ;read PCH + tst a ;is valid? + ifne eep_load_pc + mov pch,a ;set PC + rcall eep_read + mov pcl,a + end eep_load_pc + PrintStr eep_loaded ;" loaded" + .ifdef spi_eep_adr + ldi a,spi_idle ;close spi slave + out spi_out,a + .else + sec ;nak & stop + rcall i2c_putack + rcall i2c_stop + .endif + ldi a,0 ;post returncode OK + rjmp eep_close + +; EEPROM read 1 Byte, select new slot if necessary +eep_read: + tst yl ;need to open next slot? + ifeq eep_next_slot + tst yh ;1st slot? + ifne eep_read_first + .ifdef spi_eep_adr + ldi a,spi_idle ;close spi slave + out spi_out,a + .else + sec ;nak & stop + rcall i2c_putack + rcall i2c_stop + .endif + end eep_read_first + lds a,prog_num + do eep_find_prog + out eearl,yh ;read slot to find prog# + out eecr,one + in b,eedr + cp b,a ;match? + exiteq eep_find_prog + inc yh ;all slots done? + breq eep_read_overrun + loop eep_find_prog + .ifdef spi_eep_adr + out spi_out,f ;set slave select + ldi a,3 ;command: read eep + out_spi a + out_spi yh + out_spi yl + .else + do eep_read_ready + ldi a,eep_adr + rcall i2c_start ;may need timeout if dead EEPROM + loopcs eep_read_ready + mov a,yh + rcall i2c_write + mov a,yl + rcall i2c_write + ldi a,eep_adr+1 ;switch to read + rcall i2c_start + .endif + .ifndef spi_eep_adr + else eep_next_slot + clc ;ack + rcall i2c_putack + .endif + end eep_next_slot + ;read data byte + .ifdef spi_eep_adr + in_spi a + .else + rcall i2c_read + .endif + adiw y,1 ;next + ret +; overran the last slot, no ending count 0x00 +eep_read_overrun: + PrintStr err_corrupt ;" corrupted" + pop a ;remove return address + pop a + ldi a,1 ;post returncode fail + sbrc flags,deb_act + rjmp eep_close + rjmp eep_app_read_exit + +;dma save program +dma_eep_save: + lds a,dma_last_cmd + lds b,dma_tab_index + sts dma_last_cmd,allon ;mark invalid sequence of command + cpi a,0 ;previous set block address table? + ifne_or eep_ds_inv + cpi b,5 ;block address table valid? + ifne_or eep_ds_inv + lds a,dma_tab ;program number valid? + cpi a,0xff + ifeq eep_ds_inv + rjmp iw_exit ;exit - invalid parameters + end eep_ds_inv + sts prog_num,a + in b,spl ;save sp - allows sub to exit + sts sp_save,b + in b,sph + sts sp_save+1,b + rcall eep_open + PrintStr eep_prog ;10,13,"Program " + lds a,prog_num ;prog# + rcall PrintHex + lds zl,dma_tab+1 ;load memory address + lds zh,dma_tab+2 + lds xl,dma_tab+3 ;load block count + lds xh,dma_tab+4 + ldi yl,0 ;initial slot allocation + ldi yh,0 + out eearh,one + ldi a,0 ;set app save marker + rcall eep_write + mov a,xl ;calculate count from end address + sub a,zl + rcall eep_write + mov a,xh + sbc a,zh + rcall eep_write + do eep_app_save_data + cp xl,zl + ifeq eep_app_save_adr + cp xh,zh + exiteq eep_app_save_data + end eep_app_save_adr + ;disconnect SPI/I2C, connect RAM + .if (io_sel_direct > 0) + out abushi,e ;disable IO sel. exp. + .endif + out cbus,readmem ;disable IO select + .ifdef spi_eep_adr + cbi spcr,spe ;disable SPI + .endif + out abuslo,zl ;read from RAM + out abushi,zh + adiw z,1 ;next address + wait_data_valid 1 + in a,dbusin + ;connect SPI/I2C + out cbus,clear + .if (io_sel_direct > 0) + out abushi,d ;prepare IO select + .endif + .ifdef spi_eep_adr + out spi_out,f ;select slave + sbi spcr,spe ;enable SPI + .else + out dbusout,allon ;float all outputs high + out dbusddr,allon ;(discharge low cap) + out dbusddr,zero + out dbusout,zero ;open collector drive via ddr + .endif + out cbus,c ;set IO select + ena_io_select + rcall eep_write ;store in EEPROM + loop eep_app_save_data + .ifndef spi_eep_adr + lds zl,i2c_statreg ;set ack + sbr zl,0b1000000 + sts i2c_statreg,zl + .endif + rcall eep_write_close + PrintStr eep_saved ;" saved" + rcall crlf + ldi a,0x16 ;last successful command was read + sts dma_last_cmd,a + rjmp iw_exit + +;dma load program +dma_eep_load: + lds a,dma_last_cmd + lds b,dma_tab_index + sts dma_last_cmd,allon ;mark invalid sequence of command + cpi a,0 ;previous set block address table? + ifne_or eep_dl_inv + cpi b,3 ;block address table valid? + ifne_or eep_dl_inv + lds a,dma_tab ;program number valid? + cpi a,0xff + ifeq eep_dl_inv + rjmp iw_exit ;exit - invalid parameters + end eep_dl_inv + sts prog_num,a + PrintStr eep_prog ;10,13,"Program " + lds a,prog_num ;prog# + rcall PrintHex + clr c ;check prog exists + out eearh,one + lds a,prog_num + do eep_app_scan_loop + out eearl,c ;read slot pointer + out eecr,one + in d,eedr + cp d,a ;prog# match? + exiteq eep_app_scan_loop + inc c ;all slots done? + ifeq eep_app_load_bad_prog + PrintStr eep_notfound ;" not found" + rjmp eep_app_read_exit + end eep_app_load_bad_prog + loop eep_app_scan_loop + rcall eep_open + ldi yl,0 ;start reading from 1st slot + ldi yh,0 + rcall eep_read + tst a + ifne eep_app_file_incompat + PrintStr bad_format ;" incompatible format" + rjmp eep_app_read_exit2 + end eep_app_file_incompat + lds zl,dma_tab+1 ;load memory address + lds zh,dma_tab+2 + rcall eep_read ;read count - set end address + mov xl,a + rcall eep_read + mov xh,a + add xl,zl + sts dma_tab+3,xl + adc xh,zh + sts dma_tab+4,xh + .ifdef spi_eep_adr + out dbusddr,allon + .endif + do eep_app_load_loop + cp xl,zl + ifeq eep_app_load_adr + cp xh,zh + exiteq eep_app_load_loop + end eep_app_load_adr + rcall eep_read + ;disconnect SPI/I2C, connect RAM + .if (io_sel_direct > 0) + out abushi,e ;disable IO select + .endif + out cbus,clear ;disable IO select + .ifdef spi_eep_adr + cbi spcr,spe ;disable SPI + .else + out dbusddr,allon ;dbus = output + .endif + out abuslo,zl ;set write address + out abushi,zh + out cbus,writemem ;WE, ~OE + out dbusout,a ;dbus write + adiw z,1 ;next address + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + ;connect SPI/I2C + .if (io_sel_direct > 0) + out abushi,d ;prepare IO select + .endif + .ifdef spi_eep_adr + out spi_out,f ;set slave select = EEP + sbi spcr,spe ;enable SPI + .else + out dbusout,allon ;float all outputs high + out dbusddr,zero + out dbusout,zero ;open collector drive via ddr + .endif + out cbus,c ;set IO select + loop eep_app_load_loop + PrintStr eep_loaded ;" loaded" + ldi a,0x17 ;last successful command was read + sts dma_last_cmd,a + .ifndef spi_eep_adr + lds a,i2c_statreg + sbr a,0b1000000 ;set ack + sts i2c_statreg,a + .endif +eep_app_read_exit2: + .ifdef spi_eep_adr + ldi a,spi_idle ;close spi slave + out spi_out,a + .else + sec ;nak & stop + rcall i2c_putack + rcall i2c_stop + .endif +eep_app_read_exit: + rcall crlf + rcall eep_close + rjmp iw_exit + +eep_info1: .db 13,10,"EEPROM autoload ",0,0 +eep_info2: .db " - ",0 +eep_info3: .db " slots free",0 +eep_info4: .db 13,10,"prog#/slots ",0 +eep_none: .db "none",0,0 +eep_notfound: .db " not found",0,0 +eep_prog: .db 13,10,"Program ",0,0 +eep_loaded: .db " loaded",0 +eep_saved: .db " saved",0,0 +err_eep_full: .db " EEPROM full",0,0 + .ifdef spi_eep_adr +err_no_eep: .db 13,10,"SPI EEPROM not found",0,0 + .else +err_no_eep: .db 13,10,"I2C EEPROM not found",0,0 + .endif +err_corrupt: .db " corrupted",0,0 +save_wait: .db 13,10,"Saving, to abort",13,10,0,0 +save_ok: .db 13,"Save OK",0,0 +save_abort: .db " Save aborted",0 +bad_format: .db " incompatible format",0,0 + +.else + .equ dma_eep_load = dma_cmd_inv + .equ dma_eep_save = dma_cmd_inv +.endif + diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_NMOS.inc b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_NMOS.inc new file mode 100644 index 00000000..e1009bde --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_NMOS.inc @@ -0,0 +1,1928 @@ +; +; 6502 EMULATOR include +; +; N M O S c o r e +; +; Copyright (C) 2013-2014 Klaus Dormann +; +; This program is free software: you can redistribute it and/or modify +; it under the terms of the GNU General Public License as published by +; the Free Software Foundation, either version 3 of the License, or +; (at your option) any later version. +; +; This program is distributed in the hope that it will be useful, +; but WITHOUT ANY WARRANTY; without even the implied warranty of +; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +; GNU General Public License for more details. +; +; You should have received a copy of the GNU General Public License +; along with this program. If not, see . +; +; +.set core_version = 831 +#define core_string "N6502" ;identify NMOS core in version message + +;***************************************************************** +; +; 6502 emulation disassembly table +; +;***************************************************************** +;addressing modes +.equ op_nv = 0b0000111 ;invalid +.equ op_s = 0b0000000 ;single (implied) - TAX +.equ op_a = 0b0010000 ;absolute - LDA abs +.equ op_x = 0b0010001 ;absolute indexed X - LDA abs,x +.equ op_y = 0b0010010 ;absolute indexed Y - LDA abs,y +.equ op_i = 0b1010011 ;absolute indirect - JMP (abs) +.equ op_m = 0b0101000 ;immediate - LDA # +.equ op_r = 0b0011000 ;relative to PC - BEQ rel +.equ op_z = 0b0001000 ;zero page - LDA zp +.equ op_zxi = 0b1001100 ;zero page indexed X indirect LDA (zp,x) +.equ op_zx = 0b0001001 ;zero page indexed X - LDA zp,x +.equ op_zy = 0b0001010 ;zero page indexed Y - LDA zp,y +.equ op_ziy = 0b1001101 ;zero page indidrect indexed Y - LDA (zp),y +.equ op_sa = 0b0000110 ;single accumulator - ASL A +; 0b00_____ no prefix +; 0b01_____ # - immediate +; 0b10_____ ( - opening indirect +; 0b__00___ no data - implied +; 0b__01___ 1 Byte - zero page or immediate +; 0b__10___ 2 Bytes - absolute +; 0b__11___ 1 Byte relative - calculated absolute +; 0b____000 no suffix +; 0b____001 ,X - indexed X +; 0b____010 ,Y - indexed Y +; 0b____011 ) - closing indirect +; 0b____100 ,X) - indexed X indirect +; 0b____101 ),Y - indirect indexed Y +; 0b____110 A - implied accumulator +; 0b____111 Invalid Instruction + +dis_opcode: .db "BRK",op_s + .db "ORA",op_zxi + .db "?02",op_nv + .db "?03",op_nv + .db "?04",op_nv + .db "ORA",op_z + .db "ASL",op_z + .db "?07",op_nv + .db "PHP",op_s + .db "ORA",op_m + .db "ASL",op_sa + .db "?0B",op_nv + .db "?0C",op_nv + .db "ORA",op_a + .db "ASL",op_a + .db "?0F",op_nv + + .db "BPL",op_r + .db "ORA",op_ziy + .db "?12",op_nv + .db "?13",op_nv + .db "?14",op_nv + .db "ORA",op_zx + .db "ASL",op_zx + .db "?17",op_nv + .db "CLC",op_s + .db "ORA",op_y + .db "?1A",op_nv + .db "?1B",op_nv + .db "?1C",op_nv + .db "ORA",op_x + .db "ASL",op_x + .db "?1F",op_nv + + .db "JSR",op_a + .db "AND",op_zxi + .db "?22",op_nv + .db "?23",op_nv + .db "BIT",op_z + .db "AND",op_z + .db "ROL",op_z + .db "?27",op_nv + .db "PLP",op_s + .db "AND",op_m + .db "ROL",op_sa + .db "?2B",op_nv + .db "BIT",op_a + .db "AND",op_a + .db "ROL",op_a + .db "?2F",op_nv + + .db "BMI",op_r + .db "AND",op_ziy + .db "?32",op_nv + .db "?33",op_nv + .db "?34",op_nv + .db "AND",op_zx + .db "ROL",op_zx + .db "?37",op_nv + .db "SEC",op_s + .db "AND",op_y + .db "?3A",op_nv + .db "?3B",op_nv + .db "?3C",op_nv + .db "AND",op_x + .db "ROL",op_x + .db "?3F",op_nv + + .db "RTI",op_s + .db "EOR",op_zxi + .db "?42",op_nv + .db "?43",op_nv + .db "?44",op_nv + .db "EOR",op_z + .db "LSR",op_z + .db "?47",op_nv + .db "PHA",op_s + .db "EOR",op_m + .db "LSR",op_sa + .db "?4B",op_nv + .db "JMP",op_a + .db "EOR",op_a + .db "LSR",op_a + .db "?4F",op_nv + + .db "BVC",op_r + .db "EOR",op_ziy + .db "?52",op_nv + .db "?53",op_nv + .db "?54",op_nv + .db "EOR",op_zx + .db "LSR",op_zx + .db "?57",op_nv + .db "CLI",op_s + .db "EOR",op_y + .db "?5A",op_nv + .db "?5B",op_nv + .db "?5C",op_nv + .db "EOR",op_x + .db "LSR",op_x + .db "?5F",op_nv + + .db "RTS",op_s + .db "ADC",op_zxi + .db "?62",op_nv + .db "?63",op_nv + .db "?64",op_nv + .db "ADC",op_z + .db "ROR",op_z + .db "?67",op_nv + .db "PLA",op_s + .db "ADC",op_m + .db "ROR",op_sa + .db "?6B",op_nv + .db "JMP",op_i + .db "ADC",op_a + .db "ROR",op_a + .db "?6F",op_nv + + .db "BVS",op_r + .db "ADC",op_ziy + .db "?72",op_nv + .db "?73",op_nv + .db "?74",op_nv + .db "ADC",op_zx + .db "ROR",op_zx + .db "?77",op_nv + .db "SEI",op_s + .db "ADC",op_y + .db "?7A",op_nv + .db "?7B",op_nv + .db "?7C",op_nv + .db "ADC",op_x + .db "ROR",op_x + .db "?7F",op_nv + + .db "?80",op_nv + .db "STA",op_zxi + .db "?82",op_nv + .db "?83",op_nv + .db "STY",op_z + .db "STA",op_z + .db "STX",op_z + .db "?87",op_nv + .db "DEY",op_s + .db "?89",op_nv + .db "TXA",op_s + .db "?8B",op_nv + .db "STY",op_a + .db "STA",op_a + .db "STX",op_a + .db "?8F",op_nv + + .db "BCC",op_r + .db "STA",op_ziy + .db "?92",op_nv + .db "?93",op_nv + .db "STY",op_zx + .db "STA",op_zx + .db "STX",op_zy + .db "?97",op_nv + .db "TYA",op_s + .db "STA",op_y + .db "TXS",op_s + .db "?9B",op_nv + .db "?9C",op_nv + .db "STA",op_x + .db "?9E",op_nv + .db "?9F",op_nv + + .db "LDY",op_m + .db "LDA",op_zxi + .db "LDX",op_m + .db "?A3",op_nv + .db "LDY",op_z + .db "LDA",op_z + .db "LDX",op_z + .db "?A7",op_nv + .db "TAY",op_s + .db "LDA",op_m + .db "TAX",op_s + .db "?AB",op_nv + .db "LDY",op_a + .db "LDA",op_a + .db "LDX",op_a + .db "?AF",op_nv + + .db "BCS",op_r + .db "LDA",op_ziy + .db "?B2",op_nv + .db "?B3",op_nv + .db "LDY",op_zx + .db "LDA",op_zx + .db "LDX",op_zy + .db "?B7",op_nv + .db "CLV",op_s + .db "LDA",op_y + .db "TSX",op_s + .db "?BB",op_nv + .db "LDY",op_x + .db "LDA",op_x + .db "LDX",op_y + .db "?BF",op_nv + + .db "CPY",op_m + .db "CMP",op_zxi + .db "?C2",op_nv + .db "?C3",op_nv + .db "CPY",op_z + .db "CMP",op_z + .db "DEC",op_z + .db "?C7",op_nv + .db "INY",op_s + .db "CMP",op_m + .db "DEX",op_s + .db "?CB",op_nv + .db "CPY",op_a + .db "CMP",op_a + .db "DEC",op_a + .db "?CF",op_nv + + .db "BNE",op_r + .db "CMP",op_ziy + .db "?D2",op_nv + .db "?D3",op_nv + .db "?D4",op_nv + .db "CMP",op_zx + .db "DEC",op_zx + .db "?D7",op_nv + .db "CLD",op_s + .db "CMP",op_y + .db "?DA",op_nv + .db "?DB",op_nv + .db "?DC",op_nv + .db "CMP",op_x + .db "DEC",op_x + .db "?DF",op_nv + + .db "CPX",op_m + .db "SBC",op_zxi + .db "?E2",op_nv + .db "?E3",op_nv + .db "CPX",op_z + .db "SBC",op_z + .db "INC",op_z + .db "?E7",op_nv + .db "INX",op_s + .db "SBC",op_m + .db "NOP",op_s + .db "?EB",op_nv + .db "CPX",op_a + .db "SBC",op_a + .db "INC",op_a + .db "?EF",op_nv + + .db "BEQ",op_r + .db "SBC",op_ziy + .db "?F2",op_nv + .db "?F3",op_nv + .db "?F4",op_nv + .db "SBC",op_zx + .db "INC",op_zx + .db "?F7",op_nv + .db "SED",op_s + .db "SBC",op_y + .db "?FA",op_nv + .db "?FB",op_nv + .db "?FC",op_nv + .db "SBC",op_x + .db "INC",op_x + .db "?FF",op_nv + +;***************************************************************** +; +; 6 5 0 2 e m u l a t i o n m a c r o s +; +;***************************************************************** + +; +; op_decode +; +; opcode fetch and decode, prefetch low operand +.macro op_decode + out abuslo,pcl ;opcode fetch + out abushi,pch + sei ;allow emulation INT, NMI + adiw pch:pcl,1 ;pc -> op low + cli + wait_data_valid 4 ;240 minimum @ 16MHz + in opcode,dbusin + + out abuslo,pcl ;operand address low prefetch + out abushi,pch + wait_data_valid 6 ;360ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode +.endmacro + +;op decode after single, opcode already fetched +.macro op_decode_single + sei ;allow emulation INT, NMI + out abuslo,pcl ;operand address low prefetch + cli + out abushi,pch + wait_data_valid 6 ;360ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode +.endmacro + +; address generate relative +.macro adgen_r + rjmp no_branch ;condition false + in operand,dbusin + clr a ;expand sign bit + sbrc operand,7 ;negative? + dec a + add pcl,operand ;set new PC + adc pch,a +no_branch: op_decode +.endmacro + +; address generate absolute +.macro adgen_a + in oplow,dbusin + out abuslo,pcl ;operand high address fetch + out abushi,pch + adiw pch:pcl,1 ;pc -> next instruction + cbr flags,(1< next instruction + cbr flags,(1< next instruction + cbr flags,(1<----> + bld stat,2 ;-----N-- + + andi stat2,0b1101100 ;-V1BDI-- (Break cleared) + ori stat2,0b0100000 ; ^=1 (set unused) + + op_decode_single ;next instruction + +; opcode: ROL A +ROL_s: in opcode,dbusin ;next opcode + + out sreg,stat ;get C + rol rega ;AVR emulated OP + in stat,sreg ;save NZC + + op_decode_single ;next instruction + +; opcode: ROR A +ROR_s: in opcode,dbusin ;next opcode + + out sreg,stat ;get C + ror rega ;AVR emulated OP + in stat,sreg ;save NZC + + op_decode_single ;next instruction + +; opcode: SEC +SEC_s: in opcode,dbusin ;next opcode + + sbr stat,1 ;AVR emulated OP + + op_decode_single ;next instruction + +; opcode: SED +SED_s: in opcode,dbusin ;next opcode + + sbr stat2,0b1000 ;AVR emulated OP + + op_decode_single ;next instruction + +; opcode: SEI +SEI_s: in opcode,dbusin ;next opcode + + sbr stat2,0b100 ;AVR emulated OP + ldi a,IRQ_dis ;only NMI stays enabled + out ibus,a + .ifdef irq_dis_real ;+3 + out timsk,one ;only TOV0 (single step) stays enabled + ldi a,0b11000 ;no USART interrupts, only RX & TX enable + out ucsrb,a + .endif + + op_decode_single ;next instruction + +; opcode: TAX +TAX_s: in opcode,dbusin ;next opcode + + mov regx,rega ;AVR emulated OP + flags_gen_nz regx + + op_decode_single ;next instruction + +; opcode: TAY +TAY_s: in opcode,dbusin ;next opcode + + mov regy,rega ;AVR emulated OP + flags_gen_nz regy + + op_decode_single ;next instruction + +; opcode: TSX +TSX_s: in opcode,dbusin ;next opcode + + mov regx,spointer ;AVR emulated OP + flags_gen_nz regx + + op_decode_single ;next instruction + +; opcode: TXA +TXA_s: in opcode,dbusin ;next opcode + + mov rega,regx ;AVR emulated OP + flags_gen_nz rega + + op_decode_single ;next instruction + +; opcode: TXS +TXS_s: in opcode,dbusin ;next opcode + + mov spointer,regx ;AVR emulated OP + ;flags are not changed + + op_decode_single ;next instruction + +; opcode: TYA +TYA_s: in opcode,dbusin ;next opcode + + mov rega,regy ;AVR emulated OP + flags_gen_nz rega + + op_decode_single ;next instruction + +;***************************************************************** +; +; Program counter +; instructions modifying the PC +; +;***************************************************************** + +; opcode: BCC +BCC_r: sbrc stat,0 + adgen_r ;branch if skip + +; opcode: BCS +BCS_r: sbrs stat,0 + adgen_r ;branch if skip + +; opcode: BEQ +BEQ_r: sbrs stat,1 + adgen_r ;branch if skip + +; opcode: BMI +BMI_r: sbrs stat,2 + adgen_r ;branch if skip + +; opcode: BNE +BNE_r: sbrc stat,1 + adgen_r ;branch if skip + +; opcode: BPL +BPL_r: sbrc stat,2 + adgen_r ;branch if skip + +; opcode: BVC +BVC_r: sbrc stat2,6 + adgen_r ;branch if skip + +; opcode: BVS +BVS_r: sbrs stat2,6 + adgen_r ;branch if skip + +; opcode: JMP +JMP_i: in oplow,dbusin ;save low pointer to pc + out abuslo,pcl ;fetch high pointer to pc + out abushi,pch + mov pcl,oplow + wait_data_valid 1 ;60ns minimum @ 16MHz + in pch,dbusin ;point to new pc + + out abuslo,pcl ;fetch pc low + out abushi,pch + adiw pch:pcl,1 + wait_data_valid 2 ;120ns minimum @ 16MHz + +JMP_a: in oplow,dbusin ;save pc low + out abuslo,pcl ;fetch pc high + out abushi,pch + mov pcl,oplow + wait_data_valid 1 ;60ns minimum @ 16MHz + in pch,dbusin ;load new pc + + op_decode ;next instruction + +; opcode: JSR +JSR_a: in oplow,dbusin ;save new PC as operand address + out abuslo,pcl ;new PC high fetch + out abushi,pch + ;pc++ skipped + wait_data_valid 0 ;0ns minimum @ 16MHz + in ophigh,dbusin + + out abuslo,spointer ;push pch + out abushi,one + dec spointer + out cbus,writemem ;WE, ~OE + out dbusout,pch ;precharge write + out dbusddr,allon ;output data valid + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + + out abuslo,spointer ;push pcl + dec spointer + out cbus,writemem ;WE + out dbusout,pcl ;precharge write + out cbus,clear ;~WE / write cycle ends 120ns/16MHz + out dbusddr,zero ;data hold ends after 60ns + out cbus,readmem ;OE / read mode back on + + movw pcl,oplow ;load new PC + + op_decode ;next instruction + +; opcode: RTS +RTS_s: inc spointer + out abuslo,spointer ;pull pcl + out abushi,one + inc spointer + wait_data_valid 1 ;60ns minimum @ 16MHz + in pcl,dbusin + out abuslo,spointer ;pull pch + wait_data_valid 0 ;0ns minimum @ 16MHz + in pch,dbusin + adiw pch:pcl,1 ;point to next instruction + + op_decode ;next instruction + +; opcode: RTI +RTI_s: inc spointer + out abuslo,spointer ;pull status + out abushi,one + inc spointer + wait_data_valid 1 ;60ns minimum @ 16MHz + in stat2,dbusin + out abuslo,spointer ;pull pcl + inc spointer + ;status restore while we are waiting for data + IRQ_restore + mov stat,stat2 ;restore AVR format + wait_data_valid 6 ;360ns minimum @ 16MHz + in pcl,dbusin + out abuslo,spointer ;pull pch + ;status restore while we are waiting for data + andi stat,0b11 ;------ZC + bst stat2,7 ;>----> + bld stat,2 ;-----N-- + andi stat2,0b1101100 ;-V1BDI-- (Break cleared) + ori stat2,0b0100000 ; ^=1 (set unused) + wait_data_valid 5 ;300ns minimum @ 16MHz + in pch,dbusin + + op_decode ;next instruction + +; opcode: BRK +BRK_s: ;save new PC as operand address + out abuslo,allon ;new PC high fetch from irq vector + out abushi,allon + ldi zl,0xfe ;preload vector low + ldi a,IRQ_dis + out ibus,a + .ifdef irq_dis_real ;+3 + out timsk,one ;only TOV0 (single step) stays enabled + ldi a,0b11000 ;no USART interrupts, only RX & TX enable + out ucsrb,a + .endif + ;status merge while we are waiting for data + mov a,stat ;merge status in 6502 format + andi a,0b11 ;------ZC + wait_data_valid 5 ;300ns minimum @ 16MHz + in ophigh,dbusin + out abuslo,zl ;new PC low fetch from irq vector + ;status merge while we are waiting for data + bst stat,2 ;<----< + bld a,7 ;N------- + or a,stat2 ;-V1BDI-- + sbr a,0b110000 ; ^^=1 (pushed by Break) + sbr stat2,0b100 ;I=1 (IRQ disabled) + wait_data_valid 5 ;300ns minimum @ 16MHz + in oplow,dbusin + + out abuslo,spointer ;push pch + out abushi,one + dec spointer + out cbus,writemem ;WE, ~OE + out dbusout,pch ;precharge write + out dbusddr,allon ;output data valid + out cbus,clear ;~WE / write cycle ends 180ns/16MHz + + out abuslo,spointer ;push pcl + dec spointer + out cbus,writemem ;WE + out dbusout,pcl ;write + out cbus,clear ;~WE / write cycle ends 120ns/16MHz + + out abuslo,spointer ;push status + dec spointer + out cbus,writemem ;WE + out dbusout,a ;write + out cbus,clear ;~WE / write cycle ends 120ns/16MHz + out dbusddr,zero ;data hold ends after 60ns + out cbus,readmem ;OE / read mode back on + + movw pcl,oplow ;load new PC + + op_decode ;next instruction + + +; +; instruction decode vector table +; + align 8 ;align to page boundary + +oc_tab: rjmp BRK_s ;0x00 + rjmp ORA_zxi + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp ORA_z + rjmp ASL_z + rjmp illegalop + rjmp PHP_s + rjmp ORA_m + rjmp ASL_s + rjmp illegalop + rjmp illegalop + rjmp ORA_a + rjmp ASL_a + rjmp illegalop + rjmp BPL_r ;0x10 + rjmp ORA_ziy + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp ORA_zx + rjmp ASL_zx + rjmp illegalop + rjmp CLC_s + rjmp ORA_y + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp ORA_x + rjmp ASL_x + rjmp illegalop + rjmp JSR_a ;0x20 + rjmp AND_zxi + rjmp illegalop + rjmp illegalop + rjmp BIT_z + rjmp AND_z + rjmp ROL_z + rjmp illegalop + rjmp PLP_s + rjmp AND_m + rjmp ROL_s + rjmp illegalop + rjmp BIT_a + rjmp AND_a + rjmp ROL_a + rjmp illegalop + rjmp BMI_r ;0x30 + rjmp AND_ziy + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp AND_zx + rjmp ROL_zx + rjmp illegalop + rjmp SEC_s + rjmp AND_y + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp AND_x + rjmp ROL_x + rjmp illegalop + rjmp RTI_s ;0x40 + rjmp EOR_zxi + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp EOR_z + rjmp LSR_z + rjmp illegalop + rjmp PHA_s + rjmp EOR_m + rjmp LSR_s + rjmp illegalop + rjmp JMP_a + rjmp EOR_a + rjmp LSR_a + rjmp illegalop + rjmp BVC_r ;0x50 + rjmp EOR_ziy + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp EOR_zx + rjmp LSR_zx + rjmp illegalop + rjmp CLI_s + rjmp EOR_y + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp EOR_x + rjmp LSR_x + rjmp illegalop + rjmp RTS_s ;0x60 + rjmp ADC_zxi + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp ADC_z + rjmp ROR_z + rjmp illegalop + rjmp PLA_s + rjmp ADC_m + rjmp ROR_s + rjmp illegalop + rjmp JMP_i + rjmp ADC_a + rjmp ROR_a + rjmp illegalop + rjmp BVS_r ;0x70 + rjmp ADC_ziy + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp ADC_zx + rjmp ROR_zx + rjmp illegalop + rjmp SEI_s + rjmp ADC_y + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp ADC_x + rjmp ROR_x + rjmp illegalop + rjmp illegalop ;0x80 + rjmp STA_zxi + rjmp illegalop + rjmp illegalop + rjmp STY_z + rjmp STA_z + rjmp STX_z + rjmp illegalop + rjmp DEY_s + rjmp illegalop + rjmp TXA_s + rjmp illegalop + rjmp STY_a + rjmp STA_a + rjmp STX_a + rjmp illegalop + rjmp BCC_r ;0x90 + rjmp STA_ziy + rjmp illegalop + rjmp illegalop + rjmp STY_zx + rjmp STA_zx + rjmp STX_zy + rjmp illegalop + rjmp TYA_s + rjmp STA_y + rjmp TXS_s + rjmp illegalop + rjmp illegalop + rjmp STA_x + rjmp illegalop + rjmp illegalop + rjmp LDY_m ;0xa0 + rjmp LDA_zxi + rjmp LDX_m + rjmp illegalop + rjmp LDY_z + rjmp LDA_z + rjmp LDX_z + rjmp illegalop + rjmp TAY_s + rjmp LDA_m + rjmp TAX_s + rjmp illegalop + rjmp LDY_a + rjmp LDA_a + rjmp LDX_a + rjmp illegalop + rjmp BCS_r ;0xb0 + rjmp LDA_ziy + rjmp illegalop + rjmp illegalop + rjmp LDY_zx + rjmp LDA_zx + rjmp LDX_zy + rjmp illegalop + rjmp CLV_s + rjmp LDA_y + rjmp TSX_s + rjmp illegalop + rjmp LDY_x + rjmp LDA_x + rjmp LDX_y + rjmp illegalop + rjmp CPY_m ;0xc0 + rjmp CMP_zxi + rjmp illegalop + rjmp illegalop + rjmp CPY_z + rjmp CMP_z + rjmp DEC_z + rjmp illegalop + rjmp INY_s + rjmp CMP_m + rjmp DEX_s + rjmp illegalop + rjmp CPY_a + rjmp CMP_a + rjmp DEC_a + rjmp illegalop + rjmp BNE_r ;0xd0 + rjmp CMP_ziy + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp CMP_zx + rjmp DEC_zx + rjmp illegalop + rjmp CLD_s + rjmp CMP_y + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp CMP_x + rjmp DEC_x + rjmp illegalop + rjmp CPX_m ;0xe0 + rjmp SBC_zxi + rjmp illegalop + rjmp illegalop + rjmp CPX_z + rjmp SBC_z + rjmp INC_z + rjmp illegalop + rjmp INX_s + rjmp SBC_m + rjmp NOP_s + rjmp illegalop + rjmp CPX_a + rjmp SBC_a + rjmp INC_a + rjmp illegalop + rjmp BEQ_r ;0xf0 + rjmp SBC_ziy + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp SBC_zx + rjmp INC_zx + rjmp illegalop + rjmp SED_s + rjmp SBC_y + rjmp illegalop + rjmp illegalop + rjmp illegalop + rjmp SBC_x + rjmp INC_x + rjmp illegalop +;***************************************************************** +; +; Exceptions +; +;***************************************************************** + +; illegal opcode +illegalop: + jmp deb_inv_op ;extension + +; indirect addresspointer exceeded end of zeropage - NOT IMPLEMENTED +;zp_wrap: rjmp zp_wrap ;diag will be added later + +; stackpointer exceeded end of stackpage - NOT IMPLEMENTED! +; sp_wrap: rjmp sp_wrap ;diag will be added later + +; attempt to write to protected romspace - NOT implemented +;rom_wrt: rjmp rom_wrt ;diag will be added later + +;***************************************************************** +; +; Memory read instructions +; Load, arithmetic & logical +; +;***************************************************************** + +; opcode: ADC + adgen_x ADC_ ;abs,X + adgen_y ADC_ ;abs,Y + adgen_zxi ADC_ ;(ZP,X) indexed indirect + adgen_ziy ADC_ ;(ZP),Y indirect indexed + adgen_zx ADC_ ;ZP,X + adgen_z ADC_ ;ZP absolute +ADC_a: adgen_a ;absolute + +ADC_o: op_fetch ;common entry after address generate +ADC_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + sbrc stat2,3 ;test decimal flag + rjmp ADC_d + out sreg,stat ;get C + adc rega,operand ;AVR emulated OP + in stat,sreg ;save NZC + bst stat,3 ;save V + bld stat2,6 + +ADC_d3: op_decode ;next instruction + +ADC_d: addi rega,0x66 ;decimal correction + out sreg,stat + adc rega,operand + in stat,sreg + brcs ADC_d2 ;MSD + subi rega,0x60 + out sreg,stat +ADC_d2: brhs ADC_d3 ;LSD + subi rega,0x06 + rjmp ADC_d3 + +; opcode: AND + adgen_x AND_ ;abs,X + adgen_y AND_ ;abs,Y + adgen_zxi AND_ ;(ZP,X) indexed indirect + adgen_ziy AND_ ;(ZP),Y indirect indexed + adgen_zx AND_ ;ZP,X + adgen_z AND_ ;ZP absolute +AND_a: adgen_a ;absolute + +AND_o: op_fetch ;common entry after address generate +AND_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + and rega,operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + op_decode ;next instruction + +; opcode: BIT + adgen_z BIT_ ;ZP absolute +BIT_a: adgen_a ;absolute + +BIT_o: op_fetch ;common entry after address generate +BIT_m: in operand,dbusin + + mov a,rega ;keep A + out sreg,stat ;keep C + and a,operand ;A & M -> Z + in stat,sreg + bst operand,6 ;M6 -> V + bld stat2,6 + bst operand,7 ;M7 -> N + bld stat,2 + + op_decode ;next instruction + +; opcode: CMP +; a compare in a 6502 works with reversed carry opposed to an AVR +; the reason: a 6502 performs an add with complemented operand as a compare + adgen_x CMP_ ;abs,X + adgen_y CMP_ ;abs,Y + adgen_zxi CMP_ ;(ZP,X) indexed indirect + adgen_ziy CMP_ ;(ZP),Y indirect indexed + adgen_zx CMP_ ;ZP,X + adgen_z CMP_ ;ZP absolute +CMP_a: adgen_a ;absolute + +CMP_o: op_fetch ;common entry after address generate +CMP_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + cp rega,operand ;AVR emulated OP + in stat,sreg ;save NZC + eor stat,one ;invert C + + op_decode ;next instruction + +; opcode: CPX +; a compare in a 6502 works with reversed carry opposed to an AVR +; the reason: a 6502 performs an add with complemented operand as a compare + adgen_z CPX_ ;ZP absolute +CPX_a: adgen_a ;absolute + +CPX_o: op_fetch ;common entry after address generate +CPX_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + cp regx,operand ;AVR emulated OP + in stat,sreg ;save NZC + eor stat,one ;invert C + + op_decode ;next instruction + +; opcode: CPY +; a compare in a 6502 works with reversed carry opposed to an AVR +; the reason: a 6502 performs an add with complemented operand as a compare + adgen_z CPY_ ;ZP absolute +CPY_a: adgen_a ;absolute + +CPY_o: op_fetch ;common entry after address generate +CPY_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + cp regy,operand ;AVR emulated OP + in stat,sreg ;save NZC + eor stat,one ;invert C + + op_decode ;next instruction + +; opcode: EOR + adgen_x EOR_ ;abs,X + adgen_y EOR_ ;abs,Y + adgen_zxi EOR_ ;(ZP,X) indexed indirect + adgen_ziy EOR_ ;(ZP),Y indirect indexed + adgen_zx EOR_ ;ZP,X + adgen_z EOR_ ;ZP absolute +EOR_a: adgen_a ;absolute + +EOR_o: op_fetch ;common entry after address generate +EOR_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + eor rega,operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + op_decode ;next instruction + +; opcode: LDA + adgen_x LDA_ ;abs,X + adgen_y LDA_ ;abs,Y + adgen_zxi LDA_ ;(ZP,X) indexed indirect + adgen_ziy LDA_ ;(ZP),Y indirect indexed + adgen_zx LDA_ ;ZP,X + adgen_z LDA_ ;ZP absolute +LDA_a: adgen_a ;absolute + +LDA_o: reg_fetch rega ;common entry after address generate +LDA_m: in rega,dbusin ;same for immediate + + flags_gen_nz rega + + op_decode ;next instruction + +; opcode: LDX + adgen_y LDX_ ;abs,Y + adgen_zy LDX_ ;ZP,Y + adgen_z LDX_ ;ZP absolute +LDX_a: adgen_a ;absolute + +LDX_o: reg_fetch regx ;common entry after address generate +LDX_m: in regx,dbusin ;same for immediate + + flags_gen_nz regx + + op_decode ;next instruction + +; opcode: LDY + adgen_x LDY_ ;abs,X + adgen_zx LDY_ ;ZP,X + adgen_z LDY_ ;ZP absolute +LDY_a: adgen_a ;absolute + +LDY_o: reg_fetch regy ;common entry after address generate +LDY_m: in regy,dbusin ;same for immediate + + flags_gen_nz regy + + op_decode ;next instruction + +; opcode: ORA + adgen_x ORA_ ;abs,X + adgen_y ORA_ ;abs,Y + adgen_zxi ORA_ ;(ZP,X) indexed indirect + adgen_ziy ORA_ ;(ZP),Y indirect indexed + adgen_zx ORA_ ;ZP,X + adgen_z ORA_ ;ZP absolute +ORA_a: adgen_a ;absolute + +ORA_o: op_fetch ;common entry after address generate +ORA_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + or rega,operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + op_decode ;next instruction + +; opcode: SBC +; subtraction in a 6502 works with reversed carry, borrow = !carry +; the reason: a 6502 performs an add with complemented operand during subtract + adgen_x SBC_ ;abs,X + adgen_y SBC_ ;abs,Y + adgen_zxi SBC_ ;(ZP,X) indexed indirect + adgen_ziy SBC_ ;(ZP),Y indirect indexed + adgen_zx SBC_ ;ZP,X + adgen_z SBC_ ;ZP absolute +SBC_a: adgen_a ;absolute + +SBC_o: op_fetch ;common entry after address generate +SBC_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + + com operand + out sreg,stat ;get C + adc rega,operand ;AVR emulated OP + in stat,sreg ;save NZC + bst stat,3 ;save V + bld stat2,6 + + sbrs stat2,3 ;test decimal flag + rjmp SBC_d ;skip decimal mode correction + + brcs SBC_d2 ;MSD correction + subi rega,0x60 + out sreg,stat +SBC_d2: brhs SBC_d ;LSD correction + subi rega,0x06 + +SBC_d: op_decode ;next instruction + + +;***************************************************************** +; +; Modify memory instructions +; Shift, increment & decrement +; +;***************************************************************** + +; opcode: ASL + adgen_x ASL_ ;abs,X + adgen_zx ASL_ ;ZP,X + adgen_z ASL_ ;ZP absolute +ASL_a: adgen_a ;absolute + +ASL_o: op_fetch_modify ;common entry after address generate +ASL_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + lsl operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: LSR + adgen_x LSR_ ;abs,X + adgen_zx LSR_ ;ZP,X + adgen_z LSR_ ;ZP absolute +LSR_a: adgen_a ;absolute + +LSR_o: op_fetch_modify ;common entry after address generate +LSR_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + lsr operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: ROL + adgen_x ROL_ ;abs,X + adgen_zx ROL_ ;ZP,X + adgen_z ROL_ ;ZP absolute +ROL_a: adgen_a ;absolute + +ROL_o: op_fetch_modify ;common entry after address generate +ROL_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;get C + rol operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: ROR + adgen_x ROR_ ;abs,X + adgen_zx ROR_ ;ZP,X + adgen_z ROR_ ;ZP absolute +ROR_a: adgen_a ;absolute + +ROR_o: op_fetch_modify ;common entry after address generate +ROR_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;get C + ror operand ;AVR emulated OP + in stat,sreg ;save NZC + + store_modify + +; opcode: DEC + adgen_x DEC_ ;abs,X + adgen_zx DEC_ ;ZP,X + adgen_z DEC_ ;ZP absolute +DEC_a: adgen_a ;absolute + +DEC_o: op_fetch_modify ;common entry after address generate +DEC_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + dec operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + store_modify + +; opcode: INC + adgen_x INC_ ;abs,X + adgen_zx INC_ ;ZP,X + adgen_z INC_ ;ZP absolute +INC_a: adgen_a ;absolute + +INC_o: op_fetch_modify ;common entry after address generate +INC_m: in operand,dbusin ;operand prefetched (z, zx, zy) + + out sreg,stat ;keep C + inc operand ;AVR emulated OP + in stat,sreg ;save NZ, keep C + + store_modify + +;***************************************************************** +; +; Memory write instructions +; Store register +; +;***************************************************************** + +; opcode: STA + adgen_x STA_ ;abs,X + adgen_y STA_ ;abs,Y + adgen_zxi STA_ ;(ZP,X) indexed indirect + adgen_ziy STA_ ;(ZP),Y indirect indexed + adgen_zx STA_ ;ZP,X + adgen_z STA_ ;ZP absolute +STA_a: adgen_a ;absolute + +STA_o: store_reg rega,STA_m ;common entry after address generate + +; opcode: STX + adgen_zy STX_ ;ZP,y + adgen_z STX_ ;ZP absolute +STX_a: adgen_a ;absolute + +STX_o: store_reg regx,STX_m ;common entry after address generate + +; opcode: STY + adgen_s_zx STY_ ;ZP,x + adgen_s_z STY_ ;ZP absolute +STY_a: adgen_a ;absolute + +STY_o: store_reg regy,STY_m ;common entry after address generate + diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_config.inc b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_config.inc new file mode 100644 index 00000000..8eefd053 --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_Emu_config.inc @@ -0,0 +1,387 @@ +.if config_part == 1 ;invoked from 6502_Emu.asm + +;********************************************************************* +; +; 6502 Emulator Configuration +; +; This file should preserve your personal configuration when upgrading +; the source code. +; +;********************************************************************* +.set config_version = 831 + +;ATMega platform - ATMega16 or ATMega32 +; ATMega32 may be required due to flash size for configured features +.IFNDEF SIGNATURE_000 ;not already defined per default device in Atmel Studio >4 + .NOLIST + ;.INCLUDE "m16def.inc" + .INCLUDE "m32def.inc" + .LIST +.ENDIF + +;AVR clock speed +.equ Osc_Hz = 16000000 ;16 MHz + +;external SRAM waittime between applying address and data stable +.set data_valid_ns = 180 +; the time is calculated as follows: +; RAM access time + AVR input sync latch (1/2 clock) +; + input & output propagation delay (~ 2 * 15ns) +; for a 62256-80 on an AVR at 16MHz: 80 + 62,5 / 2 + 15 + 15 +; only change if RAM is slower than 120ns +; in most cases at least 3 waitcycles are used for housekeeping anyway + +;Baudrate +.equ BAUD = 38400 ;maximum standard rate with <1% deviation @ 16MHz + +;RS232 software flow control watermarks, disabled if undefined +; the buffer max is 255 bytes +; RX only to prevent overruning applications input capacity +.equ flowlo = 128 ;low watermark, send XON if less buffer used +.equ flowhi = 192 ;high watermark, send XOFF if reached + +;select emulator core CMOS 65C02, NMOS 6502 if undefined +;.equ cmos_core = 1 + +;interrupt disable mode real, virtual if undefined +;.equ irq_dis_real = 1 +; virtual = background interrupts always allowed = always full control, +; no atomic timing for disabled instruction sequence. +; real = absolutely no interrupts allowed when disabled except single step and NMI, +; program must not have extended disable periods, atomic timing is enforced, +; reset button mandatory to recover the monitor/debugger when I bit remains set. + +;ROM load & write protect page boundary - RAM at this page and above is write protected +;adds 2 cycles (125ns) to instructions writing to memory (stores & modifying memory) +;.equ rommap = 0xc0 + +;**** IO **** +;internal IO access page (RS232, Timers, Latches) - disabled if undefined +.equ iomap = 0xbf +; Can be configured overlapping ROM-space if no operand fetch from the same page +; is required. Instruction fetch including immediate operands will always be +; served from RAM (used as peudo-ROM) - writes and reads of nonimmediate operands +; will be to and from IO-space. +; setting iomap to page zero is not allowed. + +; enable phi2 output on portd7, disabled if undefined +; required to drive 65xx IO chips +.equ phi2_ena = 1 + +; enable NMI input on portd2, disabled if undefined +;.ifndef irq_dis_real + .equ nmi_ena = 1 +;.endif + +;**** IO select expansion registers **** +;define inactive values of IO-select pins on IO-select expansion registers +;defines the opposite value as strobe polarity for each IO select pin + +.equ ios1_default = 0b10000001 ;IO select pin 1 expansion default +;io select bits 10 = -74HC573 input latch +; 11 = 74HC573 output latch +; 12 = HD44780 compatible character LCD +; 13 = 65xx IO +; 14 = I2C connect (74hc4066) +; 15 = XMEM select +; 16 = SPI select +; 17 = -IO reset + +.ifndef phi2_ena ;not available if phi2 uses cbus pin 7 + ;.equ ios2_default = 0b00000000 ;IO select pin 2 expansion default + ;io select bits 20 = + ; 21 = + ; 22 = + ; 23 = + ; 24 = + ; 25 = + ; 26 = + ; 27 = +.endif + +.ifndef nmi_ena ;not available if NMI uses cbus pin 2 + ;.equ ios3_default = 0b00000000 ;IO select pin 3 expansion default + ;io select bits 30 = + ; 31 = + ; 32 = + ; 33 = + ; 34 = + ; 35 = + ; 36 = + ; 37 = +.endif + +;**** IO select for builtin modules **** +; enable SPI module and define IO select signal for SPI, disabled if undefined +.equ spi_sel = 16 ;IO select register 1, pin 6 + +; enable I2C module and define IO select signal for I2C, disabled if undefined +.equ i2c_sel = 14 ;IO select register 1, pin 4 + +; enable LCD module and define IO select signal for LCD, disabled if undefined +.equ lcd_sel = 12 ;IO select register 1, pin 2 + +; IO selects of the addon IO modules in part 2 of the configuration + +;**** SPI software address translation **** +;translate IO-address to slave select +;reset state, must be defined +.equ spi_idle = 0b11111 ;all slaves inactive +;.equ spi_idle = 0xf ;unused address for hardware translation +;SS bit 0 = -SD card +;SS bit 1 = -74HC165 parallel input shifter +;SS bit 2 = -74HC595 parallel output shifter +;SS bit 3 = -25LC512 SPI EEPROM 64kB +;SS bit 4 = -unused + +;enable spi virtual address translation, disabled if undefined +.equ spi_vat = 1 + +;oplow BCD to SS pin table +.macro spi_virt_ss +; x0 = SD card on bit0 (-cs) & bit4 (+oe) +; x1 = 74HC165 on bit1 (-sh/+ld -oe) + .db 0b00001^spi_idle,0b00010^spi_idle +; x2 = 74HC595 on bit2 (+rck) +; x3 = 25LC512 EEPROM on bit 3 (-cs) +; .db 0b00100^spi_idle,0b01000^spi_idle + .db 0b00100^spi_idle,spi_idle ;EEPROM masked +; x4 unused +; x5 inactive + .db 0b10000^spi_idle,spi_idle +; x6 inactive +; x7 inactive + .db spi_idle,spi_idle +.endmacro + +;**** IO resets **** +;a reset pin can be defined and must reside on an IO-select expansion register +;this pin is strobed low during reset if defined +.equ io_reset_pin = 17 + +;definition for io modules with a reset vector +.macro io_modules_reset + rcall ltch_rs ;reset 74HC573 +.endmacro + +;**** miscelaneous **** +;64kB serial EEPROM reserved for non volatile program storage +;eep_adr >= 8 = I2C slave adr.; eep_adr < 8 = SPI device adr. +;none if undefined +;.equ eep_adr = 0xa0 ;I2C EEPROM +.equ eep_adr = 3 ;SPI EEPROM + +; self diag register enable, allow force IRQ, NMI, RESET +; should stay undefined to prevent you from shooting yourself in the foot +.equ ena_diag = 1 + +.endif +.if config_part == 2 ;invoked from 6502_Emu_IO.inc + +;************************************************************** +; +; I/O address decode tables +; assign internal or external IO modules +; +;************************************************************** + + align 4 ;keep each table on same page + +; I/O address table, reserve 0x10 addresses at a time +; larger chunks can be defined by pointing sequential addresses +; to the same entry point +; read address table +ior_tab: + rjmp ir_exit ;0x + rjmp ir_exit ;1x + rjmp ir_exit ;2x + rjmp ir_exit ;3x + rjmp ir_exit ;4x + rjmp ir_exit ;5x + rjmp ir_exit ;6x + rjmp ir_exit ;7x + rjmp ir_exit ;8x + rjmp spr_data ;9x SPI data register + rjmp io65xx_rd ;Ax 65xx IO chip RAM + rjmp io65xx_rd ;Bx 65xx IO chip + rjmp ltch_rd ;Cx 74HC573 latch(es) + rjmp lcd_rd ;Dx character LCD + rjmp iorE0 ;Ex - subdecoded 0xe0 - 0xef + rjmp iordreg ;Fx - internal emulated registers + +; write address table +iow_tab: + rjmp iw_exit ;0x + rjmp iw_exit ;1x + rjmp iw_exit ;2x + rjmp iw_exit ;3x + rjmp iw_exit ;4x + rjmp iw_exit ;5x + rjmp iw_exit ;6x + rjmp iw_exit ;7x + rjmp iw_exit ;8x + rjmp spw_data ;9x SPI data register + rjmp io65xx_wrt ;Ax 65xx IO chip (RAM) + rjmp io65xx_wrt ;Bx 65xx IO chip + rjmp ltch_wrt ;Cx 74HC573 latch(es) + rjmp lcd_wrt ;Dx character LCD + rjmp iowE0 ;Ex - subdecoded 0xe0 - 0xef + rjmp iowtreg ;Fx - internal emulated registers + +; sub address decode tables +; - select 1 from a range of 0x10 addresses + +; subdecode 0xe0 - 0xef +; read address decode table iorE0 (0xe0 - 0xef) +iorE0_tab: + rjmp ir_exit ;0 + rjmp ir_exit ;1 + rjmp ir_exit ;2 + rjmp ir_exit ;3 + rjmp ir_exit ;4 + rjmp ir_exit ;5 + rjmp ir_exit ;6 + rjmp ir_exit ;7 + rjmp ir_exit ;8 + rjmp ir_exit ;9 + rjmp ir_exit ;A + rjmp ir_exit ;B + rjmp ir_exit ;C + rjmp ir_exit ;D + rjmp ir_exit ;E + rjmp ir_exit ;F + + +; write address decode table iowE0 (0xe0 - 0xef) +iowE0_tab: + rjmp iw_exit ;0 + rjmp iw_exit ;1 + rjmp iw_exit ;2 + rjmp iw_exit ;3 + rjmp iw_exit ;4 + rjmp iw_exit ;5 + rjmp iw_exit ;6 + rjmp iw_exit ;7 + rjmp iw_exit ;8 + rjmp iw_exit ;9 + rjmp iw_exit ;A + rjmp iw_exit ;B + rjmp iw_exit ;C + rjmp iw_exit ;D + rjmp iw_exit ;E + rjmp iw_exit ;F + +; internal I/O table, subgroup of range defined by +; iordreg / iowtreg +; read internal register address table +ior_int_tab: + rjmp acia_rx ;0 - ACIA receive data register + rjmp tcdn_r ;1 - 10ms tick countdown timer + rjmp i2c_stat ;2 - i2c read status + rjmp i2c_data_rd ;3 - i2c read data register + rjmp t1r_adr ;4 - timer 1 register address + rjmp t1r_data ;5 - timer 1 data + rjmp spr_dat_lst ;6 - spi data after last write + rjmp dmr_stat ;7 - dma status + rjmp dmr_data ;8 - dma parameter data + rjmp ir_exit ;9 + rjmp ir_exit ;A + rjmp ir_exit ;B + rjmp ir_diag ;C - diag selftest register + rjmp ir_vector ;D - global internal IRQ vector + rjmp ir_mask ;E - global internal IRQ mask + rjmp ir_flag ;F - global internal IRQ flags + +; write internal register address +iow_int_tab: + rjmp acia_tx ;0 - ACIA transmit data register + rjmp tcdn_w ;1 - 10ms tick countdown timer + rjmp i2c_cmd ;2 - i2c command register + rjmp i2c_data_wrt ;3 - i2c write data register + rjmp t1w_adr ;4 - timer 1 register address + rjmp t1w_data ;5 - timer 1 data + rjmp spw_cmd ;6 - spi command register + rjmp dmw_cmd ;7 - dma command register + rjmp dmw_data ;8 - dma parameter data + rjmp iw_exit ;9 + rjmp iw_exit ;A + rjmp iw_exit ;B + rjmp iw_diag ;C - diag selftest register + rjmp iw_exit ;D - read only IRQ vector + rjmp iw_mask ;E - global internal IRQ mask + rjmp iw_flag ;F - global internal IRQ flags + + +;check address decode table alignment for missing or extra entry +.if (pc & 0xf) + .error "Address decode tables are misaligned!" +.endif + +;SPI address to slave select translation +.ifdef spi_vat +spi_vss: + spi_virt_ss +.endif + +;************************************************************** +; +; IO address decoder +; +;************************************************************** + +;decoding bits 0-3 of an IO address + +iorE0: ;read decode for 0xe0 - 0xef + io_adr_dec iorE0_tab + +iowE0: ;write decode for 0xe0 - 0xef + io_adr_dec iowE0_tab + +;************************************************************** +; +; parallel IO modules +; +; examples: 74HC573 latch IO, Phi2 synced IO +; +;************************************************************** + +;IO to 74HC573 latch +; +; multiple latches require individual IO-selects. these can be set by +; software address decode or hardware decoder 74HC237 (up to 8 latches, +; up to 4 each mixed r/w) + +ltch_rd: + set_io_select 10 ;read with strobe low io select extension reg 1, pin 0 + par_rd 100 ;min 60ns to data valid (3state output enable time OE - Q) + ;+ 1/2 clock (31.3ns) avr input latch delay + +ltch_wrt: + set_io_select 11 ;write with strobe high io select extension reg 1, pin 1 + par_wrt 60 ;min 60ns enable strobe (propagation delay time LE - Q) + rjmp iw_exit ;next instruction + +ltch_rs: + clr operand ;clear 74hc573 output latch + set_io_reset 11 ;select latch strobe + par_wrt 60 ;write operand with strobe + ret + +;***************************************************************** +; +;IO to 65xx chip using phi2 +; +io65xx_rd: + set_io_select 13 ;read with strobe on io select extension reg 1, pin 3 + phi2_rd ;timed read synchronized to phi2 (OC2) + +io65xx_wrt: + set_io_select 13 ;write with strobe on io select extension reg 1, pin 3 + phi2_wrt ;timed write synchronized to phi2 (OC2) + +;no software reset - hardware reset driven by reset pin + + +;.org pc + 0x400 ;test sufficient space for custom modules + +.endif diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.eep b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.eep new file mode 100644 index 00000000..1996e8fd --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.eep @@ -0,0 +1 @@ +:00000001FF diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.hex b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.hex new file mode 100644 index 00000000..75daa03e --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.hex @@ -0,0 +1,923 @@ +:020000020000FC +:100000000C94821564C3000022C300000C94FE14FB +:100010000C94FE140C94FE140C94BE0D0C94B00DB4 +:100020000C94B70D0C94A90D0C9402150C94441566 +:100030000C94FE140FC0000055C000000C94FE1478 +:100040000C94FE140C94FE140C94FE140C94FE14E8 +:100050000C94FE14FFB6AF93BF934BB02CB144FE8B +:1000600019C02030B9F431603D7F2091BF002F735B +:100070002093BF004090BE00242109F48B98709219 +:10008000D7007092D500809BFECF0F930E947F19FE +:100090000F912BE14090D700439441F0B2E0A09142 +:1000A000D6002D93A093D6004092D700242D203C5B +:1000B00048F02091D800233929F023E12093D8007B +:1000C00028EB2AB930FD0AC02091BE00207409F047 +:1000D0008B9A2091BF0020642093BF00BF91AF9105 +:1000E000FFBE1895FFB6AF93BF934090D500209107 +:1000F000D800222332F02CB920682093D800442065 +:1001000007C0B1E0A091D400A4192C912CB94A9455 +:1001100011F428E92AB94092D50030FD0AC0209197 +:10012000BE00207809F08B9A2091BF0020682093B0 +:10013000BF00BF91AF91FFBE18950D0A4C6F61646F +:10014000696E672C203C4553433E20746F206162EA +:100150006F72740D0A00204C6F61642061626F72CF +:10016000746564000D0A436865636B20726573658E +:100170007420766563746F72000020205265736589 +:1001800074000A0D416C6C20627265616B706F695E +:100190006E747320636C6561726564000A0D42724F +:1001A00065616B706F696E7473202028736C6F7457 +:1001B000233A61646472657373290D0A00000A0DA5 +:1001C0004E6F206D6F726520627265616B706F6932 +:1001D0006E7420736C6F747320617661696C6162F8 +:1001E0006C6500000D4C6F6164204F4B0000204E89 +:1001F0006F6E2D486578206461746120696E20728D +:1002000065636F72640020496E76616C6964206674 +:10021000756E6374696F6E206F7220636F756E7494 +:1002200020696E207265636F726400000D0A41568A +:100230005220496C6C6567616C20496E74657272FE +:10024000757074000D1B5B4B1B5B3141000042520B +:100250004B004F52414C3F3032073F3033073F3065 +:1002600034074F52410841534C083F30370750483C +:1002700050004F52412841534C063F3042073F3017 +:1002800043074F52411041534C103F3046074250F4 +:100290004C184F52414D3F3132073F3133073F3108 +:1002A00034074F52410941534C093F313707434C02 +:1002B00043004F5241123F3141073F3142073F3126 +:1002C00043074F52411141534C113F3146074A53A6 +:1002D0005210414E444C3F3232073F3233074249BD +:1002E0005408414E4408524F4C083F323707504C97 +:1002F0005000414E4428524F4C063F32420742497B +:100300005410414E4410524F4C103F324607424D5C +:100310004918414E444D3F3332073F3333073F3393 +:100320003407414E4409524F4C093F333707534578 +:100330004300414E44123F3341073F3342073F33AE +:100340004307414E4411524F4C113F33460752541C +:100350004900454F524C3F3432073F3433073F3456 +:100360003407454F52084C5352083F343707504822 +:100370004100454F52284C5352063F3442074A4DE4 +:100380005010454F52104C5352103F3446074256BE +:100390004318454F524D3F3532073F3533073F3500 +:1003A0003407454F52094C5352093F353707434CE8 +:1003B0004900454F52123F3541073F3542073F350F +:1003C0004307454F52114C5352113F354607525483 +:1003D00053004144434C3F3632073F3633073F36E4 +:1003E000340741444308524F52083F363707504CB8 +:1003F000410041444328524F52063F3642074A4D7E +:10040000505341444310524F52103F364607425614 +:1004100053184144434D3F3732073F3733073F3787 +:10042000340741444309524F52093F373707534578 +:100430004900414443123F3741073F3742073F37A6 +:10044000430741444311524F52113F3746073F384B +:1004500030075354414C3F3832073F383307535429 +:10046000590853544108535458083F3837074445F6 +:1004700059003F383907545841003F384207535418 +:10048000591053544110535458103F3846074243B3 +:1004900043185354414D3F3932073F3933075354C2 +:1004A0005909535441095354580A3F39370754598D +:1004B000410053544112545853003F3942073F39C9 +:1004C0004307535441113F3945073F3946074C44D0 +:1004D00059284C44414C4C4458283F4133074C4424 +:1004E00059084C4441084C4458083F41370754418F +:1004F00059004C444128544158003F4142074C4464 +:1005000059104C4441104C4458103F414607424357 +:1005100053184C44414D3F4232073F4233074C444D +:1005200059094C4441094C44580A3F423707434C4F +:1005300056004C444112545358003F4242074C4429 +:1005400059114C4441114C4458123F424607435004 +:100550005928434D504C3F4332073F4333074350E4 +:100560005908434D5008444543083F433707494E17 +:100570005900434D5028444558003F4342074350DB +:100580005910434D5010444543103F434607424ED7 +:100590004518434D504D3F4432073F4433073F44D5 +:1005A0003407434D5009444543093F443707434C02 +:1005B0004400434D50123F4441073F4442073F44EB +:1005C0004307434D5011444543113F4446074350B0 +:1005D00058285342434C3F4532073F453307435069 +:1005E000580853424308494E43083F453707494E90 +:1005F0005800534243284E4F50003F454207435056 +:10060000581053424310494E43103F454607424558 +:1006100051185342434D3F4632073F4633073F464A +:10062000340753424309494E43093F463707534570 +:100630004400534243123F4641073F4642073F466C +:10064000430753424311494E43113F46460737FF84 +:100650000FC03F77E093CD00F093CE00A093D10080 +:10066000B093D2003F7D74BAD2BAF6E0029734FF5D +:10067000019758BA5BBAEEEF00E40BBF072F037087 +:10068000D3B3E8BB72FB07F9062B6460C3B3B8BAF7 +:100690006BBABA94E2BA95BB54BAC2BAB8BABA94B1 +:1006A000E2BA85BBC2BAB8BABA94E2BA05BBC2BA5A +:1006B00074BAD2BACE010FE50DBF88BB9BBB78944C +:1006C0000196F894E3B388BB9BBB0196099437FF6E +:1006D0000FC03F77E093CD00F093CE00A093D10000 +:1006E000B093D2003F7D74BAD2BAF6E0029734FFDD +:1006F0000197EBEFE8BB5BBAEAEF00E40BBF072F13 +:100700000370D3B3E8BB72FB07F9062B6460C3B375 +:10071000B8BA6BBABA94E2BA95BB54BAC2BAB8BA0C +:10072000BA94E2BA85BBC2BAB8BABA94E2BA05BB07 +:10073000C2BA74BAD2BACE010FE50DBF88BB9BBB5B +:1007400078940196F894E3B388BB9BBB0196099417 +:10075000E3B3550F7FB7789488BBF8949BBB0196A1 +:100760000994E3B37E7F789488BBF8949BBB019691 +:100770000994E3B3677F789488BBF8949BBB019698 +:100780000994E3B36B7F00EC0BBF789488BBF894BB +:100790009BBB01960994E3B36F7B789488BBF89474 +:1007A0009BBB01960994E3B37FBF8A947FB778948B +:1007B00088BBF8949BBB01960994E3B37FBF9A94DE +:1007C0007FB7789488BBF8949BBB01960994E3B3F8 +:1007D0007FBF83947FB7789488BBF8949BBB0196C6 +:1007E0000994E3B37FBF93947FB7789488BBF89460 +:1007F0009BBB01960994E3B356957FB7789488BB69 +:10080000F8949BBB01960994E3B300C000C00000BC +:10081000789488BBF8949BBB01960994E3B3B8BA6B +:100820006BBABA94E2BA55BB54BAC2BA74BAD2BA65 +:10083000789488BBF8949BBB01960994E3B3072F87 +:10084000037072FB07F9062B0063B8BA6BBABA944F +:10085000E2BA05BB54BAC2BA74BAD2BA789488BBA9 +:10086000F8949BBB01960994E3B3B394B8BA6BBAFE +:1008700000C0000053B37FBF55237FB7789488BB77 +:10088000F8949BBB01960994E3B3B394B8BA6BBADE +:1008900000C0000063B300EC62FD00E40BBF762FE4 +:1008A000737067FB72F96C766062789488BBF89419 +:1008B0009BBB01960994E3B37FBF551F7FB7789424 +:1008C00088BBF8949BBB01960994E3B37FBF57950F +:1008D0007FB7789488BBF8949BBB01960994E3B3E7 +:1008E0007160789488BBF8949BBB01960994E3B33C +:1008F0006860789488BBF8949BBB01960994E3B335 +:10090000646000E40BBF789488BBF8949BBB0196AD +:100910000994E3B3852E7FBF88207FB7789488BB86 +:10092000F8949BBB01960994E3B3952E7FBF992061 +:100930007FB7789488BBF8949BBB01960994E3B386 +:100940008B2C7FBF88207FB7789488BBF8949BBBA3 +:1009500001960994E3B3582D7FBF55237FB7789450 +:1009600088BBF8949BBB01960994E3B3B82C7894A8 +:1009700088BBF8949BBB01960994E3B3592D7FBFC4 +:1009800055237FB7789488BBF8949BBB0196099454 +:1009900070FD06C0A3B20027A7FC0A958A0D901F20 +:1009A00088BB9BBB78940196F894E3B388BB9BBB50 +:1009B0000196099470FF06C0A3B20027A7FC0A9510 +:1009C0008A0D901F88BB9BBB78940196F894E3B383 +:1009D00088BB9BBB0196099471FF06C0A3B2002798 +:1009E000A7FC0A958A0D901F88BB9BBB7894019643 +:1009F000F894E3B388BB9BBB0196099472FF06C0D1 +:100A0000A3B20027A7FC0A958A0D901F88BB9BBB49 +:100A100078940196F894E3B388BB9BBB0196099444 +:100A200071FD06C0A3B20027A7FC0A958A0D901F8E +:100A300088BB9BBB78940196F894E3B388BB9BBBBF +:100A40000196099472FD06C0A3B20027A7FC0A957F +:100A50008A0D901F88BB9BBB78940196F894E3B3F2 +:100A600088BB9BBB0196099466FD06C0A3B2002714 +:100A7000A7FC0A958A0D901F88BB9BBB78940196B2 +:100A8000F894E3B388BB9BBB0196099466FF06C04C +:100A9000A3B20027A7FC0A958A0D901F88BB9BBBB9 +:100AA00078940196F894E3B388BB9BBB01960994B4 +:100AB000C3B388BB9BBB8C2F00C093B388BB9BBBCD +:100AC00001960000C3B388BB9BBB8C2F00C093B3BF +:100AD00088BB9BBB78940196F894E3B388BB9BBB1F +:100AE00001960994C3B388BB9BBB00C00000D3B37D +:100AF000B8BA6BBABA94E2BA95BB54BAC2BAB8BA29 +:100B0000BA94E2BA85BBC2BA74BAD2BACE0188BB73 +:100B10009BBB78940196F894E3B388BB9BBB01968A +:100B20000994B394B8BA6BBAB39400C083B3B8BA9B +:100B300000C0000093B3019688BB9BBB78940196DC +:100B4000F894E3B388BB9BBB01960994B394B8BAFD +:100B50006BBAB39400C063B3B8BAB39400EC62FD4F +:100B600000E40BBF762F83B3B8BA737067FB72F9DA +:100B70006C76606293B388BB9BBB78940196F894C3 +:100B8000E3B388BB9BBB0196099458BA5BBAEEEFFE +:100B900000E40BBF072F0370D3B3E8BB72FB07F968 +:100BA000062B00636460C3B3B8BA6BBABA94E2BAF6 +:100BB00095BB54BAC2BAB8BABA94E2BA85BBC2BA43 +:100BC000B8BABA94E2BA05BBC2BA74BAD2BACE0104 +:100BD00088BB9BBB78940196F894E3B388BB9BBB1E +:040BE00001960994DD +:100C0000C4CF7BC3FDC0FCC0FBC098C321C4F8C0E7 +:100C100015CEA5C39DCDF4C0F3C095C31EC4F0C0CE +:100C200011CF78C3EDC0ECC0EBC082C30BC4E8C0E9 +:100C300098CD5AC3E5C0E4C0E3C04DC3FAC3E0C0D9 +:100C400051CF52C1DDC0DCC08FC16FC16DC4D8C0EF +:100C50001BCE7CC130CED4C08CC16CC16AC4D0C0A4 +:100C6000CDCE4FC1CDC0CCC0CBC059C157C4C8C078 +:100C700036CE31C1C5C0C4C0C3C024C146C4C0C083 +:100C800065CF38C2BDC0BCC0BBC055C217C4B8C058 +:100C9000C5CD62C2B0CDB4C015CF52C214C4B0C06D +:100CA000E3CE35C2ADC0ACC0ABC03FC201C4A8C02A +:100CB00068CD17C2A5C0A4C0A3C00AC2F0C3A0C01B +:100CC00030CFB2C09DC09CC09BC0CFC064C498C090 +:100CD000CBCDDCC0FACD94C0EBCECCC061C490C00B +:100CE000D5CEAFC08DC08CC08BC0B9C04EC488C03B +:100CF00006CE91C085C084C083C084C03DC480C07E +:100D00007FC0F1C47DC07CC05CC50EC534C578C051 +:100D100054CD76C01FCE74C058C50BC531C570C048 +:100D200037CEEEC46DC06CC047C5F8C41EC568C0E0 +:100D300024CED0C41ACE64C063C0C3C461C060C036 +:100D4000BCC22AC28BC25CC0A6C247C275C258C010 +:100D5000EBCD55C2DECD54C0A3C244C272C250C056 +:100D600029CE27C24DC04CC090C231C25FC248C01C +:100D700012CD09C2E4CD44C07FC2FCC14EC240C006 +:100D800099C128C13DC03CC084C145C13BC438C0E5 +:100D900028CD52C108CD34C081C142C138C430C051 +:100DA0003FCE25C12DC02CC02BC02FC125C428C0CB +:100DB000E0CC07C125C024C023C0FAC014C420C0A1 +:100DC0005AC1EDC21DC01CC045C10AC352C418C0DF +:100DD000FECC17C319CD14C042C107C34FC410C005 +:100DE000FBCDEAC20DC00CC00BC0F4C23CC408C0AD +:100DF0007ECDCCC205C004C003C0BFC22BC400C09E +:100E00000C944B15C3B388BB9BBB01963F7EC80DAA +:100E1000D3B3D71D35C0C3B388BB9BBB01963F7E00 +:100E2000C90DD3B3D71D2CC0C3B3C80DC8BB7BBA83 +:100E3000C3953061000003B3C8BBC02F00C0D3B35B +:100E40001FC0C3B3C8BB7BBAC3953061000003B3F6 +:100E5000C8BBC02FC90D0000D3B3D71D11C0C3B389 +:100E6000C80DC8BB7BBADD2711C0C3B3C8BB7BBAF2 +:100E7000DD270CC0C3B388BB9BBB01963F7ED3B3B9 +:100E8000C8BBDBBBDF3B11F4BDD401C0A3B263FD23 +:100E90000FC07FBF5A1D7FB773FB66F988BB9BBB32 +:100EA00078940196F894E3B388BB9BBB01960994B0 +:100EB0005A597FBF5A1D7FB710F050567FBF75F348 +:100EC0005650ECCFC3B388BB9BBB01963F7EC80D89 +:100ED000D3B3D71D35C0C3B388BB9BBB01963F7E40 +:100EE000C90DD3B3D71D2CC0C3B3C80DC8BB7BBAC3 +:100EF000C3953061000003B3C8BBC02F00C0D3B39B +:100F00001FC0C3B3C8BB7BBAC3953061000003B335 +:100F1000C8BBC02FC90D0000D3B3D71D11C0C3B3C8 +:100F2000C80DC8BB7BBADD2711C0C3B3C8BB7BBA31 +:100F3000DD270CC0C3B388BB9BBB01963F7ED3B3F8 +:100F4000C8BBDBBBDF3B11F45DD401C0A3B27FBFE4 +:100F50005A217FB788BB9BBB78940196F894E3B382 +:100F600088BB9BBB01960994C3B3C8BB7BBADD2782 +:100F70000CC0C3B388BB9BBB01963F7ED3B3C8BB39 +:100F8000DBBBDF3B11F43ED401C0A3B2052F7FBF12 +:100F90000A217FB7A6FA66F9A7FA72F988BB9BBB4C +:100FA00078940196F894E3B388BB9BBB01960994AF +:100FB000C3B388BB9BBB01963F7EC80DD3B3D71D7F +:100FC00035C0C3B388BB9BBB01963F7EC90DD3B36D +:100FD000D71D2CC0C3B3C80DC8BB7BBAC395306145 +:100FE000000003B3C8BBC02F00C0D3B31FC0C3B33E +:100FF000C8BB7BBAC3953061000003B3C8BBC02F28 +:10100000C90D0000D3B3D71D11C0C3B3C80DC8BBF1 +:101010007BBADD2711C0C3B3C8BB7BBADD270CC0C8 +:10102000C3B388BB9BBB01963F7ED3B3C8BBDBBBBE +:10103000DF3B11F4E7D301C0A3B25A157FB7762581 +:1010400088BB9BBB78940196F894E3B388BB9BBBA9 +:1010500001960994C3B3C8BB7BBADD270CC0C3B3E8 +:1010600088BB9BBB01963F7ED3B3C8BBDBBBDF3BDA +:1010700011F4C8D301C0A3B28A147FB7762588BB08 +:101080009BBB78940196F894E3B388BB9BBB019615 +:101090000994C3B3C8BB7BBADD270CC0C3B388BBFC +:1010A0009BBB01963F7ED3B3C8BBDBBBDF3B11F4D8 +:1010B000A9D301C0A3B29A147FB7762588BB9BBB86 +:1010C00078940196F894E3B388BB9BBB019609948E +:1010D000C3B388BB9BBB01963F7EC80DD3B3D71D5E +:1010E00035C0C3B388BB9BBB01963F7EC90DD3B34C +:1010F000D71D2CC0C3B3C80DC8BB7BBAC395306124 +:10110000000003B3C8BBC02F00C0D3B31FC0C3B31C +:10111000C8BB7BBAC3953061000003B3C8BBC02F06 +:10112000C90D0000D3B3D71D11C0C3B3C80DC8BBD0 +:101130007BBADD2711C0C3B3C8BB7BBADD270CC0A7 +:10114000C3B388BB9BBB01963F7ED3B3C8BBDBBB9D +:10115000DF3B11F457D301C0A3B27FBF5A257FB73D +:1011600088BB9BBB78940196F894E3B388BB9BBB88 +:1011700001960994C3B388BB9BBB01963F7EC80D03 +:10118000D3B3D71D35C0C3B388BB9BBB01963F7E8D +:10119000C90DD3B3D71D2CC0C3B3C80DC8BB7BBA10 +:1011A000C3953061000003B3C8BBC02F00C0D3B3E8 +:1011B0001FC0C3B3C8BB7BBAC3953061000003B383 +:1011C000C8BBC02FC90D0000D3B3D71D11C0C3B316 +:1011D000C80DC8BB7BBADD2712C0C3B3C8BB7BBA7E +:1011E000DD270DC0C3B388BB9BBB01963F7ED3B345 +:1011F000C8BBDBBBDF3B19F405D35A2D01C053B389 +:101200007FBF55237FB788BB9BBB78940196F8942A +:10121000E3B388BB9BBB01960994C3B388BB9BBB5C +:1012200001963F7EC90DD3B3D71D11C0C3B3C90DFD +:10123000C8BB7BBADD2712C0C3B3C8BB7BBADD27EE +:101240000DC0C3B388BB9BBB01963F7ED3B3C8BB65 +:10125000DBBBDF3B19F4D6D28A2C01C083B27FBF3F +:1012600088207FB788BB9BBB78940196F894E3B342 +:1012700088BB9BBB01960994C3B388BB9BBB0196FB +:101280003F7EC80DD3B3D71D11C0C3B3C80DC8BBB3 +:101290007BBADD2712C0C3B3C8BB7BBADD270DC044 +:1012A000C3B388BB9BBB01963F7ED3B3C8BBDBBB3C +:1012B000DF3B19F4A7D29A2C01C093B27FBF9920CB +:1012C0007FB788BB9BBB78940196F894E3B388BB47 +:1012D0009BBB01960994C3B388BB9BBB01963F7E21 +:1012E000C80DD3B3D71D35C0C3B388BB9BBB019614 +:1012F0003F7EC90DD3B3D71D2CC0C3B3C80DC8BB27 +:101300007BBAC3953061000003B3C8BBC02F00C0D7 +:10131000D3B31FC0C3B3C8BB7BBAC3953061000051 +:1013200003B3C8BBC02FC90D0000D3B3D71D11C074 +:10133000C3B3C80DC8BB7BBADD2711C0C3B3C8BBDC +:101340007BBADD270CC0C3B388BB9BBB01963F7E35 +:10135000D3B3C8BBDBBBDF3B11F454D201C0A3B293 +:101360007FBF5A297FB788BB9BBB78940196F894BE +:10137000E3B388BB9BBB01960994C3B388BB9BBBFB +:1013800001963F7EC80DD3B3D71D35C0C3B388BB0C +:101390009BBB01963F7EC90DD3B3D71D2CC0C3B3F1 +:1013A000C80DC8BB7BBAC3953061000003B3C8BB8E +:1013B000C02F00C0D3B31FC0C3B3C8BB7BBAC39593 +:1013C0003061000003B3C8BBC02FC90D0000D3B308 +:1013D000D71D11C0C3B3C80DC8BB7BBADD2711C070 +:1013E000C3B3C8BB7BBADD270CC0C3B388BB9BBBF0 +:1013F00001963F7ED3B3C8BBDBBBDF3B11F402D207 +:1014000001C0A3B2A0947FBF5A1D7FB773FB66F9DA +:1014100063FF05C010F050567FBF0DF0565088BBDB +:101420009BBB78940196F894E3B388BB9BBB019671 +:101430000994C3B388BB9BBB01963F7EC80DD3B351 +:10144000D71D11C0C3B3C80DC8BB7BBADD2711C0FF +:10145000C3B3C8BB7BBADD270CC0C3B388BB9BBB7F +:1014600001963F7ED3B3C8BBDBBBDF3B11F4C9D1D0 +:1014700001C0A3B2AA0C7FB7DF3B81F0E2BAA5BAE4 +:1014800054BAC2BA74BAD2BA88BB9BBB78940196DC +:10149000F894E3B388BB9BBB01960994B9C1C3B36D +:1014A00088BB9BBB01963F7EC80DD3B3D71D11C02F +:1014B000C3B3C80DC8BB7BBADD2711C0C3B3C8BB5B +:1014C0007BBADD270CC0C3B388BB9BBB01963F7EB4 +:1014D000D3B3C8BBDBBBDF3B11F493D101C0A3B2D4 +:1014E000A6947FB7DF3B81F0E2BAA5BA54BAC2BA7C +:1014F00074BAD2BA88BB9BBB78940196F894E3B3D4 +:1015000088BB9BBB0196099483C1C3B388BB9BBBBB +:1015100001963F7EC80DD3B3D71D11C0C3B3C80D0C +:10152000C8BB7BBADD2711C0C3B3C8BB7BBADD27FC +:101530000CC0C3B388BB9BBB01963F7ED3B3C8BB73 +:10154000DBBBDF3B11F45DD101C0A3B27FBFAA1C9E +:101550007FB7DF3B81F0E2BAA5BA54BAC2BA74BA17 +:10156000D2BA88BB9BBB78940196F894E3B388BB4E +:101570009BBB019609944CC1C3B388BB9BBB01962E +:101580003F7EC80DD3B3D71D11C0C3B3C80DC8BBB0 +:101590007BBADD2711C0C3B3C8BB7BBADD270CC043 +:1015A000C3B388BB9BBB01963F7ED3B3C8BBDBBB39 +:1015B000DF3B11F426D101C0A3B27FBFA7947FB750 +:1015C000DF3B81F0E2BAA5BA54BAC2BA74BAD2BA51 +:1015D00088BB9BBB78940196F894E3B388BB9BBB14 +:1015E0000196099415C1C3B388BB9BBB01963F7E8E +:1015F000C80DD3B3D71D11C0C3B3C80DC8BB7BBAC8 +:10160000DD2711C0C3B3C8BB7BBADD270CC0C3B391 +:1016100088BB9BBB01963F7ED3B3C8BBDBBBDF3B24 +:1016200011F4EFD001C0A3B27FBFAA947FB7DF3B14 +:1016300081F0E2BAA5BA54BAC2BA74BAD2BA88BBB7 +:101640009BBB78940196F894E3B388BB9BBB01964F +:101650000994DEC0C3B388BB9BBB01963F7EC80D17 +:10166000D3B3D71D11C0C3B3C80DC8BB7BBADD2728 +:1016700011C0C3B3C8BB7BBADD270CC0C3B388BBE2 +:101680009BBB01963F7ED3B3C8BBDBBBDF3B11F4F2 +:10169000B8D001C0A3B27FBFA3947FB7DF3B81F076 +:1016A000E2BAA5BA54BAC2BA74BAD2BA88BB9BBB62 +:1016B00078940196F894E3B388BB9BBB0196099498 +:1016C000A7C0C3B388BB9BBB01963F7EC80DD3B3F5 +:1016D000D71D35C0C3B388BB9BBB01963F7EC90DE8 +:1016E000D3B3D71D2CC0C3B3C80DC8BB7BBAC39539 +:1016F0003061000003B3C8BBC02F00C0D3B31FC00C +:10170000C3B3C8BB7BBAC3953061000003B3C8BB89 +:10171000C02FC90D0000D3B3D71D11C0C3B3C80D6E +:10172000C8BB7BBADD270FC0C3B3C8BB7BBADD27FC +:101730000AC0C3B388BB9BBB01963F7ED3B3C8BB73 +:10174000DBBBDF3B81F0E2BA55BB54BAC2BA74BA14 +:10175000D2BA88BB9BBB78940196F894E3B388BB5C +:101760009BBB01960994A52E53C0C3B3C90DC8BB3A +:101770007BBADD270FC0C3B3C8BB7BBADD270AC065 +:10178000C3B388BB9BBB01963F7ED3B3C8BBDBBB57 +:10179000DF3B81F0E2BA85BA54BAC2BA74BAD2BA9F +:1017A00088BB9BBB78940196F894E3B388BB9BBB42 +:1017B00001960994A82C2CC0C3B3C80DC8BB7BBA32 +:1017C0000EC0C3B3C8BB7BBA0AC0C3B388BB9BBB44 +:1017D00001963F7ED3B3C8BBDBBBDF3B81F0E2BAEF +:1017E00095BA54BAC2BA74BAD2BA88BB9BBB7894C1 +:1017F0000196F894E3B388BB9BBB01960994A92C8E +:1018000007C03062FEE0EC2FE07FE295E0580994DB +:10181000FEE0EC2FE07FE295E0570994F89479BE62 +:1018200005E003BF0E9468158DD143D268D096D3DE +:1018300026D5EBD272BE0BE90CBF0DE003BF72BE22 +:101840000AE008B601FE04C012E018BF0A9509F0CC +:10185000F8CFC2BA11E81BBB969AC2BA72BE58BE84 +:1018600003E009BF0093C000D2BA78940895C2BAC9 +:1018700011E81BBB969A0091C700002389F0C1FDB7 +:101880000FC0C098C79ADA9A00C000C000C000001C +:101890001BBB03B307FD17C2C8BB00E20A95F1F7F3 +:1018A000C79ADA9A00C000C000C000001BBBA3B2F8 +:1018B000D2BAF6E00895C2BA11E81BBB969A00911D +:1018C000C700002389F0C1FD0FC0C098C79ADA9AFB +:1018D00000C000C000C000001BBB03B307FDF5C182 +:1018E000C8BB00E20A95F1F7C798A5BA54BADA9ACC +:1018F00000C000C000C000001BBB74BAE9C100E317 +:10190000A02E78BA5092C700C2BA11E81BBB969AB3 +:1019100005E13DD00FEB3BD00DEF39D0E4E6F9E126 +:10192000C0E00591002331F00F3F11F4C1E001C088 +:1019300033D0F7CFC0E000E82FD0E9E6F9E1C1E00D +:101940004DD00591002329F00A1511F07092C700BF +:10195000F7CF0091C700002321F4EAE7F9E10E94E4 +:1019600083190895380C0106FF4E36353032204574 +:101970006D752056302E383362000D0A4C434420DA +:101980007265736574206661696C6564000002BFEE +:1019900002B70023E9F716C072BEA02EC09802B7A6 +:1019A0000C3919F47092C7000895C79ADA9A00C0EA +:1019B00000C000C000001BBB03B307FDF0CF00E276 +:1019C0000A95F1F7C8BBC798A5BA54BADA9A00C00D +:1019D00000C000C000001BBB74BA089572BEC0985E +:1019E00002B70C3919F47092C7000895C79ADA9AB1 +:1019F00000C000C000C000001BBB03B307FDF0CF58 +:101A000000E20A95F1F7C8BBC79ADA9A00C000C095 +:101A100000C000001BBB03B3A02E08950091BF00BF +:101A20000F7B0090BE00002221F40090C50000FE54 +:101A30008B98AA2430FD21C00090D7000020D9F057 +:101A4000A091D600B2E0A019AC900A940092D70001 +:101A500031F01091BE00107409F08B9A0064202DB3 +:101A6000203848F42091D800213929F021E1209331 +:101A7000D80028EB2AB90093BF00F6E00895009043 +:101A8000D50030FD22C10394E9F30091BF000F7728 +:101A90001090BE00102221F41090C50010FE8B980B +:101AA00028EB2AB9A091D400B1E0AD92A093D40064 +:101AB0000092D500039431F01091BE00107809F027 +:101AC0008B9A00680093BF0003C1A090C100F6E0AC +:101AD0000895A092C100FCC0A091C100A83048F4B4 +:101AE000AA5BB0E0AC90A091C100A625A093C10074 +:101AF00005C019F4A090C20001C0AA24F6E0089520 +:101B0000A091C100A83048F4AA5BB0E0AC92A091CB +:101B1000C100A625A093C10014C099F40A2D077036 +:101B20001A2D177F1093C200107312951FBD1A2D26 +:101B3000107C1295110F012B0EBD00B7A3FA00F90E +:101B400000BFC6C07FBC7EBC7092C1007092C20054 +:101B500008952091BF0024602093BF008B9A1895B0 +:101B60002091BF0020612093BF008B9A189520918F +:101B7000BF0028602093BF008B9A18952091BF006A +:101B800020622093BF008B9A1895A090C300F6E0C6 +:101B90000895A092C300A092C4009AC0A090BE0075 +:101BA000F6E008950A2D0C7303600093C00009BF8E +:101BB0000A2D0093BE001090BF001022112011F4D6 +:101BC0008B9801C08B9A84C0A090BF0008B70C739B +:101BD000A02AF6E008950A2D0C7308BF18B71C73ED +:101BE0000A2D0F7305251090BF00112A10221092A4 +:101BF000BF000090BE00102009F48B9869C0AA2491 +:101C00000090BF001090BE00102D1121D1F06894FB +:101C1000012F007F11F0102FA2F8012F0C7C11F082 +:101C2000102FA1F8012F0A7A11F0102FA0F8A39419 +:101C3000AA0C1525106C01220092BF00102009F497 +:101C40008B98F6E00895A090C50000E430FD006890 +:101C5000A02AF6E00895A7FE1AC0307435600091FE +:101C6000BF000F730093BF000090BE00002109F475 +:101C70008B98D2E0C0E00AE009930BE10993C0938E +:101C8000D600C093D70000E00BBF7894DDC7A2FC5C +:101C90000DC0A1FC8A9AA1FE8A98A0FC8B9AA0FE96 +:101CA0008B980A2D03700093C50012C00E94CB19B7 +:101CB0000FC08B988A987092C5007092BE0000E8A1 +:101CC0000093BF0008950F910F91029734FF019781 +:101CD0003F7DD2BAF6E088BB9BBB78940196F8941E +:0E1CE000E3B388BB9BBB01960994F6E0089520 +:101D0000F4CFF3CFF2CFF1CFF0CFEFCFEECFEDCFD7 +:101D1000ECCF06C186C085C061C0A9CD55C0C0C08A +:101D2000D7CFD6CFD5CFD4CFD3CFD2CFD1CFD0CF9F +:101D3000CFCFDBC096C095C05DC0BDCD4AC0B5C099 +:101D4000D4CFD3CFD2CFD1CFD0CFCFCFCECFCDCF97 +:101D5000CCCFCBCFCACFC9CFC8CFC7CFC6CFC5CFC7 +:101D6000B7CFB6CFB5CFB4CFB3CFB2CFB1CFB0CF5F +:101D7000AFCFAECFADCFACCFABCFAACFA9CFA8CF8F +:101D80004DCE03CF72C20AC2A0CEA6CEE3C0D0C150 +:101D9000E9C1ABCFAACFA9CF56CF31CFFFCE14CF59 +:101DA0006ECEF7CE3AC20EC294CEAACE83C0A8C1E0 +:101DB000C3C18ECF8DCF8CCF4ECF8ACFF3CE0BCF7A +:101DC0001E1D1B1F0F1F1F1FFEE0EC2FEF70E056A4 +:101DD0000994FEE0EC2FEF70E0550994C2BA11E8C7 +:101DE0001BBB969AC79AD89800001BBBA3B2D2BA65 +:101DF000F6E00895C2BA11E81BBB969AC798A5BA37 +:101E000054BAD99A1BBB74BA63CFAA24C2BA11E8D8 +:101E10001BBB969AC798A5BA54BAD99A1BBB74BA79 +:101E20000895C2BA11E81BBB969AE4B58799FDCF15 +:101E3000FF27E45EF04F099400000000000000005E +:101E4000000000000000C79ADB9A00C000C000C07C +:101E500000C000C000C00000A3B21BBBD2BAF6E0B5 +:101E60000895C2BA11E81BBB969AE4B58799FDCFD5 +:101E7000FF27E45CF04F0994000000000000000020 +:101E8000000000000000C798DB9A00C000C00000FE +:101E9000A5BA54BA00C000C000C01BBB74BA18CFAA +:101EA000FEE0EC2FEF70E0540994FEE0EC2FEF70B1 +:101EB000E0530994A6FC0FC00091C80006FF0BC0B8 +:101EC0000FE108BB6E9AC2BA11E81BBB969ADE9A64 +:101ED0001BBB6E98D2BAA092C8000A2D00610F7386 +:101EE0000DB97EB8A4FC6EB8F3CEEC2FE770E054C9 +:101EF000FDE1049008BA6E9AC2BA11E81BBB969A2B +:101F0000DE9AAFB80FE10090C800779BFECF1FB0FC +:101F10001092C90006FE08BB1BBB6E98D2BAD8CE81 +:101F2000EC2FE770E054FDE1049008BA6E9AC2BA53 +:101F300011E81BBB969ADE9A5FB80FE10090C800CB +:101F4000779BFECFAFB006FE08BB1BBB6E98D2BA24 +:101F5000F6E00895A090C900F6E008950FE108BBEF +:101F600003E57EB80DB9C2BA11E81D7F1BBB969A76 +:101F7000DE9A7FB8779BFECF5FB8779BFECF0FB11D +:101F80000F3F21F0EAE9FFE10E9483191BBBD2BA9F +:101F90007092C80000E10DB908950D0A5350492010 +:101FA00062757320737475636B000091C80006FF3F +:101FB00016C00091CA001091CB00033029F4A09103 +:101FC000D100B091D2000EC0033121F0003039F4BD +:101FD000153029F4A091CF00B091D00003C05092E9 +:101FE000CA0076CEA092CA00E091CC00E770E0541F +:101FF000FDE10490E091CD00F091CE000DB1102EE6 +:102000000064202EC2BA11E8C1ECD0E754BA09B777 +:102010000E7F09BF3068789408BAF8942DB8CBBB0E +:10202000D2BB5FB8779BFECF0FB11BBB1DB8C2BA46 +:10203000E8BBFBBBE2BA05BB3196C2BA119759F7B0 +:1020400074BAE093CD00F093CE0003E10093CA0090 +:1020500009B7016009BF3F773BCE0091C80006FF7A +:1020600016C00091CA001091CB00023029F4A09153 +:10207000D100B091D2000EC0023121F0003039F40D +:10208000153029F4A091CF00B091D00003C0509238 +:10209000CA001ECEA092CA00E091CC00E770E054C6 +:1020A000FDE10490E091CD00F091CE000DB1102E35 +:1020B0000064202E11E8C1ECD0E709B70E7F09BFFC +:1020C0003068E8BBFBBB78940000F894319603B30A +:1020D00008BA2DB8CBBBD2BB0FB9779BFECF1BBBC9 +:1020E0001DB8D2BA119769F7E093CD00F093CE00F6 +:1020F00002E10093CA0009B7016009BF3F77E8CD4C +:102100000A2D083028F4EBE8E00FF0E1F71D099400 +:102110005092CA00DDCD07C006C09FCF46CF1CC17C +:10212000C5C051C39EC3A092CB00A092CA00D0CD1F +:10213000A090CA00F6E008950091CA00023068F449 +:102140000091CB00053048F4ECECF0E0E00FF71D17 +:10215000A08203950093CB00BBCD5092CA00509251 +:10216000CB00B6CD0091CB00053008F0072DECEC8C +:10217000F0E0E00FF71DA08003950093CB00509294 +:10218000CA00F6E00895C2BA11E81BBB969A55BA88 +:1021900054BA212E74BA75BADC9A0895E091C6003B +:1021A000E0FD0DC0F0DFE2FB8894E3FDBFD19CD1E0 +:1021B000A02EE860E093C6002BBAD2BA01C0A72CCB +:1021C000F6E00895E091C600E2FBE1FF13C00A2D9E +:1021D000DADF0894E3FDAAD10A2D33D1E47010F0C0 +:1021E000E06403C0EF7BE160BDD1E093C6002BBA91 +:1021F000D2BA6ECD0E2F097079F4C5DF0A2D3AD10F +:10220000E47010F0E06403C0EF7BE160ABD1E093D9 +:10221000C6002BBAD2BA5CCD5BCDE091C6000A2DC8 +:10222000033088F4013010F413D00FC031F4EB7F89 +:10223000E5FDEDD0E5FFE26008C0EB7FE5FDE7D00E +:10224000E5FFE66002C009F4E2D0E093C60040CDAD +:10225000E0FD0AC098DFE2FB0894E3FD67D1E4707B +:10226000E16080D12BBAD2BA0895E091C6008BDF2D +:102270009A9BE068AE2E2BBAD2BAF6E00895C2BAA5 +:1022800011E81BBB969A83DFC3D0E093C600E5FF3D +:1022900004C0ECE9F2E20E94831908950D0A493264 +:1022A000432062757320737475636B000091CA00DC +:1022B0001091CB00053029F4A091D100B091D2004B +:1022C0000EC0053121F0013039F4153029F4A09108 +:1022D000CF00B091D00003C05092CA00F9CCA092B8 +:1022E000CA00E091CD00F091CE00C091C600C0FDC3 +:1022F000F3CFC2BA48DF02B21BB2C2FB8894C3FD5F +:1023000015D1C860C093C60009B70E7F09BF3068F9 +:10231000EBD02BBAC2BA54BAE8BBFBBBE2BA05BBDE +:102320003196C2BA119759F055BA789474BAF894A4 +:1023300075BA1BBA02BA8894C2FBF8D0E9CF74BA56 +:10234000E093CD00F093CE0005E10093CA0009B7F9 +:10235000016009BF3F77BCCC0091CA001091CB004F +:10236000043029F4A091D100B091D2000EC0043104 +:1023700021F0013039F4153029F4A091CF00B0914B +:10238000D00003C05092CA00A3CCA092CA00E09132 +:10239000CD00F091CE0011E8C1E9D0E7212E1C2E2E +:1023A0000D2EC091C6000C2F097061F709B70E7F82 +:1023B00009BF3068E8BBFBBB78940000F894319605 +:1023C000C2FB03B3C2BA55BA54BA74BA75BA1BBACF +:1023D00002BA50D030F02BBAD2BA119759F704E1B3 +:1023E0000BC0C470C160C093C600BCD02BBAD2BAB7 +:1023F000052D119709F404E10093CA00E093CD0084 +:10240000F093CE0009B7016009BF3F7761CCBBDE16 +:10241000A39A1EE30EF01CEF1A95F1F700C0EE2709 +:10242000989902C0E16209C0E8940FEF23D099990E +:1024300002C0E16201C0E16095D0A3982BBAD2BA84 +:102440000895999910C0A09A15E00EF019E11A9517 +:10245000F1F70000A098989BFECF11E00EF01BE072 +:102460001A95F1F70000A19A11E00EF01BE01A9501 +:10247000F1F700000894001FA09A11E00EF01BE095 +:102480001A95F1F7000018F40000A19802C0A19A73 +:1024900000C011E00EF01BE01A95F1F70000A098C3 +:1024A000989BFECF13E00EF017E11A95F1F700C0EC +:1024B000000F11F70000A09A12E00EF01CE01A9530 +:1024C000F1F7A19812E00EF01CE01A95F1F7A09830 +:1024D000989BFECF11E00EF01BE01A95F1F700C0BB +:1024E000889499990894089501E026F01AE01A95C5 +:1024F000F1F700000000A09A12E00EF01CE01A951F +:10250000F1F7A19812E00EF01CE01A95F1F7A098EF +:10251000989BFECF11E00EF01BE01A95F1F700C07A +:10252000889499990894001F00F70895A09A11E0E3 +:102530000EF01BE01A95F1F7000018F40000A198C6 +:1025400002C0A19A00C011E00EF01BE01A95F1F74D +:102550000000A098989BFECF11E00EF01BE01A95AA +:10256000F1F7089526F01AE01A95F1F7000000C07F +:10257000A09A12E00EF01CE01A95F1F7A19A12E071 +:102580000EF01CE01A95F1F7A098989BFECF11E091 +:102590000EF01BE01A95F1F70000A19808956EB8AF +:1025A00000E50DB907E108BBC2BA11E81BBB969A5A +:1025B000DE9A212E05E00FB9779BFECF5FB8779B9F +:1025C000FECF0FB138B21FE118BB0F3F19F01BB29D +:1025D00002B20895EEE8F9E296D60C94251CCC23BD +:1025E000B1F4C0919F00E199FECFDEBB6CBA1DB380 +:1025F0001C1761F0139539F4CDBB1FB7F894E29A1C +:10260000E19A1FBF03C0D39591F1EDCFC0E0C03078 +:1026100011F0C03801F50F931FE138BA05E00FB98A +:10262000779BFECF5FB8779BFECF0FB118BB0170D1 +:10263000A1F738BA06E00FB9779BFECF18BB38BABE +:1026400002E00FB9779BFECFDFB9779BFECFCFB902 +:10265000779BFECF0F910FB9779BFECFCF3711F04D +:10266000CF3F11F40FE108BB219609F00895E0E88F +:10267000F9E249D60FE108BBD0E01DD00C94DD1B78 +:102680000FE108BBCC2309F0D395DD2309F013D06B +:1026900032FD0C94DD1B74BA2BBAD2BA7EBA7FBA63 +:1026A00050929F001091C8007EB814FD6EB8106162 +:1026B0001F731DB90895C0919F00E199FECFDEBB45 +:1026C0006CBA1DB21C1631F45DBA1FB6F894E29ACA +:1026D000E19A1FBED39589F7E199FECF0895E4E60C +:1026E000F9E211D600919F0014D63D7FAA276FBA58 +:1026F00000919F00AEBB6CBA1DB2101641F0A395BD +:1027000029F4E8E5F9E2FFD501E0C5CFF3CF47DFD3 +:10271000C0E0D0E02ED0002329F4E6EEF9E2F3D5B4 +:1027200001E0B9CFA02F25D0F02F23D0E02F54BA4D +:1027300020D02BBAC2BA6E98E8BBFBBBE2BA05BB8D +:102740003196C2BA1BBA38BA6E9A02BAAA9581F704 +:1027500010D0A02FAA2339F70CD0002319F0902F06 +:1027600008D0802FE0E7F9E2CED50FE108BB00E00A +:1027700092CFCC23C9F4DD2311F00FE108BB009107 +:102780009F00DEBB6CBA1DB3101719F0D39591F002 +:10279000F8CF38BA03E00FB9779BFECFDFB9779B4C +:1027A000FECFCFB9779BFECF5FB8779BFECF0FB13F +:1027B00021960895E6EAF9E2A6D50F910F9101E07E +:1027C00032FD69CFA9C00091CA001091CB00509290 +:1027D000CA00003031F4153021F40091CC000F3FD5 +:1027E00009F476CA00939F001DB710939A001EB794 +:1027F00010939B00D4DEE4E6F9E285D500919F00BA +:1028000088D5E091CD00F091CE00A091CF00B0919D +:10281000D000C0E0D0E06FBA00E0E1DE0A2F0E1B6E +:10282000DEDE0B2F0F0BDBDEAE1711F4BF1781F0CE +:102830002BBAD2BA6E98E8BBFBBB319600C003B38B +:10284000C2BA1BBA38BA6E9A02BADE9AC8DEECCFA8 +:1028500017DFE8E7F9E257D552D506E10093CA0041 +:1028600037CA0091CA001091CB005092CA000030C4 +:1028700031F4133021F40091CC000F3F09F428CA41 +:1028800000939F00E4E6F9E23ED500919F0041D518 +:1028900000246FBA00919F000EBA6CBA1DB21016D8 +:1028A00039F0039421F4E8E5F9E22DD535C0F4CFF1 +:1028B00076DEC0E0D0E05DDF002321F0E6EEF9E255 +:1028C00022D528C0E091CD00F091CE0052DFA02F9C +:1028D00050DFB02FAE0FA093CF00BF1FB093D0003A +:1028E00054BAAE1711F4BF1779F043DF2BBAC2BA4E +:1028F0006E98E8BBFBBBE2BA05BB3196C2BA1BBA05 +:1029000038BA6E9A02BAEDCFE0E7F9E2FCD407E1FB +:102910000093CA000FE108BBF2D4BDDED9C90D0A8D +:10292000454550524F4D206175746F6C6F61642046 +:102930000000202D200020736C6F74732066726578 +:1029400065000D0A70726F67232F736C6F747320AC +:1029500020006E6F6E650000206E6F7420666F75CC +:102960006E6400000D0A50726F6772616D20000086 +:10297000206C6F616465640020736176656400009B +:1029800020454550524F4D2066756C6C00000D0A75 +:1029900053504920454550524F4D206E6F7420666C +:1029A0006F756E64000020636F7272757074656479 +:1029B00000000D0A536176696E672C203C45534335 +:1029C0003E20746F2061626F72740D0A00000D5317 +:1029D000617665204F4B000020536176652061626F +:1029E0006F727465640020696E636F6D70617469E5 +:1029F000626C6520666F726D61740000ECE2F2E05B +:102A000082D4FFCFFFB620919200422E2F7719F08B +:102A10004A944092920020919300222319F02A9523 +:102A2000209393002091BF0021604090C3004A94FE +:102A300019F44090C40022604092C3002093BF006C +:102A40004090BE00242109F08B9A32FD1BC030FF5C +:102A500019C037FF0FC03F77E093CD00F093CE0051 +:102A6000A093D100B093D2003F7D74BAD2BAF6E001 +:102A7000029734FF0197346000E00BBF0F910F9174 +:102A80007894E2C0FFBE189500E00BBF01970F914C +:102A90000F917894FAC335E00091BF000F737092E4 +:102AA000BF000090BE00002109F48B9800E00BBF2E +:102AB000029768BE7894EB3D11F409D646F01E2EBD +:102AC00094D4ECE3F9E31FD4012D23D40196DDC3A4 +:102AD0000FE108BBC2BA11E81BBB969ADE9A0FEB56 +:102AE00007BB5ABA00EF01BB00C01BBBC2BA57BA42 +:102AF0007DB87EB8C2BA11E81D7F1BBB969A1BBB7E +:102B0000C2BA089508E00EBF0FE50DBF55245A94D0 +:102B100066246394772400E3C02E00E2D02E00E107 +:102B2000E02EF6E0D5DF04E000BF02E005BF74BC94 +:102B300007E003BD09E105BD7092D7007092D50092 +:102B400001E10093D80000E60093910000E80093B3 +:102B5000920050929F0009E109B900E000BD08E928 +:102B60000AB972BE0BE90CBF0DE003BF72BE03E0F1 +:102B700008BF09BF35E07894C2D304B7057099F057 +:102B8000EE27FF27C2BA54BAE8BBFBBBE2BA75BA5C +:102B9000C2BA3196C9F774BAD2BAC0EAD0E0599233 +:102BA000C43BE9F705C0ABD320D4EAE7F1E0ABD3EF +:102BB000F2D3ECE4F9E3A7D3E6E6F9E3A4D304B750 +:102BC0000570D9F17FBA5EBA6CBA0DB37EBA0F3F09 +:102BD000A1F100939F0083DD002379F5FAD39923B7 +:102BE00049F11FB6F894D2E0C0E0062C0EBA6CBAD8 +:102BF0000DB30F3F89F00C3561F403940EBA6CBA33 +:102C00000DB30F3F49F0023709F40DE0013709F425 +:102C100002E209930394EACFC093D600C093D70091 +:102C20001FBE7EBA6CD3F89432E004B7007E04BFB6 +:102C300036C303C0E4E6F1E066D304B7007E04BF08 +:102C40000AE070D3D2D309D4AFF0D8B7D1FF12C005 +:102C5000D2E0D8BFC0919200CF7729F0C091920006 +:102C6000CA95C0939200C0919300CC2319F0CA95E5 +:102C7000C0939300C0919200CC2351F4C0E8C0935C +:102C800092003F7BB2D3E9D32ED3D0E6D09391000C +:102C9000D0919300DD2379F4C03869F431FF09C085 +:102CA00028D307E33FD3A1D3D8D323D308E33AD320 +:102CB00002C0509293001FB6F8940090D7000020F5 +:102CC000B9F0C091D600D2E0C01908810A940092F0 +:102CD000D700202D203848F42091D800213929F040 +:102CE00021E12093D80028EB2AB91FBE0BC009C0F0 +:102CF0001FBE2FF05F9B03C00CB104C002C031FDAA +:102D0000CCC2A2CFC0919200CF7749F01FB6F89401 +:102D1000C0919200C068C09392001FBEBDC2D0E0B7 +:102D2000C09191000F3709F408E0083069F4C0360B +:102D300051F0F8D2E0D208E0F5D2CA95088102320B +:102D400011F400E4302700E0003258F0C03948F4B4 +:102D5000013628F00B3718F436FD01C00052E2D2DC +:102D60000993C0939100023211F410E431270B3122 +:102D700031F417F0D2E0D8BFD6E0D09392000930FA +:102D800079F431FD0DC031D3EC016FD3173009F464 +:102D90007CC2F89452BE09E003BF0DE003BF40C2FD +:102DA0000D3009F079C2C03659F408810D3411F0A4 +:102DB000043431F4E4E4F2E0A6D221960BE2099364 +:102DC00078823F7B0DB700939A000EB700939B006B +:102DD000C0E6C09391000991013431F509910134A5 +:102DE00019F4D0D3502F51C2083519F4CBD3802E0B +:102DF0004CC2093519F4C6D3902E47C2033519F4D5 +:102E0000C1D3B02E42C2063449F4BCD3602F762F12 +:102E1000737067FB72F960626C7637C2003519F423 +:102E2000D2D3CF0132C21CC2023409F056C009917C +:102E3000093429F40991071113C2EFD326C20335CF +:102E400069F5C1D3C0EAD0E009910E1729F40985CC +:102E50000F1711F4E2D319C2CA3AB1F7C0EA0991C7 +:102E60000515A9F40985051591F42197E883FA87DA +:102E7000E8BBFBBB00C0000003B30C8B0BEDE2BA58 +:102E800005BB54BAC2BA74BAD2BAC7D3FEC1CA3AE1 +:102E900031F7EEEBF1E037D2C0D3F7C10334E1F400 +:102EA00009910023C9F00032D9F309900710D8C165 +:102EB0002197013439F4D9D3002019F4E4E9F9E376 +:102EC00022D2E3C100530A3038F4C0EAC00FD0E088 +:102ED000D71DD8D3A2D3D9C1C3C1043409F50991F0 +:102EE0000B3241F409910711BBC1C0919800D091F8 +:102EF000990003C0219767D3EF010AE031FD06E096 +:102F00000F93FDD10D2F05D20C2F03D2F4D1ADD2EA +:102F10000F910A95A9F7C0939800D0939900B5C175 +:102F2000053409F0ABC00991093431F40991071156 +:102F300097C1D9D49DD4A9C1033509F041C022D38A +:102F40000F3F09F48DC100939F0029DBC0E0D0E062 +:102F50006FBAE2EBF9E2D7D1E7D30A33E9F7BB273F +:102F600080D4A02F3CDB0DE0DDD17BD4AA23A9F0D7 +:102F700022D021D0003061F474D431DBAA95E1F77E +:102F800070D4BB2321F0E2E8F9E3BDD173CB04C0D8 +:102F9000E6E0F2E0B8D16ECB0DC00DD00CD0013020 +:102FA00029F4EEECF9E2AFD16BCB04C0E6E0F2E03D +:102FB000AAD160CBD1CF0F93ACD10F9110DB51C40C +:102FC0000C3449F4DFD20F3F29F000939F004DD31A +:102FD00086DB5BC145C1043469F5D4D20F3FD1F320 +:102FE000002411276FBA0EBA6CBA1DB2101649F43C +:102FF0005DBA1FB6F894E29AE19A1FBE1395E19963 +:10300000FECF039481F77EBA7FBA112349F077D1BE +:10301000012F7FD1E6E3F9E276D104E683D109C03E +:10302000102FE4E6F9E26FD1012F73D1E8E5F9E260 +:103030006AD12BC1013411F57FBA0991002351F2F5 +:103040000032D9F3023231F0AED25EBA6ED40991B9 +:103050000032E9F3002371F0023279F411E00991B2 +:10306000002311F0023209F40FEF1EBB5ED413955A +:103070000F3FA9F738D47EBA08C1F2C00D3409F069 +:1030800046C0D2BAE0919400F091950009910023D6 +:10309000D9F00B3251F431FD02C0F39502C0E05C6F +:1030A000FF4F0991002381F0DBC00D3259F431FD4F +:1030B00002C0FA9502C0E054F709102E09910023CE +:1030C00019F0CEC021977FD2E07E0E2F31FD005C3B +:1030D000102EE0939400F093950011D10F2F19D189 +:1030E0000E2F17D10AD1E8BBFBBBE89400C003B395 +:1030F0000B3D09F4DAD2E2D0319603E00E2399F7C2 +:10310000FAD00FE10E2379F7E11539F7BEC0073584 +:1031100071F509910B3229F4E0919600F091970036 +:1031200006C0219765D2E0939400F09395001C2E81 +:103130000991002321F00032D9F335D2F9CFC12D06 +:10314000C2BA54BA0991002359F00032D9F32BD2F4 +:10315000D5D2E8BBFBBBE2BA05BB3196C2BAF2CF0F +:1031600074BAD2BAE0939600F09397008EC00C34F4 +:1031700009F040C00991071173C03D7F76D2EAE3A0 +:10318000F1E0C1D0D1D20A33E9F7BB276AD3A02F2F +:103190000DE0C8D066D3F02FBCD063D3E02FB9D0F8 +:1031A00060D30030B9F4AA23A9F0C2BA54BA59D3F3 +:1031B000E8BBFBBBE2BA05BB3196C2BAAA95B9F728 +:1031C00074BAD2BA4ED3BB2321F0E2E8F9E39BD024 +:1031D000F4C20EC0013041F4FF2309F0CF01E4EE48 +:1031E000F1E091D0EAC204C0E6E0F2E08CD0E5C2A2 +:1031F000C9CF4BC0083429F40991071131C03D7F74 +:1032000044C00734E9F4099107112AC0C0E6C0930D +:1032100091000AE087D0E9D032601FD1F8943B7F5B +:1032200088BB9BBBF6E000EC62FD00E40BBFE3B3A0 +:10323000EB3D09F44CD2019688BB9BBB01960994E7 +:10324000083539F4099107110BC059D0F89432E0D0 +:10325000E7CF023529F40991071102C09CD015C0AF +:1032600021970881071121960FE30883C0E6BDD09E +:10327000F4D0099157D0023211F410E431270F3302 +:10328000C1F7C09391002FD0DFCCC0E6C09391006E +:103290000AE048D0AAD0E1D0D7CCF8943B7FF6E042 +:1032A00000EC62FD00E40BBF88BB9BBB78940196E9 +:1032B000F894E3B388BB9BBB019609940F930295E6 +:1032C00001D00F910F70005D0A3308F0095F56F5C9 +:1032D00033FD08C038600F9309D007E32BD00DE60B +:1032E00029D00F9127C002D00BE424C002D00BE5F7 +:1032F00021C00BE11FC000E215C00AE313C00AE0C1 +:1033000011D00DE00FC00591002311F00BD0FBCFC1 +:1033100008950F93029501D00F910F70005D0A334D +:1033200008F0095F33FF06C00F93377FDFDF0DE63C +:1033300001D00F91CF93DF93B7F40F92C091D400D7 +:10334000D1E00090D5000394E1F3F8940090D5000B +:1033500028EB2AB909930394C093D4000092D500B6 +:1033600078940F9015C04090D500442051F0D1E0E2 +:10337000C091D400C41928815D9BFECF2CB94A941A +:10338000F4CF4092D50028E92AB95D9BFECF0CB955 +:10339000DF91CF9108957092BE007092BF008B981C +:1033A00030FD06C005ED039519F000E80093BF005D +:1033B0000E940E0CF6E07092C50000EF01BB00EC1D +:1033C0000ABF5092CA00552788249924B52C772724 +:1033D00064E2CCEFDFEFC8BBDBBB00C0219683B358 +:1033E000C8BB00C0000093B3089502E300939300AC +:1033F0000DE098DF01E396DF0B2D8BDF7CDF31FFE3 +:1034000002C0E89401C063D1092F58DF082F56DFAE +:1034100072DF052F7EDF6FDF08E784DF082D79DF9D +:103420006ADF09E77FDF092D74DF65DF0EE472FBD9 +:103430004EDF06E566FB4BDF0DE274DF02E472DF70 +:1034400004E463FB44DF09E462FB41DF0AE571FB4E +:103450003EDF03E470FB3BDF4ECF31FF02C007E4E9 +:1034600001C008E45FDF0EE35DCFC8BBDBBB112406 +:10347000E894FE0103B30B3D11F417D1EF01002EC8 +:103480002196000C111C000C111CEEE4F2E0E00D82 +:10349000F11D05911CDF05911ADF059118DF2BDF67 +:1034A00014911076103211F403E23CDF103411F461 +:1034B00008E238DF103639F403B302950770005D77 +:1034C00031DF0CE22FDF14911871183031F4C8BBD2 +:1034D000DBBB219600C003B31CDF103169F4C8BB0D +:1034E000DBBB219600C003B2C8BBDBBB219600C08A +:1034F00003B30FDF002D0DDF183109F42CD0149128 +:103500001770113021F40CE20DDF08E50BDF1230EB +:1035100021F40CE207DF09E505DF133011F409E2BD +:1035200001DF143031F40CE2FDDE08E5FBDE09E2D8 +:10353000F9DE153031F409E2F5DE0CE2F3DE09E5DF +:10354000F1DE163011F401E4EDDE173019F4ECE38E +:10355000F9E3D9DE0895C8BBDBBB21960027000044 +:1035600003B200200AF40A950C0E0D1FD2DE002DC6 +:10357000D0CE00530A3028F00131F0F0075000316E +:10358000D8F4089509910023B9F00032D9F3F1DF9E +:10359000002E02940991002379F0EBDF00291990A5 +:1035A000112051F40895E5DF002E029409910023C3 +:1035B00019F0DFDF0029089500919A000DBF0091F6 +:1035C0009B000EBF4DCE09910023B1F30032D9F319 +:1035D000D0DFFF27E02F0991002349F0CADF14E074 +:1035E000EE0FFF1F48F31A95D9F7E02BF4CF08959B +:1035F0000991002309F30032D9F3BBDFFF27E02F45 +:103600000991003249F0B5DF14E0EE0FFF1FA0F280 +:103610001A95D9F7E02BF4CF0895C0EAD0E0002442 +:10362000FA85F5110394E991E5110394CA3AC1F7BB +:10363000071004C0E4E9F9E366DE16C0ECE9F1E046 +:1036400062DEC0EAE881FA85E51511F4F51549F066 +:1036500052DE0C2F005766DE50DE0F2F5ADE0E2F83 +:1036600058DE2196CA3A71F70895C0EAD0E00024E6 +:1036700009D02196CA3AE1F7002019F0E2E8F1E01A +:1036800042DE0895E881FA85E51511F4F51561F03B +:103690000C89E8BBFBBBE2BA05BB54BAC2BA74BA28 +:1036A000D2BA58825A8603940895C0EAD0E00990AD +:1036B0000E1651F409840F1639F4E51511F4F515B9 +:1036C00011F00B8968940895CA3A89F70895CF9349 +:1036D000DF93C0EAD0E0E8940990081651F4098419 +:1036E000091639F4851511F4951511F0EB896894D4 +:1036F00002C0CA3A89F7DF91CF910895CF93DF9343 +:10370000C0EAD0E009900E1651F409840F1639F47E +:10371000E51511F4F51511F00B8B0BED02C0CA3A4B +:1037200089F7DF91CF910895CF93DF931FB6F89477 +:103730002091D7002223B1F0C091D600D2E0C21B65 +:1037400008812A952093D700203848F42091D8008A +:10375000213929F021E12093D80028EB2AB91FBE96 +:1037600008C006C01FBE27F05F9B02C00CB101C09D +:10377000DDCFDF91CF910B3171F400919F000F3FAE +:1037800029F4E6E5F1E0BFDD60C005C0E8EDF9E24F +:10379000BADD0C943A130895C7DF00530A3028F0BD +:1037A000013120F00750003108F40895EEEEF1E009 +:1037B000AADD00919F000F3F61F7C6E0C093920021 +:1037C0001FB6F8942091D7002223E1F0C091D600D3 +:1037D000D2E0C01908812A952093D700203848F4F8 +:1037E0002091D800213929F021E12093D80028EB3D +:1037F0002AB91FBEC6E0C09392000D3011F400E05C +:1038000091DD0CC01FBE57F05F9B08C00CB1C6E035 +:10381000C09392000D3011F400E084DD77F0D8B74A +:10382000D1FF0BC0D2E0D8BFC0919200CF7729F072 +:10383000C0919200CA95C0939200C0919200CC238F +:1038400009F0BECFC0E8C09392000E944B130091D4 +:103850009A000DBF00919B000EBF32FD16CD4FDDCB +:103860001ECD9ADF0295002E97DF0029B00F089534 +:10387000E2E3F9E248DD002400276FBA0EBA6CBA21 +:103880001DB3151529F4039519F401E34BDD002749 +:103890000394A1F73EDDE6E3F9E235DDE1E011272F +:1038A0000FEF0EBA6CBA1DB2111630F0101609F4F3 +:1038B000C39510F4C1E0012D039499F70F3F81F0F7 +:1038C000102FEA9529F4E2E4F9E21DDDEAE0012F88 +:1038D00013951FDD0FE226DD0C2F1BDD0CDDE0CF85 +:1038E0007FBA7EBA0895EEE1F9E20DDD7FBA5EBAE5 +:1038F0006CBA0DB30F3F21F4E2E5F9E204DD14C028 +:1039000008DD062C0EBA6CBA1DB31F3F69F0F3DC5C +:1039100002E208DD012F06DD03940EBA6CBA0DB386 +:103920000F3FC9F702E2FEDC08950DBB0FB6F89415 +:10393000E29AE19A0FBEE199FECF0895496C6C6559 +:1039400067616C204F70636F646520000D0A0D0A7B +:103950004E3635303220456D756C61746F7220566D +:10396000302E38336200206275696C7420466562BF +:1039700020323520323031362031303A35353A3543 +:10398000370020436865636B73756D206661696CF1 +:10399000656400000A0D4E6F20627265616B706F86 +:0C39A000696E74732061637469766500C1 +:00000001FF diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.lst b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.lst new file mode 100644 index 00000000..aa2c0fec --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.lst @@ -0,0 +1,10529 @@ + +AVRASM ver. 2.1.43 6502_emu.asm Thu Feb 25 10:55:57 2016 + +6502_emu.asm(100): Including file 'sam.inc' +6502_emu.asm(110): Including file '6502_Emu_config.inc' +6502_Emu_config.inc(18): Including file 'm32def.inc' +6502_emu.asm(642): Including file '6502_Emu_NMOS.inc' +6502_emu.asm(651): Including file '6502_Emu_IO.inc' +6502_Emu_IO.inc(1173): Including file '6502_Emu_config.inc' + + + ; + ; 6 5 0 2 E M U L A T O R + ; + ; An AVR emulates a 6502 with >2MHz speed + ; + ; Copyright (C) 2013-2015 Klaus Dormann + ; + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU General Public License as published by + ; the Free Software Foundation, either version 3 of the License, or + ; (at your option) any later version. + ; + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU General Public License for more details. + ; + ; You should have received a copy of the GNU General Public License + ; along with this program. If not, see . + ; + ; contact info at http://2m5.de or email K@2m5.de + ; + #define version "0.83b" ;makes a printable version number + ; + ; version history: + ; 0.8 24-jan-13 1st version distributed for testing + ; 0.81 04-mar-13 added binary load/save/autoload support for applications + ; added 6502_Emu_config.inc for all reconfigurable items. + ; split cpu core into 6502_Emu_NMOS.inc to support change to CMOS + ; added timer 1 access, tested and fixed all interrupts + ; added countdown timer & interrupt vector register + ; added optional software flow control to rx buffer + ; improved terminal support for backspace and delete key + ; 0.82 20-jul-13 added CMOS core (65C02 instructions and disassembly) + ; 0.83 17-may-14 added breakpoint support to debugger + ; added SPI support to IO module, DMA for SPI & I2C + ; 0.83a 17-aug-14 changed interrupt disabled in real mode to honor NMI & single step + ; fixed diag stop continuing until 10ms interrupt, now immediate + ; fixed invalid opcode message broken by check for breakpoint + ; 0.83b 24-jan-15 fixed ATMega32 interrupt table, fixed break hanging on some terminals + ; reduced interrupt latency caused by the monitor waiting for tx buffer + ; + ; + ; ATMEGA16 & ATMEGA32 fuse settings: + ; 16 MHz crystal + ; JTAGEN unprogrammed + ; BOD enabled - 4,0V + ; Preserve EEPROM - protect non volatile program memory, else clears all saved programs + ; + ; related docs: http://2m5.de/6502_Emu/index.htm + ; + ; description of hardware: + ; porta0:7 -> address bus high : IO chip select latches + ; portb0:7 -> address bus low : IO address & IO R/W : SPI & slave select latch + ; portc0:7 <> data bus : I2C bus switch + ; portd0:1 RS232 monitor & ACIA emulation + ; portd2 <- ~NMI (INT0) / optional IO-select 3 + ; portd3 <- ~IRQ (INT1) + ; portd4 -> ~RD_RAM (/OE at SRAM) + ; portd5 -> ~WR_RAM (/WE at SRAM) + ; /CE tied low at SRAM + ; portd6 -> IO-select 1 + ; portd7 -> phi2 (OC2) / optional IO-select 2 + ; + ; pullups required for MNI, IRQ, weak pullups for WR_RAM, RD_RAM + ; + ; optional weak pullups or pulldowns on IO selects and + ; IO busses to reset external hardware during high-Z + ; + ; timer0 debugger 20ms timer: ctc interrupt + ; debugger single step: overflow interrupt + ; timer2 optional 1 MHz phase 2 output on OC2 + ; + + ; The following notes apply to the NMOS emulation core: + ; + ; Emulation is documented instructions only ! + ; + ; Invalid 6502 instructions will cause a halt with message. + ; + ; Decimal mode emulation will emulate documented behavior only: + ; a decimal result & carry-flag is valid if both operands were valid BCD + ; + ; negative, overflow & zero-flags may be altered after a decimal add + ; or subtract, but have no valid meaning and may not be identical to real + ; hardware. The result of a decimal operation with non decimal operands + ; (any nibble >9) may not match the result of a hardware 6502 + ; + ; In the CMOS emulation core all instructions are valid and if not defined + ; otherwise, will be executed as NOP instructions of various length in bytes + ; and cycles depending on the decode mechanism in the original CMOS core. + ; + ; A decimal operation with valid decimal numbers will have a valid result + ; and valid NZC flags. The result and flags of decimal add or subtract with + ; invalid BCD operands may not match a real 65C02. + + + .LIST + + + ;**************************** + ; + ; C O N F I G U R A T I O N + ; + ;**************************** + .set config_part=1 + .include "6502_Emu_config.inc" + + + ;********************************************************************* + ; + ; 6502 Emulator Configuration + ; + ; This file should preserve your personal configuration when upgrading + ; the source code. + ; + ;********************************************************************* + .set config_version = 831 + + ;ATMega platform - ATMega16 or ATMega32 + ; ATMega32 may be required due to flash size for configured features + .IFNDEF SIGNATURE_000 ;not already defined per default device in Atmel Studio >4 + .LIST + .ENDIF + + ;AVR clock speed + .equ Osc_Hz = 16000000 ;16 MHz + + ;external SRAM waittime between applying address and data stable + .set data_valid_ns = 180 + ; the time is calculated as follows: + ; RAM access time + AVR input sync latch (1/2 clock) + ; + input & output propagation delay (~ 2 * 15ns) + ; for a 62256-80 on an AVR at 16MHz: 80 + 62,5 / 2 + 15 + 15 + ; only change if RAM is slower than 120ns + ; in most cases at least 3 waitcycles are used for housekeeping anyway + + ;Baudrate + .equ BAUD = 38400 ;maximum standard rate with <1% deviation @ 16MHz + + ;RS232 software flow control watermarks, disabled if undefined + ; the buffer max is 255 bytes + ; RX only to prevent overruning applications input capacity + .equ flowlo = 128 ;low watermark, send XON if less buffer used + .equ flowhi = 192 ;high watermark, send XOFF if reached + + ;select emulator core CMOS 65C02, NMOS 6502 if undefined + ;.equ cmos_core = 1 + + ;interrupt disable mode real, virtual if undefined + ;.equ irq_dis_real = 1 + ; virtual = background interrupts always allowed = always full control, + ; no atomic timing for disabled instruction sequence. + ; real = absolutely no interrupts allowed when disabled except single step and NMI, + ; program must not have extended disable periods, atomic timing is enforced, + ; reset button mandatory to recover the monitor/debugger when I bit remains set. + + ;ROM load & write protect page boundary - RAM at this page and above is write protected + ;adds 2 cycles (125ns) to instructions writing to memory (stores & modifying memory) + ;.equ rommap = 0xc0 + + ;**** IO **** + ;internal IO access page (RS232, Timers, Latches) - disabled if undefined + .equ iomap = 0xbf + ; Can be configured overlapping ROM-space if no operand fetch from the same page + ; is required. Instruction fetch including immediate operands will always be + ; served from RAM (used as peudo-ROM) - writes and reads of nonimmediate operands + ; will be to and from IO-space. + ; setting iomap to page zero is not allowed. + + ; enable phi2 output on portd7, disabled if undefined + ; required to drive 65xx IO chips + .equ phi2_ena = 1 + + ; enable NMI input on portd2, disabled if undefined + ;.ifndef irq_dis_real + .equ nmi_ena = 1 + ;.endif + + ;**** IO select expansion registers **** + ;define inactive values of IO-select pins on IO-select expansion registers + ;defines the opposite value as strobe polarity for each IO select pin + + .equ ios1_default = 0b10000001 ;IO select pin 1 expansion default + ;io select bits 10 = -74HC573 input latch + ; 11 = 74HC573 output latch + ; 12 = HD44780 compatible character LCD + ; 13 = 65xx IO + ; 14 = I2C connect (74hc4066) + ; 15 = XMEM select + ; 16 = SPI select + ; 17 = -IO reset + + .ifndef phi2_ena ;not available if phi2 uses cbus pin 7 + .endif + + .ifndef nmi_ena ;not available if NMI uses cbus pin 2 + .endif + + ;**** IO select for builtin modules **** + ; enable SPI module and define IO select signal for SPI, disabled if undefined + .equ spi_sel = 16 ;IO select register 1, pin 6 + + ; enable I2C module and define IO select signal for I2C, disabled if undefined + .equ i2c_sel = 14 ;IO select register 1, pin 4 + + ; enable LCD module and define IO select signal for LCD, disabled if undefined + .equ lcd_sel = 12 ;IO select register 1, pin 2 + + ; IO selects of the addon IO modules in part 2 of the configuration + + ;**** SPI software address translation **** + ;translate IO-address to slave select + ;reset state, must be defined + .equ spi_idle = 0b11111 ;all slaves inactive + ;.equ spi_idle = 0xf ;unused address for hardware translation + ;SS bit 0 = -SD card + ;SS bit 1 = -74HC165 parallel input shifter + ;SS bit 2 = -74HC595 parallel output shifter + ;SS bit 3 = -25LC512 SPI EEPROM 64kB + ;SS bit 4 = -unused + + ;enable spi virtual address translation, disabled if undefined + .equ spi_vat = 1 + + ;oplow BCD to SS pin table + .macro spi_virt_ss + ; x0 = SD card on bit0 (-cs) & bit4 (+oe) + ; x1 = 74HC165 on bit1 (-sh/+ld -oe) + .db 0b00001^spi_idle,0b00010^spi_idle + ; x2 = 74HC595 on bit2 (+rck) + ; x3 = 25LC512 EEPROM on bit 3 (-cs) + ; .db 0b00100^spi_idle,0b01000^spi_idle + .db 0b00100^spi_idle,spi_idle ;EEPROM masked + ; x4 unused + ; x5 inactive + .db 0b10000^spi_idle,spi_idle + ; x6 inactive + ; x7 inactive + .db spi_idle,spi_idle + .endmacro + + ;**** IO resets **** + ;a reset pin can be defined and must reside on an IO-select expansion register + ;this pin is strobed low during reset if defined + .equ io_reset_pin = 17 + + ;definition for io modules with a reset vector + .macro io_modules_reset + rcall ltch_rs ;reset 74HC573 + .endmacro + + ;**** miscelaneous **** + ;64kB serial EEPROM reserved for non volatile program storage + ;eep_adr >= 8 = I2C slave adr.; eep_adr < 8 = SPI device adr. + ;none if undefined + ;.equ eep_adr = 0xa0 ;I2C EEPROM + .equ eep_adr = 3 ;SPI EEPROM + + ; self diag register enable, allow force IRQ, NMI, RESET + ; should stay undefined to prevent you from shooting yourself in the foot + .equ ena_diag = 1 + + .endif + .if config_part == 2 ;invoked from 6502_Emu_IO.inc + .if (pc & 0xf) + .endif + .ifdef spi_vat + .endif + .endif + + ;configuration based clock constants + .equ cycle_time_tns = (10000000000 / Osc_Hz) ;1/10 ns cpu clock duration + .equ ten_ms = ((Osc_Hz - 51200) / 102400) ;10ms OCR0 value rounded + + ;configuration based baudrate constants and error checking + .equ UBRR_value = ((Osc_Hz + Baud * 8) / (Baud * 16) - 1) ; rounded + .equ Baud_error = ((1000 * Osc_Hz / (16 * (UBRR_value + 1)) / Baud) - 1000) ;0/00 deviation + .if ((Baud_error > 10) || (Baud_error < -10)) ; +/-10 0/00 acceptable + .endif + + ;configuration based serial EEPROM constants + .ifdef eep_adr + .if eep_adr < 8 + .ifdef spi_sel + .ifdef spi_vat + .equ spi_eep_adr = spi_idle^(1< 15) + .error "MACRO wait_ns - too many cycles to burn" + .else + .if (cycles > 0) + .if (cycles & 8) + rjmp pc+1 + rjmp pc+1 + rjmp pc+1 + rjmp pc+1 + .endif + .if (cycles & 4) + rjmp pc+1 + rjmp pc+1 + .endif + .if (cycles & 2) + rjmp pc+1 + .endif + .if (cycles & 1) + nop + .endif + .endif + .endif + .endmacro + ; wait_data_valid cycles already used + #define wait_data_valid wait_ns data_valid_ns, + + ; print string - debugger + .macro PrintStr ;@0 = message pointer + ldi zl,low(@0*2) + ldi zh,high(@0*2) + rcall prtstr + .endmacro + .macro PrintStr_far ;@0 = message pointer + ldi zl,low(@0*2) + ldi zh,high(@0*2) + call prtstr + .endmacro + + + ;***************************************************************** + ; + ; reset and interrupt vectors according to µc type + ; + ;***************************************************************** + + #ifdef _M16DEF_INC_ + #endif + #ifdef _M32DEF_INC_ +000000 940c 1582 jmp reset ; Reset handler +000002 c364 rjmp NMI ; INT0 handler +000003 0000 nop +000004 c322 rjmp IRQ ; INT1 handler +000005 0000 nop +000006 940c 14fe jmp illegalint ; INT2 handler +000008 940c 14fe jmp illegalint ; Timer2 compare match +00000a 940c 14fe jmp illegalint ; Timer2 overflow + .ifdef iomap +00000c 940c 0dbe jmp t1_icr ; Timer1 capture event +00000e 940c 0db0 jmp t1_ocra ; Timer1 compare match A +000010 940c 0db7 jmp t1_ocrb ; Timer1 compare match B +000012 940c 0da9 jmp t1_ovi ; Timer1 overflow handler + .else + .endif +000014 940c 1502 jmp t0_cmi ; Timer0 compare match - debugger 10ms timer +000016 940c 1544 jmp t0_ovi ; Timer0 overflow handler - debugger single step +000018 940c 14fe jmp illegalint ; SPI - Serial transfer complete +00001a c00f rjmp rx_int ; USART - RX complete +00001b 0000 nop +00001c c055 rjmp tx_udre ; USART - data register empty +00001d 0000 nop +00001e 940c 14fe jmp illegalint ; USART - TX complete +000020 940c 14fe jmp illegalint ; ADC conversion complete +000022 940c 14fe jmp illegalint ; EEPROM ready +000024 940c 14fe jmp illegalint ; Analog comparator +000026 940c 14fe jmp illegalint ; TWI serial interface +000028 940c 14fe jmp illegalint ; SPM ready + #endif + .if pc < 0x2a + .endif + + ;***************************************************************** + ; + ; RS232 buffer + ; + ;***************************************************************** + ; + ; RX complete interrupt - rx fifo input + ; + rx_int: +00002a b6ff in s,sreg +00002b 93af push xl +00002c 93bf push xh +00002d b04b in k,ucsra +00002e b12c in i,udr +00002f fe44 sbrs k,fe ;no stop bit = possible break +000030 c019 ifs_and rx_break +000031 3020 cpi i,0 ;break should have all bits 0 +000032 f4b9 ifeq rx_break +000033 6031 sbr flags,(1< ;## + ;.ifdef cmos_core + ;stp_instr: .db "STP - Emulator halted",0 ; X + ;.else + ;inv_instr: .db "Illegal Opcode ",0 ; X + ;.endif + ;emu_msg: .db 13,10,13,10,core_string," Emulator V",version,0 ; X + ;built_msg: .db " built ",__DATE__," ",__TIME__,0 ;14 +00009d 0a0d +00009e 6f4c +00009f 6461 +0000a0 6e69 +0000a1 2c67 +0000a2 3c20 +0000a3 5345 +0000a4 3e43 +0000a5 7420 +0000a6 206f +0000a7 6261 +0000a8 726f +0000a9 0d74 +0000aa 000a load_wait: .db 13,10,"Loading, to abort",13,10,0 ;14 +0000ab 4c20 +0000ac 616f +0000ad 2064 +0000ae 6261 +0000af 726f +0000b0 6574 +0000b1 0064 load_abort: .db " Load aborted",0 ; 7 + ;err_chksum: .db " Checksum failed",0,0 ; 9 +0000b2 0a0d +0000b3 6843 +0000b4 6365 +0000b5 206b +0000b6 6572 +0000b7 6573 +0000b8 2074 +0000b9 6576 +0000ba 7463 +0000bb 726f +0000bc 0000 rs_vect_empty: .db 13,10,"Check reset vector",0,0 ;11 +0000bd 2020 +0000be 6552 +0000bf 6573 +0000c0 0074 reset_msg: .db " Reset",0 ; 4 +0000c1 0d0a +0000c2 6c41 +0000c3 206c +0000c4 7262 +0000c5 6165 +0000c6 706b +0000c7 696f +0000c8 746e +0000c9 2073 +0000ca 6c63 +0000cb 6165 +0000cc 6572 +0000cd 0064 bpt_clrd_msg: .db 10,13,"All breakpoints cleared",0 ;13 +0000ce 0d0a +0000cf 7242 +0000d0 6165 +0000d1 706b +0000d2 696f +0000d3 746e +0000d4 2073 +0000d5 2820 +0000d6 6c73 +0000d7 746f +0000d8 3a23 +0000d9 6461 +0000da 7264 +0000db 7365 +0000dc 2973 +0000dd 0a0d +0000de 0000 bpt_info: .db 10,13,"Breakpoints (slot#:address)",13,10,0,0 ;17 + ;bpt_info_none: .db 10,13,"No breakpoints active",0 ;12 +0000df 0d0a +0000e0 6f4e +0000e1 6d20 +0000e2 726f +0000e3 2065 +0000e4 7262 +0000e5 6165 +0000e6 706b +0000e7 696f +0000e8 746e +0000e9 7320 +0000ea 6f6c +0000eb 7374 +0000ec 6120 +0000ed 6176 +0000ee 6c69 +0000ef 6261 +0000f0 656c +0000f1 0000 bpt_slot_full: .db 10,13,"No more breakpoint slots available",0,0 ;19 + .ifndef irq_dis_real ;+53 words available (6 less for NMOS) +0000f2 4c0d +0000f3 616f +0000f4 2064 +0000f5 4b4f +0000f6 0000 load_ok: .db 13,"Load OK",0,0 ; 5 +0000f7 4e20 +0000f8 6e6f +0000f9 482d +0000fa 7865 +0000fb 6420 +0000fc 7461 +0000fd 2061 +0000fe 6e69 +0000ff 7220 +000100 6365 +000101 726f +000102 0064 err_nonhex: .db " Non-Hex data in record",0 ;12 +000103 4920 +000104 766e +000105 6c61 +000106 6469 +000107 6620 +000108 6e75 +000109 7463 +00010a 6f69 +00010b 206e +00010c 726f +00010d 6320 +00010e 756f +00010f 746e +000110 6920 +000111 206e +000112 6572 +000113 6f63 +000114 6472 +000115 0000 err_func: .db " Invalid function or count in record",0,0 ;19 +000116 0a0d +000117 5641 +000118 2052 +000119 6c49 +00011a 656c +00011b 6167 +00011c 206c +00011d 6e49 +00011e 6574 +00011f 7272 +000120 7075 +000121 0074 illegal_int: .db 13,10,"AVR Illegal Interrupt",0 ;12 +000122 1b0d +000123 4b5b +000124 5b1b +000125 4131 +000126 0000 back_line: .db 13,27,91,"K",27,91,"1A",0,0 ; 5 + .endif + + ;************************************************** + ; + ; 6502 emulation core + ; + ;************************************************** + .ifdef cmos_core + .else + .include "6502_Emu_NMOS.inc" + + ; 6502 EMULATOR include + ; + ; N M O S c o r e + ; + ; Copyright (C) 2013-2014 Klaus Dormann + ; + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU General Public License as published by + ; the Free Software Foundation, either version 3 of the License, or + ; (at your option) any later version. + ; + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU General Public License for more details. + ; + ; You should have received a copy of the GNU General Public License + ; along with this program. If not, see . + ; + ; + .set core_version = 831 + #define core_string "N6502" ;identify NMOS core in version message + + ;***************************************************************** + ; + ; 6502 emulation disassembly table + ; + ;***************************************************************** + ;addressing modes + .equ op_nv = 0b0000111 ;invalid + .equ op_s = 0b0000000 ;single (implied) - TAX + .equ op_a = 0b0010000 ;absolute - LDA abs + .equ op_x = 0b0010001 ;absolute indexed X - LDA abs,x + .equ op_y = 0b0010010 ;absolute indexed Y - LDA abs,y + .equ op_i = 0b1010011 ;absolute indirect - JMP (abs) + .equ op_m = 0b0101000 ;immediate - LDA # + .equ op_r = 0b0011000 ;relative to PC - BEQ rel + .equ op_z = 0b0001000 ;zero page - LDA zp + .equ op_zxi = 0b1001100 ;zero page indexed X indirect LDA (zp,x) + .equ op_zx = 0b0001001 ;zero page indexed X - LDA zp,x + .equ op_zy = 0b0001010 ;zero page indexed Y - LDA zp,y + .equ op_ziy = 0b1001101 ;zero page indidrect indexed Y - LDA (zp),y + .equ op_sa = 0b0000110 ;single accumulator - ASL A + ; 0b00_____ no prefix + ; 0b01_____ # - immediate + ; 0b10_____ ( - opening indirect + ; 0b__00___ no data - implied + ; 0b__01___ 1 Byte - zero page or immediate + ; 0b__10___ 2 Bytes - absolute + ; 0b__11___ 1 Byte relative - calculated absolute + ; 0b____000 no suffix + ; 0b____001 ,X - indexed X + ; 0b____010 ,Y - indexed Y + ; 0b____011 ) - closing indirect + ; 0b____100 ,X) - indexed X indirect + ; 0b____101 ),Y - indirect indexed Y + ; 0b____110 A - implied accumulator + ; 0b____111 Invalid Instruction + +000127 5242 +000128 004b dis_opcode: .db "BRK",op_s +000129 524f +00012a 4c41 .db "ORA",op_zxi +00012b 303f +00012c 0732 .db "?02",op_nv +00012d 303f +00012e 0733 .db "?03",op_nv +00012f 303f +000130 0734 .db "?04",op_nv +000131 524f +000132 0841 .db "ORA",op_z +000133 5341 +000134 084c .db "ASL",op_z +000135 303f +000136 0737 .db "?07",op_nv +000137 4850 +000138 0050 .db "PHP",op_s +000139 524f +00013a 2841 .db "ORA",op_m +00013b 5341 +00013c 064c .db "ASL",op_sa +00013d 303f +00013e 0742 .db "?0B",op_nv +00013f 303f +000140 0743 .db "?0C",op_nv +000141 524f +000142 1041 .db "ORA",op_a +000143 5341 +000144 104c .db "ASL",op_a +000145 303f +000146 0746 .db "?0F",op_nv + +000147 5042 +000148 184c .db "BPL",op_r +000149 524f +00014a 4d41 .db "ORA",op_ziy +00014b 313f +00014c 0732 .db "?12",op_nv +00014d 313f +00014e 0733 .db "?13",op_nv +00014f 313f +000150 0734 .db "?14",op_nv +000151 524f +000152 0941 .db "ORA",op_zx +000153 5341 +000154 094c .db "ASL",op_zx +000155 313f +000156 0737 .db "?17",op_nv +000157 4c43 +000158 0043 .db "CLC",op_s +000159 524f +00015a 1241 .db "ORA",op_y +00015b 313f +00015c 0741 .db "?1A",op_nv +00015d 313f +00015e 0742 .db "?1B",op_nv +00015f 313f +000160 0743 .db "?1C",op_nv +000161 524f +000162 1141 .db "ORA",op_x +000163 5341 +000164 114c .db "ASL",op_x +000165 313f +000166 0746 .db "?1F",op_nv + +000167 534a +000168 1052 .db "JSR",op_a +000169 4e41 +00016a 4c44 .db "AND",op_zxi +00016b 323f +00016c 0732 .db "?22",op_nv +00016d 323f +00016e 0733 .db "?23",op_nv +00016f 4942 +000170 0854 .db "BIT",op_z +000171 4e41 +000172 0844 .db "AND",op_z +000173 4f52 +000174 084c .db "ROL",op_z +000175 323f +000176 0737 .db "?27",op_nv +000177 4c50 +000178 0050 .db "PLP",op_s +000179 4e41 +00017a 2844 .db "AND",op_m +00017b 4f52 +00017c 064c .db "ROL",op_sa +00017d 323f +00017e 0742 .db "?2B",op_nv +00017f 4942 +000180 1054 .db "BIT",op_a +000181 4e41 +000182 1044 .db "AND",op_a +000183 4f52 +000184 104c .db "ROL",op_a +000185 323f +000186 0746 .db "?2F",op_nv + +000187 4d42 +000188 1849 .db "BMI",op_r +000189 4e41 +00018a 4d44 .db "AND",op_ziy +00018b 333f +00018c 0732 .db "?32",op_nv +00018d 333f +00018e 0733 .db "?33",op_nv +00018f 333f +000190 0734 .db "?34",op_nv +000191 4e41 +000192 0944 .db "AND",op_zx +000193 4f52 +000194 094c .db "ROL",op_zx +000195 333f +000196 0737 .db "?37",op_nv +000197 4553 +000198 0043 .db "SEC",op_s +000199 4e41 +00019a 1244 .db "AND",op_y +00019b 333f +00019c 0741 .db "?3A",op_nv +00019d 333f +00019e 0742 .db "?3B",op_nv +00019f 333f +0001a0 0743 .db "?3C",op_nv +0001a1 4e41 +0001a2 1144 .db "AND",op_x +0001a3 4f52 +0001a4 114c .db "ROL",op_x +0001a5 333f +0001a6 0746 .db "?3F",op_nv + +0001a7 5452 +0001a8 0049 .db "RTI",op_s +0001a9 4f45 +0001aa 4c52 .db "EOR",op_zxi +0001ab 343f +0001ac 0732 .db "?42",op_nv +0001ad 343f +0001ae 0733 .db "?43",op_nv +0001af 343f +0001b0 0734 .db "?44",op_nv +0001b1 4f45 +0001b2 0852 .db "EOR",op_z +0001b3 534c +0001b4 0852 .db "LSR",op_z +0001b5 343f +0001b6 0737 .db "?47",op_nv +0001b7 4850 +0001b8 0041 .db "PHA",op_s +0001b9 4f45 +0001ba 2852 .db "EOR",op_m +0001bb 534c +0001bc 0652 .db "LSR",op_sa +0001bd 343f +0001be 0742 .db "?4B",op_nv +0001bf 4d4a +0001c0 1050 .db "JMP",op_a +0001c1 4f45 +0001c2 1052 .db "EOR",op_a +0001c3 534c +0001c4 1052 .db "LSR",op_a +0001c5 343f +0001c6 0746 .db "?4F",op_nv + +0001c7 5642 +0001c8 1843 .db "BVC",op_r +0001c9 4f45 +0001ca 4d52 .db "EOR",op_ziy +0001cb 353f +0001cc 0732 .db "?52",op_nv +0001cd 353f +0001ce 0733 .db "?53",op_nv +0001cf 353f +0001d0 0734 .db "?54",op_nv +0001d1 4f45 +0001d2 0952 .db "EOR",op_zx +0001d3 534c +0001d4 0952 .db "LSR",op_zx +0001d5 353f +0001d6 0737 .db "?57",op_nv +0001d7 4c43 +0001d8 0049 .db "CLI",op_s +0001d9 4f45 +0001da 1252 .db "EOR",op_y +0001db 353f +0001dc 0741 .db "?5A",op_nv +0001dd 353f +0001de 0742 .db "?5B",op_nv +0001df 353f +0001e0 0743 .db "?5C",op_nv +0001e1 4f45 +0001e2 1152 .db "EOR",op_x +0001e3 534c +0001e4 1152 .db "LSR",op_x +0001e5 353f +0001e6 0746 .db "?5F",op_nv + +0001e7 5452 +0001e8 0053 .db "RTS",op_s +0001e9 4441 +0001ea 4c43 .db "ADC",op_zxi +0001eb 363f +0001ec 0732 .db "?62",op_nv +0001ed 363f +0001ee 0733 .db "?63",op_nv +0001ef 363f +0001f0 0734 .db "?64",op_nv +0001f1 4441 +0001f2 0843 .db "ADC",op_z +0001f3 4f52 +0001f4 0852 .db "ROR",op_z +0001f5 363f +0001f6 0737 .db "?67",op_nv +0001f7 4c50 +0001f8 0041 .db "PLA",op_s +0001f9 4441 +0001fa 2843 .db "ADC",op_m +0001fb 4f52 +0001fc 0652 .db "ROR",op_sa +0001fd 363f +0001fe 0742 .db "?6B",op_nv +0001ff 4d4a +000200 5350 .db "JMP",op_i +000201 4441 +000202 1043 .db "ADC",op_a +000203 4f52 +000204 1052 .db "ROR",op_a +000205 363f +000206 0746 .db "?6F",op_nv + +000207 5642 +000208 1853 .db "BVS",op_r +000209 4441 +00020a 4d43 .db "ADC",op_ziy +00020b 373f +00020c 0732 .db "?72",op_nv +00020d 373f +00020e 0733 .db "?73",op_nv +00020f 373f +000210 0734 .db "?74",op_nv +000211 4441 +000212 0943 .db "ADC",op_zx +000213 4f52 +000214 0952 .db "ROR",op_zx +000215 373f +000216 0737 .db "?77",op_nv +000217 4553 +000218 0049 .db "SEI",op_s +000219 4441 +00021a 1243 .db "ADC",op_y +00021b 373f +00021c 0741 .db "?7A",op_nv +00021d 373f +00021e 0742 .db "?7B",op_nv +00021f 373f +000220 0743 .db "?7C",op_nv +000221 4441 +000222 1143 .db "ADC",op_x +000223 4f52 +000224 1152 .db "ROR",op_x +000225 373f +000226 0746 .db "?7F",op_nv + +000227 383f +000228 0730 .db "?80",op_nv +000229 5453 +00022a 4c41 .db "STA",op_zxi +00022b 383f +00022c 0732 .db "?82",op_nv +00022d 383f +00022e 0733 .db "?83",op_nv +00022f 5453 +000230 0859 .db "STY",op_z +000231 5453 +000232 0841 .db "STA",op_z +000233 5453 +000234 0858 .db "STX",op_z +000235 383f +000236 0737 .db "?87",op_nv +000237 4544 +000238 0059 .db "DEY",op_s +000239 383f +00023a 0739 .db "?89",op_nv +00023b 5854 +00023c 0041 .db "TXA",op_s +00023d 383f +00023e 0742 .db "?8B",op_nv +00023f 5453 +000240 1059 .db "STY",op_a +000241 5453 +000242 1041 .db "STA",op_a +000243 5453 +000244 1058 .db "STX",op_a +000245 383f +000246 0746 .db "?8F",op_nv + +000247 4342 +000248 1843 .db "BCC",op_r +000249 5453 +00024a 4d41 .db "STA",op_ziy +00024b 393f +00024c 0732 .db "?92",op_nv +00024d 393f +00024e 0733 .db "?93",op_nv +00024f 5453 +000250 0959 .db "STY",op_zx +000251 5453 +000252 0941 .db "STA",op_zx +000253 5453 +000254 0a58 .db "STX",op_zy +000255 393f +000256 0737 .db "?97",op_nv +000257 5954 +000258 0041 .db "TYA",op_s +000259 5453 +00025a 1241 .db "STA",op_y +00025b 5854 +00025c 0053 .db "TXS",op_s +00025d 393f +00025e 0742 .db "?9B",op_nv +00025f 393f +000260 0743 .db "?9C",op_nv +000261 5453 +000262 1141 .db "STA",op_x +000263 393f +000264 0745 .db "?9E",op_nv +000265 393f +000266 0746 .db "?9F",op_nv + +000267 444c +000268 2859 .db "LDY",op_m +000269 444c +00026a 4c41 .db "LDA",op_zxi +00026b 444c +00026c 2858 .db "LDX",op_m +00026d 413f +00026e 0733 .db "?A3",op_nv +00026f 444c +000270 0859 .db "LDY",op_z +000271 444c +000272 0841 .db "LDA",op_z +000273 444c +000274 0858 .db "LDX",op_z +000275 413f +000276 0737 .db "?A7",op_nv +000277 4154 +000278 0059 .db "TAY",op_s +000279 444c +00027a 2841 .db "LDA",op_m +00027b 4154 +00027c 0058 .db "TAX",op_s +00027d 413f +00027e 0742 .db "?AB",op_nv +00027f 444c +000280 1059 .db "LDY",op_a +000281 444c +000282 1041 .db "LDA",op_a +000283 444c +000284 1058 .db "LDX",op_a +000285 413f +000286 0746 .db "?AF",op_nv + +000287 4342 +000288 1853 .db "BCS",op_r +000289 444c +00028a 4d41 .db "LDA",op_ziy +00028b 423f +00028c 0732 .db "?B2",op_nv +00028d 423f +00028e 0733 .db "?B3",op_nv +00028f 444c +000290 0959 .db "LDY",op_zx +000291 444c +000292 0941 .db "LDA",op_zx +000293 444c +000294 0a58 .db "LDX",op_zy +000295 423f +000296 0737 .db "?B7",op_nv +000297 4c43 +000298 0056 .db "CLV",op_s +000299 444c +00029a 1241 .db "LDA",op_y +00029b 5354 +00029c 0058 .db "TSX",op_s +00029d 423f +00029e 0742 .db "?BB",op_nv +00029f 444c +0002a0 1159 .db "LDY",op_x +0002a1 444c +0002a2 1141 .db "LDA",op_x +0002a3 444c +0002a4 1258 .db "LDX",op_y +0002a5 423f +0002a6 0746 .db "?BF",op_nv + +0002a7 5043 +0002a8 2859 .db "CPY",op_m +0002a9 4d43 +0002aa 4c50 .db "CMP",op_zxi +0002ab 433f +0002ac 0732 .db "?C2",op_nv +0002ad 433f +0002ae 0733 .db "?C3",op_nv +0002af 5043 +0002b0 0859 .db "CPY",op_z +0002b1 4d43 +0002b2 0850 .db "CMP",op_z +0002b3 4544 +0002b4 0843 .db "DEC",op_z +0002b5 433f +0002b6 0737 .db "?C7",op_nv +0002b7 4e49 +0002b8 0059 .db "INY",op_s +0002b9 4d43 +0002ba 2850 .db "CMP",op_m +0002bb 4544 +0002bc 0058 .db "DEX",op_s +0002bd 433f +0002be 0742 .db "?CB",op_nv +0002bf 5043 +0002c0 1059 .db "CPY",op_a +0002c1 4d43 +0002c2 1050 .db "CMP",op_a +0002c3 4544 +0002c4 1043 .db "DEC",op_a +0002c5 433f +0002c6 0746 .db "?CF",op_nv + +0002c7 4e42 +0002c8 1845 .db "BNE",op_r +0002c9 4d43 +0002ca 4d50 .db "CMP",op_ziy +0002cb 443f +0002cc 0732 .db "?D2",op_nv +0002cd 443f +0002ce 0733 .db "?D3",op_nv +0002cf 443f +0002d0 0734 .db "?D4",op_nv +0002d1 4d43 +0002d2 0950 .db "CMP",op_zx +0002d3 4544 +0002d4 0943 .db "DEC",op_zx +0002d5 443f +0002d6 0737 .db "?D7",op_nv +0002d7 4c43 +0002d8 0044 .db "CLD",op_s +0002d9 4d43 +0002da 1250 .db "CMP",op_y +0002db 443f +0002dc 0741 .db "?DA",op_nv +0002dd 443f +0002de 0742 .db "?DB",op_nv +0002df 443f +0002e0 0743 .db "?DC",op_nv +0002e1 4d43 +0002e2 1150 .db "CMP",op_x +0002e3 4544 +0002e4 1143 .db "DEC",op_x +0002e5 443f +0002e6 0746 .db "?DF",op_nv + +0002e7 5043 +0002e8 2858 .db "CPX",op_m +0002e9 4253 +0002ea 4c43 .db "SBC",op_zxi +0002eb 453f +0002ec 0732 .db "?E2",op_nv +0002ed 453f +0002ee 0733 .db "?E3",op_nv +0002ef 5043 +0002f0 0858 .db "CPX",op_z +0002f1 4253 +0002f2 0843 .db "SBC",op_z +0002f3 4e49 +0002f4 0843 .db "INC",op_z +0002f5 453f +0002f6 0737 .db "?E7",op_nv +0002f7 4e49 +0002f8 0058 .db "INX",op_s +0002f9 4253 +0002fa 2843 .db "SBC",op_m +0002fb 4f4e +0002fc 0050 .db "NOP",op_s +0002fd 453f +0002fe 0742 .db "?EB",op_nv +0002ff 5043 +000300 1058 .db "CPX",op_a +000301 4253 +000302 1043 .db "SBC",op_a +000303 4e49 +000304 1043 .db "INC",op_a +000305 453f +000306 0746 .db "?EF",op_nv + +000307 4542 +000308 1851 .db "BEQ",op_r +000309 4253 +00030a 4d43 .db "SBC",op_ziy +00030b 463f +00030c 0732 .db "?F2",op_nv +00030d 463f +00030e 0733 .db "?F3",op_nv +00030f 463f +000310 0734 .db "?F4",op_nv +000311 4253 +000312 0943 .db "SBC",op_zx +000313 4e49 +000314 0943 .db "INC",op_zx +000315 463f +000316 0737 .db "?F7",op_nv +000317 4553 +000318 0044 .db "SED",op_s +000319 4253 +00031a 1243 .db "SBC",op_y +00031b 463f +00031c 0741 .db "?FA",op_nv +00031d 463f +00031e 0742 .db "?FB",op_nv +00031f 463f +000320 0743 .db "?FC",op_nv +000321 4253 +000322 1143 .db "SBC",op_x +000323 4e49 +000324 1143 .db "INC",op_x +000325 463f +000326 0746 .db "?FF",op_nv + + ;***************************************************************** + ; + ; 6 5 0 2 e m u l a t i o n m a c r o s + ; + ;***************************************************************** + + ; + ; op_decode + ; + ; opcode fetch and decode, prefetch low operand + .macro op_decode + out abuslo,pcl ;opcode fetch + out abushi,pch + sei ;allow emulation INT, NMI + adiw pch:pcl,1 ;pc -> op low + cli + wait_data_valid 4 ;240 minimum @ 16MHz + in opcode,dbusin + + out abuslo,pcl ;operand address low prefetch + out abushi,pch + wait_data_valid 6 ;360ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode + .endmacro + + ;op decode after single, opcode already fetched + .macro op_decode_single + sei ;allow emulation INT, NMI + out abuslo,pcl ;operand address low prefetch + cli + out abushi,pch + wait_data_valid 6 ;360ns minimum @ 16MHz + adiw pch:pcl,1 ;pc -> op high + ijmp ;execute opcode + .endmacro + + ; address generate relative + .macro adgen_r + rjmp no_branch ;condition false + in operand,dbusin + clr a ;expand sign bit + sbrc operand,7 ;negative? + dec a + add pcl,operand ;set new PC + adc pch,a + no_branch: op_decode + .endmacro + + ; address generate absolute + .macro adgen_a + in oplow,dbusin + out abuslo,pcl ;operand high address fetch + out abushi,pch + adiw pch:pcl,1 ;pc -> next instruction + cbr flags,(1< next instruction + cbr flags,(1< next instruction + cbr flags,(1<----> +000452 f972 bld stat,2 ;-----N-- + +000453 766c andi stat2,0b1101100 ;-V1BDI-- (Break cleared) +000454 6260 ori stat2,0b0100000 ; ^=1 (set unused) + +000455 9478 +000456 bb88 +000457 94f8 +000458 bb9b +000459 9601 +00045a 9409 op_decode_single ;next instruction + + ; opcode: ROL A +00045b b3e3 ROL_s: in opcode,dbusin ;next opcode + +00045c bf7f out sreg,stat ;get C +00045d 1f55 rol rega ;AVR emulated OP +00045e b77f in stat,sreg ;save NZC + +00045f 9478 +000460 bb88 +000461 94f8 +000462 bb9b +000463 9601 +000464 9409 op_decode_single ;next instruction + + ; opcode: ROR A +000465 b3e3 ROR_s: in opcode,dbusin ;next opcode + +000466 bf7f out sreg,stat ;get C +000467 9557 ror rega ;AVR emulated OP +000468 b77f in stat,sreg ;save NZC + +000469 9478 +00046a bb88 +00046b 94f8 +00046c bb9b +00046d 9601 +00046e 9409 op_decode_single ;next instruction + + ; opcode: SEC +00046f b3e3 SEC_s: in opcode,dbusin ;next opcode + +000470 6071 sbr stat,1 ;AVR emulated OP + +000471 9478 +000472 bb88 +000473 94f8 +000474 bb9b +000475 9601 +000476 9409 op_decode_single ;next instruction + + ; opcode: SED +000477 b3e3 SED_s: in opcode,dbusin ;next opcode + +000478 6068 sbr stat2,0b1000 ;AVR emulated OP + +000479 9478 +00047a bb88 +00047b 94f8 +00047c bb9b +00047d 9601 +00047e 9409 op_decode_single ;next instruction + + ; opcode: SEI +00047f b3e3 SEI_s: in opcode,dbusin ;next opcode + +000480 6064 sbr stat2,0b100 ;AVR emulated OP +000481 e400 ldi a,IRQ_dis ;only NMI stays enabled +000482 bf0b out ibus,a + .ifdef irq_dis_real ;+3 + .endif + +000483 9478 +000484 bb88 +000485 94f8 +000486 bb9b +000487 9601 +000488 9409 op_decode_single ;next instruction + + ; opcode: TAX +000489 b3e3 TAX_s: in opcode,dbusin ;next opcode + +00048a 2e85 mov regx,rega ;AVR emulated OP +00048b bf7f +00048c 2088 +00048d b77f flags_gen_nz regx + +00048e 9478 +00048f bb88 +000490 94f8 +000491 bb9b +000492 9601 +000493 9409 op_decode_single ;next instruction + + ; opcode: TAY +000494 b3e3 TAY_s: in opcode,dbusin ;next opcode + +000495 2e95 mov regy,rega ;AVR emulated OP +000496 bf7f +000497 2099 +000498 b77f flags_gen_nz regy + +000499 9478 +00049a bb88 +00049b 94f8 +00049c bb9b +00049d 9601 +00049e 9409 op_decode_single ;next instruction + + ; opcode: TSX +00049f b3e3 TSX_s: in opcode,dbusin ;next opcode + +0004a0 2c8b mov regx,spointer ;AVR emulated OP +0004a1 bf7f +0004a2 2088 +0004a3 b77f flags_gen_nz regx + +0004a4 9478 +0004a5 bb88 +0004a6 94f8 +0004a7 bb9b +0004a8 9601 +0004a9 9409 op_decode_single ;next instruction + + ; opcode: TXA +0004aa b3e3 TXA_s: in opcode,dbusin ;next opcode + +0004ab 2d58 mov rega,regx ;AVR emulated OP +0004ac bf7f +0004ad 2355 +0004ae b77f flags_gen_nz rega + +0004af 9478 +0004b0 bb88 +0004b1 94f8 +0004b2 bb9b +0004b3 9601 +0004b4 9409 op_decode_single ;next instruction + + ; opcode: TXS +0004b5 b3e3 TXS_s: in opcode,dbusin ;next opcode + +0004b6 2cb8 mov spointer,regx ;AVR emulated OP + ;flags are not changed + +0004b7 9478 +0004b8 bb88 +0004b9 94f8 +0004ba bb9b +0004bb 9601 +0004bc 9409 op_decode_single ;next instruction + + ; opcode: TYA +0004bd b3e3 TYA_s: in opcode,dbusin ;next opcode + +0004be 2d59 mov rega,regy ;AVR emulated OP +0004bf bf7f +0004c0 2355 +0004c1 b77f flags_gen_nz rega + +0004c2 9478 +0004c3 bb88 +0004c4 94f8 +0004c5 bb9b +0004c6 9601 +0004c7 9409 op_decode_single ;next instruction + + ;***************************************************************** + ; + ; Program counter + ; instructions modifying the PC + ; + ;***************************************************************** + + ; opcode: BCC +0004c8 fd70 BCC_r: sbrc stat,0 +0004c9 c006 +0004ca b2a3 +0004cb 2700 +0004cc fca7 +0004cd 950a +0004ce 0d8a +0004cf 1f90 +0004d0 bb88 +0004d1 bb9b +0004d2 9478 +0004d3 9601 +0004d4 94f8 +0004d5 b3e3 +0004d6 bb88 +0004d7 bb9b +0004d8 9601 +0004d9 9409 adgen_r ;branch if skip + + ; opcode: BCS +0004da ff70 BCS_r: sbrs stat,0 +0004db c006 +0004dc b2a3 +0004dd 2700 +0004de fca7 +0004df 950a +0004e0 0d8a +0004e1 1f90 +0004e2 bb88 +0004e3 bb9b +0004e4 9478 +0004e5 9601 +0004e6 94f8 +0004e7 b3e3 +0004e8 bb88 +0004e9 bb9b +0004ea 9601 +0004eb 9409 adgen_r ;branch if skip + + ; opcode: BEQ +0004ec ff71 BEQ_r: sbrs stat,1 +0004ed c006 +0004ee b2a3 +0004ef 2700 +0004f0 fca7 +0004f1 950a +0004f2 0d8a +0004f3 1f90 +0004f4 bb88 +0004f5 bb9b +0004f6 9478 +0004f7 9601 +0004f8 94f8 +0004f9 b3e3 +0004fa bb88 +0004fb bb9b +0004fc 9601 +0004fd 9409 adgen_r ;branch if skip + + ; opcode: BMI +0004fe ff72 BMI_r: sbrs stat,2 +0004ff c006 +000500 b2a3 +000501 2700 +000502 fca7 +000503 950a +000504 0d8a +000505 1f90 +000506 bb88 +000507 bb9b +000508 9478 +000509 9601 +00050a 94f8 +00050b b3e3 +00050c bb88 +00050d bb9b +00050e 9601 +00050f 9409 adgen_r ;branch if skip + + ; opcode: BNE +000510 fd71 BNE_r: sbrc stat,1 +000511 c006 +000512 b2a3 +000513 2700 +000514 fca7 +000515 950a +000516 0d8a +000517 1f90 +000518 bb88 +000519 bb9b +00051a 9478 +00051b 9601 +00051c 94f8 +00051d b3e3 +00051e bb88 +00051f bb9b +000520 9601 +000521 9409 adgen_r ;branch if skip + + ; opcode: BPL +000522 fd72 BPL_r: sbrc stat,2 +000523 c006 +000524 b2a3 +000525 2700 +000526 fca7 +000527 950a +000528 0d8a +000529 1f90 +00052a bb88 +00052b bb9b +00052c 9478 +00052d 9601 +00052e 94f8 +00052f b3e3 +000530 bb88 +000531 bb9b +000532 9601 +000533 9409 adgen_r ;branch if skip + + ; opcode: BVC +000534 fd66 BVC_r: sbrc stat2,6 +000535 c006 +000536 b2a3 +000537 2700 +000538 fca7 +000539 950a +00053a 0d8a +00053b 1f90 +00053c bb88 +00053d bb9b +00053e 9478 +00053f 9601 +000540 94f8 +000541 b3e3 +000542 bb88 +000543 bb9b +000544 9601 +000545 9409 adgen_r ;branch if skip + + ; opcode: BVS +000546 ff66 BVS_r: sbrs stat2,6 +000547 c006 +000548 b2a3 +000549 2700 +00054a fca7 +00054b 950a +00054c 0d8a +00054d 1f90 +00054e bb88 +00054f bb9b +000550 9478 +000551 9601 +000552 94f8 +000553 b3e3 +000554 bb88 +000555 bb9b +000556 9601 +000557 9409 adgen_r ;branch if skip + + ; opcode: JMP +000558 b3c3 JMP_i: in oplow,dbusin ;save low pointer to pc +000559 bb88 out abuslo,pcl ;fetch high pointer to pc +00055a bb9b out abushi,pch +00055b 2f8c mov pcl,oplow +00055c c000 wait_data_valid 1 ;60ns minimum @ 16MHz +00055d b393 in pch,dbusin ;point to new pc + +00055e bb88 out abuslo,pcl ;fetch pc low +00055f bb9b out abushi,pch +000560 9601 adiw pch:pcl,1 +000561 0000 wait_data_valid 2 ;120ns minimum @ 16MHz + +000562 b3c3 JMP_a: in oplow,dbusin ;save pc low +000563 bb88 out abuslo,pcl ;fetch pc high +000564 bb9b out abushi,pch +000565 2f8c mov pcl,oplow +000566 c000 wait_data_valid 1 ;60ns minimum @ 16MHz +000567 b393 in pch,dbusin ;load new pc + +000568 bb88 +000569 bb9b +00056a 9478 +00056b 9601 +00056c 94f8 +00056d b3e3 +00056e bb88 +00056f bb9b +000570 9601 +000571 9409 op_decode ;next instruction + + ; opcode: JSR +000572 b3c3 JSR_a: in oplow,dbusin ;save new PC as operand address +000573 bb88 out abuslo,pcl ;new PC high fetch +000574 bb9b out abushi,pch + ;pc++ skipped +000575 c000 +000576 0000 wait_data_valid 0 ;0ns minimum @ 16MHz +000577 b3d3 in ophigh,dbusin + +000578 bab8 out abuslo,spointer ;push pch +000579 ba6b out abushi,one +00057a 94ba dec spointer +00057b bae2 out cbus,writemem ;WE, ~OE +00057c bb95 out dbusout,pch ;precharge write +00057d ba54 out dbusddr,allon ;output data valid +00057e bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz + +00057f bab8 out abuslo,spointer ;push pcl +000580 94ba dec spointer +000581 bae2 out cbus,writemem ;WE +000582 bb85 out dbusout,pcl ;precharge write +000583 bac2 out cbus,clear ;~WE / write cycle ends 120ns/16MHz +000584 ba74 out dbusddr,zero ;data hold ends after 60ns +000585 bad2 out cbus,readmem ;OE / read mode back on + +000586 01ce movw pcl,oplow ;load new PC + +000587 bb88 +000588 bb9b +000589 9478 +00058a 9601 +00058b 94f8 +00058c b3e3 +00058d bb88 +00058e bb9b +00058f 9601 +000590 9409 op_decode ;next instruction + + ; opcode: RTS +000591 94b3 RTS_s: inc spointer +000592 bab8 out abuslo,spointer ;pull pcl +000593 ba6b out abushi,one +000594 94b3 inc spointer +000595 c000 wait_data_valid 1 ;60ns minimum @ 16MHz +000596 b383 in pcl,dbusin +000597 bab8 out abuslo,spointer ;pull pch +000598 c000 +000599 0000 wait_data_valid 0 ;0ns minimum @ 16MHz +00059a b393 in pch,dbusin +00059b 9601 adiw pch:pcl,1 ;point to next instruction + +00059c bb88 +00059d bb9b +00059e 9478 +00059f 9601 +0005a0 94f8 +0005a1 b3e3 +0005a2 bb88 +0005a3 bb9b +0005a4 9601 +0005a5 9409 op_decode ;next instruction + + ; opcode: RTI +0005a6 94b3 RTI_s: inc spointer +0005a7 bab8 out abuslo,spointer ;pull status +0005a8 ba6b out abushi,one +0005a9 94b3 inc spointer +0005aa c000 wait_data_valid 1 ;60ns minimum @ 16MHz +0005ab b363 in stat2,dbusin +0005ac bab8 out abuslo,spointer ;pull pcl +0005ad 94b3 inc spointer + ;status restore while we are waiting for data +0005ae ec00 +0005af fd62 +0005b0 e400 +0005b1 bf0b IRQ_restore +0005b2 2f76 mov stat,stat2 ;restore AVR format + wait_data_valid 6 ;360ns minimum @ 16MHz +0005b3 b383 in pcl,dbusin +0005b4 bab8 out abuslo,spointer ;pull pch + ;status restore while we are waiting for data +0005b5 7073 andi stat,0b11 ;------ZC +0005b6 fb67 bst stat2,7 ;>----> +0005b7 f972 bld stat,2 ;-----N-- +0005b8 766c andi stat2,0b1101100 ;-V1BDI-- (Break cleared) +0005b9 6260 ori stat2,0b0100000 ; ^=1 (set unused) + wait_data_valid 5 ;300ns minimum @ 16MHz +0005ba b393 in pch,dbusin + +0005bb bb88 +0005bc bb9b +0005bd 9478 +0005be 9601 +0005bf 94f8 +0005c0 b3e3 +0005c1 bb88 +0005c2 bb9b +0005c3 9601 +0005c4 9409 op_decode ;next instruction + + ; opcode: BRK + BRK_s: ;save new PC as operand address +0005c5 ba58 out abuslo,allon ;new PC high fetch from irq vector +0005c6 ba5b out abushi,allon +0005c7 efee ldi zl,0xfe ;preload vector low +0005c8 e400 ldi a,IRQ_dis +0005c9 bf0b out ibus,a + .ifdef irq_dis_real ;+3 + .endif + ;status merge while we are waiting for data +0005ca 2f07 mov a,stat ;merge status in 6502 format +0005cb 7003 andi a,0b11 ;------ZC + wait_data_valid 5 ;300ns minimum @ 16MHz +0005cc b3d3 in ophigh,dbusin +0005cd bbe8 out abuslo,zl ;new PC low fetch from irq vector + ;status merge while we are waiting for data +0005ce fb72 bst stat,2 ;<----< +0005cf f907 bld a,7 ;N------- +0005d0 2b06 or a,stat2 ;-V1BDI-- +0005d1 6300 sbr a,0b110000 ; ^^=1 (pushed by Break) +0005d2 6064 sbr stat2,0b100 ;I=1 (IRQ disabled) + wait_data_valid 5 ;300ns minimum @ 16MHz +0005d3 b3c3 in oplow,dbusin + +0005d4 bab8 out abuslo,spointer ;push pch +0005d5 ba6b out abushi,one +0005d6 94ba dec spointer +0005d7 bae2 out cbus,writemem ;WE, ~OE +0005d8 bb95 out dbusout,pch ;precharge write +0005d9 ba54 out dbusddr,allon ;output data valid +0005da bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz + +0005db bab8 out abuslo,spointer ;push pcl +0005dc 94ba dec spointer +0005dd bae2 out cbus,writemem ;WE +0005de bb85 out dbusout,pcl ;write +0005df bac2 out cbus,clear ;~WE / write cycle ends 120ns/16MHz + +0005e0 bab8 out abuslo,spointer ;push status +0005e1 94ba dec spointer +0005e2 bae2 out cbus,writemem ;WE +0005e3 bb05 out dbusout,a ;write +0005e4 bac2 out cbus,clear ;~WE / write cycle ends 120ns/16MHz +0005e5 ba74 out dbusddr,zero ;data hold ends after 60ns +0005e6 bad2 out cbus,readmem ;OE / read mode back on + +0005e7 01ce movw pcl,oplow ;load new PC + +0005e8 bb88 +0005e9 bb9b +0005ea 9478 +0005eb 9601 +0005ec 94f8 +0005ed b3e3 +0005ee bb88 +0005ef bb9b +0005f0 9601 +0005f1 9409 op_decode ;next instruction + + + ; + ; instruction decode vector table + ; + align 8 ;align to page boundary + +000600 cfc4 oc_tab: rjmp BRK_s ;0x00 +000601 c37b rjmp ORA_zxi +000602 c0fd rjmp illegalop +000603 c0fc rjmp illegalop +000604 c0fb rjmp illegalop +000605 c398 rjmp ORA_z +000606 c421 rjmp ASL_z +000607 c0f8 rjmp illegalop +000608 ce15 rjmp PHP_s +000609 c3a5 rjmp ORA_m +00060a cd9d rjmp ASL_s +00060b c0f4 rjmp illegalop +00060c c0f3 rjmp illegalop +00060d c395 rjmp ORA_a +00060e c41e rjmp ASL_a +00060f c0f0 rjmp illegalop +000610 cf11 rjmp BPL_r ;0x10 +000611 c378 rjmp ORA_ziy +000612 c0ed rjmp illegalop +000613 c0ec rjmp illegalop +000614 c0eb rjmp illegalop +000615 c382 rjmp ORA_zx +000616 c40b rjmp ASL_zx +000617 c0e8 rjmp illegalop +000618 cd98 rjmp CLC_s +000619 c35a rjmp ORA_y +00061a c0e5 rjmp illegalop +00061b c0e4 rjmp illegalop +00061c c0e3 rjmp illegalop +00061d c34d rjmp ORA_x +00061e c3fa rjmp ASL_x +00061f c0e0 rjmp illegalop +000620 cf51 rjmp JSR_a ;0x20 +000621 c152 rjmp AND_zxi +000622 c0dd rjmp illegalop +000623 c0dc rjmp illegalop +000624 c18f rjmp BIT_z +000625 c16f rjmp AND_z +000626 c46d rjmp ROL_z +000627 c0d8 rjmp illegalop +000628 ce1b rjmp PLP_s +000629 c17c rjmp AND_m +00062a ce30 rjmp ROL_s +00062b c0d4 rjmp illegalop +00062c c18c rjmp BIT_a +00062d c16c rjmp AND_a +00062e c46a rjmp ROL_a +00062f c0d0 rjmp illegalop +000630 cecd rjmp BMI_r ;0x30 +000631 c14f rjmp AND_ziy +000632 c0cd rjmp illegalop +000633 c0cc rjmp illegalop +000634 c0cb rjmp illegalop +000635 c159 rjmp AND_zx +000636 c457 rjmp ROL_zx +000637 c0c8 rjmp illegalop +000638 ce36 rjmp SEC_s +000639 c131 rjmp AND_y +00063a c0c5 rjmp illegalop +00063b c0c4 rjmp illegalop +00063c c0c3 rjmp illegalop +00063d c124 rjmp AND_x +00063e c446 rjmp ROL_x +00063f c0c0 rjmp illegalop +000640 cf65 rjmp RTI_s ;0x40 +000641 c238 rjmp EOR_zxi +000642 c0bd rjmp illegalop +000643 c0bc rjmp illegalop +000644 c0bb rjmp illegalop +000645 c255 rjmp EOR_z +000646 c417 rjmp LSR_z +000647 c0b8 rjmp illegalop +000648 cdc5 rjmp PHA_s +000649 c262 rjmp EOR_m +00064a cdb0 rjmp LSR_s +00064b c0b4 rjmp illegalop +00064c cf15 rjmp JMP_a +00064d c252 rjmp EOR_a +00064e c414 rjmp LSR_a +00064f c0b0 rjmp illegalop +000650 cee3 rjmp BVC_r ;0x50 +000651 c235 rjmp EOR_ziy +000652 c0ad rjmp illegalop +000653 c0ac rjmp illegalop +000654 c0ab rjmp illegalop +000655 c23f rjmp EOR_zx +000656 c401 rjmp LSR_zx +000657 c0a8 rjmp illegalop +000658 cd68 rjmp CLI_s +000659 c217 rjmp EOR_y +00065a c0a5 rjmp illegalop +00065b c0a4 rjmp illegalop +00065c c0a3 rjmp illegalop +00065d c20a rjmp EOR_x +00065e c3f0 rjmp LSR_x +00065f c0a0 rjmp illegalop +000660 cf30 rjmp RTS_s ;0x60 +000661 c0b2 rjmp ADC_zxi +000662 c09d rjmp illegalop +000663 c09c rjmp illegalop +000664 c09b rjmp illegalop +000665 c0cf rjmp ADC_z +000666 c464 rjmp ROR_z +000667 c098 rjmp illegalop +000668 cdcb rjmp PLA_s +000669 c0dc rjmp ADC_m +00066a cdfa rjmp ROR_s +00066b c094 rjmp illegalop +00066c ceeb rjmp JMP_i +00066d c0cc rjmp ADC_a +00066e c461 rjmp ROR_a +00066f c090 rjmp illegalop +000670 ced5 rjmp BVS_r ;0x70 +000671 c0af rjmp ADC_ziy +000672 c08d rjmp illegalop +000673 c08c rjmp illegalop +000674 c08b rjmp illegalop +000675 c0b9 rjmp ADC_zx +000676 c44e rjmp ROR_zx +000677 c088 rjmp illegalop +000678 ce06 rjmp SEI_s +000679 c091 rjmp ADC_y +00067a c085 rjmp illegalop +00067b c084 rjmp illegalop +00067c c083 rjmp illegalop +00067d c084 rjmp ADC_x +00067e c43d rjmp ROR_x +00067f c080 rjmp illegalop +000680 c07f rjmp illegalop ;0x80 +000681 c4f1 rjmp STA_zxi +000682 c07d rjmp illegalop +000683 c07c rjmp illegalop +000684 c55c rjmp STY_z +000685 c50e rjmp STA_z +000686 c534 rjmp STX_z +000687 c078 rjmp illegalop +000688 cd54 rjmp DEY_s +000689 c076 rjmp illegalop +00068a ce1f rjmp TXA_s +00068b c074 rjmp illegalop +00068c c558 rjmp STY_a +00068d c50b rjmp STA_a +00068e c531 rjmp STX_a +00068f c070 rjmp illegalop +000690 ce37 rjmp BCC_r ;0x90 +000691 c4ee rjmp STA_ziy +000692 c06d rjmp illegalop +000693 c06c rjmp illegalop +000694 c547 rjmp STY_zx +000695 c4f8 rjmp STA_zx +000696 c51e rjmp STX_zy +000697 c068 rjmp illegalop +000698 ce24 rjmp TYA_s +000699 c4d0 rjmp STA_y +00069a ce1a rjmp TXS_s +00069b c064 rjmp illegalop +00069c c063 rjmp illegalop +00069d c4c3 rjmp STA_x +00069e c061 rjmp illegalop +00069f c060 rjmp illegalop +0006a0 c2bc rjmp LDY_m ;0xa0 +0006a1 c22a rjmp LDA_zxi +0006a2 c28b rjmp LDX_m +0006a3 c05c rjmp illegalop +0006a4 c2a6 rjmp LDY_z +0006a5 c247 rjmp LDA_z +0006a6 c275 rjmp LDX_z +0006a7 c058 rjmp illegalop +0006a8 cdeb rjmp TAY_s +0006a9 c255 rjmp LDA_m +0006aa cdde rjmp TAX_s +0006ab c054 rjmp illegalop +0006ac c2a3 rjmp LDY_a +0006ad c244 rjmp LDA_a +0006ae c272 rjmp LDX_a +0006af c050 rjmp illegalop +0006b0 ce29 rjmp BCS_r ;0xb0 +0006b1 c227 rjmp LDA_ziy +0006b2 c04d rjmp illegalop +0006b3 c04c rjmp illegalop +0006b4 c290 rjmp LDY_zx +0006b5 c231 rjmp LDA_zx +0006b6 c25f rjmp LDX_zy +0006b7 c048 rjmp illegalop +0006b8 cd12 rjmp CLV_s +0006b9 c209 rjmp LDA_y +0006ba cde4 rjmp TSX_s +0006bb c044 rjmp illegalop +0006bc c27f rjmp LDY_x +0006bd c1fc rjmp LDA_x +0006be c24e rjmp LDX_y +0006bf c040 rjmp illegalop +0006c0 c199 rjmp CPY_m ;0xc0 +0006c1 c128 rjmp CMP_zxi +0006c2 c03d rjmp illegalop +0006c3 c03c rjmp illegalop +0006c4 c184 rjmp CPY_z +0006c5 c145 rjmp CMP_z +0006c6 c43b rjmp DEC_z +0006c7 c038 rjmp illegalop +0006c8 cd28 rjmp INY_s +0006c9 c152 rjmp CMP_m +0006ca cd08 rjmp DEX_s +0006cb c034 rjmp illegalop +0006cc c181 rjmp CPY_a +0006cd c142 rjmp CMP_a +0006ce c438 rjmp DEC_a +0006cf c030 rjmp illegalop +0006d0 ce3f rjmp BNE_r ;0xd0 +0006d1 c125 rjmp CMP_ziy +0006d2 c02d rjmp illegalop +0006d3 c02c rjmp illegalop +0006d4 c02b rjmp illegalop +0006d5 c12f rjmp CMP_zx +0006d6 c425 rjmp DEC_zx +0006d7 c028 rjmp illegalop +0006d8 cce0 rjmp CLD_s +0006d9 c107 rjmp CMP_y +0006da c025 rjmp illegalop +0006db c024 rjmp illegalop +0006dc c023 rjmp illegalop +0006dd c0fa rjmp CMP_x +0006de c414 rjmp DEC_x +0006df c020 rjmp illegalop +0006e0 c15a rjmp CPX_m ;0xe0 +0006e1 c2ed rjmp SBC_zxi +0006e2 c01d rjmp illegalop +0006e3 c01c rjmp illegalop +0006e4 c145 rjmp CPX_z +0006e5 c30a rjmp SBC_z +0006e6 c452 rjmp INC_z +0006e7 c018 rjmp illegalop +0006e8 ccfe rjmp INX_s +0006e9 c317 rjmp SBC_m +0006ea cd19 rjmp NOP_s +0006eb c014 rjmp illegalop +0006ec c142 rjmp CPX_a +0006ed c307 rjmp SBC_a +0006ee c44f rjmp INC_a +0006ef c010 rjmp illegalop +0006f0 cdfb rjmp BEQ_r ;0xf0 +0006f1 c2ea rjmp SBC_ziy +0006f2 c00d rjmp illegalop +0006f3 c00c rjmp illegalop +0006f4 c00b rjmp illegalop +0006f5 c2f4 rjmp SBC_zx +0006f6 c43c rjmp INC_zx +0006f7 c008 rjmp illegalop +0006f8 cd7e rjmp SED_s +0006f9 c2cc rjmp SBC_y +0006fa c005 rjmp illegalop +0006fb c004 rjmp illegalop +0006fc c003 rjmp illegalop +0006fd c2bf rjmp SBC_x +0006fe c42b rjmp INC_x +0006ff c000 rjmp illegalop + ;***************************************************************** + ; + ; Exceptions + ; + ;***************************************************************** + + ; illegal opcode + illegalop: +000700 940c 154b jmp deb_inv_op ;extension + + ; indirect addresspointer exceeded end of zeropage - NOT IMPLEMENTED + ;zp_wrap: rjmp zp_wrap ;diag will be added later + + ; stackpointer exceeded end of stackpage - NOT IMPLEMENTED! + ; sp_wrap: rjmp sp_wrap ;diag will be added later + + ; attempt to write to protected romspace - NOT implemented + ;rom_wrt: rjmp rom_wrt ;diag will be added later + + ;***************************************************************** + ; + ; Memory read instructions + ; Load, arithmetic & logical + ; + ;***************************************************************** + + ; opcode: ADC +000702 b3c3 +000703 bb88 +000704 bb9b +000705 9601 +000706 7e3f +000707 0dc8 +000708 b3d3 +000709 1dd7 +00070a c035 adgen_x ADC_ ;abs,X +00070b b3c3 +00070c bb88 +00070d bb9b +00070e 9601 +00070f 7e3f +000710 0dc9 +000711 b3d3 +000712 1dd7 +000713 c02c adgen_y ADC_ ;abs,Y +000714 b3c3 +000715 0dc8 +000716 bbc8 +000717 ba7b +000718 95c3 +000719 6130 +00071a 0000 +00071b b303 +00071c bbc8 +00071d 2fc0 +00071e c000 +00071f b3d3 +000720 c01f adgen_zxi ADC_ ;(ZP,X) indexed indirect +000721 b3c3 +000722 bbc8 +000723 ba7b +000724 95c3 +000725 6130 +000726 0000 +000727 b303 +000728 bbc8 +000729 2fc0 +00072a 0dc9 +00072b 0000 +00072c b3d3 +00072d 1dd7 +00072e c011 adgen_ziy ADC_ ;(ZP),Y indirect indexed +00072f b3c3 +000730 0dc8 +000731 bbc8 +000732 ba7b +000733 27dd +000734 c011 adgen_zx ADC_ ;ZP,X +000735 b3c3 +000736 bbc8 +000737 ba7b +000738 27dd +000739 c00c adgen_z ADC_ ;ZP absolute +00073a b3c3 +00073b bb88 +00073c bb9b +00073d 9601 +00073e 7e3f +00073f b3d3 ADC_a: adgen_a ;absolute + +000740 bbc8 +000741 bbdb +000742 3bdf +000743 f411 +000744 d4bd +000745 c001 ADC_o: op_fetch ;common entry after address generate +000746 b2a3 ADC_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +000747 fd63 sbrc stat2,3 ;test decimal flag +000748 c00f rjmp ADC_d +000749 bf7f out sreg,stat ;get C +00074a 1d5a adc rega,operand ;AVR emulated OP +00074b b77f in stat,sreg ;save NZC +00074c fb73 bst stat,3 ;save V +00074d f966 bld stat2,6 + +00074e bb88 +00074f bb9b +000750 9478 +000751 9601 +000752 94f8 +000753 b3e3 +000754 bb88 +000755 bb9b +000756 9601 +000757 9409 ADC_d3: op_decode ;next instruction + +000758 595a ADC_d: addi rega,0x66 ;decimal correction +000759 bf7f out sreg,stat +00075a 1d5a adc rega,operand +00075b b77f in stat,sreg +00075c f010 brcs ADC_d2 ;MSD +00075d 5650 subi rega,0x60 +00075e bf7f out sreg,stat +00075f f375 ADC_d2: brhs ADC_d3 ;LSD +000760 5056 subi rega,0x06 +000761 cfec rjmp ADC_d3 + + ; opcode: AND +000762 b3c3 +000763 bb88 +000764 bb9b +000765 9601 +000766 7e3f +000767 0dc8 +000768 b3d3 +000769 1dd7 +00076a c035 adgen_x AND_ ;abs,X +00076b b3c3 +00076c bb88 +00076d bb9b +00076e 9601 +00076f 7e3f +000770 0dc9 +000771 b3d3 +000772 1dd7 +000773 c02c adgen_y AND_ ;abs,Y +000774 b3c3 +000775 0dc8 +000776 bbc8 +000777 ba7b +000778 95c3 +000779 6130 +00077a 0000 +00077b b303 +00077c bbc8 +00077d 2fc0 +00077e c000 +00077f b3d3 +000780 c01f adgen_zxi AND_ ;(ZP,X) indexed indirect +000781 b3c3 +000782 bbc8 +000783 ba7b +000784 95c3 +000785 6130 +000786 0000 +000787 b303 +000788 bbc8 +000789 2fc0 +00078a 0dc9 +00078b 0000 +00078c b3d3 +00078d 1dd7 +00078e c011 adgen_ziy AND_ ;(ZP),Y indirect indexed +00078f b3c3 +000790 0dc8 +000791 bbc8 +000792 ba7b +000793 27dd +000794 c011 adgen_zx AND_ ;ZP,X +000795 b3c3 +000796 bbc8 +000797 ba7b +000798 27dd +000799 c00c adgen_z AND_ ;ZP absolute +00079a b3c3 +00079b bb88 +00079c bb9b +00079d 9601 +00079e 7e3f +00079f b3d3 AND_a: adgen_a ;absolute + +0007a0 bbc8 +0007a1 bbdb +0007a2 3bdf +0007a3 f411 +0007a4 d45d +0007a5 c001 AND_o: op_fetch ;common entry after address generate +0007a6 b2a3 AND_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +0007a7 bf7f out sreg,stat ;keep C +0007a8 215a and rega,operand ;AVR emulated OP +0007a9 b77f in stat,sreg ;save NZ, keep C + +0007aa bb88 +0007ab bb9b +0007ac 9478 +0007ad 9601 +0007ae 94f8 +0007af b3e3 +0007b0 bb88 +0007b1 bb9b +0007b2 9601 +0007b3 9409 op_decode ;next instruction + + ; opcode: BIT +0007b4 b3c3 +0007b5 bbc8 +0007b6 ba7b +0007b7 27dd +0007b8 c00c adgen_z BIT_ ;ZP absolute +0007b9 b3c3 +0007ba bb88 +0007bb bb9b +0007bc 9601 +0007bd 7e3f +0007be b3d3 BIT_a: adgen_a ;absolute + +0007bf bbc8 +0007c0 bbdb +0007c1 3bdf +0007c2 f411 +0007c3 d43e +0007c4 c001 BIT_o: op_fetch ;common entry after address generate +0007c5 b2a3 BIT_m: in operand,dbusin + +0007c6 2f05 mov a,rega ;keep A +0007c7 bf7f out sreg,stat ;keep C +0007c8 210a and a,operand ;A & M -> Z +0007c9 b77f in stat,sreg +0007ca faa6 bst operand,6 ;M6 -> V +0007cb f966 bld stat2,6 +0007cc faa7 bst operand,7 ;M7 -> N +0007cd f972 bld stat,2 + +0007ce bb88 +0007cf bb9b +0007d0 9478 +0007d1 9601 +0007d2 94f8 +0007d3 b3e3 +0007d4 bb88 +0007d5 bb9b +0007d6 9601 +0007d7 9409 op_decode ;next instruction + + ; opcode: CMP + ; a compare in a 6502 works with reversed carry opposed to an AVR + ; the reason: a 6502 performs an add with complemented operand as a compare +0007d8 b3c3 +0007d9 bb88 +0007da bb9b +0007db 9601 +0007dc 7e3f +0007dd 0dc8 +0007de b3d3 +0007df 1dd7 +0007e0 c035 adgen_x CMP_ ;abs,X +0007e1 b3c3 +0007e2 bb88 +0007e3 bb9b +0007e4 9601 +0007e5 7e3f +0007e6 0dc9 +0007e7 b3d3 +0007e8 1dd7 +0007e9 c02c adgen_y CMP_ ;abs,Y +0007ea b3c3 +0007eb 0dc8 +0007ec bbc8 +0007ed ba7b +0007ee 95c3 +0007ef 6130 +0007f0 0000 +0007f1 b303 +0007f2 bbc8 +0007f3 2fc0 +0007f4 c000 +0007f5 b3d3 +0007f6 c01f adgen_zxi CMP_ ;(ZP,X) indexed indirect +0007f7 b3c3 +0007f8 bbc8 +0007f9 ba7b +0007fa 95c3 +0007fb 6130 +0007fc 0000 +0007fd b303 +0007fe bbc8 +0007ff 2fc0 +000800 0dc9 +000801 0000 +000802 b3d3 +000803 1dd7 +000804 c011 adgen_ziy CMP_ ;(ZP),Y indirect indexed +000805 b3c3 +000806 0dc8 +000807 bbc8 +000808 ba7b +000809 27dd +00080a c011 adgen_zx CMP_ ;ZP,X +00080b b3c3 +00080c bbc8 +00080d ba7b +00080e 27dd +00080f c00c adgen_z CMP_ ;ZP absolute +000810 b3c3 +000811 bb88 +000812 bb9b +000813 9601 +000814 7e3f +000815 b3d3 CMP_a: adgen_a ;absolute + +000816 bbc8 +000817 bbdb +000818 3bdf +000819 f411 +00081a d3e7 +00081b c001 CMP_o: op_fetch ;common entry after address generate +00081c b2a3 CMP_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +00081d 155a cp rega,operand ;AVR emulated OP +00081e b77f in stat,sreg ;save NZC +00081f 2576 eor stat,one ;invert C + +000820 bb88 +000821 bb9b +000822 9478 +000823 9601 +000824 94f8 +000825 b3e3 +000826 bb88 +000827 bb9b +000828 9601 +000829 9409 op_decode ;next instruction + + ; opcode: CPX + ; a compare in a 6502 works with reversed carry opposed to an AVR + ; the reason: a 6502 performs an add with complemented operand as a compare +00082a b3c3 +00082b bbc8 +00082c ba7b +00082d 27dd +00082e c00c adgen_z CPX_ ;ZP absolute +00082f b3c3 +000830 bb88 +000831 bb9b +000832 9601 +000833 7e3f +000834 b3d3 CPX_a: adgen_a ;absolute + +000835 bbc8 +000836 bbdb +000837 3bdf +000838 f411 +000839 d3c8 +00083a c001 CPX_o: op_fetch ;common entry after address generate +00083b b2a3 CPX_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +00083c 148a cp regx,operand ;AVR emulated OP +00083d b77f in stat,sreg ;save NZC +00083e 2576 eor stat,one ;invert C + +00083f bb88 +000840 bb9b +000841 9478 +000842 9601 +000843 94f8 +000844 b3e3 +000845 bb88 +000846 bb9b +000847 9601 +000848 9409 op_decode ;next instruction + + ; opcode: CPY + ; a compare in a 6502 works with reversed carry opposed to an AVR + ; the reason: a 6502 performs an add with complemented operand as a compare +000849 b3c3 +00084a bbc8 +00084b ba7b +00084c 27dd +00084d c00c adgen_z CPY_ ;ZP absolute +00084e b3c3 +00084f bb88 +000850 bb9b +000851 9601 +000852 7e3f +000853 b3d3 CPY_a: adgen_a ;absolute + +000854 bbc8 +000855 bbdb +000856 3bdf +000857 f411 +000858 d3a9 +000859 c001 CPY_o: op_fetch ;common entry after address generate +00085a b2a3 CPY_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +00085b 149a cp regy,operand ;AVR emulated OP +00085c b77f in stat,sreg ;save NZC +00085d 2576 eor stat,one ;invert C + +00085e bb88 +00085f bb9b +000860 9478 +000861 9601 +000862 94f8 +000863 b3e3 +000864 bb88 +000865 bb9b +000866 9601 +000867 9409 op_decode ;next instruction + + ; opcode: EOR +000868 b3c3 +000869 bb88 +00086a bb9b +00086b 9601 +00086c 7e3f +00086d 0dc8 +00086e b3d3 +00086f 1dd7 +000870 c035 adgen_x EOR_ ;abs,X +000871 b3c3 +000872 bb88 +000873 bb9b +000874 9601 +000875 7e3f +000876 0dc9 +000877 b3d3 +000878 1dd7 +000879 c02c adgen_y EOR_ ;abs,Y +00087a b3c3 +00087b 0dc8 +00087c bbc8 +00087d ba7b +00087e 95c3 +00087f 6130 +000880 0000 +000881 b303 +000882 bbc8 +000883 2fc0 +000884 c000 +000885 b3d3 +000886 c01f adgen_zxi EOR_ ;(ZP,X) indexed indirect +000887 b3c3 +000888 bbc8 +000889 ba7b +00088a 95c3 +00088b 6130 +00088c 0000 +00088d b303 +00088e bbc8 +00088f 2fc0 +000890 0dc9 +000891 0000 +000892 b3d3 +000893 1dd7 +000894 c011 adgen_ziy EOR_ ;(ZP),Y indirect indexed +000895 b3c3 +000896 0dc8 +000897 bbc8 +000898 ba7b +000899 27dd +00089a c011 adgen_zx EOR_ ;ZP,X +00089b b3c3 +00089c bbc8 +00089d ba7b +00089e 27dd +00089f c00c adgen_z EOR_ ;ZP absolute +0008a0 b3c3 +0008a1 bb88 +0008a2 bb9b +0008a3 9601 +0008a4 7e3f +0008a5 b3d3 EOR_a: adgen_a ;absolute + +0008a6 bbc8 +0008a7 bbdb +0008a8 3bdf +0008a9 f411 +0008aa d357 +0008ab c001 EOR_o: op_fetch ;common entry after address generate +0008ac b2a3 EOR_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +0008ad bf7f out sreg,stat ;keep C +0008ae 255a eor rega,operand ;AVR emulated OP +0008af b77f in stat,sreg ;save NZ, keep C + +0008b0 bb88 +0008b1 bb9b +0008b2 9478 +0008b3 9601 +0008b4 94f8 +0008b5 b3e3 +0008b6 bb88 +0008b7 bb9b +0008b8 9601 +0008b9 9409 op_decode ;next instruction + + ; opcode: LDA +0008ba b3c3 +0008bb bb88 +0008bc bb9b +0008bd 9601 +0008be 7e3f +0008bf 0dc8 +0008c0 b3d3 +0008c1 1dd7 +0008c2 c035 adgen_x LDA_ ;abs,X +0008c3 b3c3 +0008c4 bb88 +0008c5 bb9b +0008c6 9601 +0008c7 7e3f +0008c8 0dc9 +0008c9 b3d3 +0008ca 1dd7 +0008cb c02c adgen_y LDA_ ;abs,Y +0008cc b3c3 +0008cd 0dc8 +0008ce bbc8 +0008cf ba7b +0008d0 95c3 +0008d1 6130 +0008d2 0000 +0008d3 b303 +0008d4 bbc8 +0008d5 2fc0 +0008d6 c000 +0008d7 b3d3 +0008d8 c01f adgen_zxi LDA_ ;(ZP,X) indexed indirect +0008d9 b3c3 +0008da bbc8 +0008db ba7b +0008dc 95c3 +0008dd 6130 +0008de 0000 +0008df b303 +0008e0 bbc8 +0008e1 2fc0 +0008e2 0dc9 +0008e3 0000 +0008e4 b3d3 +0008e5 1dd7 +0008e6 c011 adgen_ziy LDA_ ;(ZP),Y indirect indexed +0008e7 b3c3 +0008e8 0dc8 +0008e9 bbc8 +0008ea ba7b +0008eb 27dd +0008ec c012 adgen_zx LDA_ ;ZP,X +0008ed b3c3 +0008ee bbc8 +0008ef ba7b +0008f0 27dd +0008f1 c00d adgen_z LDA_ ;ZP absolute +0008f2 b3c3 +0008f3 bb88 +0008f4 bb9b +0008f5 9601 +0008f6 7e3f +0008f7 b3d3 LDA_a: adgen_a ;absolute + +0008f8 bbc8 +0008f9 bbdb +0008fa 3bdf +0008fb f419 +0008fc d305 +0008fd 2d5a +0008fe c001 LDA_o: reg_fetch rega ;common entry after address generate +0008ff b353 LDA_m: in rega,dbusin ;same for immediate + +000900 bf7f +000901 2355 +000902 b77f flags_gen_nz rega + +000903 bb88 +000904 bb9b +000905 9478 +000906 9601 +000907 94f8 +000908 b3e3 +000909 bb88 +00090a bb9b +00090b 9601 +00090c 9409 op_decode ;next instruction + + ; opcode: LDX +00090d b3c3 +00090e bb88 +00090f bb9b +000910 9601 +000911 7e3f +000912 0dc9 +000913 b3d3 +000914 1dd7 +000915 c011 adgen_y LDX_ ;abs,Y +000916 b3c3 +000917 0dc9 +000918 bbc8 +000919 ba7b +00091a 27dd +00091b c012 adgen_zy LDX_ ;ZP,Y +00091c b3c3 +00091d bbc8 +00091e ba7b +00091f 27dd +000920 c00d adgen_z LDX_ ;ZP absolute +000921 b3c3 +000922 bb88 +000923 bb9b +000924 9601 +000925 7e3f +000926 b3d3 LDX_a: adgen_a ;absolute + +000927 bbc8 +000928 bbdb +000929 3bdf +00092a f419 +00092b d2d6 +00092c 2c8a +00092d c001 LDX_o: reg_fetch regx ;common entry after address generate +00092e b283 LDX_m: in regx,dbusin ;same for immediate + +00092f bf7f +000930 2088 +000931 b77f flags_gen_nz regx + +000932 bb88 +000933 bb9b +000934 9478 +000935 9601 +000936 94f8 +000937 b3e3 +000938 bb88 +000939 bb9b +00093a 9601 +00093b 9409 op_decode ;next instruction + + ; opcode: LDY +00093c b3c3 +00093d bb88 +00093e bb9b +00093f 9601 +000940 7e3f +000941 0dc8 +000942 b3d3 +000943 1dd7 +000944 c011 adgen_x LDY_ ;abs,X +000945 b3c3 +000946 0dc8 +000947 bbc8 +000948 ba7b +000949 27dd +00094a c012 adgen_zx LDY_ ;ZP,X +00094b b3c3 +00094c bbc8 +00094d ba7b +00094e 27dd +00094f c00d adgen_z LDY_ ;ZP absolute +000950 b3c3 +000951 bb88 +000952 bb9b +000953 9601 +000954 7e3f +000955 b3d3 LDY_a: adgen_a ;absolute + +000956 bbc8 +000957 bbdb +000958 3bdf +000959 f419 +00095a d2a7 +00095b 2c9a +00095c c001 LDY_o: reg_fetch regy ;common entry after address generate +00095d b293 LDY_m: in regy,dbusin ;same for immediate + +00095e bf7f +00095f 2099 +000960 b77f flags_gen_nz regy + +000961 bb88 +000962 bb9b +000963 9478 +000964 9601 +000965 94f8 +000966 b3e3 +000967 bb88 +000968 bb9b +000969 9601 +00096a 9409 op_decode ;next instruction + + ; opcode: ORA +00096b b3c3 +00096c bb88 +00096d bb9b +00096e 9601 +00096f 7e3f +000970 0dc8 +000971 b3d3 +000972 1dd7 +000973 c035 adgen_x ORA_ ;abs,X +000974 b3c3 +000975 bb88 +000976 bb9b +000977 9601 +000978 7e3f +000979 0dc9 +00097a b3d3 +00097b 1dd7 +00097c c02c adgen_y ORA_ ;abs,Y +00097d b3c3 +00097e 0dc8 +00097f bbc8 +000980 ba7b +000981 95c3 +000982 6130 +000983 0000 +000984 b303 +000985 bbc8 +000986 2fc0 +000987 c000 +000988 b3d3 +000989 c01f adgen_zxi ORA_ ;(ZP,X) indexed indirect +00098a b3c3 +00098b bbc8 +00098c ba7b +00098d 95c3 +00098e 6130 +00098f 0000 +000990 b303 +000991 bbc8 +000992 2fc0 +000993 0dc9 +000994 0000 +000995 b3d3 +000996 1dd7 +000997 c011 adgen_ziy ORA_ ;(ZP),Y indirect indexed +000998 b3c3 +000999 0dc8 +00099a bbc8 +00099b ba7b +00099c 27dd +00099d c011 adgen_zx ORA_ ;ZP,X +00099e b3c3 +00099f bbc8 +0009a0 ba7b +0009a1 27dd +0009a2 c00c adgen_z ORA_ ;ZP absolute +0009a3 b3c3 +0009a4 bb88 +0009a5 bb9b +0009a6 9601 +0009a7 7e3f +0009a8 b3d3 ORA_a: adgen_a ;absolute + +0009a9 bbc8 +0009aa bbdb +0009ab 3bdf +0009ac f411 +0009ad d254 +0009ae c001 ORA_o: op_fetch ;common entry after address generate +0009af b2a3 ORA_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +0009b0 bf7f out sreg,stat ;keep C +0009b1 295a or rega,operand ;AVR emulated OP +0009b2 b77f in stat,sreg ;save NZ, keep C + +0009b3 bb88 +0009b4 bb9b +0009b5 9478 +0009b6 9601 +0009b7 94f8 +0009b8 b3e3 +0009b9 bb88 +0009ba bb9b +0009bb 9601 +0009bc 9409 op_decode ;next instruction + + ; opcode: SBC + ; subtraction in a 6502 works with reversed carry, borrow = !carry + ; the reason: a 6502 performs an add with complemented operand during subtract +0009bd b3c3 +0009be bb88 +0009bf bb9b +0009c0 9601 +0009c1 7e3f +0009c2 0dc8 +0009c3 b3d3 +0009c4 1dd7 +0009c5 c035 adgen_x SBC_ ;abs,X +0009c6 b3c3 +0009c7 bb88 +0009c8 bb9b +0009c9 9601 +0009ca 7e3f +0009cb 0dc9 +0009cc b3d3 +0009cd 1dd7 +0009ce c02c adgen_y SBC_ ;abs,Y +0009cf b3c3 +0009d0 0dc8 +0009d1 bbc8 +0009d2 ba7b +0009d3 95c3 +0009d4 6130 +0009d5 0000 +0009d6 b303 +0009d7 bbc8 +0009d8 2fc0 +0009d9 c000 +0009da b3d3 +0009db c01f adgen_zxi SBC_ ;(ZP,X) indexed indirect +0009dc b3c3 +0009dd bbc8 +0009de ba7b +0009df 95c3 +0009e0 6130 +0009e1 0000 +0009e2 b303 +0009e3 bbc8 +0009e4 2fc0 +0009e5 0dc9 +0009e6 0000 +0009e7 b3d3 +0009e8 1dd7 +0009e9 c011 adgen_ziy SBC_ ;(ZP),Y indirect indexed +0009ea b3c3 +0009eb 0dc8 +0009ec bbc8 +0009ed ba7b +0009ee 27dd +0009ef c011 adgen_zx SBC_ ;ZP,X +0009f0 b3c3 +0009f1 bbc8 +0009f2 ba7b +0009f3 27dd +0009f4 c00c adgen_z SBC_ ;ZP absolute +0009f5 b3c3 +0009f6 bb88 +0009f7 bb9b +0009f8 9601 +0009f9 7e3f +0009fa b3d3 SBC_a: adgen_a ;absolute + +0009fb bbc8 +0009fc bbdb +0009fd 3bdf +0009fe f411 +0009ff d202 +000a00 c001 SBC_o: op_fetch ;common entry after address generate +000a01 b2a3 SBC_m: in operand,dbusin ;immediate & operand prefetched (z, zx, zy) + +000a02 94a0 com operand +000a03 bf7f out sreg,stat ;get C +000a04 1d5a adc rega,operand ;AVR emulated OP +000a05 b77f in stat,sreg ;save NZC +000a06 fb73 bst stat,3 ;save V +000a07 f966 bld stat2,6 + +000a08 ff63 sbrs stat2,3 ;test decimal flag +000a09 c005 rjmp SBC_d ;skip decimal mode correction + +000a0a f010 brcs SBC_d2 ;MSD correction +000a0b 5650 subi rega,0x60 +000a0c bf7f out sreg,stat +000a0d f00d SBC_d2: brhs SBC_d ;LSD correction +000a0e 5056 subi rega,0x06 + +000a0f bb88 +000a10 bb9b +000a11 9478 +000a12 9601 +000a13 94f8 +000a14 b3e3 +000a15 bb88 +000a16 bb9b +000a17 9601 +000a18 9409 SBC_d: op_decode ;next instruction + + + ;***************************************************************** + ; + ; Modify memory instructions + ; Shift, increment & decrement + ; + ;***************************************************************** + + ; opcode: ASL +000a19 b3c3 +000a1a bb88 +000a1b bb9b +000a1c 9601 +000a1d 7e3f +000a1e 0dc8 +000a1f b3d3 +000a20 1dd7 +000a21 c011 adgen_x ASL_ ;abs,X +000a22 b3c3 +000a23 0dc8 +000a24 bbc8 +000a25 ba7b +000a26 27dd +000a27 c011 adgen_zx ASL_ ;ZP,X +000a28 b3c3 +000a29 bbc8 +000a2a ba7b +000a2b 27dd +000a2c c00c adgen_z ASL_ ;ZP absolute +000a2d b3c3 +000a2e bb88 +000a2f bb9b +000a30 9601 +000a31 7e3f +000a32 b3d3 ASL_a: adgen_a ;absolute + +000a33 bbc8 +000a34 bbdb +000a35 3bdf +000a36 f411 +000a37 d1c9 +000a38 c001 ASL_o: op_fetch_modify ;common entry after address generate +000a39 b2a3 ASL_m: in operand,dbusin ;operand prefetched (z, zx, zy) + +000a3a 0caa lsl operand ;AVR emulated OP +000a3b b77f in stat,sreg ;save NZC + +000a3c 3bdf +000a3d f081 +000a3e bae2 +000a3f baa5 +000a40 ba54 +000a41 bac2 +000a42 ba74 +000a43 bad2 +000a44 bb88 +000a45 bb9b +000a46 9478 +000a47 9601 +000a48 94f8 +000a49 b3e3 +000a4a bb88 +000a4b bb9b +000a4c 9601 +000a4d 9409 +000a4e c1b9 store_modify + + ; opcode: LSR +000a4f b3c3 +000a50 bb88 +000a51 bb9b +000a52 9601 +000a53 7e3f +000a54 0dc8 +000a55 b3d3 +000a56 1dd7 +000a57 c011 adgen_x LSR_ ;abs,X +000a58 b3c3 +000a59 0dc8 +000a5a bbc8 +000a5b ba7b +000a5c 27dd +000a5d c011 adgen_zx LSR_ ;ZP,X +000a5e b3c3 +000a5f bbc8 +000a60 ba7b +000a61 27dd +000a62 c00c adgen_z LSR_ ;ZP absolute +000a63 b3c3 +000a64 bb88 +000a65 bb9b +000a66 9601 +000a67 7e3f +000a68 b3d3 LSR_a: adgen_a ;absolute + +000a69 bbc8 +000a6a bbdb +000a6b 3bdf +000a6c f411 +000a6d d193 +000a6e c001 LSR_o: op_fetch_modify ;common entry after address generate +000a6f b2a3 LSR_m: in operand,dbusin ;operand prefetched (z, zx, zy) + +000a70 94a6 lsr operand ;AVR emulated OP +000a71 b77f in stat,sreg ;save NZC + +000a72 3bdf +000a73 f081 +000a74 bae2 +000a75 baa5 +000a76 ba54 +000a77 bac2 +000a78 ba74 +000a79 bad2 +000a7a bb88 +000a7b bb9b +000a7c 9478 +000a7d 9601 +000a7e 94f8 +000a7f b3e3 +000a80 bb88 +000a81 bb9b +000a82 9601 +000a83 9409 +000a84 c183 store_modify + + ; opcode: ROL +000a85 b3c3 +000a86 bb88 +000a87 bb9b +000a88 9601 +000a89 7e3f +000a8a 0dc8 +000a8b b3d3 +000a8c 1dd7 +000a8d c011 adgen_x ROL_ ;abs,X +000a8e b3c3 +000a8f 0dc8 +000a90 bbc8 +000a91 ba7b +000a92 27dd +000a93 c011 adgen_zx ROL_ ;ZP,X +000a94 b3c3 +000a95 bbc8 +000a96 ba7b +000a97 27dd +000a98 c00c adgen_z ROL_ ;ZP absolute +000a99 b3c3 +000a9a bb88 +000a9b bb9b +000a9c 9601 +000a9d 7e3f +000a9e b3d3 ROL_a: adgen_a ;absolute + +000a9f bbc8 +000aa0 bbdb +000aa1 3bdf +000aa2 f411 +000aa3 d15d +000aa4 c001 ROL_o: op_fetch_modify ;common entry after address generate +000aa5 b2a3 ROL_m: in operand,dbusin ;operand prefetched (z, zx, zy) + +000aa6 bf7f out sreg,stat ;get C +000aa7 1caa rol operand ;AVR emulated OP +000aa8 b77f in stat,sreg ;save NZC + +000aa9 3bdf +000aaa f081 +000aab bae2 +000aac baa5 +000aad ba54 +000aae bac2 +000aaf ba74 +000ab0 bad2 +000ab1 bb88 +000ab2 bb9b +000ab3 9478 +000ab4 9601 +000ab5 94f8 +000ab6 b3e3 +000ab7 bb88 +000ab8 bb9b +000ab9 9601 +000aba 9409 +000abb c14c store_modify + + ; opcode: ROR +000abc b3c3 +000abd bb88 +000abe bb9b +000abf 9601 +000ac0 7e3f +000ac1 0dc8 +000ac2 b3d3 +000ac3 1dd7 +000ac4 c011 adgen_x ROR_ ;abs,X +000ac5 b3c3 +000ac6 0dc8 +000ac7 bbc8 +000ac8 ba7b +000ac9 27dd +000aca c011 adgen_zx ROR_ ;ZP,X +000acb b3c3 +000acc bbc8 +000acd ba7b +000ace 27dd +000acf c00c adgen_z ROR_ ;ZP absolute +000ad0 b3c3 +000ad1 bb88 +000ad2 bb9b +000ad3 9601 +000ad4 7e3f +000ad5 b3d3 ROR_a: adgen_a ;absolute + +000ad6 bbc8 +000ad7 bbdb +000ad8 3bdf +000ad9 f411 +000ada d126 +000adb c001 ROR_o: op_fetch_modify ;common entry after address generate +000adc b2a3 ROR_m: in operand,dbusin ;operand prefetched (z, zx, zy) + +000add bf7f out sreg,stat ;get C +000ade 94a7 ror operand ;AVR emulated OP +000adf b77f in stat,sreg ;save NZC + +000ae0 3bdf +000ae1 f081 +000ae2 bae2 +000ae3 baa5 +000ae4 ba54 +000ae5 bac2 +000ae6 ba74 +000ae7 bad2 +000ae8 bb88 +000ae9 bb9b +000aea 9478 +000aeb 9601 +000aec 94f8 +000aed b3e3 +000aee bb88 +000aef bb9b +000af0 9601 +000af1 9409 +000af2 c115 store_modify + + ; opcode: DEC +000af3 b3c3 +000af4 bb88 +000af5 bb9b +000af6 9601 +000af7 7e3f +000af8 0dc8 +000af9 b3d3 +000afa 1dd7 +000afb c011 adgen_x DEC_ ;abs,X +000afc b3c3 +000afd 0dc8 +000afe bbc8 +000aff ba7b +000b00 27dd +000b01 c011 adgen_zx DEC_ ;ZP,X +000b02 b3c3 +000b03 bbc8 +000b04 ba7b +000b05 27dd +000b06 c00c adgen_z DEC_ ;ZP absolute +000b07 b3c3 +000b08 bb88 +000b09 bb9b +000b0a 9601 +000b0b 7e3f +000b0c b3d3 DEC_a: adgen_a ;absolute + +000b0d bbc8 +000b0e bbdb +000b0f 3bdf +000b10 f411 +000b11 d0ef +000b12 c001 DEC_o: op_fetch_modify ;common entry after address generate +000b13 b2a3 DEC_m: in operand,dbusin ;operand prefetched (z, zx, zy) + +000b14 bf7f out sreg,stat ;keep C +000b15 94aa dec operand ;AVR emulated OP +000b16 b77f in stat,sreg ;save NZ, keep C + +000b17 3bdf +000b18 f081 +000b19 bae2 +000b1a baa5 +000b1b ba54 +000b1c bac2 +000b1d ba74 +000b1e bad2 +000b1f bb88 +000b20 bb9b +000b21 9478 +000b22 9601 +000b23 94f8 +000b24 b3e3 +000b25 bb88 +000b26 bb9b +000b27 9601 +000b28 9409 +000b29 c0de store_modify + + ; opcode: INC +000b2a b3c3 +000b2b bb88 +000b2c bb9b +000b2d 9601 +000b2e 7e3f +000b2f 0dc8 +000b30 b3d3 +000b31 1dd7 +000b32 c011 adgen_x INC_ ;abs,X +000b33 b3c3 +000b34 0dc8 +000b35 bbc8 +000b36 ba7b +000b37 27dd +000b38 c011 adgen_zx INC_ ;ZP,X +000b39 b3c3 +000b3a bbc8 +000b3b ba7b +000b3c 27dd +000b3d c00c adgen_z INC_ ;ZP absolute +000b3e b3c3 +000b3f bb88 +000b40 bb9b +000b41 9601 +000b42 7e3f +000b43 b3d3 INC_a: adgen_a ;absolute + +000b44 bbc8 +000b45 bbdb +000b46 3bdf +000b47 f411 +000b48 d0b8 +000b49 c001 INC_o: op_fetch_modify ;common entry after address generate +000b4a b2a3 INC_m: in operand,dbusin ;operand prefetched (z, zx, zy) + +000b4b bf7f out sreg,stat ;keep C +000b4c 94a3 inc operand ;AVR emulated OP +000b4d b77f in stat,sreg ;save NZ, keep C + +000b4e 3bdf +000b4f f081 +000b50 bae2 +000b51 baa5 +000b52 ba54 +000b53 bac2 +000b54 ba74 +000b55 bad2 +000b56 bb88 +000b57 bb9b +000b58 9478 +000b59 9601 +000b5a 94f8 +000b5b b3e3 +000b5c bb88 +000b5d bb9b +000b5e 9601 +000b5f 9409 +000b60 c0a7 store_modify + + ;***************************************************************** + ; + ; Memory write instructions + ; Store register + ; + ;***************************************************************** + + ; opcode: STA +000b61 b3c3 +000b62 bb88 +000b63 bb9b +000b64 9601 +000b65 7e3f +000b66 0dc8 +000b67 b3d3 +000b68 1dd7 +000b69 c035 adgen_x STA_ ;abs,X +000b6a b3c3 +000b6b bb88 +000b6c bb9b +000b6d 9601 +000b6e 7e3f +000b6f 0dc9 +000b70 b3d3 +000b71 1dd7 +000b72 c02c adgen_y STA_ ;abs,Y +000b73 b3c3 +000b74 0dc8 +000b75 bbc8 +000b76 ba7b +000b77 95c3 +000b78 6130 +000b79 0000 +000b7a b303 +000b7b bbc8 +000b7c 2fc0 +000b7d c000 +000b7e b3d3 +000b7f c01f adgen_zxi STA_ ;(ZP,X) indexed indirect +000b80 b3c3 +000b81 bbc8 +000b82 ba7b +000b83 95c3 +000b84 6130 +000b85 0000 +000b86 b303 +000b87 bbc8 +000b88 2fc0 +000b89 0dc9 +000b8a 0000 +000b8b b3d3 +000b8c 1dd7 +000b8d c011 adgen_ziy STA_ ;(ZP),Y indirect indexed +000b8e b3c3 +000b8f 0dc8 +000b90 bbc8 +000b91 ba7b +000b92 27dd +000b93 c00f adgen_zx STA_ ;ZP,X +000b94 b3c3 +000b95 bbc8 +000b96 ba7b +000b97 27dd +000b98 c00a adgen_z STA_ ;ZP absolute +000b99 b3c3 +000b9a bb88 +000b9b bb9b +000b9c 9601 +000b9d 7e3f +000b9e b3d3 STA_a: adgen_a ;absolute + +000b9f bbc8 +000ba0 bbdb +000ba1 3bdf +000ba2 f081 +000ba3 bae2 +000ba4 bb55 +000ba5 ba54 +000ba6 bac2 +000ba7 ba74 +000ba8 bad2 +000ba9 bb88 +000baa bb9b +000bab 9478 +000bac 9601 +000bad 94f8 +000bae b3e3 +000baf bb88 +000bb0 bb9b +000bb1 9601 +000bb2 9409 +000bb3 2ea5 +000bb4 c053 STA_o: store_reg rega,STA_m ;common entry after address generate + + ; opcode: STX +000bb5 b3c3 +000bb6 0dc9 +000bb7 bbc8 +000bb8 ba7b +000bb9 27dd +000bba c00f adgen_zy STX_ ;ZP,y +000bbb b3c3 +000bbc bbc8 +000bbd ba7b +000bbe 27dd +000bbf c00a adgen_z STX_ ;ZP absolute +000bc0 b3c3 +000bc1 bb88 +000bc2 bb9b +000bc3 9601 +000bc4 7e3f +000bc5 b3d3 STX_a: adgen_a ;absolute + +000bc6 bbc8 +000bc7 bbdb +000bc8 3bdf +000bc9 f081 +000bca bae2 +000bcb ba85 +000bcc ba54 +000bcd bac2 +000bce ba74 +000bcf bad2 +000bd0 bb88 +000bd1 bb9b +000bd2 9478 +000bd3 9601 +000bd4 94f8 +000bd5 b3e3 +000bd6 bb88 +000bd7 bb9b +000bd8 9601 +000bd9 9409 +000bda 2ca8 +000bdb c02c STX_o: store_reg regx,STX_m ;common entry after address generate + + ; opcode: STY +000bdc b3c3 +000bdd 0dc8 +000bde bbc8 +000bdf ba7b +000be0 c00e adgen_s_zx STY_ ;ZP,x +000be1 b3c3 +000be2 bbc8 +000be3 ba7b +000be4 c00a adgen_s_z STY_ ;ZP absolute +000be5 b3c3 +000be6 bb88 +000be7 bb9b +000be8 9601 +000be9 7e3f +000bea b3d3 STY_a: adgen_a ;absolute + +000beb bbc8 +000bec bbdb +000bed 3bdf +000bee f081 +000bef bae2 +000bf0 ba95 +000bf1 ba54 +000bf2 bac2 +000bf3 ba74 +000bf4 bad2 +000bf5 bb88 +000bf6 bb9b +000bf7 9478 +000bf8 9601 +000bf9 94f8 +000bfa b3e3 +000bfb bb88 +000bfc bb9b +000bfd 9601 +000bfe 9409 +000bff 2ca9 +000c00 c007 STY_o: store_reg regy,STY_m ;common entry after address generate + + .endif + + ;************************************************** + ; + ; I/O page (iomap) address decode - emulated I/O + ; + ;************************************************** + .ifdef iomap + .include "6502_Emu_IO.inc" + + ; 6502 EMULATOR include + ; I/O page (iomap) address decode & emulated I/O + ; + ; Copyright (C) 2013-2015 Klaus Dormann + ; + ; This program is free software: you can redistribute it and/or modify + ; it under the terms of the GNU General Public License as published by + ; the Free Software Foundation, either version 3 of the License, or + ; (at your option) any later version. + ; + ; This program is distributed in the hope that it will be useful, + ; but WITHOUT ANY WARRANTY; without even the implied warranty of + ; MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + ; GNU General Public License for more details. + ; + ; You should have received a copy of the GNU General Public License + ; along with this program. If not, see . + ; + .set io_version = 832 + ;***************************************************************** + ; + ; IO macros + ; + ;***************************************************************** + + ;I/O address least significant nibble address decode + ; + ;@0 = table of 16 addresses for decoded nibble (0x0 - 0xf) + .macro io_adr_dec + .if (@0 & 0xff) > 0xf0 + .error "Address decode table @0 crosses a page boundary!" + .endif + ldi zh,high(@0) ;register address decode + mov zl,oplow ;lower byte + andi zl,0xf ;lower 4 bits + addi zl,low(@0) ;add offset + ijmp ;address specific code + .endmacro + + ;macro set IO select pin + ; + ;@0 = io_strobe pin direct (1-3) or extended (10-17, 20-27, 30-37) + .macro set_io_select + out cbus,clear ;turn off -OE to RAM + .set io_select = @0 + .if io_select > 3 ;generate strobe + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios1_default ;precharge IO-select register + .set io_strobe_pol = !((ios1_default >> io_select) & 1) + .set io_sel_direct = 6 ;bit to enable extension register + .else + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios2_default ;precharge IO-select register + .set io_strobe_pol = !((ios2_default >> io_select) & 1) + .set io_sel_direct = 7 ;bit to enable extension register + .else + .set io_select = io_select -10 + ldi b,ios3_default ;precharge IO-select register + .set io_strobe_pol = !((ios3_default >> io_select) & 1) + .set io_sel_direct = 2 ;bit to enable extension register + .endif + .endif + out abushi,b + sbi cbus,io_sel_direct ;make register transparent + .else + .set io_sel_direct = 0 + .if (io_select == 3) ;translate to pin + .set io_select = 2 + .else + .set io_select = io_select + 5 + .endif + .endif + .endmacro + + ;macro set IO selectpin and keep reset pin low + ; + ;@0 io_strobe pin direct (1-3) or extended (10-17, 20-27, 30-37) + .macro set_io_reset + out cbus,clear ;turn off -OE to RAM + .set io_select = @0 + .if io_select > 3 ;generate strobe + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios1_default ;precharge IO-select register + .set io_strobe_pol = !((ios1_default >> io_select) & 1) + .set io_sel_direct = 6 ;bit to enable extension register + .else + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios2_default ;precharge IO-select register + .set io_strobe_pol = !((ios2_default >> io_select) & 1) + .set io_sel_direct = 7 ;bit to enable extension register + .else + .set io_select = io_select -10 + ldi b,ios3_default ;precharge IO-select register + .set io_strobe_pol = !((ios3_default >> io_select) & 1) + .set io_sel_direct = 2 ;bit to enable extension register + .endif + .endif + .ifdef io_reset_pin + .if (@0 & 0x30) == (io_reset_pin & 0x30) + cbr b,(1 << (io_reset_pin & 7)) + .endif + .endif + out abushi,b + sbi cbus,io_sel_direct ;make register transparent + .else + .set io_sel_direct = 0 + .if (io_select == 3) ;translate to pin + .set io_select = 2 + .else + .set io_select = io_select + 5 + .endif + .endif + .endmacro + + ;macro prepare IO select pin + ;use with make_io_select, precharges yl & yh with strobe + ; + ;@0 = io_strobe pin direct (1-3) or extended (10-17, 20-27, 30-37) + .macro prep_io_select + .set io_select = @0 + .if io_select > 3 ;generate strobe + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios1_default ;precharge IO-select register + ldi yl,ios1_default^(1<> io_select) & 1) + .set io_sel_direct = 6 ;bit to enable extension register + .else + .set io_select = io_select -10 + .if io_select < 8 + ldi b,ios2_default ;precharge IO-select register + ldi yl,ios2_default^(1<> io_select) & 1) + .set io_sel_direct = 7 ;bit to enable extension register + .else + .set io_select = io_select -10 + ldi b,ios3_default ;precharge IO-select register + ldi yl,ios3_default^(1<> io_select) & 1) + .set io_sel_direct = 2 ;bit to enable extension register + .endif + .endif + ldi yh,0x30|(1< 0) + out abushi,yl + .endif + out cbus,yh + .endmacro + + ;macro enable IO select pin + ; + .macro ena_io_select + .if (io_sel_direct > 0) + .if io_strobe_pol + sbi abushi,io_select ;strobe high + .else + cbi abushi,io_select ;strobe low + .endif + .else + sbi cbus,io_select ;strobe high + .endif + .endmacro + + ;macro disable IO select pin + ; + .macro dis_io_select + .if (io_sel_direct > 0) + out abushi,b ;end strobe + .else + out cbus,clear ;end strobe + .endif + .endmacro + + ;macro disable SPI select pin + ; + .macro dis_spi_select + .if (io_sel_direct > 0) + out abushi,b ;end strobe if io extension + .endif + ;must be followed by + ; out cbus,{readmem|clear} + .endmacro + + ;macro SPI wait for spdr complete + ; + .macro wait_spi + wait_spdr: + sbis spsr,spif + rjmp wait_spdr + .endmacro + + ;macro out @0 to SPI and wait for spdr complete + ; + .macro out_spi + out spdr,@0 + wait_spdr: + sbis spsr,spif + rjmp wait_spdr + .endmacro + + ;macro in @0 from SPI and wait for data ready + ; + .macro in_spi + out spdr,allon + wait_spdr: + sbis spsr,spif + rjmp wait_spdr + in @0,spdr + .endmacro + + ;macro parallel read + ; + ;@0 minimum read strobe in ns, max 800ns + ; maximum time to data valid is @0 -1/2 clock, -32ns + .macro par_rd + sbi abuslo,7 ;generate R/-W if needed + ena_io_select + wait_ns @0,1 + dis_io_select + in operand,dbusin ;data latched during previous cycle + out cbus,readmem ;IO-select off & read mode back on + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret + .endmacro + + ;macro parallel write + ; + ;@0 minimum write strobe duration in ns, max 800ns + .macro par_wrt + cbi abuslo,7 ;generate R/-W if needed + out dbusout,operand ;precharge data to be written + out dbusddr,allon ;data write mode + ena_io_select + wait_ns @0,1 + dis_io_select + out dbusddr,zero ;data hold ends + .endmacro + + ;parallel pre read macro - data to a, no return + ; + ;@0 minimum read strobe in ns, max 800ns + ; maximum time to data valid is @0 -1/2 clock, -32ns + .macro par_pre_rd + sbi abuslo,7 ;generate R/-W + ena_io_select + wait_ns @0,1 + dis_io_select + in a,dbusin ;data latched during previous cycle + .endmacro + + ;phase 2 synchronisation macro + ; next instruction after macro is at tcnt=7, OC2=1 + ; + ; you are here | at end of macro + ; _ _ _ _ _ _ _V_ _ _ + ; Phi2 _ _| |_ _ _ _ _ _ _ _| + ; + ; tcnt 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 + ; + ; 500ns/phase, 62.5ns/count + + .macro phi2_sync + phi2_syncloop: + in zl,tcnt2 + sbic pind,7 ;wait for phi2 low + rjmp phi2_syncloop + clr zh + subi zl,low(-phi2_synctable) ;calculate offset cycles + sbci zh,high(-phi2_synctable) + ijmp + + ; .if (PC & 0xff) > 0xf8 ;keep table on same page - avoid adc zh,zero + ; .org (PC + 0x100) & 0xff00 + ; .endif + phi2_synctable: ;delay -1 cycle for each count in tcnt + nop ;0/1 - tcnt=0/OC2=1 + nop ;1/1 + nop ;2/1 + nop ;3/1 + nop ;4/1 + nop ;5/1 + nop ;6/1 + ; next 7/1 - output to next cycle, input from previous cycle + .endmacro + + .macro nop2 ;2 cycle nop + rjmp pc+1 + .endmacro + + ;macro phase 2 synchronized read + ; + ; + ; data latched 1/2 clock ahead of IN + + ; address valid + | + ; after sync + | | + ; | | _ _ _ _ _ _ _ _ _ _ _ _ | _ _ + ; chip select _ _|_ _|_ _| | |_ _ + ; _ _ _ _V_ | _ _ _ _ _ _ _ V + ; Phi2 |_V_ _ _ _ _ _ _| |_ _ _ _ + ; + ; tcnt 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 + ; + .macro phi2_rd + phi2_sync + sbi abuslo,7 ;7/1 generate R/-W - tcnt=7/OC2=1 + ena_io_select ;1/0 CS strobe >300ns before phi2 + nop2 ;3/0 + nop2 ;5/0 + nop2 ;7/0 + nop2 ;1/1 + nop2 ;3/1 + nop2 ;5/1 + nop ;7/1 + in operand,dbusin ;0/0 input latched at 7/1 +30ns + dis_io_select ;1/0 end strobe 125ns after phi2 te + out cbus,readmem ;IO-select off & read mode back on + ldi oc_tabh,high(oc_tab) ;restore zh as opcode table + ret + .endmacro + + ;macro phase 2 synchronized write + ; + ; output data valid + + ; address valid + | + ; after sync + | | + ; | | _ _ _ _ _ _ _|_ _ _ _ _ _ _ + ; chip select _ _|_ _|_ _| | |_ _ _ + ; _ _ _ _V_ | _ _V_ _ _ _ _ _ + ; Phi2 |_V_ _ _ _ _ _ _| |_ _ _ _ + ; + ; tcnt 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 4 5 6 7 0 1 2 3 + ; + .macro phi2_wrt + phi2_sync + cbi abuslo,7 ;7/1 generate R/-W - tcnt=7/OC2=1 + ena_io_select ;1/0 CS strobe high >300ns before phi2 + nop2 ;3/0 + nop2 ;5/0 + nop ;7/0 + out dbusout,operand ;0/1 precharge data to be written + out dbusddr,allon ;1/1 write data valid 125 ns after phi2 le + nop2 ;2/1 + nop2 ;4/1 + nop2 ;6/1 + dis_io_select ;0/0 end strobe 60ns after phi2 te + out dbusddr,zero ;data hold ends + rjmp iw_exit ;next instruction + .endmacro + + ;**************************************************************** + ; + ; Begin IO address decode after load, store or modify instruction + ; + ;**************************************************************** + + ;address decode for higher nibble of internally mapped address + iomodify: +000c01 6230 sbr flags,(1<10ms? +000cd1 f419 ifeq lcd_rs_timeout +000cd2 9270 00c7 sts lcd_flags,zero +000cd4 9508 ret + end lcd_rs_timeout +000cd5 9ac7 +000cd6 9ada +000cd7 c000 +000cd8 c000 +000cd9 c000 +000cda 0000 +000cdb bb1b +000cdc b303 par_pre_rd 450 +000cdd fd07 sbrc a,7 ;test status busy +000cde cff0 loop lcd_rs_busy +000cdf e200 ldi a,32 ;delay 96 cycles = 6µs + do lcd_rs_adr ; for older hd44780 requiring +000ce0 950a dec a ; extra time after busy +000ce1 f7f1 loopne lcd_rs_adr ; to increment RAM address + lcd_rs_fwrt: +000ce2 bbc8 out abuslo,oplow ;set register +000ce3 98c7 +000ce4 baa5 +000ce5 ba54 +000ce6 9ada +000ce7 c000 +000ce8 c000 +000ce9 c000 +000cea 0000 +000ceb bb1b +000cec ba74 par_wrt 450 ;write with 450ns strobe +000ced 9508 ret + + lcd_rs_rd: ;read from lcd with timeout on busy +000cee be72 out tcnt0,zero +000cef 98c0 cbi abuslo,0 ;set status register + do lcd_rs_rd_busy +000cf0 b702 in a,tcnt0 ;busy timeout? +000cf1 390c cpi a,0x9c ;>10ms? +000cf2 f419 ifeq lcd_rs_rd_timeout +000cf3 9270 00c7 sts lcd_flags,zero +000cf5 9508 ret + end lcd_rs_rd_timeout +000cf6 9ac7 +000cf7 9ada +000cf8 c000 +000cf9 c000 +000cfa c000 +000cfb 0000 +000cfc bb1b +000cfd b303 par_pre_rd 450 +000cfe fd07 sbrc a,7 ;test status busy +000cff cff0 loop lcd_rs_rd_busy +000d00 e200 ldi a,32 ;delay 96 cycles = 6µs + do lcd_rs_rd_adr ; for older hd44780 requiring +000d01 950a dec a ; extra time after busy +000d02 f7f1 loopne lcd_rs_rd_adr ; to increment RAM address +000d03 bbc8 out abuslo,oplow ;set register +000d04 9ac7 +000d05 9ada +000d06 c000 +000d07 c000 +000d08 c000 +000d09 0000 +000d0a bb1b +000d0b b303 par_pre_rd 450 ;read with 450ns strobe +000d0c 2ea0 mov operand,a +000d0d 9508 ret + .endif + + ;***************************************************************** + ; + ; emulated 6551 ACIA - data register only + ; + ; ACIA is not available, when the debugger is using the RS232 interface + ; use exit command (X) to enable ACIA, use break to return to the debugger + ; + ;data register, TX on write, RX on read both with 256 byte FIFO buffer + acia_rx: +000d0e 9100 00bf lds a,irq_flag +000d10 7b0f cbr a,0b01000000 ;clear rdrf +000d11 9000 00be lds c,irq_mask ;other interrupts pending & enabled? +000d13 2200 and c,a +000d14 f421 ifeq rx_irq_clear + .ifdef ena_diag +000d15 9000 00c5 lds c,selftest +000d17 fe00 sbrs c,0 ;forced IRQ by selftest + .endif +000d18 988b cbi cbusddr,3 ;clear IRQ + end rx_irq_clear +000d19 24aa clr operand ;default response +000d1a fd30 sbrc flags,deb_on ;acia disconnected? +000d1b c021 ifs acia_rx_ena +000d1c 9000 00d7 lds c,rx_fill ;precharge rx level + .ifdef irq_dis_real + .endif +000d1e 2000 tst c ;buffer empty? +000d1f f0d9 ifne acia_rx_empty +000d20 91a0 00d6 lds xl,rx_inx ;prepare address to read rx fifo +000d22 e0b2 ldi xh,high(rx_buf) +000d23 19a0 sub xl,c +000d24 90ac ld operand,x ;read +000d25 940a dec c ;update pointer +000d26 9200 00d7 sts rx_fill,c +000d28 f031 ifne acia_rx_more +000d29 9110 00be lds b,irq_mask ;check acia irq enabled +000d2b 7410 andi b,0b01000000 ;RDRF IRQ enabled ? +000d2c f009 ifne acia_rx_int +000d2d 9a8b sbi cbusddr,3 ;set IRQ + end acia_rx_int +000d2e 6400 sbr a,0b01000000 ;set rdrf - more rx data + end acia_rx_more + .ifdef flowlo +000d2f 2d20 mov i,c +000d30 3820 cpi i,flowlo ;buffer lower watermark? +000d31 f448 iflo acia_flow +000d32 9120 00d8 lds i,flow_cmd +000d34 3921 cpi i,0x91 ;xon done? +000d35 f029 ifne acia_send_xon +000d36 e121 ldi i,0x11 ;post xon pending +000d37 9320 00d8 sts flow_cmd,i +000d39 eb28 ldi i,usart_txi_ena ;notify transmitter +000d3a b92a out ucsrb,i + .ifdef irq_dis_real + .endif + end acia_send_xon + end acia_flow + .endif + end acia_rx_empty +000d3b 9300 00bf sts irq_flag,a + end acia_rx_ena +000d3d e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000d3e 9508 ret + + acia_tx: +000d3f 9000 00d5 lds c,tx_fill ;precharge level + .ifdef irq_dis_real + .endif +000d41 fd30 sbrc flags,deb_on ;acia connected? + iw_retry_ext: +000d42 c122 rjmp iw_retry ;disconnected - loop until buffer is available +000d43 9403 inc c ;space in buffer ? +000d44 f3e9 breq iw_retry_ext ;full - loop until buffer is available +000d45 9100 00bf lds a,irq_flag +000d47 770f cbr a,0b10000000 ;clear tdre +000d48 9010 00be lds d,irq_mask ;other interrupts pending & enabled? +000d4a 2210 and d,a +000d4b f421 ifeq tx_irq_clear + .ifdef ena_diag +000d4c 9010 00c5 lds d,selftest +000d4e fe10 sbrs d,0 ;forced IRQ by selftest + .endif +000d4f 988b cbi cbusddr,3 ;clear IRQ + end tx_irq_clear + +000d50 eb28 ldi i,usart_txi_ena ;notify transmitter +000d51 b92a out ucsrb,i + .ifdef irq_dis_real + .endif +000d52 91a0 00d4 lds xl,tx_inx ;load pointer +000d54 e0b1 ldi xh,high(tx_buf) +000d55 92ad st x+,operand ;send data to fifo +000d56 93a0 00d4 sts tx_inx,xl ;save index +000d58 9200 00d5 sts tx_fill,c +000d5a 9403 inc c ;more tx fifo available? +000d5b f031 ifne acia_tx_more +000d5c 9110 00be lds b,irq_mask ;TDRE IRQ enabled +000d5e 7810 andi b,0b10000000 +000d5f f009 ifne acia_tx_int +000d60 9a8b sbi cbusddr,3 ;set IRQ + end acia_tx_int +000d61 6800 sbr a,0b10000000 ;set tdre - tx buffer available + end acia_tx_more +000d62 9300 00bf sts irq_flag,a +000d64 c103 rjmp iw_exit + + ;************************************************************** + ; + ; Timer 1 registers + ; + ; no output or input pins available, internal operations only + ; see ATMega datasheet for register and bit functionality + ; + ; write address register, then read or write data register + ; output high byte first, automatic decrement to low byte + ; input low byte first, automatic increment to high byte + ; + ; 0 = ICR1L 1 = ICR1H 2 = OCR1BL 3 = OCR1BH + ; 4 = OCR1AL 5 = OCR1AH 6 = TCNT1L 7 = TCNT1H + ; 8 = combined TCCR1 (merged TCCR1A, TCCR1B, SFIOR) + ; + ;TCCR1 bit assignment + ;write [WGM13|WGM12|WGM11|WGM10|PSR10|CS12|CS11|CS10] + ;read [WGM13|WGM12|WGM11|WGM10| 0 |CS12|CS11|CS10] + + t1r_adr: +000d65 90a0 00c1 lds operand,t1_adr ;respond with current address +000d67 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000d68 9508 ret + + t1w_adr: +000d69 92a0 00c1 sts t1_adr,operand +000d6b c0fc rjmp iw_exit + + t1r_data: +000d6c 91a0 00c1 lds xl,t1_adr +000d6e 30a8 cpi xl,8 ;TCCR1? +000d6f f448 iflo t1r_data_word +000d70 5baa addi xl,0x46 ;add memory offset to t1 registers +000d71 e0b0 ldi xh,0 +000d72 90ac ld operand,x +000d73 91a0 00c1 lds xl,t1_adr +000d75 25a6 eor xl,one ;switch between low & high byte +000d76 93a0 00c1 sts t1_adr,xl +000d78 c005 else t1r_data_word +000d79 f419 ifeq t1r_data_ctl +000d7a 90a0 00c2 lds operand,t1_ctrl +000d7c c001 else t1r_data_ctl +000d7d 24aa clr operand + end t1r_data_ctl + end t1r_data_word +000d7e e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000d7f 9508 ret + + t1w_data: +000d80 91a0 00c1 lds xl,t1_adr +000d82 30a8 cpi xl,8 ;TCCR1? +000d83 f448 iflo t1w_data_word +000d84 5baa addi xl,0x46 ;add memory offset to t1 registers +000d85 e0b0 ldi xh,0 +000d86 92ac st x,operand +000d87 91a0 00c1 lds xl,t1_adr +000d89 25a6 eor xl,one ;switch between high & low byte +000d8a 93a0 00c1 sts t1_adr,xl +000d8c c014 else t1w_data_word +000d8d f499 ifeq t1w_data_ctl +000d8e 2d0a mov a,operand ;test prescaler bits valid +000d8f 7007 andi a,7 ;mask clock select bits +000d90 2d1a mov b,operand +000d91 7f17 andi b,0xf7 ;strip psr10 - is write only +000d92 9310 00c2 sts t1_ctrl,b ;store for readback +000d94 7310 andi b,0x30 ;mask wgm11:10 +000d95 9512 swap b ;move into position +000d96 bd1f out TCCR1A,b +000d97 2d1a mov b,operand ;mask wgm13:12 +000d98 7c10 andi b,0xc0 +000d99 9512 swap b ;move into position +000d9a 0f11 lsl b +000d9b 2b01 or a,b ;merge with clock select +000d9c bd0e out TCCR1B,a +000d9d b700 in a,SFIOR ;move psr10 to sfior +000d9e faa3 bst operand,3 +000d9f f900 bld a,0 +000da0 bf00 out SFIOR,a + end t1w_data_ctl + end t1w_data_word +000da1 c0c6 rjmp iw_exit + + t1_rs: +000da2 bc7f out TCCR1A,zero ;stop timer +000da3 bc7e out TCCR1B,zero +000da4 9270 00c1 sts t1_adr,zero ;clear regs +000da6 9270 00c2 sts t1_ctrl,zero +000da8 9508 ret + + ;timer 1 interrupts + t1_ovi: +000da9 9120 00bf lds i,irq_flag ;set t1 overflow +000dab 6024 sbr i,(1<<2) +000dac 9320 00bf sts irq_flag,i +000dae 9a8b sbi cbusddr,3 ;set IRQ +000daf 9518 reti + t1_ocra: +000db0 9120 00bf lds i,irq_flag ;set t1 output compare flag A +000db2 6120 sbr i,(1<<4) +000db3 9320 00bf sts irq_flag,i +000db5 9a8b sbi cbusddr,3 ;set IRQ +000db6 9518 reti + t1_ocrb: +000db7 9120 00bf lds i,irq_flag ;set t1 output compare flag B +000db9 6028 sbr i,(1<<3) +000dba 9320 00bf sts irq_flag,i +000dbc 9a8b sbi cbusddr,3 ;set IRQ +000dbd 9518 reti + t1_icr: +000dbe 9120 00bf lds i,irq_flag ;set t1 input compare flag +000dc0 6220 sbr i,(1<<5) +000dc1 9320 00bf sts irq_flag,i +000dc3 9a8b sbi cbusddr,3 ;set IRQ +000dc4 9518 reti + + ;tick countdown timer + ;write # of ticks (10ms) to flag/interrupt + ;read remaining ticks to next flag/interrupt + ;reloads last countdown at bottom - periodic countdown + tcdn_r: +000dc5 90a0 00c3 lds operand,tcdn_count ;respond with remaining ticks +000dc7 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000dc8 9508 ret + + tcdn_w: +000dc9 92a0 00c3 sts tcdn_count,operand ;store current count +000dcb 92a0 00c4 sts tcdn_top,operand ;store periodic count +000dcd c09a rjmp iw_exit + + ;interrupt mask register + ;allows avr internal io-flags to cause an IRQ on the 6502 cpu + ;write:[TDRE|RDRF|ICF1|OCF1A|OCF1B|TOV1|tcdn|tick] + ; read:[TDRE|RDRF|ICF1|OCF1A|OCF1B|TOV1|tcdn|tick] + ;tick = periodic 10ms interrupt (t0 ctc) + ;tcdn = tick countdown interrupt + ;T1 related masks - see ATMega datasheet + ;RDRF: set if receiver fifo has data - cleared if buffer empty + ;TDRE: set if transmitter fifo not full - cleared if buffer full + ir_mask: +000dce 90a0 00be lds operand,irq_mask ;respond with current mask +000dd0 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000dd1 9508 ret + + iw_mask: +000dd2 2d0a mov a,operand ;set t1 mask +000dd3 730c andi a,0x3c +000dd4 6003 ori a,0b11 ;precharge timsk with t0 ie +000dd5 9300 00c0 sts timer_ena,a + .ifdef irq_dis_real + .endif +000dd7 bf09 out timsk,a +000dd8 2d0a mov a,operand ;save mask +000dd9 9300 00be sts irq_mask,a + ; in b,tifr ;check pending flags enabled + ; andi b,0x3c +000ddb 9010 00bf lds d,irq_flag + ; or d,b ;merge t1 & saved +000ddd 2210 and d,a +000dde 2011 tst d +000ddf f411 ifeq mask_irq_clear ;all masked flags serviced? +000de0 988b cbi cbusddr,3 ;clear IRQ +000de1 c001 else mask_irq_clear +000de2 9a8b sbi cbusddr,3 ;set IRQ pending + end mask_irq_clear +000de3 c084 rjmp iw_exit + + + ;interrupt flag register + ;avr internal io-flags + ;write:[ - | - |ICF1|OCF1A|OCF1B|TOV1|tcdn|tick] + ; read:[TDRE|RDRF|ICF1|OCF1A|OCF1B|TOV1|tcdn|tick] + ;tick: periodic 10ms interrupt (t0 ctc) - write 1 to clear + ;tcdn: tick countdown reached 0 - write 1 to clear + ;T1 related masks - see ATMega datasheet - write 1 to clear + ;RDRF: set if ACIA receiver fifo has data - cleared if empty + ;TDRE: set if ACIA transmitter fifo not full - cleared if full + ir_flag: +000de4 90a0 00bf lds operand,irq_flag ;respond with pending flags +000de6 b708 in a,tifr ;get t1 flags +000de7 730c andi a,0x3c +000de8 2aa0 or operand,a ;merge to saved flags +000de9 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000dea 9508 ret + + iw_flag: +000deb 2d0a mov a,operand ;clear t1 flags +000dec 730c andi a,0x3c +000ded bf08 out tifr,a +000dee b718 in b,tifr ;keep pending flags +000def 731c andi b,0x3c +000df0 2d0a mov a,operand ;clear saved flags +000df1 730f andi a,0b00111111 ;ACIA can not be cleared +000df2 2505 eor a,allon ;reverse mask +000df3 9010 00bf lds d,irq_flag +000df5 2a11 or d,b ;merge t1 & saved +000df6 2210 and d,a ;mask over flags +000df7 9210 00bf sts irq_flag,d +000df9 9000 00be lds c,irq_mask ;check remaining enabled +000dfb 2010 and d,c +000dfc f409 ifeq flag_irq_clear ;all flags serviced? +000dfd 988b cbi cbusddr,3 ;clear IRQ + end flag_irq_clear +000dfe c069 rjmp iw_exit + + ;interrupt vector register + ;avr internal io interrupt vectors, read only + ;reading the vector clears the corresponding flag except + ;external IRQ must be cleared at the source + ;RDRF & TDRE are cleared by writing or reading the ACIA data reg + ; 0 = external IRQ - low on IRQ input pin + ; 2 = tick - periodic 10ms interrupt (t0 ctc) + ; 4 = tcdn - tick countdown reached 0 + ; 6 = TOV1 - timer 1 overflow + ; 8 = OCF1B - timer 1 output compare register b match + ;10 = OCF1A - timer 1 output compare register a match + ;12 = ICF1 - timer 1 input capture register match + ;14 = RDRF - ACIA receive data register full + ;16 = TDRE - ACIA transmit data register empty + ir_vector: +000dff 24aa clr operand ;initialize vector +000e00 9000 00bf lds c,irq_flag ;read pending flags +000e02 9010 00be lds d,irq_mask ;mask with enabled interrupts +000e04 2d10 mov b,c ;make 6 enabled +000e05 2111 and b,d +000e06 f0d1 ifne ir_vect_internal +000e07 9468 set ;precharge to set bit +000e08 2f01 mov a,b +000e09 7f00 andi a,0xf0 ;interrupt source 2^2? +000e0a f011 ifne ir_vect_b2 +000e0b 2f10 mov b,a ;isolate bit group +000e0c f8a2 bld operand,2 ;add 2^2 + end ir_vect_b2 +000e0d 2f01 mov a,b +000e0e 7c0c andi a,0xcc ;interrupt source 2^1? +000e0f f011 ifne ir_vect_b1 +000e10 2f10 mov b,a ;isolate bit group +000e11 f8a1 bld operand,1 ;add 2^1 + end ir_vect_b1 +000e12 2f01 mov a,b +000e13 7a0a andi a,0xaa ;interrupt source 2^0? +000e14 f011 ifne ir_vect_b0 +000e15 2f10 mov b,a ;isolate bit group +000e16 f8a0 bld operand,0 ;add 2^0 + end ir_vect_b0 +000e17 94a3 inc operand ;make vector 2 4 6 ... 16 +000e18 0caa lsl operand +000e19 2515 eor b,allon ;clear flag +000e1a 6c10 sbr b,0b11000000 ;can't clear RDRF & TDRE +000e1b 2201 and c,b +000e1c 9200 00bf sts irq_flag,c +000e1e 2010 and d,c ;all enabled flags done? +000e1f f409 ifeq ir_vect_clr_int +000e20 988b cbi cbusddr,3 ;clear IRQ + end ir_vect_clr_int + end ir_vect_internal +000e21 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000e22 9508 ret + + ;diag selftest register + ;allows setting of external control lines if enabled + ;enter debugger, query debugger running, query DMA available + ;write:[DEB| - | - | - | - |RES|NMI|IRQ] + ; + start debugger, halt emulation + ; read:[DEB| 1 | 0 | 0 | 0 | 0 |NMI|IRQ] + ; | + IO version >= 0.83 (has DMA) + ; + debugger currently running, ACIA disconnected + ir_diag: +000e23 90a0 00c5 lds operand,selftest ;respond with saved selftest flags +000e25 e400 ldi a,0b1000000 ;mark current IO version +000e26 fd30 sbrc flags,deb_on ;mark debugger is running +000e27 6800 sbr a,0b10000000 +000e28 2aa0 or operand,a +000e29 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +000e2a 9508 ret + + iw_diag: +000e2b fea7 sbrs operand,7 ;test enter diag +000e2c c01a ifs iw_diag_enter +000e2d 7430 andi flags,(1<4 + .ENDIF + .ifndef phi2_ena ;not available if phi2 uses cbus pin 7 + .endif + .ifndef nmi_ena ;not available if NMI uses cbus pin 2 + .endif + .endif + .if config_part == 2 ;invoked from 6502_Emu_IO.inc + + ;************************************************************** + ; + ; I/O address decode tables + ; assign internal or external IO modules + ; + ;************************************************************** + + align 4 ;keep each table on same page + + ; I/O address table, reserve 0x10 addresses at a time + ; larger chunks can be defined by pointing sequential addresses + ; to the same entry point + ; read address table + ior_tab: +000e80 cff4 rjmp ir_exit ;0x +000e81 cff3 rjmp ir_exit ;1x +000e82 cff2 rjmp ir_exit ;2x +000e83 cff1 rjmp ir_exit ;3x +000e84 cff0 rjmp ir_exit ;4x +000e85 cfef rjmp ir_exit ;5x +000e86 cfee rjmp ir_exit ;6x +000e87 cfed rjmp ir_exit ;7x +000e88 cfec rjmp ir_exit ;8x +000e89 c106 rjmp spr_data ;9x SPI data register +000e8a c086 rjmp io65xx_rd ;Ax 65xx IO chip RAM +000e8b c085 rjmp io65xx_rd ;Bx 65xx IO chip +000e8c c061 rjmp ltch_rd ;Cx 74HC573 latch(es) +000e8d cda9 rjmp lcd_rd ;Dx character LCD +000e8e c055 rjmp iorE0 ;Ex - subdecoded 0xe0 - 0xef +000e8f c0c0 rjmp iordreg ;Fx - internal emulated registers + + ; write address table + iow_tab: +000e90 cfd7 rjmp iw_exit ;0x +000e91 cfd6 rjmp iw_exit ;1x +000e92 cfd5 rjmp iw_exit ;2x +000e93 cfd4 rjmp iw_exit ;3x +000e94 cfd3 rjmp iw_exit ;4x +000e95 cfd2 rjmp iw_exit ;5x +000e96 cfd1 rjmp iw_exit ;6x +000e97 cfd0 rjmp iw_exit ;7x +000e98 cfcf rjmp iw_exit ;8x +000e99 c0db rjmp spw_data ;9x SPI data register +000e9a c096 rjmp io65xx_wrt ;Ax 65xx IO chip (RAM) +000e9b c095 rjmp io65xx_wrt ;Bx 65xx IO chip +000e9c c05d rjmp ltch_wrt ;Cx 74HC573 latch(es) +000e9d cdbd rjmp lcd_wrt ;Dx character LCD +000e9e c04a rjmp iowE0 ;Ex - subdecoded 0xe0 - 0xef +000e9f c0b5 rjmp iowtreg ;Fx - internal emulated registers + + ; sub address decode tables + ; - select 1 from a range of 0x10 addresses + + ; subdecode 0xe0 - 0xef + ; read address decode table iorE0 (0xe0 - 0xef) + iorE0_tab: +000ea0 cfd4 rjmp ir_exit ;0 +000ea1 cfd3 rjmp ir_exit ;1 +000ea2 cfd2 rjmp ir_exit ;2 +000ea3 cfd1 rjmp ir_exit ;3 +000ea4 cfd0 rjmp ir_exit ;4 +000ea5 cfcf rjmp ir_exit ;5 +000ea6 cfce rjmp ir_exit ;6 +000ea7 cfcd rjmp ir_exit ;7 +000ea8 cfcc rjmp ir_exit ;8 +000ea9 cfcb rjmp ir_exit ;9 +000eaa cfca rjmp ir_exit ;A +000eab cfc9 rjmp ir_exit ;B +000eac cfc8 rjmp ir_exit ;C +000ead cfc7 rjmp ir_exit ;D +000eae cfc6 rjmp ir_exit ;E +000eaf cfc5 rjmp ir_exit ;F + + + ; write address decode table iowE0 (0xe0 - 0xef) + iowE0_tab: +000eb0 cfb7 rjmp iw_exit ;0 +000eb1 cfb6 rjmp iw_exit ;1 +000eb2 cfb5 rjmp iw_exit ;2 +000eb3 cfb4 rjmp iw_exit ;3 +000eb4 cfb3 rjmp iw_exit ;4 +000eb5 cfb2 rjmp iw_exit ;5 +000eb6 cfb1 rjmp iw_exit ;6 +000eb7 cfb0 rjmp iw_exit ;7 +000eb8 cfaf rjmp iw_exit ;8 +000eb9 cfae rjmp iw_exit ;9 +000eba cfad rjmp iw_exit ;A +000ebb cfac rjmp iw_exit ;B +000ebc cfab rjmp iw_exit ;C +000ebd cfaa rjmp iw_exit ;D +000ebe cfa9 rjmp iw_exit ;E +000ebf cfa8 rjmp iw_exit ;F + + ; internal I/O table, subgroup of range defined by + ; iordreg / iowtreg + ; read internal register address table + ior_int_tab: +000ec0 ce4d rjmp acia_rx ;0 - ACIA receive data register +000ec1 cf03 rjmp tcdn_r ;1 - 10ms tick countdown timer +000ec2 c272 rjmp i2c_stat ;2 - i2c read status +000ec3 c20a rjmp i2c_data_rd ;3 - i2c read data register +000ec4 cea0 rjmp t1r_adr ;4 - timer 1 register address +000ec5 cea6 rjmp t1r_data ;5 - timer 1 data +000ec6 c0e3 rjmp spr_dat_lst ;6 - spi data after last write +000ec7 c1d0 rjmp dmr_stat ;7 - dma status +000ec8 c1e9 rjmp dmr_data ;8 - dma parameter data +000ec9 cfab rjmp ir_exit ;9 +000eca cfaa rjmp ir_exit ;A +000ecb cfa9 rjmp ir_exit ;B +000ecc cf56 rjmp ir_diag ;C - diag selftest register +000ecd cf31 rjmp ir_vector ;D - global internal IRQ vector +000ece ceff rjmp ir_mask ;E - global internal IRQ mask +000ecf cf14 rjmp ir_flag ;F - global internal IRQ flags + + ; write internal register address + iow_int_tab: +000ed0 ce6e rjmp acia_tx ;0 - ACIA transmit data register +000ed1 cef7 rjmp tcdn_w ;1 - 10ms tick countdown timer +000ed2 c23a rjmp i2c_cmd ;2 - i2c command register +000ed3 c20e rjmp i2c_data_wrt ;3 - i2c write data register +000ed4 ce94 rjmp t1w_adr ;4 - timer 1 register address +000ed5 ceaa rjmp t1w_data ;5 - timer 1 data +000ed6 c083 rjmp spw_cmd ;6 - spi command register +000ed7 c1a8 rjmp dmw_cmd ;7 - dma command register +000ed8 c1c3 rjmp dmw_data ;8 - dma parameter data +000ed9 cf8e rjmp iw_exit ;9 +000eda cf8d rjmp iw_exit ;A +000edb cf8c rjmp iw_exit ;B +000edc cf4e rjmp iw_diag ;C - diag selftest register +000edd cf8a rjmp iw_exit ;D - read only IRQ vector +000ede cef3 rjmp iw_mask ;E - global internal IRQ mask +000edf cf0b rjmp iw_flag ;F - global internal IRQ flags + + + ;check address decode table alignment for missing or extra entry + .if (pc & 0xf) + .endif + + ;SPI address to slave select translation + .ifdef spi_vat + spi_vss: +000ee0 1d1e +000ee1 1f1b +000ee2 1f0f +000ee3 1f1f spi_virt_ss + .endif + + ;************************************************************** + ; + ; IO address decoder + ; + ;************************************************************** + + ;decoding bits 0-3 of an IO address + + iorE0: ;read decode for 0xe0 - 0xef +000ee4 e0fe +000ee5 2fec +000ee6 70ef +000ee7 56e0 +000ee8 9409 io_adr_dec iorE0_tab + + iowE0: ;write decode for 0xe0 - 0xef +000ee9 e0fe +000eea 2fec +000eeb 70ef +000eec 55e0 +000eed 9409 io_adr_dec iowE0_tab + + ;************************************************************** + ; + ; parallel IO modules + ; + ; examples: 74HC573 latch IO, Phi2 synced IO + ; + ;************************************************************** + + ;IO to 74HC573 latch + ; + ; multiple latches require individual IO-selects. these can be set by + ; software address decode or hardware decoder 74HC237 (up to 8 latches, + ; up to 4 each mixed r/w) + + ltch_rd: +000eee bac2 +000eef e811 +000ef0 bb1b +000ef1 9a96 set_io_select 10 ;read with strobe low io select extension reg 1, pin 0 +000ef2 9ac7 +000ef3 98d8 +000ef4 0000 +000ef5 bb1b +000ef6 b2a3 +000ef7 bad2 +000ef8 e0f6 +000ef9 9508 par_rd 100 ;min 60ns to data valid (3state output enable time OE - Q) + ;+ 1/2 clock (31.3ns) avr input latch delay + + ltch_wrt: +000efa bac2 +000efb e811 +000efc bb1b +000efd 9a96 set_io_select 11 ;write with strobe high io select extension reg 1, pin 1 +000efe 98c7 +000eff baa5 +000f00 ba54 +000f01 9ad9 +000f02 bb1b +000f03 ba74 par_wrt 60 ;min 60ns enable strobe (propagation delay time LE - Q) +000f04 cf63 rjmp iw_exit ;next instruction + + ltch_rs: +000f05 24aa clr operand ;clear 74hc573 output latch +000f06 bac2 +000f07 e811 +000f08 bb1b +000f09 9a96 set_io_reset 11 ;select latch strobe +000f0a 98c7 +000f0b baa5 +000f0c ba54 +000f0d 9ad9 +000f0e bb1b +000f0f ba74 par_wrt 60 ;write operand with strobe +000f10 9508 ret + + ;***************************************************************** + ; + ;IO to 65xx chip using phi2 + ; + io65xx_rd: +000f11 bac2 +000f12 e811 +000f13 bb1b +000f14 9a96 set_io_select 13 ;read with strobe on io select extension reg 1, pin 3 +000f15 b5e4 +000f16 9987 +000f17 cffd +000f18 27ff +000f19 5ee4 +000f1a 4ff0 +000f1b 9409 +000f1c 0000 +000f1d 0000 +000f1e 0000 +000f1f 0000 +000f20 0000 +000f21 0000 +000f22 0000 +000f23 9ac7 +000f24 9adb +000f25 c000 +000f26 c000 +000f27 c000 +000f28 c000 +000f29 c000 +000f2a c000 +000f2b 0000 +000f2c b2a3 +000f2d bb1b +000f2e bad2 +000f2f e0f6 +000f30 9508 phi2_rd ;timed read synchronized to phi2 (OC2) + + io65xx_wrt: +000f31 bac2 +000f32 e811 +000f33 bb1b +000f34 9a96 set_io_select 13 ;write with strobe on io select extension reg 1, pin 3 +000f35 b5e4 +000f36 9987 +000f37 cffd +000f38 27ff +000f39 5ce4 +000f3a 4ff0 +000f3b 9409 +000f3c 0000 +000f3d 0000 +000f3e 0000 +000f3f 0000 +000f40 0000 +000f41 0000 +000f42 0000 +000f43 98c7 +000f44 9adb +000f45 c000 +000f46 c000 +000f47 0000 +000f48 baa5 +000f49 ba54 +000f4a c000 +000f4b c000 +000f4c c000 +000f4d bb1b +000f4e ba74 +000f4f cf18 phi2_wrt ;timed write synchronized to phi2 (OC2) + + ;no software reset - hardware reset driven by reset pin + + + ;.org pc + 0x400 ;test sufficient space for custom modules + + .endif + + ;read address decode of internally mapped registers + iordreg: +000f50 e0fe +000f51 2fec +000f52 70ef +000f53 54e0 +000f54 9409 io_adr_dec ior_int_tab + + ;write address decode of internally mapped registers + iowtreg: +000f55 e0fe +000f56 2fec +000f57 70ef +000f58 53e0 +000f59 9409 io_adr_dec iow_int_tab + + .ifdef spi_sel + ;******************************************************************** + ; + ; SPI + ; + ;******************************************************************** + ;fixed definitions for the SPI interface - port share with abuslo + .EQU spi_in =pinb ; SPI input + .EQU spi_ddr =ddrb ; SPI DDR, + .EQU spi_out =portb ; SPI output + .EQU spi_sck =7 ; spi clock output + .EQU spi_miso =6 ; master input + .EQU spi_mosi =5 ; master output + ; spi_ss =0-4 ; spi slave select + + ;SPI command - write SPCR, SPSR, slave select hold + ;w [ x |SSHLD|DORD |SPI2X|CPOL |CPHA |SPR1 |SPR0 ] + ; >-----------------------v + ;SPSR [ 0 | 0 | 0 | 0 | 0 | 0 | 0 |SPI2X] + ; + ;SPCR [ 0 | 0 |DORD | 1 |CPOL |CPHA |SPR1 |SPR0 ] + ; --> [SPIE | SPE |DORD |MSTR |CPOL |CPHA |SPR1 |SPR0 ] + spw_cmd: +000f5a fca6 sbrc operand,6 ;test clearing sshld +000f5b c00f ifs_and spw_cmd_sshld +000f5c 9100 00c8 lds a,spi_cmd +000f5e ff06 sbrs a,6 ;test sshld not already clear +000f5f c00b ifs spw_cmd_sshld +000f60 e10f ldi a,spi_idle ;turn off ss +000f61 bb08 out abuslo,a +000f62 9a6e sbi spcr,spe ;enable SPI +000f63 bac2 +000f64 e811 +000f65 bb1b +000f66 9a96 set_io_select spi_sel +000f67 9ade ena_io_select +000f68 bb1b dis_spi_select ;latch spi interface +000f69 986e cbi spcr,spe ;stop spi +000f6a bad2 out cbus,readmem ;clear IO ext select & set read mode + end spw_cmd_sshld +000f6b 92a0 00c8 sts spi_cmd,operand ;save slave select hold +000f6d 2d0a mov a,operand ;charge with forced bits +000f6e 6100 sbr a,(1<------------------+ | + ; TWI activate + ; o + ; optional Interrupt | -INT only + ; | + ; | + ; <---------------------->|--+ + ; -IRQ or -NMI in Schottky + ; + ;define your I2C interface + ;i2c_sel defined in main file + .EQU i2c_in =dbusin ; I2C input + .EQU i2c_ddr =dbusddr ; I2C DDR + .EQU i2c_out =dbusout ; I2C output + .EQU i2c_scl =0 ; clock i/o + .EQU i2c_sda =1 ; data i/o + .EQU i2c_int =2 ; -interrupt input (optional to detect i2c int) + .EQU i2c_res =3 ; -reset output (optional to reset i2c slaves) + ; # of clocks for 400kHz SCL phase (1/2 clock) @ Osc_Hz rounded up + .EQU i2c_clk =((Osc_Hz / 2 - 1) / 400000) + 1 + #define i2c_data a + ;used registers a (data), b (timing), zl (status), e (io select default) + + ; + ; open i2c interface + ; + i2c_open: +0010c3 bac2 +0010c4 e811 +0010c5 bb1b +0010c6 9a96 set_io_select i2c_sel + i2c_open_rs: +0010c7 ba55 out dbusout,allon ;float all outputs high +0010c8 ba54 out dbusddr,allon ;(discharge low cap) +0010c9 2e21 mov e,b +0010ca ba74 out dbusddr,zero +0010cb ba75 out dbusout,zero ;open collector drive via ddr +0010cc 9adc ena_io_select +0010cd 9508 ret + + ; + ; read i2c data + ; + ; send ack before reading except on 1st read + i2c_data_rd: +0010ce 91e0 00c6 lds zl,i2c_statreg ;load parameters +0010d0 fde0 sbrc zl,0 ;test interface stopped +0010d1 c00d ifs i2c_read_ok +0010d2 dff0 rcall i2c_open +0010d3 fbe2 bst zl,2 ;set speed +0010d4 9488 clc ;ack +0010d5 fde3 sbrc zl,3 ;read ack required? +0010d6 d1bf rcall i2c_putack +0010d7 d19c rcall i2c_read +0010d8 2ea0 mov operand,i2c_data +0010d9 60e8 sbr zl,0b1000 ;set read ack required +0010da 93e0 00c6 sts i2c_statreg,zl ;save status + .if (io_sel_direct > 0) +0010dc ba2b out abushi,e ;close i2c interface + .endif +0010dd bad2 out cbus,readmem ;clear IO select & set read mode +0010de c001 else i2c_read_ok +0010df 2ca7 mov operand,zero + end i2c_read_ok +0010e0 e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +0010e1 9508 ret + ; + ; write i2c data if not stopped or previous read + ; write i2c address if start condition + ; + ; if nak response (slave not ready/present) send stop + i2c_data_wrt: +0010e2 91e0 00c6 lds zl,i2c_statreg ;load parameters +0010e4 fbe2 bst zl,2 ;set speed +0010e5 ffe1 sbrs zl,1 ;start pending? +0010e6 c013 ifs i2c_adr +0010e7 2d0a mov a,operand +0010e8 dfda rcall i2c_open +0010e9 9408 sec ;nak +0010ea fde3 sbrc zl,3 ;read ack outstanding? +0010eb d1aa rcall i2c_putack +0010ec 2d0a mov i2c_data,operand + .ifdef i2c_eep_adr + .else +0010ed d133 rcall i2c_start + .endif +0010ee 70e4 andi zl,0b100 ;keep speed, clear the rest +0010ef f010 ifcc i2c_start_ack +0010f0 64e0 sbr zl,0b1000000 ;set ack +0010f1 c003 else i2c_start_ack +0010f2 7bef cbr zl,0b1000000 ;clear ack +0010f3 60e1 sbr zl,0b1 ;set stop +0010f4 d1bd rcall i2c_stop + end i2c_start_ack +0010f5 93e0 00c6 sts i2c_statreg,zl + .if (io_sel_direct > 0) +0010f7 ba2b out abushi,e ;close i2c interface + .endif +0010f8 bad2 out cbus,readmem ;clear IO select & set read mode +0010f9 cd6e rjmp iw_exit + end i2c_adr +0010fa 2f0e mov a,zl +0010fb 7009 andi a,0b1001 ;not stopped and not read? +0010fc f479 ifeq i2_wrt_ok +0010fd dfc5 rcall i2c_open +0010fe 2d0a mov i2c_data,operand +0010ff d13a rcall i2c_write +001100 70e4 andi zl,0b100 ;keep speed, clear the rest +001101 f010 ifcc i2c_write_ack +001102 64e0 sbr zl,0b1000000 ;set ack +001103 c003 else i2c_write_ack +001104 7bef cbr zl,0b1000000 ;clear ack +001105 60e1 sbr zl,0b1 ;set stop +001106 d1ab rcall i2c_stop + end i2c_write_ack +001107 93e0 00c6 sts i2c_statreg,zl + .if (io_sel_direct > 0) +001109 ba2b out abushi,e ;close i2c interface + .endif +00110a bad2 out cbus,readmem ;clear IO select & set read mode +00110b cd5c rjmp iw_exit + end i2_wrt_ok +00110c cd5b rjmp iw_exit + + ; + ; write i2c command + ; + ;0=send stop, nak & stop if pending read + ;1=set start(next data write = address), speed 100kHz + ;2=set start(next data write = address), speed 400kHz + ;3=send reset (9 naks), optional hw reset + ; allow sufficient time after resetting hardware + ; + i2c_cmd: +00110d 91e0 00c6 lds zl,i2c_statreg +00110f 2d0a mov a,operand +001110 3003 cpi a,3 +001111 f488 iflo i2c_cmd_012 +001112 3001 cpi a,1 +001113 f410 iflo i2c_cmd_stop ;command code 0 - send stop +001114 d013 rcall i2c_send_stop +001115 c00f rjmp i2c_cmd_exit + end i2c_cmd_stop +001116 f431 ifeq i2c_start_100 ;command code 1 - set start 100kHz +001117 7feb cbr zl,0b100 ;speed 100 kHz +001118 fde5 sbrc zl,5 ;bus not stuck? +001119 d0ed rcall i2c_reset ;stuck bus requires a reset +00111a ffe5 sbrs zl,5 ;bus still stuck? +00111b 60e2 sbr zl,0b10 ;OK to start +00111c c008 rjmp i2c_cmd_exit + end i2c_start_100 ;command code 2 - set start 400kHz +00111d 7feb cbr zl,0b100 ;speed 100 kHz for reset +00111e fde5 sbrc zl,5 ;bus not stuck? +00111f d0e7 rcall i2c_reset ;stuck bus requires a reset +001120 ffe5 sbrs zl,5 ;bus still stuck? +001121 60e6 sbr zl,0b110 ;OK to start with 400kHz +001122 c002 rjmp i2c_cmd_exit + end i2c_cmd_012 +001123 f409 ifeq i2c_cmd_reset ;command code 3 - reset i2c bus +001124 d0e2 rcall i2c_reset + end i2c_cmd_reset + i2c_cmd_exit: +001125 93e0 00c6 sts i2c_statreg,zl +001127 cd40 rjmp iw_exit + + ;stop i2c + i2c_send_stop: +001128 fde0 sbrc zl,0 ;not already stopped? +001129 c00a ifs i2c_not_stop +00112a df98 rcall i2c_open +00112b fbe2 bst zl,2 ;set speed +00112c 9408 sec ;nak +00112d fde3 sbrc zl,3 ;read ack outstanding? +00112e d167 rcall i2c_putack +00112f 70e4 andi zl,0b100 ;keep speed, clear the rest +001130 60e1 sbr zl,0b1 ;set stop +001131 d180 rcall i2c_stop + .if (io_sel_direct > 0) +001132 ba2b out abushi,e ;close i2c interface + .endif +001133 bad2 out cbus,readmem ;clear IO select & set read mode + end i2c_not_stop +001134 9508 ret + + ; + ; read i2c status + ; + ; [ IRQ | ACK |Stuck| 0 |Read |Speed|Start|Stop ] + ;IRQ: 1=I2C Interrupt pending + ;ACK: 1=slave acknowledge - device present/ready + ;Stuck: 1=SCL or SDA stuck - interface needs reset + ; 0 + ;Read: 1=Send read acknowledge pending + ;Speed: 1=400kHz, 0=100kHz + ;Start: 1=next write = address + ;Stop: 1=interface stopped + i2c_stat: +001135 91e0 00c6 lds zl,i2c_statreg ;load status +001137 df8b rcall i2c_open +001138 9b9a sbis i2c_in,i2c_int ;skip if no interrupt +001139 68e0 sbr zl,0b10000000 ;merge interrupt to status +00113a 2eae mov operand,zl + .if (io_sel_direct > 0) +00113b ba2b out abushi,e ;close i2c interface + .endif +00113c bad2 out cbus,readmem ;clear IO select & set read mode +00113d e0f6 ldi oc_tabh,high(oc_tab) ;restore zh as opcode table +00113e 9508 ret + + ; + ; I2C reset - mark unusable if stuck + ; + i2c_rs: +00113f bac2 +001140 e811 +001141 bb1b +001142 9a96 set_io_reset i2c_sel +001143 df83 rcall i2c_open_rs +001144 d0c3 rcall i2c_reset_rs +001145 93e0 00c6 sts i2c_statreg,zl +001147 ffe5 sbrs zl,5 ;message, if I2C stuck +001148 c004 ifs i2c_rs_fail +001149 e9ec +00114a e2f2 +00114b 940e 1983 PrintStr_far i2c_fail + end i2c_rs_fail +00114d 9508 ret +00114e 0a0d +00114f 3249 +001150 2043 +001151 7562 +001152 2073 +001153 7473 +001154 6375 +001155 006b i2c_fail: .db 13,10,"I2C bus stuck",0 + + ;DMA I2C read block + dma_i2c_rb: +001156 9100 00ca lds a,dma_last_cmd +001158 9110 00cb lds b,dma_tab_index +00115a 3005 cpi a,5 ;current i2c read block (retry)? +00115b f429 ifeq i2c_drb_retry +00115c 91a0 00d1 lds xl,dma_tab+5 ;load in progress block count +00115e 91b0 00d2 lds xh,dma_tab+6 +001160 c00e rjmp dma_i2c_rb1 + end i2c_drb_retry +001161 3105 cpi a,0x15 ;previous i2c read block? +001162 f021 ifeq_or i2c_drb +001163 3001 cpi a,1 ;previous set block address table? +001164 f439 ifeq_and i2c_drb +001165 3015 cpi b,5 ;block address table valid? +001166 f429 ifeq i2c_drb +001167 91a0 00cf lds xl,dma_tab+3 ;load block count +001169 91b0 00d0 lds xh,dma_tab+4 +00116b c003 rjmp dma_i2c_rb1 + end i2c_drb + dma_i2c_rbfail: +00116c 9250 00ca sts dma_last_cmd,allon ;mark invalid sequence of command +00116e ccf9 rjmp iw_exit + dma_i2c_rb1: +00116f 92a0 00ca sts dma_last_cmd,operand ;mark command in progress +001171 91e0 00cd lds zl,dma_tab+1 ;load memory address +001173 91f0 00ce lds zh,dma_tab+2 + +001175 91c0 00c6 lds yl,i2c_statreg ;load current I2C status +001177 fdc0 sbrc yl,0 ;test interface stopped +001178 cff3 rjmp dma_i2c_rbfail +001179 bac2 out cbus,clear ;readmode off +00117a df48 rcall i2c_open +00117b b202 in c,cbus ;save I2C register enable +00117c b21b in d,abushi ;save I2C enable +00117d fbc2 bst yl,2 ;set speed +00117e 9488 clc ;ack +00117f fdc3 sbrc yl,3 ;read ack required? +001180 d115 rcall i2c_putack +001181 60c8 sbr yl,0b1000 ;set read ack required +001182 93c0 00c6 sts i2c_statreg,yl ;save status +001184 b709 in a,timsk ;block single step on retry +001185 7f0e cbr a,1< 0) +001189 ba2b out abushi,e ;close i2c interface + .endif +00118a bac2 out cbus,clear ;clear IO select + ;write memory +00118b ba54 out dbusddr,allon ;prepare to write mem +00118c bbe8 out abuslo,zl ;set memory address +00118d bbfb out abushi,zh +00118e bae2 out cbus,writemem ;WE, ~OE +00118f bb05 out dbusout,a ;dbus write +001190 9631 adiw z,1 +001191 bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz +001192 9711 sbiw x,1 +001193 f059 exiteq i2c_drb_loop + ;read i2c +001194 ba55 out dbusout,allon ;float all outputs high + ; .ifdef irq_dis_real + ; sbrs stat2,2 ;all interrupts disable + ; .endif +001195 9478 sei +001196 ba74 out dbusddr,zero +001197 94f8 cli +001198 ba75 out dbusout,zero ;open collector drive via ddr +001199 ba1b out abushi,d ;reenable I2C bus +00119a ba02 out cbus,c +00119b 9488 clc +00119c fbc2 bst yl,2 ;set speed +00119d d0f8 rcall i2c_putack +00119e cfe9 loop i2c_drb_loop +00119f ba74 out dbusddr,zero ;end writing to memory +0011a0 93e0 00cd sts dma_tab+1,zl ;save next memory address +0011a2 93f0 00ce sts dma_tab+2,zh +0011a4 e105 ldi a,0x15 ;last successful command was read +0011a5 9300 00ca sts dma_last_cmd,a +0011a7 b709 in a,timsk ;undo block single step +0011a8 6001 sbr a,1< 0) +0011eb ba2b out abushi,e ;close i2c interface + .endif +0011ec bad2 out cbus,readmem ;clear IO select & set read mode +0011ed 9711 sbiw x,1 +0011ee f759 loopne i2c_dwb_loop +0011ef e104 ldi a,0x14 ;last successful command was read +0011f0 c00b else i2c_dwb_ack +0011f1 70c4 andi yl,0b100 ;keep speed, clear ack & the rest +0011f2 60c1 sbr yl,0b1 ;set stop +0011f3 93c0 00c6 sts i2c_statreg,yl +0011f5 d0bc rcall i2c_stop + .if (io_sel_direct > 0) +0011f6 ba2b out abushi,e ;close i2c interface + .endif +0011f7 bad2 out cbus,readmem +0011f8 2d05 mov a,allon ;mark dma failed unless... +0011f9 9711 sbiw x,1 +0011fa f409 ifeq i2c_dwb_end_nak ;...it is at the end of the block +0011fb e104 ldi a,0x14 + end i2c_dwb_end_nak + end i2c_dwb_ack +0011fc 9300 00ca sts dma_last_cmd,a +0011fe 93e0 00cd sts dma_tab+1,zl ;save next memory address +001200 93f0 00ce sts dma_tab+2,zh +001202 b709 in a,timsk ;undo block single step +001203 6001 sbr a,1< 2) + .set loop_cycles = (cycles / 3) + ldi b,loop_cycles + brts i2c_400kHz + ldi b,loop_cycles + @0 ;add 3* delay (100 kHz)) + i2c_400kHz: + dec b + brne pc-1 + .set cycles = (cycles - (loop_cycles * 3)) + .else + .set loop_cycles = @0 + brts i2c_400kHz + ldi b,loop_cycles ;add 3* delay (100 kHz) + dec b + brne pc-1 + nop ;compensate branch not taken + i2c_400kHz: + .endif + .if (cycles > 0) + .if (cycles & 4) + rjmp pc+1 + rjmp pc+1 + .endif + .if (cycles & 2) + rjmp pc+1 + .endif + .if (cycles & 1) + nop + .endif + .endif + .endmacro + ; + ; i2c macros - single master + ; allow clock stretching but no collision detection + ; + .macro sda1 ;set sda high, single master + cbi i2c_ddr,i2c_sda + .endmacro + .macro scl1 ;set scl high, wait scl high + cbi i2c_ddr,i2c_scl + sbis i2c_in,i2c_scl ;subtract 2 clocks + rjmp pc-1 ;in next wait_ns + .endmacro + .macro sda0 ;set sda low + sbi i2c_ddr,i2c_sda + .endmacro + .macro scl0 ;set scl low + sbi i2c_ddr,i2c_scl + .endmacro + + ; + ; i2c interface reset & check for stuck bus + ; + i2c_reset: +001207 debb rcall i2c_open + i2c_reset_rs: +001208 9aa3 sbi i2c_ddr,i2c_res ;optional hw reset +001209 e31e +00120a f00e +00120b ef1c +00120c 951a +00120d f7f1 +00120e c000 wait_i2c 190,0 ;allow reset to disengage slaves +00120f 27ee clr zl ;clear all +001210 9998 sbic i2c_in,i2c_scl ;SCL stuck low? +001211 c002 ifs i2c_stuck ;set interface not usable status +001212 62e1 sbr zl,0b100001 ;set stop & stuck +001213 c009 else i2c_stuck ;reset for devices without hw-reset +001214 94e8 clt ;set low speed +001215 ef0f ldi i2c_data,0xff ;9 clocks with nak +001216 d023 rcall i2c_write +001217 9999 sbic i2c_in,i2c_sda ;SDA stuck low? +001218 c002 ifs i2c_sda_stuck +001219 62e1 sbr zl,0b100001 ;set stop & stuck +00121a c001 else i2c_sda_stuck +00121b 60e1 sbr zl,0b1 ;set stop + end i2c_sda_stuck +00121c d095 rcall i2c_stop + end i2c_stuck +00121d 98a3 cbi i2c_ddr,i2c_res ;end optional hw reset + .if (io_sel_direct > 0) +00121e ba2b out abushi,e ;close i2c interface + .endif +00121f bad2 out cbus,readmem ;clear IO select & set read mode +001220 9508 ret + + ; + ; i2c start with address + ; + ; start -> slave, i2c_data -> slave address + ; slave ack -> SREG.C + ; +001221 9999 i2c_start: sbic i2c_in,i2c_sda ;clock previous ack +001222 c010 ifs start_prev_ack +001223 9aa0 scl0 +001224 e015 +001225 f00e +001226 e119 +001227 951a +001228 f7f1 +001229 0000 wait_i2c i2c_clk,2 ;scl1 +00122a 98a0 +00122b 9b98 +00122c cffe scl1 +00122d e011 +00122e f00e +00122f e01b +001230 951a +001231 f7f1 +001232 0000 wait_i2c i2c_clk/2,4 ;scl1-sda0 + end start_prev_ack +001233 9aa1 sda0 +001234 e011 +001235 f00e +001236 e01b +001237 951a +001238 f7f1 +001239 0000 wait_i2c i2c_clk/2,4 ;sec-rol-scl0 + ; + ; i2c write: i2c_data -> slave data, slave ack -> SREG,C + ; +00123a 9408 i2c_write: sec ;mark incomplete +00123b 1f00 rol i2c_data +00123c 9aa0 i_wrtloop: scl0 +00123d e011 +00123e f00e +00123f e01b +001240 951a +001241 f7f1 +001242 0000 wait_i2c i2c_clk/2,4 ;brcc-(nop)-sdax +001243 f418 brcc i_wrt0 ;data bit = 0 +001244 0000 nop ;sda set after 4 clocks +001245 98a1 sda1 +001246 c002 rjmp i_wrt1 +001247 9aa1 i_wrt0: sda0 +001248 c000 rjmp i_wrt1 ;nop 2 clocks +001249 e011 +00124a f00e +00124b e01b +00124c 951a +00124d f7f1 +00124e 0000 i_wrt1: wait_i2c i2c_clk/2,4 ;rjmp-scl1 +00124f 98a0 +001250 9b98 +001251 cffe scl1 +001252 e013 +001253 f00e +001254 e117 +001255 951a +001256 f7f1 +001257 c000 wait_i2c i2c_clk,7 ;scl1-lsl-brne-(nop)-scl0 +001258 0f00 lsl i2c_data +001259 f711 brne i_wrtloop +00125a 0000 nop + +00125b 9aa0 i2c_getack: scl0 +00125c e012 +00125d f00e +00125e e01c +00125f 951a +001260 f7f1 wait_i2c i2c_clk/2,2 ;sda1 +001261 98a1 sda1 ;release sda after write +001262 e012 +001263 f00e +001264 e01c +001265 951a +001266 f7f1 wait_i2c i2c_clk/2,2 ;scl1 +001267 98a0 +001268 9b98 +001269 cffe scl1 +00126a e011 +00126b f00e +00126c e01b +00126d 951a +00126e f7f1 +00126f c000 wait_i2c i2c_clk/2,3 ;scl1-clc +001270 9488 clc +001271 9999 sbic i2c_in,i2c_sda +001272 9408 sec +001273 9508 ret + ; + ; i2c read: slave data -> i2c_data, + ; +001274 e001 i2c_read: ldi i2c_data,1 ;precharge register full marker +001275 f026 +001276 e01a +001277 951a +001278 f7f1 +001279 0000 +00127a 0000 i_rdloop: wait_i2c i2c_clk/2,7 ;sbic-(sec)-rol-brcc-scl0 +00127b 9aa0 scl0 +00127c e012 +00127d f00e +00127e e01c +00127f 951a +001280 f7f1 wait_i2c i2c_clk/2,2 ;sda1 +001281 98a1 sda1 ;clear sda out from prev. putack +001282 e012 +001283 f00e +001284 e01c +001285 951a +001286 f7f1 wait_i2c i2c_clk/2,2 ;scl1 +001287 98a0 +001288 9b98 +001289 cffe scl1 +00128a e011 +00128b f00e +00128c e01b +00128d 951a +00128e f7f1 +00128f c000 wait_i2c i2c_clk/2,3 ;scl1-clc +001290 9488 clc +001291 9999 sbic i2c_in,i2c_sda +001292 9408 sec +001293 1f00 rol i2c_data +001294 f700 brcc i_rdloop ;precharged bit hasn't arrived +001295 9508 ret + ; + ; i2c putack: SREG,C -> slave ack + ; +001296 9aa0 i2c_putack: scl0 +001297 e011 +001298 f00e +001299 e01b +00129a 951a +00129b f7f1 +00129c 0000 wait_i2c i2c_clk/2,4 ;brcc-(nop)-sdax +00129d f418 brcc i_pack1 +00129e 0000 nop ;compensate brcc +00129f 98a1 sda1 +0012a0 c002 rjmp i_pack2 +0012a1 9aa1 i_pack1: sda0 +0012a2 c000 rjmp i_pack2 ;nop 2 clocks +0012a3 e011 +0012a4 f00e +0012a5 e01b +0012a6 951a +0012a7 f7f1 +0012a8 0000 i_pack2: wait_i2c i2c_clk/2,4 ;rjmp-scl1 +0012a9 98a0 +0012aa 9b98 +0012ab cffe scl1 +0012ac e011 +0012ad f00e +0012ae e01b +0012af 951a +0012b0 f7f1 wait_i2c i2c_clk/2,5 ;scl1-ret-rcall-ldi+wait(-7)-scl0 +0012b1 9508 ret + ; + ; i2c stop + ; +0012b2 f026 +0012b3 e01a +0012b4 951a +0012b5 f7f1 +0012b6 0000 +0012b7 c000 i2c_stop: wait_i2c i2c_clk/2,6 ;scl1+wait(-5)-ret-rcall-scl0 +0012b8 9aa0 scl0 +0012b9 e012 +0012ba f00e +0012bb e01c +0012bc 951a +0012bd f7f1 wait_i2c i2c_clk/2,2 ;sda0 +0012be 9aa1 sda0 +0012bf e012 +0012c0 f00e +0012c1 e01c +0012c2 951a +0012c3 f7f1 wait_i2c i2c_clk/2,2 ;scl1 +0012c4 98a0 +0012c5 9b98 +0012c6 cffe scl1 +0012c7 e011 +0012c8 f00e +0012c9 e01b +0012ca 951a +0012cb f7f1 +0012cc 0000 wait_i2c i2c_clk/2,4 ;scl1-sda1 +0012cd 98a1 sda1 +0012ce 9508 ret + .else + .endif + + .ifdef eep_vld + ;***************************************************** + ; + ; external SPI/I2C EEPROM as non volatile program storage + ; + ;***************************************************** + ; + ; EEP open - check spi/i2c bus & EEPROM presence + eep_open: + .ifdef spi_eep_adr +0012cf b86e out spsr,one ;speed 8MHz, mode 0, enabled +0012d0 e500 ldi a,0x50 +0012d1 b90d out spcr,a +0012d2 e107 ldi a,spi_eep_adr +0012d3 bb08 out spi_out,a +0012d4 bac2 +0012d5 e811 +0012d6 bb1b +0012d7 9a96 set_io_select spi_sel +0012d8 9ade ena_io_select +0012d9 2e21 mov e,b ;deselcted IO (abushi) +0012da e005 ldi a,5 ;command: read status register +0012db b90f +0012dc 9b77 +0012dd cffe out_spi a +0012de b85f +0012df 9b77 +0012e0 cffe +0012e1 b10f in_spi a +0012e2 b238 in f,spi_out ;selected slave (abuslo a.k.a. spi_out) +0012e3 e11f ldi b,spi_idle ;stop slave select +0012e4 bb18 out spi_out,b +0012e5 3f0f cpi a,0xff ;MISO open? +0012e6 f019 breq eep_no_device + .else + .endif + .if (io_sel_direct > 0) +0012e7 b21b in d,abushi ;selected IO exp. (abushi) + .endif +0012e8 b202 in c,cbus ;selected IO (cbus) +0012e9 9508 ret + eep_no_device: +0012ea e8ee +0012eb e2f9 +0012ec d696 PrintStr err_no_eep ;" SPI/I2C EEPROM not found" +0012ed 940c 1c25 jmp skip_main + ; + ; EEPROM write 1 Byte, select new slot if necessary + ; + eep_write: +0012ef 23cc tst yl ;need new slot? +0012f0 f4b1 ifeq eep_new_slot +0012f1 91c0 009f lds yl,prog_num + do eep_find_slot + do eep_write_wait ;previous write complete? +0012f3 99e1 sbic eecr,eewe +0012f4 cffe loop eep_write_wait +0012f5 bbde out eearl,yh ;read slot to find prog# +0012f6 ba6c out eecr,one +0012f7 b31d in b,eedr +0012f8 171c cp b,yl ;overwrite same +0012f9 f061 exiteq eep_find_slot +0012fa 9513 inc b ;new free slot +0012fb f439 ifeq eep_slot_allocate +0012fc bbcd out eedr,yl ;write prog# +0012fd b71f in b,sreg ;atomic write sequence +0012fe 94f8 cli +0012ff 9ae2 sbi eecr,eemwe +001300 9ae1 sbi eecr,eewe +001301 bf1f out sreg,b +001302 c003 exit eep_find_slot + end eep_slot_allocate +001303 95d3 inc yh ;all slots done? +001304 f191 breq eep_full +001305 cfed loop eep_find_slot +001306 e0c0 ldi yl,0 + end eep_new_slot +001307 30c0 cpi yl,0 ;new slot? +001308 f011 ifeq_or eep_write_open +001309 38c0 cpi yl,128 ;new page_write? +00130a f501 ifeq eep_write_open +00130b 930f push a + ;open next eeprom page for write + .ifdef spi_eep_adr +00130c e11f ldi b,spi_idle + do eep_write_ready +00130d ba38 out spi_out,f ;set slave select +00130e e005 ldi a,5 ;command: read status +00130f b90f +001310 9b77 +001311 cffe out_spi a +001312 b85f +001313 9b77 +001314 cffe +001315 b10f in_spi a ;get status +001316 bb18 out spi_out,b ;end slave select +001317 7001 andi a,1 ;write in progress +001318 f7a1 loopne eep_write_ready +001319 ba38 out spi_out,f ;set slave select +00131a e006 ldi a,6 ;command: write enable +00131b b90f +00131c 9b77 +00131d cffe out_spi a +00131e bb18 out spi_out,b ;end slave select +00131f ba38 out spi_out,f ;set slave select +001320 e002 ldi a,2 ;command: write +001321 b90f +001322 9b77 +001323 cffe out_spi a +001324 b9df +001325 9b77 +001326 cffe out_spi yh ;send write address +001327 b9cf +001328 9b77 +001329 cffe out_spi yl + .else + .endif +00132a 910f pop a + end eep_write_open + ;write data + .ifdef spi_eep_adr +00132b b90f +00132c 9b77 +00132d cffe out_spi a + .else + .endif +00132e 37cf cpi yl,127 ;EEP write buffer filled? +00132f f011 ifeq_or eep_write_buf +001330 3fcf cpi yl,255 ;EEP write buffer filled? +001331 f411 ifeq eep_write_buf + ;end of page - internal eep write + .ifdef spi_eep_adr +001332 e10f ldi a,spi_idle ;stop slave select +001333 bb08 out spi_out,a + .else + .endif + end eep_write_buf +001334 9621 adiw y,1 +001335 f009 breq eep_full +001336 9508 ret + + eep_full: ;no more slots +001337 e8e0 +001338 e2f9 +001339 d649 PrintStr err_eep_full ;" EEPROM full" + ; + ; EEP error during save + ; + eep_write_err: ;close after errors + .ifdef spi_eep_adr +00133a e10f ldi a,spi_idle ;stop slave select +00133b bb08 out spi_out,a + .else + .endif +00133c e0d0 ldi yh,0 ;free all slots for this prog# +00133d d01d rcall eep_int_close +00133e 940c 1bdd jmp discard_serial_stream ;skip remaining input, end of command + ; + ; EEP write close + ; + eep_write_close: + .ifdef spi_eep_adr +001340 e10f ldi a,spi_idle ;close spi interface +001341 bb08 out spi_out,a + .else + .endif +001342 23cc tst yl ;slot already incremented? +001343 f009 ifne eep_close_nxt_slot +001344 95d3 inc yh + end eep_close_nxt_slot +001345 23dd tst yh ;was last slot? +001346 f009 ifne eep_close_last_slot +001347 d013 rcall eep_int_close + end eep_close_last_slot +001348 fd32 sbrc flags,deb_act ;outside debugger +001349 940c 1bdd jmp discard_serial_stream ;skip remaining input, end of command + + ;general close SPI/I2C EEPROM + eep_close: + ;disconnect SPI/I2C, connect RAM + .ifdef spi_eep_adr +00134b ba74 out dbusddr,zero ;dbus = output + .endif + .if (io_sel_direct > 0) +00134c ba2b out abushi,e + .endif +00134d bad2 out cbus,readmem ;clear IO select & set read mode +00134e ba7e out eearl,zero ;set to unused address +00134f ba7f out eearh,zero +001350 9250 009f sts prog_num,allon ;load/save ended + ;restore SPI parameters from last spi_cmd + .ifdef spi_eep_adr +001352 9110 00c8 lds b,spi_cmd +001354 b87e out spsr,zero +001355 fd14 sbrc b,4 ;test SPI2X +001356 b86e out spsr,one ;SPI2X is set +001357 6110 sbr b,(1< 0) +001399 ba2b out abushi,e ;disable IO select + .endif +00139a bac2 out cbus,clear ;disable IO select + .ifdef spi_eep_adr +00139b 986e cbi spcr,spe + .else + .endif +00139c bbe8 out abuslo,zl +00139d bbfb out abushi,zh +00139e bae2 out cbus,writemem ;WE, ~OE +00139f bb05 out dbusout,a ;dbus write +0013a0 9631 adiw z,1 +0013a1 bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz + ;connect SPI/I2C + .if (io_sel_direct > 0) +0013a2 ba1b out abushi,d ;prepare IO select + .endif + .ifdef spi_eep_adr +0013a3 ba38 out spi_out,f ;set slave select +0013a4 9a6e sbi spcr,spe + .else + .endif +0013a5 ba02 out cbus,c ;activate IO select +0013a6 95aa dec xl ;record counter expired +0013a7 f781 loopne eep_load_byte +0013a8 d010 rcall eep_read ;read count +0013a9 2fa0 mov xl,a +0013aa 23aa tst xl +0013ab f739 loopne eep_load_loop +0013ac d00c rcall eep_read ;read PCH +0013ad 2300 tst a ;is valid? +0013ae f019 ifne eep_load_pc +0013af 2f90 mov pch,a ;set PC +0013b0 d008 rcall eep_read +0013b1 2f80 mov pcl,a + end eep_load_pc +0013b2 e7e0 +0013b3 e2f9 +0013b4 d5ce PrintStr eep_loaded ;" loaded" + .ifdef spi_eep_adr +0013b5 e10f ldi a,spi_idle ;close spi slave +0013b6 bb08 out spi_out,a + .else + .endif +0013b7 e000 ldi a,0 ;post returncode OK +0013b8 cf92 rjmp eep_close + + ; EEPROM read 1 Byte, select new slot if necessary + eep_read: +0013b9 23cc tst yl ;need to open next slot? +0013ba f4c9 ifeq eep_next_slot +0013bb 23dd tst yh ;1st slot? +0013bc f011 ifne eep_read_first + .ifdef spi_eep_adr +0013bd e10f ldi a,spi_idle ;close spi slave +0013be bb08 out spi_out,a + .else + .endif + end eep_read_first +0013bf 9100 009f lds a,prog_num + do eep_find_prog +0013c1 bbde out eearl,yh ;read slot to find prog# +0013c2 ba6c out eecr,one +0013c3 b31d in b,eedr +0013c4 1710 cp b,a ;match? +0013c5 f019 exiteq eep_find_prog +0013c6 95d3 inc yh ;all slots done? +0013c7 f091 breq eep_read_overrun +0013c8 cff8 loop eep_find_prog + .ifdef spi_eep_adr +0013c9 ba38 out spi_out,f ;set slave select +0013ca e003 ldi a,3 ;command: read eep +0013cb b90f +0013cc 9b77 +0013cd cffe out_spi a +0013ce b9df +0013cf 9b77 +0013d0 cffe out_spi yh +0013d1 b9cf +0013d2 9b77 +0013d3 cffe out_spi yl + .else + .endif + .ifndef spi_eep_adr + .endif + end eep_next_slot + ;read data byte + .ifdef spi_eep_adr +0013d4 b85f +0013d5 9b77 +0013d6 cffe +0013d7 b10f in_spi a + .else + .endif +0013d8 9621 adiw y,1 ;next +0013d9 9508 ret + ; overran the last slot, no ending count 0x00 + eep_read_overrun: +0013da eae6 +0013db e2f9 +0013dc d5a6 PrintStr err_corrupt ;" corrupted" +0013dd 910f pop a ;remove return address +0013de 910f pop a +0013df e001 ldi a,1 ;post returncode fail +0013e0 fd32 sbrc flags,deb_act +0013e1 cf69 rjmp eep_close +0013e2 c0a9 rjmp eep_app_read_exit + + ;dma save program + dma_eep_save: +0013e3 9100 00ca lds a,dma_last_cmd +0013e5 9110 00cb lds b,dma_tab_index +0013e7 9250 00ca sts dma_last_cmd,allon ;mark invalid sequence of command +0013e9 3000 cpi a,0 ;previous set block address table? +0013ea f431 ifne_or eep_ds_inv +0013eb 3015 cpi b,5 ;block address table valid? +0013ec f421 ifne_or eep_ds_inv +0013ed 9100 00cc lds a,dma_tab ;program number valid? +0013ef 3f0f cpi a,0xff +0013f0 f409 ifeq eep_ds_inv +0013f1 ca76 rjmp iw_exit ;exit - invalid parameters + end eep_ds_inv +0013f2 9300 009f sts prog_num,a +0013f4 b71d in b,spl ;save sp - allows sub to exit +0013f5 9310 009a sts sp_save,b +0013f7 b71e in b,sph +0013f8 9310 009b sts sp_save+1,b +0013fa ded4 rcall eep_open +0013fb e6e4 +0013fc e2f9 +0013fd d585 PrintStr eep_prog ;10,13,"Program " +0013fe 9100 009f lds a,prog_num ;prog# +001400 d588 rcall PrintHex +001401 91e0 00cd lds zl,dma_tab+1 ;load memory address +001403 91f0 00ce lds zh,dma_tab+2 +001405 91a0 00cf lds xl,dma_tab+3 ;load block count +001407 91b0 00d0 lds xh,dma_tab+4 +001409 e0c0 ldi yl,0 ;initial slot allocation +00140a e0d0 ldi yh,0 +00140b ba6f out eearh,one +00140c e000 ldi a,0 ;set app save marker +00140d dee1 rcall eep_write +00140e 2f0a mov a,xl ;calculate count from end address +00140f 1b0e sub a,zl +001410 dede rcall eep_write +001411 2f0b mov a,xh +001412 0b0f sbc a,zh +001413 dedb rcall eep_write + do eep_app_save_data +001414 17ae cp xl,zl +001415 f411 ifeq eep_app_save_adr +001416 17bf cp xh,zh +001417 f081 exiteq eep_app_save_data + end eep_app_save_adr + ;disconnect SPI/I2C, connect RAM + .if (io_sel_direct > 0) +001418 ba2b out abushi,e ;disable IO sel. exp. + .endif +001419 bad2 out cbus,readmem ;disable IO select + .ifdef spi_eep_adr +00141a 986e cbi spcr,spe ;disable SPI + .endif +00141b bbe8 out abuslo,zl ;read from RAM +00141c bbfb out abushi,zh +00141d 9631 adiw z,1 ;next address +00141e c000 wait_data_valid 1 +00141f b303 in a,dbusin + ;connect SPI/I2C +001420 bac2 out cbus,clear + .if (io_sel_direct > 0) +001421 ba1b out abushi,d ;prepare IO select + .endif + .ifdef spi_eep_adr +001422 ba38 out spi_out,f ;select slave +001423 9a6e sbi spcr,spe ;enable SPI + .else + .endif +001424 ba02 out cbus,c ;set IO select +001425 9ade ena_io_select +001426 dec8 rcall eep_write ;store in EEPROM +001427 cfec loop eep_app_save_data + .ifndef spi_eep_adr + .endif +001428 df17 rcall eep_write_close +001429 e7e8 +00142a e2f9 +00142b d557 PrintStr eep_saved ;" saved" +00142c d552 rcall crlf +00142d e106 ldi a,0x16 ;last successful command was read +00142e 9300 00ca sts dma_last_cmd,a +001430 ca37 rjmp iw_exit + + ;dma load program + dma_eep_load: +001431 9100 00ca lds a,dma_last_cmd +001433 9110 00cb lds b,dma_tab_index +001435 9250 00ca sts dma_last_cmd,allon ;mark invalid sequence of command +001437 3000 cpi a,0 ;previous set block address table? +001438 f431 ifne_or eep_dl_inv +001439 3013 cpi b,3 ;block address table valid? +00143a f421 ifne_or eep_dl_inv +00143b 9100 00cc lds a,dma_tab ;program number valid? +00143d 3f0f cpi a,0xff +00143e f409 ifeq eep_dl_inv +00143f ca28 rjmp iw_exit ;exit - invalid parameters + end eep_dl_inv +001440 9300 009f sts prog_num,a +001442 e6e4 +001443 e2f9 +001444 d53e PrintStr eep_prog ;10,13,"Program " +001445 9100 009f lds a,prog_num ;prog# +001447 d541 rcall PrintHex +001448 2400 clr c ;check prog exists +001449 ba6f out eearh,one +00144a 9100 009f lds a,prog_num + do eep_app_scan_loop +00144c ba0e out eearl,c ;read slot pointer +00144d ba6c out eecr,one +00144e b21d in d,eedr +00144f 1610 cp d,a ;prog# match? +001450 f039 exiteq eep_app_scan_loop +001451 9403 inc c ;all slots done? +001452 f421 ifeq eep_app_load_bad_prog +001453 e5e8 +001454 e2f9 +001455 d52d PrintStr eep_notfound ;" not found" +001456 c035 rjmp eep_app_read_exit + end eep_app_load_bad_prog +001457 cff4 loop eep_app_scan_loop +001458 de76 rcall eep_open +001459 e0c0 ldi yl,0 ;start reading from 1st slot +00145a e0d0 ldi yh,0 +00145b df5d rcall eep_read +00145c 2300 tst a +00145d f021 ifne eep_app_file_incompat +00145e eee6 +00145f e2f9 +001460 d522 PrintStr bad_format ;" incompatible format" +001461 c028 rjmp eep_app_read_exit2 + end eep_app_file_incompat +001462 91e0 00cd lds zl,dma_tab+1 ;load memory address +001464 91f0 00ce lds zh,dma_tab+2 +001466 df52 rcall eep_read ;read count - set end address +001467 2fa0 mov xl,a +001468 df50 rcall eep_read +001469 2fb0 mov xh,a +00146a 0fae add xl,zl +00146b 93a0 00cf sts dma_tab+3,xl +00146d 1fbf adc xh,zh +00146e 93b0 00d0 sts dma_tab+4,xh + .ifdef spi_eep_adr +001470 ba54 out dbusddr,allon + .endif + do eep_app_load_loop +001471 17ae cp xl,zl +001472 f411 ifeq eep_app_load_adr +001473 17bf cp xh,zh +001474 f079 exiteq eep_app_load_loop + end eep_app_load_adr +001475 df43 rcall eep_read + ;disconnect SPI/I2C, connect RAM + .if (io_sel_direct > 0) +001476 ba2b out abushi,e ;disable IO select + .endif +001477 bac2 out cbus,clear ;disable IO select + .ifdef spi_eep_adr +001478 986e cbi spcr,spe ;disable SPI + .else + .endif +001479 bbe8 out abuslo,zl ;set write address +00147a bbfb out abushi,zh +00147b bae2 out cbus,writemem ;WE, ~OE +00147c bb05 out dbusout,a ;dbus write +00147d 9631 adiw z,1 ;next address +00147e bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz + ;connect SPI/I2C + .if (io_sel_direct > 0) +00147f ba1b out abushi,d ;prepare IO select + .endif + .ifdef spi_eep_adr +001480 ba38 out spi_out,f ;set slave select = EEP +001481 9a6e sbi spcr,spe ;enable SPI + .else + .endif +001482 ba02 out cbus,c ;set IO select +001483 cfed loop eep_app_load_loop +001484 e7e0 +001485 e2f9 +001486 d4fc PrintStr eep_loaded ;" loaded" +001487 e107 ldi a,0x17 ;last successful command was read +001488 9300 00ca sts dma_last_cmd,a + .ifndef spi_eep_adr + .endif + eep_app_read_exit2: + .ifdef spi_eep_adr +00148a e10f ldi a,spi_idle ;close spi slave +00148b bb08 out spi_out,a + .else + .endif + eep_app_read_exit: +00148c d4f2 rcall crlf +00148d debd rcall eep_close +00148e c9d9 rjmp iw_exit + +00148f 0a0d +001490 4545 +001491 5250 +001492 4d4f +001493 6120 +001494 7475 +001495 6c6f +001496 616f +001497 2064 +001498 0000 eep_info1: .db 13,10,"EEPROM autoload ",0,0 +001499 2d20 +00149a 0020 eep_info2: .db " - ",0 +00149b 7320 +00149c 6f6c +00149d 7374 +00149e 6620 +00149f 6572 +0014a0 0065 eep_info3: .db " slots free",0 +0014a1 0a0d +0014a2 7270 +0014a3 676f +0014a4 2f23 +0014a5 6c73 +0014a6 746f +0014a7 2073 +0014a8 0020 eep_info4: .db 13,10,"prog#/slots ",0 +0014a9 6f6e +0014aa 656e +0014ab 0000 eep_none: .db "none",0,0 +0014ac 6e20 +0014ad 746f +0014ae 6620 +0014af 756f +0014b0 646e +0014b1 0000 eep_notfound: .db " not found",0,0 +0014b2 0a0d +0014b3 7250 +0014b4 676f +0014b5 6172 +0014b6 206d +0014b7 0000 eep_prog: .db 13,10,"Program ",0,0 +0014b8 6c20 +0014b9 616f +0014ba 6564 +0014bb 0064 eep_loaded: .db " loaded",0 +0014bc 7320 +0014bd 7661 +0014be 6465 +0014bf 0000 eep_saved: .db " saved",0,0 +0014c0 4520 +0014c1 5045 +0014c2 4f52 +0014c3 204d +0014c4 7566 +0014c5 6c6c +0014c6 0000 err_eep_full: .db " EEPROM full",0,0 + .ifdef spi_eep_adr +0014c7 0a0d +0014c8 5053 +0014c9 2049 +0014ca 4545 +0014cb 5250 +0014cc 4d4f +0014cd 6e20 +0014ce 746f +0014cf 6620 +0014d0 756f +0014d1 646e +0014d2 0000 err_no_eep: .db 13,10,"SPI EEPROM not found",0,0 + .else + .endif +0014d3 6320 +0014d4 726f +0014d5 7572 +0014d6 7470 +0014d7 6465 +0014d8 0000 err_corrupt: .db " corrupted",0,0 +0014d9 0a0d +0014da 6153 +0014db 6976 +0014dc 676e +0014dd 202c +0014de 453c +0014df 4353 +0014e0 203e +0014e1 6f74 +0014e2 6120 +0014e3 6f62 +0014e4 7472 +0014e5 0a0d +0014e6 0000 save_wait: .db 13,10,"Saving, to abort",13,10,0,0 +0014e7 530d +0014e8 7661 +0014e9 2065 +0014ea 4b4f +0014eb 0000 save_ok: .db 13,"Save OK",0,0 +0014ec 5320 +0014ed 7661 +0014ee 2065 +0014ef 6261 +0014f0 726f +0014f1 6574 +0014f2 0064 save_abort: .db " Save aborted",0 +0014f3 6920 +0014f4 636e +0014f5 6d6f +0014f6 6170 +0014f7 6974 +0014f8 6c62 +0014f9 2065 +0014fa 6f66 +0014fb 6d72 +0014fc 7461 +0014fd 0000 bad_format: .db " incompatible format",0,0 + + .else + .endif + + .endif + + ;************************************************** + ; + ; Monitor / Debugger Interrupts + ; + ;************************************************** + + ; + ; an illegal interrupt has occured + ; + illegalint: +0014fe e2ec +0014ff e0f2 +001500 d482 PrintStr illegal_int + do i_stop +001501 cfff loop i_stop ; reset required + + ; + ; Timer 0 compare match A - 10ms CTC interrupt + ; + t0_cmi: +001502 b6ff in s,sreg +001503 9120 0092 lds i,cmd_esc_timer ;service esc sequence timer +001505 2e42 mov k,i +001506 772f andi i,0x7f +001507 f019 ifne t0_esc_expired +001508 944a dec k +001509 9240 0092 sts cmd_esc_timer,k + end t0_esc_expired +00150b 9120 0093 lds i,cmd_reg_timer ;service register refresh timer +00150d 2322 tst i +00150e f019 ifne t0_reg_expired +00150f 952a dec i +001510 9320 0093 sts cmd_reg_timer,i + end t0_reg_expired + +001512 9120 00bf lds i,irq_flag ;check 10 ms timer +001514 6021 sbr i,1 ;set tick flag +001515 9040 00c3 lds k,tcdn_count ;update tcdn count +001517 944a dec k ;expired? +001518 f419 ifeq t0_tcdn_expired +001519 9040 00c4 lds k,tcdn_top ;reset tcdn count +00151b 6022 sbr i,2 ;set tcdn flag + end t0_tcdn_expired +00151c 9240 00c3 sts tcdn_count,k ;save count +00151e 9320 00bf sts irq_flag,i ;save flags +001520 9040 00be lds k,irq_mask ;tick or tcdn IRQ enabled? +001522 2124 and i,k +001523 f009 ifne t0_tcdn_irq +001524 9a8b sbi cbusddr,3 ;set IRQ + end t0_tcdn_irq + +001525 fd32 sbrc flags,deb_act ;no debugger instance active +001526 c01b ifs_and debug_start +001527 ff30 sbrs flags,deb_on ;debug mode +001528 c019 ifs debug_start + .if defined(spi_sel) || defined(i2c_sel) +001529 ff37 sbrs flags,dma_rpt ;interupt during dma transfer? +00152a c00f ifs t0_dma +00152b 773f cbr flags,(1< based on timer +00163a 91c0 0092 lds yl,cmd_esc_timer ;test escape timer expired +00163c 23cc tst yl +00163d f451 ifeq deb_true_esc +00163e e8c0 ldi yl,0x80 ;flag line cleared +00163f 93c0 0092 sts cmd_esc_timer,yl +001641 7b3f cbr flags,(1< +0016b3 3202 cpi a,34 ;test for string input +0016b4 f411 ifeq deb_string_mark +0016b5 e410 ldi b,(1< +0016b7 310b cpi a,27 ;test for escape +0016b8 f431 ifeq deb_esc +0016b9 f017 ifid deb_esc_disabled +0016ba e0d2 ldi yh,0b10 ;reset t0 compare match +0016bb bfd8 out tifr,yh ;if disabled + end deb_esc_disabled +0016bc e0d6 ldi yh,6 ;further chars within 50-60ms +0016bd 93d0 0092 sts cmd_esc_timer,yh ;discarded as esc sequence + end deb_esc + ; +0016bf 3009 cpi a,9 ;test for tab (step 1 instruction) +0016c0 f479 ifeq_and deb_step +0016c1 fd31 sbrc flags,emu_run ;must be stopped +0016c2 c00d ifs deb_step +0016c3 d331 rcall show_regs ;show command to be executed +0016c4 01ec movw y,pch:pcl +0016c5 d36f rcall disasm + .ifndef cmos_core +0016c6 3017 cpi b,7 ;invalid opcode? +0016c7 f409 ifeq deb_step_inv +0016c8 c27c rjmp end_command + end deb_step_inv + .endif +0016c9 94f8 cli ;force t0 overflow at end of instruction +0016ca be52 out tcnt0,allon ;overflow next count +0016cb e009 ldi a,0b00001001 ;timer 0 ctc, clock / 1 +0016cc bf03 out tccr0,a +0016cd e00d ldi a,0b00001101 ;timer 0 ctc, clock / 1024 +0016ce bf03 out tccr0,a +0016cf c240 rjmp emu_start ;executes also breakpointed opcodes + end deb_step + ; +0016d0 300d cpi a,13 ;test for carriage return +0016d1 f009 +0016d2 c279 ifeq_far deb_cr +0016d3 36c0 cpi yl,low(cmd_buf) ;test empty commandline +0016d4 f459 ifeq deb_empty +0016d5 8108 ld a,y ;test for previous M or D +0016d6 340d cpi a,'M' +0016d7 f011 ifeq_or deb_shortcut +0016d8 3404 cpi a,'D' +0016d9 f431 ifeq deb_shortcut +0016da e4e4 +0016db e0f2 +0016dc d2a6 PrintStr back_line ;seamless output +0016dd 9621 adiw y,1 ;keep M or D +0016de e20b ldi a,'+' +0016df 9309 st y+,a + end deb_shortcut + end deb_empty +0016e0 8278 st y,zero ;mark end of commandline +0016e1 7b3f cbr flags,(1<|APwwww + ; r = register A X Y P S F + ; accu indexX indexY PC SP flags(proc.status) + ; bb = hex byte of data + ; wwww = hex word of data, leading zeroes can be omitted + ; +0016ec 3401 cpi a,'A' +0016ed f531 ifeq alter_reg +0016ee 9109 ld a,y+ ;get register + ;alter accumulator +0016ef 3401 cpi a,'A' ;accumulator +0016f0 f419 ifeq alter_rega +0016f1 d3d0 rcall get_byte +0016f2 2f50 mov rega,a +0016f3 c251 rjmp end_command + end alter_rega + ;alter X index register +0016f4 3508 cpi a,'X' ;index register X +0016f5 f419 ifeq alter_regx +0016f6 d3cb rcall get_byte +0016f7 2e80 mov regx,a +0016f8 c24c rjmp end_command + end alter_regx + ;alter Y index register +0016f9 3509 cpi a,'Y' ;index register Y +0016fa f419 ifeq alter_regy +0016fb d3c6 rcall get_byte +0016fc 2e90 mov regy,a +0016fd c247 rjmp end_command + end alter_regy + ;alter stack pointer +0016fe 3503 cpi a,'S' ;stack pointer +0016ff f419 ifeq alter_spointer +001700 d3c1 rcall get_byte +001701 2eb0 mov spointer,a +001702 c242 rjmp end_command + end alter_spointer + ;alter flags (prcocessor status) +001703 3406 cpi a,'F' ;flags = processor status +001704 f449 ifeq alter_status +001705 d3bc rcall get_byte +001706 2f60 mov stat2,a +001707 2f76 mov stat,stat2 ;restore AVR format +001708 7073 andi stat,0b11 ;------ZC +001709 fb67 bst stat2,7 ;>----> +00170a f972 bld stat,2 ;-----N-- +00170b 6260 ori stat2,0b0100000 ; 1 (always 1) +00170c 766c andi stat2,0b1101100 ;-V1BDI-- (Break cleared) +00170d c237 rjmp end_command + end alter_status + ;alter program counter +00170e 3500 cpi a,'P' ;program counter +00170f f419 ifeq alter_pc +001710 d3d2 rcall get_adr +001711 01cf movw pch:pcl,z +001712 c232 rjmp end_command + end alter_pc +001713 c21c rjmp invalid_command + end alter_reg + ; + ; B = breakpoint utility + ; BI = information - list active breakpoints by slot number + ; BSaaaa = set breakpoint at address aaaa, leading zeros can be omitted + ; BC# = clear breakpoint slot #, #=0-9, #=A for all + ; +001714 3402 cpi a,'B' +001715 f009 +001716 c056 ifeq_far br_util +001717 9109 ld a,y+ +001718 3409 cpi a,'I' +001719 f429 ifeq br_info +00171a 9109 ld a,y+ ;check validity (no parms) +00171b 1107 cpse a,zero +00171c c213 rjmp invalid_command +00171d d3ef rcall brkpt_info +00171e c226 rjmp end_command + end br_info +00171f 3503 cpi a,'S' +001720 f569 ifeq br_set +001721 d3c1 rcall get_adr +001722 eac0 ldi yl,low(brkpt_lo) ;address already set? +001723 e0d0 ldi yh,high(brkpt_lo) + do br_set_already +001724 9109 ld a,y+ +001725 170e cp a,zl +001726 f429 ifeq_and br_already_set +001727 8509 ldd a,y+9 +001728 170f cp a,zh +001729 f411 ifeq br_already_set +00172a d3e2 rcall brkpt_info +00172b c219 rjmp end_command + end br_already_set +00172c 3aca cpi yl,low(brkpt_hi) +00172d f7b1 loopne br_set_already +00172e eac0 ldi yl,low(brkpt_lo) ;free slot? + do br_set_free +00172f 9109 ld a,y+ +001730 1505 cp a,allon +001731 f4a9 ifeq_and br_set_slot +001732 8509 ldd a,y+9 +001733 1505 cp a,allon +001734 f491 ifeq br_set_slot +001735 9721 sbiw y,1 +001736 83e8 st y,zl ;set new breakpoint address +001737 87fa std y+10,zh +001738 bbe8 out abuslo,zl ;fetch original opcode +001739 bbfb out abushi,zh +00173a c000 +00173b 0000 wait_data_valid 0 ;0ns minimum @ 16MHz +00173c b303 in a,dbusin +00173d 8b0c std y+20,a ;set original opcode +00173e ed0b ldi a,0xdb ;replace with STP opcode +00173f bae2 out cbus,writemem ;WE, ~OE +001740 bb05 out dbusout,a ;precharge write +001741 ba54 out dbusddr,allon ;dbus = output +001742 bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz +001743 ba74 out dbusddr,zero ;dbus = input +001744 bad2 out cbus,readmem ;OE / read mode back on +001745 d3c7 rcall brkpt_info +001746 c1fe rjmp end_command + end br_set_slot +001747 3aca cpi yl,low(brkpt_hi) +001748 f731 loopne br_set_free +001749 ebee +00174a e0f1 +00174b d237 PrintStr bpt_slot_full ;10,13,"No more breakpoint slots available" +00174c d3c0 rcall brkpt_info +00174d c1f7 rjmp end_command + end br_set +00174e 3403 cpi a,'C' +00174f f4e1 ifeq br_clr ;get slot# or all + do br_clr_parse +001750 9109 ld a,y+ +001751 2300 tst a ;premature end of input +001752 f0c9 breq br_inv_cmd +001753 3200 cpi a,32 ;skip blanks +001754 f3d9 loopeq br_clr_parse +001755 9009 ld c,y+ ;check validity (1 parameter) +001756 1007 cpse c,zero +001757 c1d8 rjmp invalid_command +001758 9721 sbiw y,1 +001759 3401 cpi a,'A' +00175a f439 ifeq br_clr_all +00175b d3d9 rcall brkpt_clr_all +00175c 2000 tst c +00175d f419 ifeq br_clr_none_msg +00175e e9e4 +00175f e3f9 +001760 d222 PrintStr bpt_info_none ;10,13,"No breakpoints active" + end br_clr_none_msg +001761 c1e3 rjmp end_command + end br_clr_all +001762 5300 subi a,'0' ;0-9? +001763 300a cpi a,10 +001764 f438 iflo br_clr_slot +001765 eac0 ldi yl,low(brkpt_lo) ;select breakpoint +001766 0fc0 add yl,a +001767 e0d0 ldi yh,high(brkpt_lo) +001768 1dd7 adc yh,zero +001769 d3d8 rcall brkpt_clr_one +00176a d3a2 rcall brkpt_info +00176b c1d9 rjmp end_command + end br_clr_slot + end br_clr +00176c c1c3 br_inv_cmd: rjmp invalid_command + end br_util + + + ; + ; D = disassemble memory Syntax: D(aaaa|+) + ; aaaa = address, leading zeros can be omitted + ; + = next, disassembles 20 instructions + ; +00176d 3404 cpi a,'D' +00176e f509 ifeq show_disasm +00176f 9109 ld a,y+ +001770 320b cpi a,'+' +001771 f441 ifeq dis_next +001772 9109 ld a,y+ ;no parameter after + +001773 1107 cpse a,zero +001774 c1bb rjmp invalid_command +001775 91c0 0098 lds yl,lmem_disas ;load previous address +001777 91d0 0099 lds yh,lmem_disas+1 +001779 c003 else dis_next +00177a 9721 sbiw y,1 ;allow immediate hex +00177b d367 rcall get_adr ;get Address +00177c 01ef movw y,z + end dis_next +00177d e00a ldi a,10 ;count +00177e fd31 sbrc flags,emu_run +00177f e006 ldi a,6 ;reduce count if running + do dis_loop +001780 930f push a +001781 d1fd rcall crlf +001782 2f0d mov a,yh ;show address +001783 d205 rcall PrintHex +001784 2f0c mov a,yl +001785 d203 rcall PrintHex +001786 d1f4 rcall space +001787 d2ad rcall disasm +001788 910f pop a +001789 950a dec a +00178a f7a9 loopne dis_loop +00178b 93c0 0098 sts lmem_disas,yl ;load previous address +00178d 93d0 0099 sts lmem_disas+1,yh +00178f c1b5 rjmp end_command + end show_disasm + .ifdef eep_vld + ; + ; E = I2C EEPROM non volatile program storage utility + ; EI = information on programs stored and free slots + ; ESpp = save program from RS232 input to EEPROM + ; ELpp = load program from EEPROM to RAM + ; EDpp = delete program in EEPROM + ; EApp"C\rLOAD $xx\rRUN\r" + ; = autoload program, send string on power on + ; either parameter may be omitted + ; FF = no autoload, "" (empty string) = send nothing + ; pp = program number 00 - FE + ; +001790 3405 cpi a,'E' +001791 f009 +001792 c0ab ifeq_far eep_util +001793 9109 ld a,y+ + ;EEPROM information +001794 3409 cpi a,'I' +001795 f431 ifeq eep_info +001796 9109 ld a,y+ ;check validity (no parms) +001797 1107 cpse a,zero +001798 c197 rjmp invalid_command +001799 d4d9 rcall eep_auto_info +00179a d49d rcall eep_cmd_info +00179b c1a9 rjmp end_command + end eep_info + ;EEPROM save +00179c 3503 cpi a,'S' +00179d f009 +00179e c041 ifeq_far eep_save +00179f d322 rcall get_byte ;get prog# +0017a0 3f0f cpi a,0xff +0017a1 f409 ifeq eep_save_inv_cmd +0017a2 c18d rjmp invalid_command + end eep_save_inv_cmd +0017a3 9300 009f sts prog_num,a +0017a5 db29 rcall eep_open +0017a6 e0c0 ldi yl,0 ;initial slot allocation +0017a7 e0d0 ldi yh,0 +0017a8 ba6f out eearh,one ;upper bytes in internal EEPROM +0017a9 ebe2 +0017aa e2f9 +0017ab d1d7 PrintStr save_wait ;13,10,"Saving, to abort",13,10 + do eep_save_record + do eep_wait_colon ;wait for start of record +0017ac d3e7 rcall read_serial_esc +0017ad 330a cpi a,':' +0017ae f7e9 loopne eep_wait_colon +0017af 27bb clr xh ;checksum +0017b0 d480 rcall read_byte_esc ;read & save count +0017b1 2fa0 mov xl,a +0017b2 db3c rcall eep_write +0017b3 e00d ldi a,13 +0017b4 d1dd rcall PrintChr +0017b5 d47b rcall read_byte_esc ;read address high +0017b6 23aa tst xl ;count 0? +0017b7 f0a9 ifne eep_save_adr ;show & save address for count >0 +0017b8 d022 rcall eep_prsv ;address high, read next +0017b9 d021 rcall eep_prsv ;address low, read function +0017ba 3000 cpi a,0 ;load function? +0017bb f461 ifeq eep_save_data + do eep_save_data_loop +0017bc d474 rcall read_byte_esc ;read & save data +0017bd db31 rcall eep_write +0017be 95aa dec xl +0017bf f7e1 loopne eep_save_data_loop +0017c0 d470 rcall read_byte_esc ;test checksum +0017c1 23bb tst xh +0017c2 f021 ifne eep_save_error_checksum +0017c3 e8e2 +0017c4 e3f9 +0017c5 d1bd PrintStr err_chksum ;" Checksum failed" +0017c6 cb73 rjmp eep_write_err + end eep_save_error_checksum +0017c7 c004 else eep_save_data +0017c8 e0e6 +0017c9 e0f2 +0017ca d1b8 PrintStr err_func ;" Invalid function or count in record" +0017cb cb6e rjmp eep_write_err + end eep_save_data +0017cc c00d else eep_save_adr ;show & save PC +0017cd d00d rcall eep_prsv ;PCH, read next +0017ce d00c rcall eep_prsv ;PCL, read function +0017cf 3001 cpi a,1 ;end of record function? +0017d0 f429 ifeq eep_save_complete +0017d1 ecee +0017d2 e2f9 +0017d3 d1af PrintStr save_ok ;13,"Save OK" +0017d4 cb6b rjmp eep_write_close +0017d5 c004 else eep_save_complete +0017d6 e0e6 +0017d7 e0f2 +0017d8 d1aa PrintStr err_func ;" Invalid function or count in record" +0017d9 cb60 rjmp eep_write_err + end eep_save_complete + end eep_save_adr +0017da cfd1 loop eep_save_record + eep_prsv: ; Output to RS232 & EEP +0017db 930f push a +0017dc d1ac rcall PrintHex ;show address +0017dd 910f pop a +0017de db10 rcall eep_write ;save address +0017df c451 rjmp read_byte_esc ;get next byte + end eep_save + ;EEPROM load +0017e0 340c cpi a,'L' +0017e1 f449 ifeq eep_load +0017e2 d2df rcall get_byte +0017e3 3f0f cpi a,0xff +0017e4 f029 breq eep_inv_cmd +0017e5 9300 009f sts prog_num,a +0017e7 d34d rcall brkpt_clr_all ;clear all breakpoints +0017e8 db86 rcall eep_load_prog +0017e9 c15b rjmp end_command +0017ea c145 eep_inv_cmd: rjmp invalid_command + end eep_load + ;EEPROM delete +0017eb 3404 cpi a,'D' +0017ec f569 ifeq eep_del +0017ed d2d4 rcall get_byte +0017ee 3f0f cpi a,0xff +0017ef f3d1 breq eep_inv_cmd +0017f0 2400 clr c ;loopcount 256 slots +0017f1 2711 clr b ;slotcount +0017f2 ba6f out eearh,one + do eep_del_loop +0017f3 ba0e out eearl,c ;find prog# +0017f4 ba6c out eecr,one +0017f5 b21d in d,eedr +0017f6 1610 cp d,a +0017f7 f449 ifeq eep_del_slot +0017f8 ba5d out eedr,allon ;mark free +0017f9 b61f in d,sreg ;atomic write sequence +0017fa 94f8 cli +0017fb 9ae2 sbi eecr,eemwe +0017fc 9ae1 sbi eecr,eewe +0017fd be1f out sreg,d +0017fe 9513 inc b ;count slots + do eep_del_wait ;write complete? +0017ff 99e1 sbic eecr,eewe +001800 cffe loop eep_del_wait + end eep_del_slot +001801 9403 inc c ;all slots done? +001802 f781 loopne eep_del_loop +001803 ba7e out eearl,zero ;set to unused address +001804 ba7f out eearh,zero +001805 2311 tst b ;count? +001806 f049 ifne eep_del_free +001807 d177 rcall crlf +001808 2f01 mov a,b +001809 d17f rcall PrintHex ;slotcount +00180a e3e6 +00180b e2f9 +00180c d176 PrintStr eep_info3 ;" slots free" +00180d e604 ldi a,'d' +00180e d183 rcall PrintChr +00180f c009 else eep_del_free +001810 2f10 mov b,a +001811 e6e4 +001812 e2f9 +001813 d16f PrintStr eep_prog ;10,13,"Program " +001814 2f01 mov a,b +001815 d173 rcall PrintHex ;prog# +001816 e5e8 +001817 e2f9 +001818 d16a PrintStr eep_notfound ;" not found" + end eep_del_free +001819 c12b rjmp end_command + end eep_del + ;EEPROM autoload +00181a 3401 cpi a,'A' +00181b f511 ifeq eep_autoload +00181c ba7f out eearh,zero ;write eep lower page + do eep_auto_parse +00181d 9109 ld a,y+ +00181e 2300 tst a ;end of input +00181f f251 breq eep_inv_cmd ;needs at least 1 parameter +001820 3200 cpi a,' ' ;skip blanks +001821 f3d9 loopeq eep_auto_parse +001822 3202 cpi a,34 ;begin of string +001823 f031 ifne eep_auto_number +001824 d2ae rcall get_wbyte +001825 ba5e out eearl,allon +001826 d46e rcall eep_auto_write + do eep_auto_parse2 +001827 9109 ld a,y+ +001828 3200 cpi a,' ' ;skip blanks +001829 f3e9 loopeq eep_auto_parse2 + end eep_auto_number +00182a 2300 tst a ;end of input +00182b f071 ifne eep_auto_next +00182c 3202 cpi a,34 +00182d f479 brne eep_auto_invalid ;only valid input is string +00182e e011 ldi b,eep_string + do eep_auto_string +00182f 9109 ld a,y+ +001830 2300 tst a ;end of command? +001831 f011 ifeq_or eep_string_end +001832 3202 cpi a,34 ;closing quotes +001833 f409 ifeq eep_string_end +001834 ef0f ldi a,0xff ;end of string marker + end eep_string_end +001835 bb1e out eearl,b +001836 d45e rcall eep_auto_write +001837 9513 inc b ;next EEPROM address +001838 3f0f cpi a,0xff ;end marker? +001839 f7a9 loopne eep_auto_string + end eep_auto_next +00183a d438 rcall eep_auto_info +00183b ba7e out eearl,zero ;protect eep from unintentional writes +00183c c108 rjmp end_command +00183d c0f2 eep_auto_invalid: rjmp invalid_command + end eep_autoload + end eep_util + .endif + ; + ; M = show memory Syntax: M(aaaa|+|-|) + ; aaaa = address, leading zeros can be omitted + ; + = next block, - = previous block, = same block + ; displays 0x100 (0x40) Bytes at full line address + ; +00183e 340d cpi a,'M' +00183f f009 +001840 c046 ifeq_far show_mem +001841 bad2 out cbus,readmem ;prepare to read +001842 91e0 0094 lds zl,lmem_display ;load previous address +001844 91f0 0095 lds zh,lmem_display+1 +001846 9109 ld a,y+ +001847 2300 tst a ;no address - show same +001848 f0d9 breq skip_get_adr +001849 320b cpi a,'+' +00184a f451 ifeq show_next +00184b fd31 sbrc flags,emu_run +00184c c002 ifs show_nxt_100 +00184d 95f3 inc zh +00184e c002 else show_nxt_100 +00184f 5ce0 +001850 4fff addiw z,0x40 ;reduce bytes if running + end show_nxt_100 +001851 9109 ld a,y+ ;no parameter after + +001852 2300 tst a +001853 f081 breq skip_get_adr +001854 c0db rjmp invalid_command + end show_next +001855 320d cpi a,'-' +001856 f459 ifeq show_previous +001857 fd31 sbrc flags,emu_run +001858 c002 ifs show_prev_100 +001859 95fa dec zh +00185a c002 else show_prev_100 +00185b 54e0 subi zl,0x40 ;reduce bytes if running +00185c 09f7 sbc zh,zero + end show_prev_100 +00185d 2e10 mov d,a +00185e 9109 ld a,y+ ;no parameter after - +00185f 2300 tst a +001860 f019 breq skip_get_adr +001861 c0ce rjmp invalid_command + end show_previous +001862 9721 sbiw y,1 ;allow immediate hex +001863 d27f rcall get_adr ;get Address + skip_get_adr: +001864 7ee0 andi zl,0xe0 ;mask full lines only +001865 2f0e mov a,zl +001866 fd31 sbrc flags,emu_run +001867 5c00 addi a,0x40 ;reduce bytes if running +001868 2e10 mov d,a +001869 93e0 0094 sts lmem_display,zl +00186b 93f0 0095 sts lmem_display+1,zh + do show_mem_line +00186d d111 rcall crlf +00186e 2f0f mov a,zh ;show address +00186f d119 rcall PrintHex +001870 2f0e mov a,zl +001871 d117 rcall PrintHex +001872 d10a rcall colon + do show_mem_data +001873 bbe8 out abuslo,zl ;memory fetch +001874 bbfb out abushi,zh +001875 94e8 clt ;clear reverse video +001876 c000 wait_data_valid 1 ;60ns minimum @ 16MHz +001877 b303 in a,dbusin +001878 3d0b cpi a,0xdb ;is potential breakpoint? +001879 f409 ifeq show_mem_brk +00187a d2da rcall brkpt_chk + end show_mem_brk +00187b d0e2 rcall RevHex +00187c 9631 adiw z,1 +00187d e003 ldi a,3 ;seperate words with spaces +00187e 230e and a,zl +00187f f799 loopne show_mem_data +001880 d0fa rcall space +001881 e10f ldi a,31 ;new line after 32 bytes +001882 230e and a,zl +001883 f779 loopne show_mem_data +001884 15e1 cp zl,d ;0x100 bytes displayed? +001885 f739 loopne show_mem_line +001886 c0be rjmp end_command + end show_mem + ; + ; W = Write memory Syntax: W(aaaa|+) bb..bb + ; aaaa = address, leading zeros can be omitted + ; + = write next byte(s) + ; bb = bytes of data, may be separated with spaces + ; +001887 3507 cpi a,'W' +001888 f571 ifeq write_mem +001889 9109 ld a,y+ +00188a 320b cpi a,'+' +00188b f429 ifeq write_next +00188c 91e0 0096 lds zl,lmem_write ;load previous next address +00188e 91f0 0097 lds zh,lmem_write+1 +001890 c006 else write_next +001891 9721 sbiw y,1 ;allow immediate hex +001892 d265 rcall get_wadr ;get write address +001893 93e0 0094 sts lmem_display,zl ;save for next display +001895 93f0 0095 sts lmem_display+1,zh + end write_next +001897 2e1c mov d,yl + do write_mem_dryrun ;syntax check before write +001898 9109 ld a,y+ +001899 2300 tst a ;end of write +00189a f021 exiteq write_mem_dryrun +00189b 3200 cpi a,32 ;skip space +00189c f3d9 loopeq write_mem_dryrun +00189d d235 rcall get_wbyte ;get data +00189e cff9 loop write_mem_dryrun +00189f 2dc1 mov yl,d +0018a0 bac2 out cbus,clear ;readmode off +0018a1 ba54 out dbusddr,allon ;dbus = output + do write_mem_realrun ;real write +0018a2 9109 ld a,y+ +0018a3 2300 tst a ;end of write +0018a4 f059 exiteq write_mem_realrun +0018a5 3200 cpi a,32 ;skip space +0018a6 f3d9 loopeq write_mem_realrun +0018a7 d22b rcall get_wbyte ;get data +0018a8 d2d5 rcall brkpt_chk_write ;check write to breakpoint +0018a9 bbe8 out abuslo,zl +0018aa bbfb out abushi,zh +0018ab bae2 out cbus,writemem ;WE, ~OE +0018ac bb05 out dbusout,a ;dbus write +0018ad 9631 adiw z,1 +0018ae bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz +0018af cff2 loop write_mem_realrun +0018b0 ba74 out dbusddr,zero ;dbus = input +0018b1 bad2 out cbus,readmem ;OE / read mode back on +0018b2 93e0 0096 sts lmem_write,zl +0018b4 93f0 0097 sts lmem_write+1,zh +0018b6 c08e rjmp end_command + end write_mem + ; + ; L = Load Intel Hex Record Syntax: L + ; loads records to memory, to abort + ; +0018b7 340c cpi a,'L' +0018b8 f009 +0018b9 c040 ifeq_far load_mem +0018ba 9109 ld a,y+ ;check validity (no parms) +0018bb 1107 cpse a,zero +0018bc c073 rjmp invalid_command +0018bd 7f3d cbr flags,(1< 0 +0018d4 f0a9 ifne load_mem_data +0018d5 bac2 out cbus,clear ;readmode off +0018d6 ba54 out dbusddr,allon ;dbus = output + do load_data +0018d7 d359 rcall read_byte_esc ;read data +0018d8 bbe8 out abuslo,zl +0018d9 bbfb out abushi,zh +0018da bae2 out cbus,writemem ;WE, ~OE +0018db bb05 out dbusout,a ;dbus write +0018dc 9631 adiw z,1 +0018dd bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz +0018de 95aa dec xl +0018df f7b9 loopne load_data +0018e0 ba74 out dbusddr,zero ;dbus = input +0018e1 bad2 out cbus,readmem ;OE / read mode back on +0018e2 d34e rcall read_byte_esc ;read checksum +0018e3 23bb tst xh +0018e4 f021 ifne load_error_checksum +0018e5 e8e2 +0018e6 e3f9 +0018e7 d09b PrintStr err_chksum ;" Checksum failed" +0018e8 c2f4 rjmp discard_serial_stream + end load_error_checksum +0018e9 c00e else load_mem_data +0018ea 3001 cpi a,1 ;end of record function +0018eb f441 ifeq load_complete +0018ec 23ff tst zh ;address is valid PC? +0018ed f009 ifne load_pc +0018ee 01cf movw pcl:pch,z ;set PC + end load_pc +0018ef eee4 +0018f0 e0f1 +0018f1 d091 PrintStr load_ok ;13,"Load OK" +0018f2 c2ea rjmp discard_serial_stream ;OK message - wait for eol +0018f3 c004 else load_complete +0018f4 e0e6 +0018f5 e0f2 +0018f6 d08c PrintStr err_func ;" Invalid function or count in record" +0018f7 c2e5 rjmp discard_serial_stream + end load_complete + end load_mem_data +0018f8 cfc9 loop load_mem_record +0018f9 c04b rjmp end_command + end load_mem + ; + ; H = Halt Emulator execution Syntax: H + ; +0018fa 3408 cpi a,'H' +0018fb f429 ifeq halt_emu +0018fc 9109 ld a,y+ ;check validity (no parms) +0018fd 1107 cpse a,zero +0018fe c031 rjmp invalid_command +0018ff 7f3d cbr flags,(1< + ; +001901 3407 cpi a,'G' +001902 f4e9 ifeq start_emu +001903 9109 ld a,y+ ;check validity (no parms) +001904 1107 cpse a,zero +001905 c02a rjmp invalid_command +001906 e6c0 ldi yl,low(cmd_buf) +001907 93c0 0091 sts cmd_inx,yl +001909 e00a ldi a,10 ;linefeed +00190a d087 rcall PrintChr +00190b d0e9 rcall show_regs +00190c 6032 sbr flags,(1< op low +00191c bb88 out abuslo,pcl ;operand address low prefetch +00191d bb9b out abushi,pch + wait_data_valid 5 ;300ns minimum @ 16MHz +00191e 9601 adiw pch:pcl,1 ;pc -> op high +00191f 9409 ijmp ;execute opcode + end start_emu + ; + ; X = Exit Debugger / start Emulator execution Syntax: X + ; +001920 3508 cpi a,'X' +001921 f439 ifeq exit_deb +001922 9109 ld a,y+ ;check validity (no parms) +001923 1107 cpse a,zero +001924 c00b rjmp invalid_command +001925 d059 rcall crlf +001926 94f8 cli +001927 e032 ldi flags,(1< + ; +001929 3502 cpi a,'R' +00192a f429 ifeq deb_reset +00192b 9109 ld a,y+ ;check validity (no parms) +00192c 1107 cpse a,zero +00192d c002 rjmp invalid_command +00192e d09c rcall soft_reset +00192f c015 rjmp end_command + end deb_reset + + ;************************************************** + ; + ; end parsing & executing commandline + ; + ;************************************************** + + ; Invalid command + + invalid_command: +001930 9721 sbiw y,1 ;caused by? +001931 8108 ld a,y +001932 1107 cpse a,zero ;end of line? +001933 9621 adiw y,1 ;last character not eol +001934 e30f ldi a,'?' ;mark invalid commannd +001935 8308 st y,a +001936 e6c0 ldi yl,low(cmd_buf) +001937 d0bd rcall show_regs +001938 d0f4 rcall show_prompt + do deb_invalid +001939 9109 ld a,y+ +00193a d057 rcall PrintChr +00193b 3202 cpi a,34 ;test for string input +00193c f411 ifeq inv_string_mark +00193d e410 ldi b,(1< adr high +0019ef b383 in pcl,dbusin ;save low pointer to pc +0019f0 bbc8 out abuslo,oplow ;fetch high pointer to pc +0019f1 c000 +0019f2 0000 wait_data_valid 0 ;0ns minimum @ 16MHz +0019f3 b393 in pch,dbusin ;point to new pc +0019f4 9508 ret + ;***************************************************************** + ; + ; show 6502 registers + ; + ; shows register, sets refresh to 500ms + ; output: 1ss pppp aa Xxx Yyy ffffffff r> + ; ss = stack pointer, pppp = program counter, aa = accumulator + ; xx = Index X, yy = Index Y, ffffffff = bitwise processor status + ; r = runmode (1 = reverse video) + ; + ;***************************************************************** + + show_regs: +0019f5 e302 ldi a,50 ;refresh timer 500ms (50 * 10) +0019f6 9300 0093 sts cmd_reg_timer,a +0019f8 e00d ldi a,13 ;return +0019f9 df98 rcall PrintChr +0019fa e301 ldi a,'1' ;stackpointer +0019fb df96 rcall PrintChr +0019fc 2d0b mov a,spointer +0019fd df8b rcall PrintHex +0019fe df7c rcall space +0019ff ff31 sbrs flags,emu_run +001a00 c002 ifs show_reg_run ;show breakpoint if halted +001a01 94e8 clt +001a02 c001 else show_reg_run +001a03 d163 rcall brkpt_chk_pc + end show_reg_run +001a04 2f09 mov a,pch ;program counter +001a05 df58 rcall RevHex +001a06 2f08 mov a,pcl +001a07 df56 rcall RevHex +001a08 df72 rcall space +001a09 2f05 mov a,rega ;accumulator +001a0a df7e rcall PrintHex +001a0b df6f rcall space +001a0c e708 ldi a,'x' ;index register X +001a0d df84 rcall PrintChr +001a0e 2d08 mov a,regx +001a0f df79 rcall PrintHex +001a10 df6a rcall space +001a11 e709 ldi a,'y' ;index register y +001a12 df7f rcall PrintChr +001a13 2d09 mov a,regy +001a14 df74 rcall PrintHex +001a15 df65 rcall space +001a16 e40e ldi a,'N' ;processor status +001a17 fb72 bst stat,2 +001a18 df4e rcall RevChr +001a19 e506 ldi a,'V' +001a1a fb66 bst stat2,6 +001a1b df4b rcall RevChr +001a1c e20d ldi a,'-' ;don´t care +001a1d df74 rcall PrintChr +001a1e e402 ldi a,'B' ;only on stack +001a1f df72 rcall PrintChr +001a20 e404 ldi a,'D' +001a21 fb63 bst stat2,3 +001a22 df44 rcall RevChr +001a23 e409 ldi a,'I' +001a24 fb62 bst stat2,2 +001a25 df41 rcall RevChr +001a26 e50a ldi a,'Z' +001a27 fb71 bst stat,1 +001a28 df3e rcall RevChr +001a29 e403 ldi a,'C' +001a2a fb70 bst stat,0 +001a2b df3b rcall RevChr +001a2c cf4e rjmp space + + show_prompt: +001a2d ff31 sbrs flags,emu_run +001a2e c002 ifs show_runmode +001a2f e407 ldi a,'G' ;go / running +001a30 c001 else show_runmode +001a31 e408 ldi a,'H' ;halted / stopped + end show_runmode +001a32 df5f rcall PrintChr +001a33 e30e ldi a,'>' +001a34 cf5d rjmp PrintChr + + ;***************************************************************** + ; + ; disassemble instruction + ; + ; expects addresss in y + ; returns b = 7 if invalid instruction + ; uses a c d z + ; + ;***************************************************************** + + disasm: +001a35 bbc8 out abuslo,yl ;memory fetch +001a36 bbdb out abushi,yh +001a37 2411 clr d ;load index to opcode table +001a38 94e8 clt ;clear reverse video +001a39 01fe movw z,y + wait_data_valid 3 ;180ns minimum @ 16MHz +001a3a b303 in a,dbusin +001a3b 3d0b cpi a,0xdb ;is potential breakpoint? +001a3c f411 ifeq show_dis_brk +001a3d d117 rcall brkpt_chk +001a3e 01ef movw y,z + end show_dis_brk +001a3f 2e00 mov c,a ;opcode +001a40 9621 adiw y,1 ;next byte +001a41 0c00 lsl c ;*4 / each entry 4 bytes +001a42 1c11 rol d +001a43 0c00 lsl c +001a44 1c11 rol d +001a45 e4ee ldi zl,low(dis_opcode<<1) +001a46 e0f2 ldi zh,high(dis_opcode<<1) +001a47 0de0 add zl,c +001a48 1df1 adc zh,d +001a49 9105 lpm a,z+ ;show mnemonics +001a4a df1c rcall RevChr +001a4b 9105 lpm a,z+ +001a4c df1a rcall RevChr +001a4d 9105 lpm a,z+ +001a4e df18 rcall RevChr +001a4f df2b rcall space +001a50 9114 lpm b,z ;show addressing +001a51 7610 andi b,0b1100000 ;mask prefix +001a52 3210 cpi b,0b0100000 +001a53 f411 ifeq dis_immediate +001a54 e203 ldi a,'#' +001a55 df3c rcall PrintChr + end dis_immediate +001a56 3410 cpi b,0b1000000 +001a57 f411 ifeq dis_pre_indirect +001a58 e208 ldi a,'(' +001a59 df38 rcall PrintChr + end dis_pre_indirect +001a5a 3610 cpi b,0b1100000 +001a5b f439 ifeq dis_bitnum +001a5c b303 in a,dbusin ;opcode -> bitnum +001a5d 9502 swap a +001a5e 7007 andi a,7 +001a5f 5d00 addi a,'0' +001a60 df31 rcall PrintChr +001a61 e20c ldi a,',' +001a62 df2f rcall PrintChr + end dis_bitnum +001a63 9114 lpm b,z +001a64 7118 andi b,0b0011000 ;mask op addressing +001a65 3018 cpi b,0b0001000 +001a66 f431 ifeq dis_data_one ;zero page or immediate +001a67 bbc8 out abuslo,yl ;memory fetch +001a68 bbdb out abushi,yh +001a69 9621 adiw y,1 +001a6a c000 wait_data_valid 1 ;60ns minimum @ 16MHz +001a6b b303 in a,dbusin +001a6c df1c rcall PrintHex + end dis_data_one +001a6d 3110 cpi b,0b0010000 +001a6e f469 ifeq dis_data_abs ;2 Byte absolute (reverse order) +001a6f bbc8 out abuslo,yl ;memory fetch +001a70 bbdb out abushi,yh +001a71 9621 adiw y,1 +001a72 c000 wait_data_valid 1 ;60ns minimum @ 16MHz +001a73 b203 in c,dbusin +001a74 bbc8 out abuslo,yl ;memory fetch +001a75 bbdb out abushi,yh +001a76 9621 adiw y,1 +001a77 c000 wait_data_valid 1 ;60ns minimum @ 16MHz +001a78 b303 in a,dbusin +001a79 df0f rcall PrintHex +001a7a 2d00 mov a,c +001a7b df0d rcall PrintHex + end dis_data_abs +001a7c 3118 cpi b,0b0011000 +001a7d f409 ifeq dis_data_rel ;1 Byte relative (calculated absolute) +001a7e d02c rcall dis_rel + end dis_data_rel +001a7f 9114 lpm b,z +001a80 7017 andi b,0b0000111 ;mask suffix +001a81 3011 cpi b,0b001 ;,X +001a82 f421 ifeq dis_x +001a83 e20c ldi a,',' +001a84 df0d rcall PrintChr +001a85 e508 ldi a,'X' +001a86 df0b rcall PrintChr + end dis_x +001a87 3012 cpi b,0b010 ;,Y +001a88 f421 ifeq dis_y +001a89 e20c ldi a,',' +001a8a df07 rcall PrintChr +001a8b e509 ldi a,'Y' +001a8c df05 rcall PrintChr + end dis_y +001a8d 3013 cpi b,0b011 ;) +001a8e f411 ifeq dis_i +001a8f e209 ldi a,')' +001a90 df01 rcall PrintChr + end dis_i +001a91 3014 cpi b,0b100 ;,X) +001a92 f431 ifeq dis_xi +001a93 e20c ldi a,',' +001a94 defd rcall PrintChr +001a95 e508 ldi a,'X' +001a96 defb rcall PrintChr +001a97 e209 ldi a,')' +001a98 def9 rcall PrintChr + end dis_xi +001a99 3015 cpi b,0b101 ;),Y +001a9a f431 ifeq dis_iy +001a9b e209 ldi a,')' +001a9c def5 rcall PrintChr +001a9d e20c ldi a,',' +001a9e def3 rcall PrintChr +001a9f e509 ldi a,'Y' +001aa0 def1 rcall PrintChr + end dis_iy +001aa1 3016 cpi b,0b110 ;A +001aa2 f411 ifeq dis_a +001aa3 e401 ldi a,'A' +001aa4 deed rcall PrintChr + end dis_a +001aa5 3017 cpi b,0b111 ;invalid instruction or BBR/BBS +001aa6 f419 ifeq dis_nv + .ifdef cmos_core + .else +001aa7 e3ec +001aa8 e3f9 +001aa9 ded9 PrintStr inv_instr + .endif + end dis_nv +001aaa 9508 ret + + ;fetch relative address and display as absolute + dis_rel: +001aab bbc8 out abuslo,yl ;memory fetch +001aac bbdb out abushi,yh +001aad 9621 adiw y,1 +001aae 2700 clr a +001aaf 0000 wait_data_valid 2 ;120ns minimum @ 16MHz +001ab0 b203 in c,dbusin +001ab1 2000 tst c +001ab2 f40a ifmi dis_rel_sign +001ab3 950a dec a ;extend sign to high + end dis_rel_sign +001ab4 0e0c add c,yl ;calculate & show absolute +001ab5 1f0d adc a,yh +001ab6 ded2 rcall PrintHex +001ab7 2d00 mov a,c +001ab8 ced0 rjmp PrintHex + + ;***************************************************************** + ; + ; get hex parameters + ; + ;***************************************************************** + + ;ASCII to hex nibble conversion + get_hex: +001ab9 5300 subi a,'0' ;hex 0-9 +001aba 300a cpi a,10 +001abb f028 ifsh hex_a_f +001abc 3101 cpi a,17 ;non hex >0 F +001ac0 f4d8 brsh inv_cmd + end hex_a_f +001ac1 9508 ret + ; + ; get 1 hex byte from commandline + ; expects 2 Hex digits, eol + ; returns hex byte in a + ; + get_byte: + do byte_parse +001ac2 9109 ld a,y+ +001ac3 2300 tst a ;premature end of input +001ac4 f0b9 breq inv_cmd +001ac5 3200 cpi a,32 ;skip blanks +001ac6 f3d9 loopeq byte_parse +001ac7 dff1 rcall get_hex ;high nibble +001ac8 2e00 mov c,a +001ac9 9402 swap c +001aca 9109 ld a,y+ +001acb 2300 tst a +001acc f079 breq inv_cmd +001acd dfeb rcall get_hex ;low nibble +001ace 2900 or a,c +001acf 9019 ld d,y+ ;end of line? +001ad0 2011 tst d +001ad1 f451 brne inv_cmd +001ad2 9508 ret + ; + ; get nth hex byte from commandline + ; expects 2 Hex digits + ; returns hex byte in a + ; + get_wbyte: +001ad3 dfe5 rcall get_hex ;high nibble +001ad4 2e00 mov c,a +001ad5 9402 swap c +001ad6 9109 ld a,y+ +001ad7 2300 tst a +001ad8 f019 breq inv_cmd +001ad9 dfdf rcall get_hex ;low nibble +001ada 2900 or a,c +001adb 9508 ret + + inv_cmd: +001adc 9100 009a lds a,sp_save ;restore sp to main loop +001ade bf0d out spl,a +001adf 9100 009b lds a,sp_save+1 +001ae1 bf0e out sph,a +001ae2 ce4d rjmp invalid_command ;immediate end of command + + ; + ; get hex address from commandline, single parameter + ; expects y pointing to 1-4 hex digits, end of line + ; uses a b + ; returns address in z + ; + get_adr: + do adr_parse +001ae3 9109 ld a,y+ +001ae4 2300 tst a ;premature end of input +001ae5 f3b1 breq inv_cmd +001ae6 3200 cpi a,32 ;skip blanks +001ae7 f3d9 loopeq adr_parse +001ae8 dfd0 rcall get_hex ;1st nibble +001ae9 27ff clr zh +001aea 2fe0 mov zl,a + do adr_nibble +001aeb 9109 ld a,y+ ;next nibble +001aec 2300 tst a +001aed f049 exiteq adr_nibble +001aee dfca rcall get_hex +001aef e014 ldi b,4 + do adr_shift_nibble +001af0 0fee lsl zl +001af1 1fff rol zh +001af2 f348 brcs inv_cmd ;exceeds 16bit +001af3 951a dec b +001af4 f7d9 loopne adr_shift_nibble +001af5 2be0 or zl,a +001af6 cff4 loop adr_nibble +001af7 9508 ret + ; + ; get hex address from commandline, multiple parameter + ; expects 1-4 hex digits, space + ; returns address in z + ; + get_wadr: + do wadr_parse +001af8 9109 ld a,y+ +001af9 2300 tst a ;premature end of input +001afa f309 breq inv_cmd +001afb 3200 cpi a,32 ;skip blanks +001afc f3d9 loopeq wadr_parse +001afd dfbb rcall get_hex ;1st nibble +001afe 27ff clr zh +001aff 2fe0 mov zl,a + do wadr_nibble +001b00 9109 ld a,y+ ;next nibble +001b01 3200 cpi a,32 +001b02 f049 exiteq wadr_nibble +001b03 dfb5 rcall get_hex +001b04 e014 ldi b,4 + do wadr_shift_nibble +001b05 0fee lsl zl +001b06 1fff rol zh +001b07 f2a0 brcs inv_cmd ;exceeds 16bit +001b08 951a dec b +001b09 f7d9 loopne wadr_shift_nibble +001b0a 2be0 or zl,a +001b0b cff4 loop wadr_nibble +001b0c 9508 ret + + ;***************************************************************** + ; + ; breakpoint utilities + ; + ;***************************************************************** + ; + ; breakpoint info - list active breakpoints + ; uses a c y z + ; + brkpt_info: +001b0d eac0 ldi yl,low(brkpt_lo) ;any breakpoints active? +001b0e e0d0 ldi yh,high(brkpt_lo) +001b0f 2400 clr c + do br_find_actv +001b10 85fa ldd zh,y+10 ;brkpt_hi set? +001b11 11f5 cpse zh,allon +001b12 9403 inc c +001b13 91e9 ld zl,y+ ;brkpt_lo set? +001b14 11e5 cpse zl,allon +001b15 9403 inc c +001b16 3aca cpi yl,low(brkpt_hi) +001b17 f7c1 loopne br_find_actv +001b18 1007 cpse c,zero +001b19 c004 ifs br_info_none +001b1a e9e4 +001b1b e3f9 +001b1c de66 PrintStr bpt_info_none ;10,13,"No breakpoints active" +001b1d c016 else br_info_none +001b1e e9ec +001b1f e0f1 +001b20 de62 PrintStr bpt_info ;10,13,"Breakpoints (slot#:address)",13,10 +001b21 eac0 ldi yl,low(brkpt_lo) ;find breakpoints + do br_info_all +001b22 81e8 ld zl,y ;brkpt_lo set? +001b23 85fa ldd zh,y+10 ;brkpt_hi set? +001b24 15e5 cp zl,allon +001b25 f411 ifne_or br_info_slot +001b26 15f5 cp zh,allon +001b27 f049 ifne br_info_slot +001b28 de52 rcall space +001b29 2f0c mov a,yl ;slot# +001b2a 5700 subi a,low(brkpt_lo) - '0' +001b2b de66 rcall PrintChr +001b2c de50 rcall colon +001b2d 2f0f mov a,zh ;address +001b2e de5a rcall PrintHex +001b2f 2f0e mov a,zl +001b30 de58 rcall PrintHex + end br_info_slot +001b31 9621 adiw y,1 ;next slot +001b32 3aca cpi yl,low(brkpt_hi) +001b33 f771 loopne br_info_all + end br_info_none +001b34 9508 ret + ; + ; clear all breakpoints + ; uses a y z + ; returns c = count of slots cleared + ; + brkpt_clr_all: +001b35 eac0 ldi yl,low(brkpt_lo) ;find breakpoints +001b36 e0d0 ldi yh,high(brkpt_lo) +001b37 2400 clr c + do br_clr_all_slots +001b38 d009 rcall brkpt_clr_one +001b39 9621 adiw y,1 ;next slot +001b3a 3aca cpi yl,low(brkpt_hi) +001b3b f7e1 loopne br_clr_all_slots +001b3c 2000 tst c +001b3d f019 ifne br_clr_all_msg +001b3e e8e2 +001b3f e0f1 +001b40 de42 PrintStr bpt_clrd_msg ;10,13,"All breakpoints cleared" + end br_clr_all_msg +001b41 9508 ret + ; + ; clear 1 breakpoint slot + ; uses a y z + ; returns c+1 if slot was active / got cleared + ; + brkpt_clr_one: +001b42 81e8 ld zl,y ;brkpt_lo set? +001b43 85fa ldd zh,y+10 ;brkpt_hi set? +001b44 15e5 cp zl,allon +001b45 f411 ifne_or br_clr_one_slot +001b46 15f5 cp zh,allon +001b47 f061 ifne br_clr_one_slot + ;write original opcode back to its RAM location +001b48 890c ldd a,y+20 ;brkpt_op +001b49 bbe8 out abuslo,zl +001b4a bbfb out abushi,zh +001b4b bae2 out cbus,writemem ;WE, ~OE +001b4c bb05 out dbusout,a ;dbus write +001b4d ba54 out dbusddr,allon ;dbus = output +001b4e bac2 out cbus,clear ;~WE / write cycle ends 180ns/16MHz +001b4f ba74 out dbusddr,zero ;dbus = input +001b50 bad2 out cbus,readmem ;OE / read mode back on +001b51 8258 st y,allon ;reset brkpt_lo +001b52 865a std y+10,allon ;reset brkpt_hi +001b53 9403 inc c + end br_clr_one_slot +001b54 9508 ret + ; + ; check STP is breakpoint + ; expects current address in z + ; on match replace a with original opcode + ; " " set T flag to signal reverse video + ; uses c y + ; + brkpt_chk: +001b55 eac0 ldi yl,low(brkpt_lo) ;match breakpoint address +001b56 e0d0 ldi yh,high(brkpt_lo) + do br_chk_adr +001b57 9009 ld c,y+ ;brkpt_lo match? +001b58 160e cp c,zl +001b59 f451 ifeq_and br_slot_match +001b5a 8409 ldd c,y+9 ;brkpt_hi match? +001b5b 160f cp c,zh +001b5c f439 ifeq br_slot_match +001b5d 15e5 cp zl,allon +001b5e f411 ifne_or br_slot_valid +001b5f 15f5 cp zh,allon +001b60 f011 ifne br_slot_valid +001b61 890b ldd a,y+19 ;show original opcode +001b62 9468 set ;signal breakpoint = reverse video + end br_slot_valid +001b63 9508 ret + end br_slot_match +001b64 3aca cpi yl,low(brkpt_hi) +001b65 f789 loopne br_chk_adr +001b66 9508 ret + ; + ; check PC is breakpoint + ; expects current address in pcl:pch + ; on match replace opcode with original opcode + ; T flag = breakpoint true/false + ; uses c + ; + brkpt_chk_pc: +001b67 93cf push yl +001b68 93df push yh +001b69 eac0 ldi yl,low(brkpt_lo) ;match breakpoint address +001b6a e0d0 ldi yh,high(brkpt_lo) +001b6b 94e8 clt + do br_pc_adr +001b6c 9009 ld c,y+ ;brkpt_lo match? +001b6d 1608 cp c,pcl +001b6e f451 ifeq_and br_pc_match +001b6f 8409 ldd c,y+9 ;brkpt_hi match? +001b70 1609 cp c,pch +001b71 f439 ifeq br_pc_match +001b72 1585 cp pcl,allon +001b73 f411 ifne_or br_pc_valid +001b74 1595 cp pch,allon +001b75 f011 ifne br_pc_valid +001b76 89eb ldd opcode,y+19 ;show original opcode +001b77 9468 set ;signal breakpoint = reverse video + end br_pc_valid +001b78 c002 rjmp br_chkp_exit + end br_pc_match +001b79 3aca cpi yl,low(brkpt_hi) +001b7a f789 loopne br_pc_adr + br_chkp_exit: +001b7b 91df pop yh +001b7c 91cf pop yl +001b7d 9508 ret + ; + ; check write memory to breakpoint address + ; expects current address in z + ; on match saves a as original opcode + ; " " replaces a with STP opcode + ; uses c + ; + brkpt_chk_write: +001b7e 93cf push yl +001b7f 93df push yh +001b80 eac0 ldi yl,low(brkpt_lo) ;match breakpoint address +001b81 e0d0 ldi yh,high(brkpt_lo) + do br_chkw_adr +001b82 9009 ld c,y+ ;brkpt_lo match? +001b83 160e cp c,zl +001b84 f451 ifeq_and br_slotw_match +001b85 8409 ldd c,y+9 ;brkpt_hi match? +001b86 160f cp c,zh +001b87 f439 ifeq br_slotw_match +001b88 15e5 cp zl,allon +001b89 f411 ifne_or br_slotw_valid +001b8a 15f5 cp zh,allon +001b8b f011 ifne br_slotw_valid +001b8c 8b0b std y+19,a ;save original opcode +001b8d ed0b ldi a,0xdb ;write STP opcode to memory + end br_slotw_valid +001b8e c002 rjmp br_chkw_exit + end br_slotw_match +001b8f 3aca cpi yl,low(brkpt_hi) +001b90 f789 loopne br_chkw_adr + br_chkw_exit: +001b91 91df pop yh +001b92 91cf pop yl +001b93 9508 ret + ; + ;***************************************************************** + ; + ; load and EEPROM save + ; + ;***************************************************************** + ; + ; RS232 read from RX fifo or direct and exit on + ; uses d, (i with cli) + ; updates checksum in xh + ; returns data in a + ; + read_serial_esc: +001b94 93cf push yl +001b95 93df push yh + ; push c + do wait_ser_data +001b96 b61f in d,sreg ;preserve sreg interrupt enable +001b97 94f8 cli +001b98 9120 00d7 lds i,rx_fill ;check buffer +001b9a 2322 tst i +001b9b f0b1 ifne esc_read_buf +001b9c 91c0 00d6 lds yl,rx_inx ;prepare address to read rx fifo +001b9e e0d2 ldi yh,high(rx_buf) +001b9f 1bc2 sub yl,i +001ba0 8108 ld a,y ;read +001ba1 952a dec i ;update pointer +001ba2 9320 00d7 sts rx_fill,i + .ifdef flowlo + ; mov i,c +001ba4 3820 cpi i,flowlo ;buffer lower watermark? +001ba5 f448 iflo esc_flow +001ba6 9120 00d8 lds i,flow_cmd +001ba8 3921 cpi i,0x91 ;xon done? +001ba9 f029 ifne esc_send_xon +001baa e121 ldi i,0x11 ;post xon pending +001bab 9320 00d8 sts flow_cmd,i +001bad eb28 ldi i,usart_txi_ena ;notify transmitter +001bae b92a out ucsrb,i + .ifdef irq_dis_real + .endif + end esc_send_xon + end esc_flow + .endif +001baf be1f out sreg,d +001bb0 c008 exit wait_ser_data +001bb1 c006 else esc_read_buf +001bb2 be1f out sreg,d +001bb3 f027 ifid_and esc_read_direct +001bb4 9b5f sbis ucsra,rxc +001bb5 c002 ifs esc_read_direct +001bb6 b10c in a,udr ;read direct if disabled & buffer empty +001bb7 c001 exit wait_ser_data + end esc_read_direct + end esc_read_buf +001bb8 cfdd loop wait_ser_data + ; pop c +001bb9 91df pop yh +001bba 91cf pop yl +001bbb 310b cpi a,27 +001bbc f471 ifeq read_abort + .ifdef eep_vld +001bbd 9100 009f lds a,prog_num ;I2C close required? +001bbf 3f0f cpi a,0xff +001bc0 f429 ifeq esc_read_load +001bc1 e5e6 +001bc2 e0f1 +001bc3 ddbf PrintStr load_abort ;" Load aborted" +001bc4 c060 rjmp skip_main +001bc5 c005 else esc_read_load +001bc6 ede8 +001bc7 e2f9 +001bc8 ddba PrintStr save_abort ;" Save aborted" + eep_close_err: ;close SPI/I2C after abort or error +001bc9 940c 133a jmp eep_write_err + end esc_read_load + .else + .endif + end read_abort +001bcb 9508 ret + + ;load hex nibble + load_hex: +001bcc dfc7 rcall read_serial_esc +001bcd 5300 subi a,'0' ;hex 0-9 +001bce 300a cpi a,10 +001bcf f028 ifsh load_a_f +001bd0 3101 cpi a,17 ;non hex >0 F +001bd4 f408 brsh inv_hex + end load_a_f +001bd5 9508 ret + ;non hex message + inv_hex: +001bd6 eeee +001bd7 e0f1 +001bd8 ddaa PrintStr err_nonhex ;" Non-Hex data in record" + .ifdef eep_vld +001bd9 9100 009f lds a,prog_num ;SPI/I2C close required? +001bdb 3f0f cpi a,0xff +001bdc f761 brne eep_close_err + .endif + ; + ; RS232 discard from RX fifo or direct with escape timer + ; uses a, d, (i with cli) + ; + ; wait for eof (skip remaining records) + discard_serial_stream: +001bdd e0c6 ldi yl,6 ;continuous data within 50ms will be discarded +001bde 93c0 0092 sts cmd_esc_timer,yl + do discard_serial +001be0 b61f in d,sreg ;preserve sreg interrupt enable +001be1 94f8 cli +001be2 9120 00d7 lds i,rx_fill ;check buffer +001be4 2322 tst i +001be5 f0e1 ifne disc_read_buf +001be6 91c0 00d6 lds yl,rx_inx ;prepare address to read rx fifo +001be8 e0d2 ldi yh,high(rx_buf) +001be9 19c0 sub yl,c +001bea 8108 ld a,y ;read +001beb 952a dec i ;update pointer +001bec 9320 00d7 sts rx_fill,i + .ifdef flowlo + ; mov i,c +001bee 3820 cpi i,flowlo ;buffer lower watermark? +001bef f448 iflo disc_flow +001bf0 9120 00d8 lds i,flow_cmd +001bf2 3921 cpi i,0x91 ;xon done? +001bf3 f029 ifne disc_send_xon +001bf4 e121 ldi i,0x11 ;post xon pending +001bf5 9320 00d8 sts flow_cmd,i +001bf7 eb28 ldi i,usart_txi_ena ;notify transmitter +001bf8 b92a out ucsrb,i + .ifdef irq_dis_real + .endif + end disc_send_xon + end disc_flow + .endif +001bf9 be1f out sreg,d +001bfa e0c6 ldi yl,6 ;further characters +001bfb 93c0 0092 sts cmd_esc_timer,yl +001bfd 300d cpi a,13 ;EOL +001bfe f411 ifeq disc_read_keepalive +001bff e000 ldi a,0 +001c00 dd91 rcall PrintChr + end disc_read_keepalive +001c01 c00c else disc_read_buf +001c02 be1f out sreg,d +001c03 f057 ifid_and disc_read_direct +001c04 9b5f sbis ucsra,rxc +001c05 c008 ifs disc_read_direct +001c06 b10c in a,udr ;read direct if disabled & buffer empty +001c07 e0c6 ldi yl,6 ;further characters +001c08 93c0 0092 sts cmd_esc_timer,yl +001c0a 300d cpi a,13 +001c0b f411 ifeq disc_read_keepalive2 +001c0c e000 ldi a,0 +001c0d dd84 rcall PrintChr + end disc_read_keepalive2 + end disc_read_direct + end disc_read_buf +001c0e f077 ifid_and disc_timer_update ;disabled timer update +001c0f b7d8 in yh,tifr +001c10 ffd1 sbrs yh,ocf0 +001c11 c00b ifs disc_timer_update +001c12 e0d2 ldi yh,0b10 ;clear t1 oc flag +001c13 bfd8 out tifr,yh +001c14 91c0 0092 lds yl,cmd_esc_timer ;test escape timer expired +001c16 77cf andi yl,0x7f +001c17 f029 ifne disc_esc_timer_update +001c18 91c0 0092 lds yl,cmd_esc_timer +001c1a 95ca dec yl +001c1b 93c0 0092 sts cmd_esc_timer,yl + end disc_esc_timer_update + end disc_timer_update +001c1d 91c0 0092 lds yl,cmd_esc_timer +001c1f 23cc tst yl +001c20 f009 exiteq discard_serial +001c21 cfbe loop discard_serial +001c22 e8c0 ldi yl,0x80 ;re-init +001c23 93c0 0092 sts cmd_esc_timer,yl + ; return to mainloop + skip_main: + .ifdef eep_vld +001c25 940e 134b call eep_close + .else + .endif +001c27 9100 009a lds a,sp_save ;restore sp to main loop +001c29 bf0d out spl,a +001c2a 9100 009b lds a,sp_save+1 +001c2c bf0e out sph,a +001c2d fd32 sbrc flags,deb_act ;on error +001c2e cd16 rjmp end_command ;debugger or +001c2f dd4f rcall crlf +001c30 cd1e rjmp end_exit ;next instruction + ; + ; Read Hex Byte from RX fifo or direct and exit on + read_byte_esc: + ;push c +001c31 df9a rcall load_hex ;high nibble +001c32 9502 swap a +001c33 2e00 mov c,a +001c34 df97 rcall load_hex ;low nibble +001c35 2900 or a,c + ;pop c +001c36 0fb0 add xh,a ;update checksum +001c37 9508 ret + + .ifdef eep_vld + ; EEPROM info - show directory + eep_cmd_info: +001c38 e3e2 +001c39 e2f9 +001c3a dd48 PrintStr eep_info2 ;" - " +001c3b 2400 clr c ;count free slots +001c3c 2700 clr a +001c3d ba6f out eearh,one + do eep_get_free +001c3e ba0e out eearl,c +001c3f ba6c out eecr,one +001c40 b31d in b,eedr +001c41 1515 cp b,allon +001c42 f429 ifeq eep_inc_free +001c43 9503 inc a ;+1 for every free block +001c44 f419 ifeq eep_100_free +001c45 e301 ldi a,'1' ;0x100 free slots +001c46 dd4b rcall PrintChr +001c47 2700 clr a + end eep_100_free + end eep_inc_free +001c48 9403 inc c +001c49 f7a1 loopne eep_get_free +001c4a dd3e rcall PrintHex ;2 digits free slots +001c4b e3e6 +001c4c e2f9 +001c4d dd35 PrintStr eep_info3 ;" slots free" +001c4e e0e1 ldi zl,1 ;progs/line, next index +001c4f 2711 clr b ;lowest prog# not listed + do eep_list +001c50 ef0f ldi a,0xff ;prog#, max to init + do eep_pslots +001c51 ba0e out eearl,c ;scan all slots +001c52 ba6c out eecr,one +001c53 b21d in d,eedr +001c54 1611 cp d,b ;not already listed? +001c55 f030 ifsh eep_next +001c56 1610 cp d,a ;count same, new if lower +001c57 f409 ifeq eep_inc_same +001c58 95c3 inc yl ;count slots + end eep_inc_same +001c59 f410 iflo eep_find_low +001c5a e0c1 ldi yl,1 ;1st slot +001c5b 2d01 mov a,d ;new lowest prog# to list + end eep_find_low + end eep_next +001c5c 9403 inc c ;loop for 256 slots +001c5d f799 loopne eep_pslots +001c5e 3f0f cpi a,0xff ;no more progs to list +001c5f f081 exiteq eep_list +001c60 2f10 mov b,a +001c61 95ea dec zl ;max progs per line? +001c62 f429 ifeq eep_list_index +001c63 e4e2 +001c64 e2f9 +001c65 dd1d PrintStr eep_info4 ;"prog#/slots " +001c66 e0ea ldi zl,10 ;next 10 progs on this line +001c67 2f01 mov a,b ;restore a + end eep_list_index +001c68 9513 inc b ;next lowest prog# +001c69 dd1f rcall PrintHex ;prog# +001c6a e20f ldi a,'/' +001c6b dd26 rcall PrintChr +001c6c 2f0c mov a,yl +001c6d dd1b rcall PrintHex ;slotcount +001c6e dd0c rcall space +001c6f cfe0 loop eep_list +001c70 ba7f out eearh,zero ;protect eep from unintentional writes +001c71 ba7e out eearl,zero +001c72 9508 ret + + eep_auto_info: +001c73 e1ee +001c74 e2f9 +001c75 dd0d PrintStr eep_info1 ;crlf,"EEPROM autoload " +001c76 ba7f out eearh,zero ;read eep autoload byte +001c77 ba5e out eearl,allon +001c78 ba6c out eecr,one +001c79 b30d in a,eedr +001c7a 3f0f cpi a,0xff ;test autoload program set +001c7b f421 ifeq eep_no_auto +001c7c e5e2 +001c7d e2f9 +001c7e dd04 PrintStr eep_none ;"none" +001c7f c014 else eep_no_auto +001c80 dd08 rcall PrintHex ;program number +001c81 2c06 mov c,one ;beginning of string +001c82 ba0e out eearl,c +001c83 ba6c out eecr,one +001c84 b31d in b,eedr +001c85 3f1f cpi b,0xff ;string present? +001c86 f069 ifne eep_auto_info_string +001c87 dcf3 rcall space +001c88 e202 ldi a,34 ;quote +001c89 dd08 rcall PrintChr +001c8a 2f01 mov a,b + do eep_auto_info_str2 +001c8b dd06 rcall PrintChr +001c8c 9403 inc c +001c8d ba0e out eearl,c +001c8e ba6c out eecr,one +001c8f b30d in a,eedr +001c90 3f0f cpi a,0xff ;string end? +001c91 f7c9 loopne eep_auto_info_str2 +001c92 e202 ldi a,34 +001c93 dcfe rcall PrintChr + end eep_auto_info_string + end eep_no_auto +001c94 9508 ret + + ; internal EEPROM write byte + eep_auto_write: +001c95 bb0d out eedr,a +001c96 b60f in c,sreg ;atomic write sequence +001c97 94f8 cli +001c98 9ae2 sbi eecr,eemwe +001c99 9ae1 sbi eecr,eewe +001c9a be0f out sreg,c + do eep_auto_wait ;write complete? +001c9b 99e1 sbic eecr,eewe +001c9c cffe loop eep_auto_wait +001c9d 9508 ret + .endif + + ; Messages part 2 (part 1 moved before opcode table to reduce empty space) + ; word count, X = don't use in part 1 ---> ;## + .ifdef cmos_core + .else +001c9e 6c49 +001c9f 656c +001ca0 6167 +001ca1 206c +001ca2 704f +001ca3 6f63 +001ca4 6564 +001ca5 0020 inv_instr: .db "Illegal Opcode ",0 ; X + .endif +001ca6 0a0d +001ca7 0a0d +001ca8 364e +001ca9 3035 +001caa 2032 +001cab 6d45 +001cac 6c75 +001cad 7461 +001cae 726f +001caf 5620 +001cb0 2e30 +001cb1 3338 +001cb2 0062 emu_msg: .db 13,10,13,10,core_string," Emulator V",version,0 ; X +001cb3 6220 +001cb4 6975 +001cb5 746c +001cb6 4620 +001cb7 6265 +001cb8 3220 +001cb9 2035 +001cba 3032 +001cbb 3631 +001cbc 3120 +001cbd 3a30 +001cbe 3535 +001cbf 353a +001cc0 0037 built_msg: .db " built ",__DATE__," ",__TIME__,0 ;14 + ;load_wait: .db 13,10,"Loading, to abort",13,10,0 ;14 + ;load_abort: .db " Load aborted",0 ; 7 +001cc1 4320 +001cc2 6568 +001cc3 6b63 +001cc4 7573 +001cc5 206d +001cc6 6166 +001cc7 6c69 +001cc8 6465 +001cc9 0000 err_chksum: .db " Checksum failed",0,0 ; 9 + ;rs_vect_empty: .db 13,10,"Check reset vector",0,0 ;11 + ;reset_msg: .db " Reset",0 ; 4 + ;bpt_clrd_msg: .db 10,13,"All breakpoints cleared",0 ;13 + ;bpt_info: .db 10,13,"Breakpoints (slot#:address)",13,10,0,0 ;17 +001cca 0d0a +001ccb 6f4e +001ccc 6220 +001ccd 6572 +001cce 6b61 +001ccf 6f70 +001cd0 6e69 +001cd1 7374 +001cd2 6120 +001cd3 7463 +001cd4 7669 +001cd5 0065 bpt_info_none: .db 10,13,"No breakpoints active",0 ;12 + ;bpt_slot_full: .db 10,13,"No more breakpoint slots available",0,0 ;19 + .ifdef irq_dis_real ;more messages not in part 1 + .endif + + + ;verify minimum versions of includes + ;required versions + .if io_version < 831 + .endif + .ifdef cmos_core + .if core_version < 831 + .endif + .else + .if core_version < 831 + .endif + .endif + .if config_version < 830 + .endif + .if sam_version < 810 + .endif + ;above base versions + .if io_version > 832 + .endif + .ifdef cmos_core + .if core_version > 832 + .endif + .else + .if core_version > 832 + .endif + .endif + .if config_version > 832 + .endif + .if sam_version > 832 + .endif + ;recommended versions + .if io_version < 832 + .endif + .ifdef cmos_core + .if core_version < 831 + .endif + .else + .if core_version < 831 + .endif + .endif + .if config_version < 830 + .endif + .if sam_version < 810 + .endif + + +RESOURCE USE INFORMATION +------------------------ + +Notice: +The register and instruction counts are symbol table hit counts, +and hence implicitly used resources are not counted, eg, the +'lpm' instruction without operands implicitly uses r0 and z, +none of which are counted. + +x,y,z are separate entities in the symbol table and are +counted separately from r26..r31 here. + +.dseg memory usage only counts static data declared with .byte + +ATmega32 register use summary: +r0 : 123 r1 : 71 r2 : 20 r3 : 8 r4 : 27 r5 : 93 r6 : 43 r7 : 191 +r8 : 56 r9 : 33 r10: 145 r11: 45 r12: 64 r13: 45 r14: 32 r15: 6 +r16: 884 r17: 237 r18: 106 r19: 129 r20: 0 r21: 34 r22: 42 r23: 96 +r24: 343 r25: 340 r26: 55 r27: 33 r28: 460 r29: 256 r30: 285 r31: 160 +x : 11 y : 96 z : 31 +Registers used: 34 out of 35 (97.1%) + +ATmega32 instruction use summary: +.lds : 0 .sts : 0 adc : 50 add : 74 adiw : 175 and : 16 +andi : 60 asr : 0 bclr : 0 bld : 15 brbc : 196 brbs : 118 +brcc : 3 brcs : 4 break : 0 breq : 26 brge : 0 brhc : 0 +brhs : 2 brid : 0 brie : 0 brlo : 4 brlt : 0 brmi : 0 +brne : 44 brpl : 0 brsh : 2 brtc : 1 brts : 21 brvc : 0 +brvs : 0 bset : 0 bst : 24 call : 8 cbi : 41 cbr : 86 +clc : 5 clh : 0 cli : 84 cln : 0 clr : 77 cls : 0 +clt : 5 clv : 0 clz : 0 com : 1 cp : 38 cpc : 0 +cpi : 198 cpse : 13 dec : 73 eor : 11 fmul : 0 fmuls : 0 +fmulsu: 0 icall : 0 ijmp : 74 in : 413 inc : 58 jmp : 22 +ld : 52 ldd : 11 ldi : 480 lds : 165 lpm : 20 lsl : 9 +lsr : 2 mov : 151 movw : 10 mul : 0 muls : 0 mulsu : 0 +neg : 0 nop : 78 or : 14 ori : 6 out :1116 pop : 29 +push : 21 rcall : 340 ret : 64 reti : 7 rjmp : 830 rol : 8 +ror : 2 sbc : 2 sbci : 3 sbi : 83 sbic : 12 sbis : 32 +sbiw : 21 sbr : 68 sbrc : 56 sbrs : 35 sec : 5 seh : 0 +sei : 75 sen : 0 ser : 0 ses : 0 set : 3 sev : 0 +sez : 0 sleep : 0 spm : 0 st : 15 std : 4 sts : 163 +sub : 7 subi : 34 swap : 10 tst : 65 wdr : 0 +Instructions used: 75 out of 113 (66.4%) + +ATmega32 memory use summary [bytes]: +Segment Begin End Code Data Used Size Use% +--------------------------------------------------------------- +[.cseg] 0x000000 0x0039ac 13002 1716 14718 32768 44.9% +[.dseg] 0x000060 0x000300 0 633 633 2048 30.9% +[.eseg] 0x000001 0x000200 0 307 307 1024 30.0% + +Assembly complete, 0 errors, 0 warnings diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.map b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.map new file mode 100644 index 00000000..10a48357 --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.map @@ -0,0 +1,2064 @@ + +AVRASM ver. 2.1.43 6502_emu.asm Thu Feb 25 10:55:57 2016 + + +SET sam_version 0000032a +SET config_part 00000002 +SET config_version 0000033f +EQU SIGNATURE_000 0000001e +EQU SIGNATURE_001 00000095 +EQU SIGNATURE_002 00000002 +EQU SREG 0000003f +EQU SPL 0000003d +EQU SPH 0000003e +EQU OCR0 0000003c +EQU GICR 0000003b +EQU GIFR 0000003a +EQU TIMSK 00000039 +EQU TIFR 00000038 +EQU SPMCR 00000037 +EQU TWCR 00000036 +EQU MCUCR 00000035 +EQU MCUCSR 00000034 +EQU TCCR0 00000033 +EQU TCNT0 00000032 +EQU OSCCAL 00000031 +EQU OCDR 00000031 +EQU SFIOR 00000030 +EQU TCCR1A 0000002f +EQU TCCR1B 0000002e +EQU TCNT1L 0000002c +EQU TCNT1H 0000002d +EQU OCR1AL 0000002a +EQU OCR1AH 0000002b +EQU OCR1BL 00000028 +EQU OCR1BH 00000029 +EQU ICR1L 00000026 +EQU ICR1H 00000027 +EQU TCCR2 00000025 +EQU TCNT2 00000024 +EQU OCR2 00000023 +EQU ASSR 00000022 +EQU WDTCR 00000021 +EQU UBRRH 00000020 +EQU UCSRC 00000020 +EQU EEARL 0000001e +EQU EEARH 0000001f +EQU EEDR 0000001d +EQU EECR 0000001c +EQU PORTA 0000001b +EQU DDRA 0000001a +EQU PINA 00000019 +EQU PORTB 00000018 +EQU DDRB 00000017 +EQU PINB 00000016 +EQU PORTC 00000015 +EQU DDRC 00000014 +EQU PINC 00000013 +EQU PORTD 00000012 +EQU DDRD 00000011 +EQU PIND 00000010 +EQU SPDR 0000000f +EQU SPSR 0000000e +EQU SPCR 0000000d +EQU UDR 0000000c +EQU UCSRA 0000000b +EQU UCSRB 0000000a +EQU UBRRL 00000009 +EQU ACSR 00000008 +EQU ADMUX 00000007 +EQU ADCSRA 00000006 +EQU ADCH 00000005 +EQU ADCL 00000004 +EQU TWDR 00000003 +EQU TWAR 00000002 +EQU TWSR 00000001 +EQU TWBR 00000000 +EQU EEDR0 00000000 +EQU EEDR1 00000001 +EQU EEDR2 00000002 +EQU EEDR3 00000003 +EQU EEDR4 00000004 +EQU EEDR5 00000005 +EQU EEDR6 00000006 +EQU EEDR7 00000007 +EQU EERE 00000000 +EQU EEWE 00000001 +EQU EEMWE 00000002 +EQU EERIE 00000003 +EQU WDP0 00000000 +EQU WDP1 00000001 +EQU WDP2 00000002 +EQU WDE 00000003 +EQU WDTOE 00000004 +EQU WDDE 00000004 +EQU GIMSK 0000003b +EQU IVCE 00000000 +EQU IVSEL 00000001 +EQU INT2 00000005 +EQU INT0 00000006 +EQU INT1 00000007 +EQU INTF2 00000005 +EQU INTF0 00000006 +EQU INTF1 00000007 +EQU ISC00 00000000 +EQU ISC01 00000001 +EQU ISC10 00000002 +EQU ISC11 00000003 +EQU ISC2 00000006 +EQU CS00 00000000 +EQU CS01 00000001 +EQU CS02 00000002 +EQU WGM01 00000003 +EQU CTC0 00000003 +EQU COM00 00000004 +EQU COM01 00000005 +EQU WGM00 00000006 +EQU PWM0 00000006 +EQU FOC0 00000007 +EQU TCNT0_0 00000000 +EQU TCNT0_1 00000001 +EQU TCNT0_2 00000002 +EQU TCNT0_3 00000003 +EQU TCNT0_4 00000004 +EQU TCNT0_5 00000005 +EQU TCNT0_6 00000006 +EQU TCNT0_7 00000007 +EQU OCR0_0 00000000 +EQU OCR0_1 00000001 +EQU OCR0_2 00000002 +EQU OCR0_3 00000003 +EQU OCR0_4 00000004 +EQU OCR0_5 00000005 +EQU OCR0_6 00000006 +EQU OCR0_7 00000007 +EQU TOIE0 00000000 +EQU OCIE0 00000001 +EQU TOV0 00000000 +EQU OCF0 00000001 +EQU TOIE2 00000006 +EQU OCIE2 00000007 +EQU TOV2 00000006 +EQU OCF2 00000007 +EQU CS20 00000000 +EQU CS21 00000001 +EQU CS22 00000002 +EQU WGM21 00000003 +EQU CTC2 00000003 +EQU COM20 00000004 +EQU COM21 00000005 +EQU WGM20 00000006 +EQU PWM2 00000006 +EQU FOC2 00000007 +EQU TCNT2_0 00000000 +EQU TCNT2_1 00000001 +EQU TCNT2_2 00000002 +EQU TCNT2_3 00000003 +EQU TCNT2_4 00000004 +EQU TCNT2_5 00000005 +EQU TCNT2_6 00000006 +EQU TCNT2_7 00000007 +EQU OCR2_0 00000000 +EQU OCR2_1 00000001 +EQU OCR2_2 00000002 +EQU OCR2_3 00000003 +EQU OCR2_4 00000004 +EQU OCR2_5 00000005 +EQU OCR2_6 00000006 +EQU OCR2_7 00000007 +EQU TCR2UB 00000000 +EQU OCR2UB 00000001 +EQU TCN2UB 00000002 +EQU AS2 00000003 +EQU TOIE1 00000002 +EQU OCIE1B 00000003 +EQU OCIE1A 00000004 +EQU TICIE1 00000005 +EQU TOV1 00000002 +EQU OCF1B 00000003 +EQU OCF1A 00000004 +EQU ICF1 00000005 +EQU WGM10 00000000 +EQU PWM10 00000000 +EQU WGM11 00000001 +EQU PWM11 00000001 +EQU FOC1B 00000002 +EQU FOC1A 00000003 +EQU COM1B0 00000004 +EQU COM1B1 00000005 +EQU COM1A0 00000006 +EQU COM1A1 00000007 +EQU CS10 00000000 +EQU CS11 00000001 +EQU CS12 00000002 +EQU WGM12 00000003 +EQU CTC10 00000003 +EQU CTC1 00000003 +EQU WGM13 00000004 +EQU CTC11 00000004 +EQU ICES1 00000006 +EQU ICNC1 00000007 +EQU SPDR0 00000000 +EQU SPDR1 00000001 +EQU SPDR2 00000002 +EQU SPDR3 00000003 +EQU SPDR4 00000004 +EQU SPDR5 00000005 +EQU SPDR6 00000006 +EQU SPDR7 00000007 +EQU SPI2X 00000000 +EQU WCOL 00000006 +EQU SPIF 00000007 +EQU SPR0 00000000 +EQU SPR1 00000001 +EQU CPHA 00000002 +EQU CPOL 00000003 +EQU MSTR 00000004 +EQU DORD 00000005 +EQU SPE 00000006 +EQU SPIE 00000007 +EQU UDR0 00000000 +EQU UDR1 00000001 +EQU UDR2 00000002 +EQU UDR3 00000003 +EQU UDR4 00000004 +EQU UDR5 00000005 +EQU UDR6 00000006 +EQU UDR7 00000007 +EQU USR 0000000b +EQU MPCM 00000000 +EQU U2X 00000001 +EQU UPE 00000002 +EQU PE 00000002 +EQU DOR 00000003 +EQU FE 00000004 +EQU UDRE 00000005 +EQU TXC 00000006 +EQU RXC 00000007 +EQU UCR 0000000a +EQU TXB8 00000000 +EQU RXB8 00000001 +EQU UCSZ2 00000002 +EQU CHR9 00000002 +EQU TXEN 00000003 +EQU RXEN 00000004 +EQU UDRIE 00000005 +EQU TXCIE 00000006 +EQU RXCIE 00000007 +EQU UCPOL 00000000 +EQU UCSZ0 00000001 +EQU UCSZ1 00000002 +EQU USBS 00000003 +EQU UPM0 00000004 +EQU UPM1 00000005 +EQU UMSEL 00000006 +EQU URSEL 00000007 +EQU UBRRHI 00000020 +EQU ACME 00000003 +EQU ACIS0 00000000 +EQU ACIS1 00000001 +EQU ACIC 00000002 +EQU ACIE 00000003 +EQU ACI 00000004 +EQU ACO 00000005 +EQU ACBG 00000006 +EQU ACD 00000007 +EQU MUX0 00000000 +EQU MUX1 00000001 +EQU MUX2 00000002 +EQU MUX3 00000003 +EQU MUX4 00000004 +EQU ADLAR 00000005 +EQU REFS0 00000006 +EQU REFS1 00000007 +EQU ADCSR 00000006 +EQU ADPS0 00000000 +EQU ADPS1 00000001 +EQU ADPS2 00000002 +EQU ADIE 00000003 +EQU ADIF 00000004 +EQU ADATE 00000005 +EQU ADFR 00000005 +EQU ADSC 00000006 +EQU ADEN 00000007 +EQU ADCH0 00000000 +EQU ADCH1 00000001 +EQU ADCH2 00000002 +EQU ADCH3 00000003 +EQU ADCH4 00000004 +EQU ADCH5 00000005 +EQU ADCH6 00000006 +EQU ADCH7 00000007 +EQU ADCL0 00000000 +EQU ADCL1 00000001 +EQU ADCL2 00000002 +EQU ADCL3 00000003 +EQU ADCL4 00000004 +EQU ADCL5 00000005 +EQU ADCL6 00000006 +EQU ADCL7 00000007 +EQU ADTS0 00000005 +EQU ADTS1 00000006 +EQU ADTS2 00000007 +EQU PORTA0 00000000 +EQU PA0 00000000 +EQU PORTA1 00000001 +EQU PA1 00000001 +EQU PORTA2 00000002 +EQU PA2 00000002 +EQU PORTA3 00000003 +EQU PA3 00000003 +EQU PORTA4 00000004 +EQU PA4 00000004 +EQU PORTA5 00000005 +EQU PA5 00000005 +EQU PORTA6 00000006 +EQU PA6 00000006 +EQU PORTA7 00000007 +EQU PA7 00000007 +EQU DDA0 00000000 +EQU DDA1 00000001 +EQU DDA2 00000002 +EQU DDA3 00000003 +EQU DDA4 00000004 +EQU DDA5 00000005 +EQU DDA6 00000006 +EQU DDA7 00000007 +EQU PINA0 00000000 +EQU PINA1 00000001 +EQU PINA2 00000002 +EQU PINA3 00000003 +EQU PINA4 00000004 +EQU PINA5 00000005 +EQU PINA6 00000006 +EQU PINA7 00000007 +EQU PORTB0 00000000 +EQU PB0 00000000 +EQU PORTB1 00000001 +EQU PB1 00000001 +EQU PORTB2 00000002 +EQU PB2 00000002 +EQU PORTB3 00000003 +EQU PB3 00000003 +EQU PORTB4 00000004 +EQU PB4 00000004 +EQU PORTB5 00000005 +EQU PB5 00000005 +EQU PORTB6 00000006 +EQU PB6 00000006 +EQU PORTB7 00000007 +EQU PB7 00000007 +EQU DDB0 00000000 +EQU DDB1 00000001 +EQU DDB2 00000002 +EQU DDB3 00000003 +EQU DDB4 00000004 +EQU DDB5 00000005 +EQU DDB6 00000006 +EQU DDB7 00000007 +EQU PINB0 00000000 +EQU PINB1 00000001 +EQU PINB2 00000002 +EQU PINB3 00000003 +EQU PINB4 00000004 +EQU PINB5 00000005 +EQU PINB6 00000006 +EQU PINB7 00000007 +EQU PORTC0 00000000 +EQU PC0 00000000 +EQU PORTC1 00000001 +EQU PC1 00000001 +EQU PORTC2 00000002 +EQU PC2 00000002 +EQU PORTC3 00000003 +EQU PC3 00000003 +EQU PORTC4 00000004 +EQU PC4 00000004 +EQU PORTC5 00000005 +EQU PC5 00000005 +EQU PORTC6 00000006 +EQU PC6 00000006 +EQU PORTC7 00000007 +EQU PC7 00000007 +EQU DDC0 00000000 +EQU DDC1 00000001 +EQU DDC2 00000002 +EQU DDC3 00000003 +EQU DDC4 00000004 +EQU DDC5 00000005 +EQU DDC6 00000006 +EQU DDC7 00000007 +EQU PINC0 00000000 +EQU PINC1 00000001 +EQU PINC2 00000002 +EQU PINC3 00000003 +EQU PINC4 00000004 +EQU PINC5 00000005 +EQU PINC6 00000006 +EQU PINC7 00000007 +EQU PORTD0 00000000 +EQU PD0 00000000 +EQU PORTD1 00000001 +EQU PD1 00000001 +EQU PORTD2 00000002 +EQU PD2 00000002 +EQU PORTD3 00000003 +EQU PD3 00000003 +EQU PORTD4 00000004 +EQU PD4 00000004 +EQU PORTD5 00000005 +EQU PD5 00000005 +EQU PORTD6 00000006 +EQU PD6 00000006 +EQU PORTD7 00000007 +EQU PD7 00000007 +EQU DDD0 00000000 +EQU DDD1 00000001 +EQU DDD2 00000002 +EQU DDD3 00000003 +EQU DDD4 00000004 +EQU DDD5 00000005 +EQU DDD6 00000006 +EQU DDD7 00000007 +EQU PIND0 00000000 +EQU PIND1 00000001 +EQU PIND2 00000002 +EQU PIND3 00000003 +EQU PIND4 00000004 +EQU PIND5 00000005 +EQU PIND6 00000006 +EQU PIND7 00000007 +EQU SREG_C 00000000 +EQU SREG_Z 00000001 +EQU SREG_N 00000002 +EQU SREG_V 00000003 +EQU SREG_S 00000004 +EQU SREG_H 00000005 +EQU SREG_T 00000006 +EQU SREG_I 00000007 +EQU SM0 00000004 +EQU SM1 00000005 +EQU SM2 00000006 +EQU SE 00000007 +EQU MCUSR 00000034 +EQU PORF 00000000 +EQU EXTRF 00000001 +EQU BORF 00000002 +EQU WDRF 00000003 +EQU JTRF 00000004 +EQU JTD 00000007 +EQU CAL0 00000000 +EQU CAL1 00000001 +EQU CAL2 00000002 +EQU CAL3 00000003 +EQU CAL4 00000004 +EQU CAL5 00000005 +EQU CAL6 00000006 +EQU CAL7 00000007 +EQU PSR10 00000000 +EQU PSR2 00000001 +EQU PUD 00000002 +EQU SPMEN 00000000 +EQU PGERS 00000001 +EQU PGWRT 00000002 +EQU BLBSET 00000003 +EQU RWWSRE 00000004 +EQU ASRE 00000004 +EQU RWWSB 00000006 +EQU ASB 00000006 +EQU SPMIE 00000007 +EQU TWBR0 00000000 +EQU TWBR1 00000001 +EQU TWBR2 00000002 +EQU TWBR3 00000003 +EQU TWBR4 00000004 +EQU TWBR5 00000005 +EQU TWBR6 00000006 +EQU TWBR7 00000007 +EQU TWIE 00000000 +EQU TWEN 00000002 +EQU TWWC 00000003 +EQU TWSTO 00000004 +EQU TWSTA 00000005 +EQU TWEA 00000006 +EQU TWINT 00000007 +EQU TWPS0 00000000 +EQU TWPS1 00000001 +EQU TWS3 00000003 +EQU TWS4 00000004 +EQU TWS5 00000005 +EQU TWS6 00000006 +EQU TWS7 00000007 +EQU TWD0 00000000 +EQU TWD1 00000001 +EQU TWD2 00000002 +EQU TWD3 00000003 +EQU TWD4 00000004 +EQU TWD5 00000005 +EQU TWD6 00000006 +EQU TWD7 00000007 +EQU TWGCE 00000000 +EQU TWA0 00000001 +EQU TWA1 00000002 +EQU TWA2 00000003 +EQU TWA3 00000004 +EQU TWA4 00000005 +EQU TWA5 00000006 +EQU TWA6 00000007 +EQU LB1 00000000 +EQU LB2 00000001 +EQU BLB01 00000002 +EQU BLB02 00000003 +EQU BLB11 00000004 +EQU BLB12 00000005 +EQU CKSEL0 00000000 +EQU CKSEL1 00000001 +EQU CKSEL2 00000002 +EQU CKSEL3 00000003 +EQU BODEN 00000006 +EQU BODLEVEL 00000007 +EQU BOOTRST 00000000 +EQU BOOTSZ0 00000001 +EQU BOOTSZ1 00000002 +EQU EESAVE 00000003 +EQU SPIEN 00000005 +EQU JTAGEN 00000006 +EQU OCDEN 00000007 +DEF XH r27 +DEF XL r26 +DEF YH r29 +DEF YL r28 +DEF ZH r31 +DEF ZL r30 +EQU FLASHEND 00003fff +EQU IOEND 0000003f +EQU SRAM_START 00000060 +EQU SRAM_SIZE 00000800 +EQU RAMEND 0000085f +EQU XRAMEND 00000000 +EQU E2END 000003ff +EQU EEPROMEND 000003ff +EQU EEADRBITS 0000000a +EQU NRWW_START_ADDR 00003800 +EQU NRWW_STOP_ADDR 00003fff +EQU RWW_START_ADDR 00000000 +EQU RWW_STOP_ADDR 000037ff +EQU PAGESIZE 00000040 +EQU FIRSTBOOTSTART 00003f00 +EQU SECONDBOOTSTART 00003e00 +EQU THIRDBOOTSTART 00003c00 +EQU FOURTHBOOTSTART 00003800 +EQU SMALLBOOTSTART 00003f00 +EQU LARGEBOOTSTART 00003800 +EQU INT0addr 00000002 +EQU INT1addr 00000004 +EQU INT2addr 00000006 +EQU OC2addr 00000008 +EQU OVF2addr 0000000a +EQU ICP1addr 0000000c +EQU OC1Aaddr 0000000e +EQU OC1Baddr 00000010 +EQU OVF1addr 00000012 +EQU OC0addr 00000014 +EQU OVF0addr 00000016 +EQU SPIaddr 00000018 +EQU URXCaddr 0000001a +EQU UDREaddr 0000001c +EQU UTXCaddr 0000001e +EQU ADCCaddr 00000020 +EQU ERDYaddr 00000022 +EQU ACIaddr 00000024 +EQU TWIaddr 00000026 +EQU SPMRaddr 00000028 +EQU INT_VECTORS_SIZE 0000002a +EQU Osc_Hz 00f42400 +SET data_valid_ns 000000b4 +EQU BAUD 00009600 +EQU flowlo 00000080 +EQU flowhi 000000c0 +EQU iomap 000000bf +EQU phi2_ena 00000001 +EQU nmi_ena 00000001 +EQU ios1_default 00000081 +EQU spi_sel 00000010 +EQU i2c_sel 0000000e +EQU lcd_sel 0000000c +EQU spi_idle 0000001f +EQU spi_vat 00000001 +EQU io_reset_pin 00000011 +EQU eep_adr 00000003 +EQU ena_diag 00000001 +EQU cycle_time_tns 00000271 +EQU ten_ms 0000009b +EQU UBRR_value 00000019 +EQU Baud_error 00000001 +EQU spi_eep_adr 00000017 +EQU eep_vld 00000001 +DEF c r0 +DEF d r1 +DEF e r2 +DEF f r3 +DEF k r4 +DEF allon r5 +DEF one r6 +DEF zero r7 +DEF regx r8 +DEF regy r9 +DEF operand r10 +DEF spointer r11 +DEF clear r12 +DEF readmem r13 +DEF writemem r14 +DEF s r15 +DEF a r16 +DEF b r17 +DEF i r18 +DEF flags r19 +EQU deb_on 00000000 +EQU emu_run 00000001 +EQU deb_act 00000002 +EQU rvs_vid 00000003 +EQU op_ind 00000004 +EQU modify 00000005 +EQU string 00000006 +EQU dma_rpt 00000007 +DEF unused_r20 r20 +DEF rega r21 +DEF stat2 r22 +DEF stat r23 +DEF pcl r24 +DEF pch r25 +ESEG eep_string 00000001 +ESEG eep_auto 000000ff +ESEG eep_pat 00000100 +DSEG cmd_buf 00000060 +DSEG cmd_end 00000090 +DSEG cmd_inx 00000091 +DSEG cmd_esc_timer 00000092 +DSEG cmd_reg_timer 00000093 +DSEG lmem_display 00000094 +DSEG lmem_write 00000096 +DSEG lmem_disas 00000098 +DSEG sp_save 0000009a +DSEG adr_limit 0000009c +DSEG rstflag 0000009e +DSEG prog_num 0000009f +DSEG brkpt_lo 000000a0 +DSEG brkpt_hi 000000aa +DSEG brkpt_op 000000b4 +DSEG irq_mask 000000be +DSEG irq_flag 000000bf +DSEG timer_ena 000000c0 +DSEG t1_adr 000000c1 +DSEG t1_ctrl 000000c2 +DSEG tcdn_count 000000c3 +DSEG tcdn_top 000000c4 +DSEG selftest 000000c5 +DSEG i2c_statreg 000000c6 +DSEG lcd_flags 000000c7 +DSEG spi_cmd 000000c8 +DSEG spi_rdat 000000c9 +DSEG dma_last_cmd 000000ca +DSEG dma_tab_index 000000cb +DSEG dma_tab 000000cc +DSEG usart_ena 000000d3 +DSEG tx_inx 000000d4 +DSEG tx_fill 000000d5 +DSEG rx_inx 000000d6 +DSEG rx_fill 000000d7 +DSEG flow_cmd 000000d8 +DSEG alignfromhere@align@1868 000000d9 +DSEG tx_buf 00000100 +DSEG rx_buf 00000200 +EQU abuslo 00000018 +EQU aloddr 00000017 +EQU abushi 0000001b +EQU ahiddr 0000001a +EQU dbusin 00000013 +EQU dbusout 00000015 +EQU dbusddr 00000014 +EQU cbusin 00000010 +EQU cbus 00000012 +EQU cbusddr 00000011 +EQU ibus 0000003b +EQU IRQ_ena 000000c0 +EQU IRQ_dis 00000040 +EQU NMI_dis 00000000 +EQU usart_txi_dis 00000098 +EQU usart_txi_ena 000000b8 +CSEG reset 00001582 +CSEG NMI 00000367 +CSEG IRQ 00000327 +CSEG illegalint 000014fe +CSEG t1_icr 00000dbe +CSEG t1_ocra 00000db0 +CSEG t1_ocrb 00000db7 +CSEG t1_ovi 00000da9 +CSEG t0_cmi 00001502 +CSEG t0_ovi 00001544 +CSEG rx_int 0000002a +CSEG tx_udre 00000072 +EQU rx_break 0000004a +EQU t_rx_break 00000033 +EQU rx_break_irq 0000003f +EQU t_rx_break_irq 0000003e +EQU l_rx_break_irq 0000003f +EQU rx_brk_wait 00000043 +EQU x_rx_brk_wait 00000045 +CSEG crlf 0000197f +EQU l_rx_break 0000004a +EQU rx_no_overrun 00000056 +EQU t_rx_no_overrun 0000004e +EQU l_rx_no_overrun 00000056 +EQU rx_flow 00000062 +EQU t_rx_flow 00000059 +EQU rx_send_xoff 00000062 +EQU t_rx_send_xoff 0000005d +EQU l_rx_send_xoff 00000062 +EQU l_rx_flow 00000062 +EQU rx_acia_on 0000006e +EQU t_rx_acia_on 00000064 +EQU rx_int_ena 00000069 +EQU t_rx_int_ena 00000068 +EQU l_rx_int_ena 00000069 +EQU l_rx_acia_on 0000006e +EQU tx_flow 00000081 +EQU t_tx_flow 0000007b +EQU l_tx_flow 00000088 +EQU tx_fifo_empty 0000008b +EQU t_tx_fifo_empty 00000089 +EQU l_tx_fifo_empty 0000008b +EQU tx_acia_on 00000099 +EQU t_tx_acia_on 0000008f +EQU tx_int_ena 00000094 +EQU t_tx_int_ena 00000093 +EQU l_tx_int_ena 00000094 +EQU l_tx_acia_on 00000099 +CSEG load_wait 0000009d +CSEG load_abort 000000ab +CSEG rs_vect_empty 000000b2 +CSEG reset_msg 000000bd +CSEG bpt_clrd_msg 000000c1 +CSEG bpt_info 000000ce +CSEG bpt_slot_full 000000df +CSEG load_ok 000000f2 +CSEG err_nonhex 000000f7 +CSEG err_func 00000103 +CSEG illegal_int 00000116 +CSEG back_line 00000122 +SET core_version 0000033f +EQU op_nv 00000007 +EQU op_s 00000000 +EQU op_a 00000010 +EQU op_x 00000011 +EQU op_y 00000012 +EQU op_i 00000053 +EQU op_m 00000028 +EQU op_r 00000018 +EQU op_z 00000008 +EQU op_zxi 0000004c +EQU op_zx 00000009 +EQU op_zy 0000000a +EQU op_ziy 0000004d +EQU op_sa 00000006 +CSEG dis_opcode 00000127 +EQU IRQ_dma 00000338 +EQU t_IRQ_dma 00000329 +CSEG oc_tab 00000600 +EQU l_IRQ_dma 00000338 +SET cycles 00000001 +EQU NMI_dma 00000378 +EQU t_NMI_dma 00000369 +EQU l_NMI_dma 00000378 +CSEG ASL_s 000003a8 +CSEG CLC_s 000003b1 +CSEG CLD_s 000003b9 +CSEG CLI_s 000003c1 +CSEG CLV_s 000003cb +CSEG DEX_s 000003d3 +CSEG DEY_s 000003dd +CSEG INX_s 000003e7 +CSEG INY_s 000003f1 +CSEG LSR_s 000003fb +CSEG NOP_s 00000404 +CSEG PHA_s 0000040e +CSEG PHP_s 0000041e +CSEG PLA_s 00000434 +CSEG PLP_s 00000444 +CSEG ROL_s 0000045b +CSEG ROR_s 00000465 +CSEG SEC_s 0000046f +CSEG SED_s 00000477 +CSEG SEI_s 0000047f +CSEG TAX_s 00000489 +CSEG TAY_s 00000494 +CSEG TSX_s 0000049f +CSEG TXA_s 000004aa +CSEG TXS_s 000004b5 +CSEG TYA_s 000004bd +CSEG BCC_r 000004c8 +CSEG no_branch@adgen_r@4732 000004d0 +CSEG BCS_r 000004da +CSEG no_branch@adgen_r@4811 000004e2 +CSEG BEQ_r 000004ec +CSEG no_branch@adgen_r@4890 000004f4 +CSEG BMI_r 000004fe +CSEG no_branch@adgen_r@4969 00000506 +CSEG BNE_r 00000510 +CSEG no_branch@adgen_r@5048 00000518 +CSEG BPL_r 00000522 +CSEG no_branch@adgen_r@5127 0000052a +CSEG BVC_r 00000534 +CSEG no_branch@adgen_r@5206 0000053c +CSEG BVS_r 00000546 +CSEG no_branch@adgen_r@5285 0000054e +CSEG JMP_i 00000558 +CSEG JMP_a 00000562 +CSEG JSR_a 00000572 +CSEG RTS_s 00000591 +CSEG RTI_s 000005a6 +CSEG BRK_s 000005c5 +CSEG alignfromhere@align@6133 000005f2 +EQU ORA_zxi 0000097d +CSEG illegalop 00000700 +EQU ORA_z 0000099e +EQU ASL_z 00000a28 +CSEG ORA_m 000009af +CSEG ORA_a 000009a3 +CSEG ASL_a 00000a2d +EQU ORA_ziy 0000098a +EQU ORA_zx 00000998 +EQU ASL_zx 00000a22 +EQU ORA_y 00000974 +EQU ORA_x 0000096b +EQU ASL_x 00000a19 +EQU AND_zxi 00000774 +EQU BIT_z 000007b4 +EQU AND_z 00000795 +EQU ROL_z 00000a94 +CSEG AND_m 000007a6 +CSEG BIT_a 000007b9 +CSEG AND_a 0000079a +CSEG ROL_a 00000a99 +EQU AND_ziy 00000781 +EQU AND_zx 0000078f +EQU ROL_zx 00000a8e +EQU AND_y 0000076b +EQU AND_x 00000762 +EQU ROL_x 00000a85 +EQU EOR_zxi 0000087a +EQU EOR_z 0000089b +EQU LSR_z 00000a5e +CSEG EOR_m 000008ac +CSEG EOR_a 000008a0 +CSEG LSR_a 00000a63 +EQU EOR_ziy 00000887 +EQU EOR_zx 00000895 +EQU LSR_zx 00000a58 +EQU EOR_y 00000871 +EQU EOR_x 00000868 +EQU LSR_x 00000a4f +EQU ADC_zxi 00000714 +EQU ADC_z 00000735 +EQU ROR_z 00000acb +CSEG ADC_m 00000746 +CSEG ADC_a 0000073a +CSEG ROR_a 00000ad0 +EQU ADC_ziy 00000721 +EQU ADC_zx 0000072f +EQU ROR_zx 00000ac5 +EQU ADC_y 0000070b +EQU ADC_x 00000702 +EQU ROR_x 00000abc +EQU STA_zxi 00000b73 +EQU STY_z 00000be1 +EQU STA_z 00000b94 +EQU STX_z 00000bbb +CSEG STY_a 00000be5 +CSEG STA_a 00000b99 +CSEG STX_a 00000bc0 +EQU STA_ziy 00000b80 +EQU STY_zx 00000bdc +EQU STA_zx 00000b8e +EQU STX_zy 00000bb5 +EQU STA_y 00000b6a +EQU STA_x 00000b61 +CSEG LDY_m 0000095d +EQU LDA_zxi 000008cc +CSEG LDX_m 0000092e +EQU LDY_z 0000094b +EQU LDA_z 000008ed +EQU LDX_z 0000091c +CSEG LDA_m 000008ff +CSEG LDY_a 00000950 +CSEG LDA_a 000008f2 +CSEG LDX_a 00000921 +EQU LDA_ziy 000008d9 +EQU LDY_zx 00000945 +EQU LDA_zx 000008e7 +EQU LDX_zy 00000916 +EQU LDA_y 000008c3 +EQU LDY_x 0000093c +EQU LDA_x 000008ba +EQU LDX_y 0000090d +CSEG CPY_m 0000085a +EQU CMP_zxi 000007ea +EQU CPY_z 00000849 +EQU CMP_z 0000080b +EQU DEC_z 00000b02 +CSEG CMP_m 0000081c +CSEG CPY_a 0000084e +CSEG CMP_a 00000810 +CSEG DEC_a 00000b07 +EQU CMP_ziy 000007f7 +EQU CMP_zx 00000805 +EQU DEC_zx 00000afc +EQU CMP_y 000007e1 +EQU CMP_x 000007d8 +EQU DEC_x 00000af3 +CSEG CPX_m 0000083b +EQU SBC_zxi 000009cf +EQU CPX_z 0000082a +EQU SBC_z 000009f0 +EQU INC_z 00000b39 +CSEG SBC_m 00000a01 +CSEG CPX_a 0000082f +CSEG SBC_a 000009f5 +CSEG INC_a 00000b3e +EQU SBC_ziy 000009dc +EQU SBC_zx 000009ea +EQU INC_zx 00000b33 +EQU SBC_y 000009c6 +EQU SBC_x 000009bd +EQU INC_x 00000b2a +CSEG deb_inv_op 0000154b +CSEG ADC_o 00000740 +CSEG ioread 00000c02 +CSEG skip_IO@op_fetch@6748 00000746 +CSEG ADC_d 00000758 +CSEG ADC_d3 0000074e +CSEG ADC_d2 0000075f +CSEG AND_o 000007a0 +CSEG skip_IO@op_fetch@7204 000007a6 +CSEG BIT_m 000007c5 +CSEG BIT_o 000007bf +CSEG skip_IO@op_fetch@7389 000007c5 +CSEG CMP_o 00000816 +CSEG skip_IO@op_fetch@7834 0000081c +CSEG CPX_o 00000835 +CSEG skip_IO@op_fetch@8021 0000083b +CSEG CPY_o 00000854 +CSEG skip_IO@op_fetch@8208 0000085a +CSEG EOR_o 000008a6 +CSEG skip_IO@op_fetch@8646 000008ac +CSEG LDA_o 000008f8 +CSEG skip_IO@reg_fetch@9084 000008ff +CSEG LDX_o 00000927 +CSEG skip_IO@reg_fetch@9348 0000092e +CSEG LDY_o 00000956 +CSEG skip_IO@reg_fetch@9612 0000095d +CSEG ORA_o 000009a9 +CSEG skip_IO@op_fetch@10054 000009af +CSEG SBC_o 000009fb +CSEG skip_IO@op_fetch@10494 00000a01 +CSEG SBC_d 00000a0f +CSEG SBC_d2 00000a0d +CSEG ASL_o 00000a33 +CSEG ASL_m 00000a39 +CSEG iomodify 00000c01 +CSEG skip_IO@op_fetch_modify@10774 00000a39 +CSEG skip_store@store_modify@10819 00000a44 +CSEG do_io@store_modify@10819 00000a4e +CSEG iowrite 00000c08 +CSEG LSR_o 00000a69 +CSEG LSR_m 00000a6f +CSEG skip_IO@op_fetch_modify@11055 00000a6f +CSEG skip_store@store_modify@11100 00000a7a +CSEG do_io@store_modify@11100 00000a84 +CSEG ROL_o 00000a9f +CSEG ROL_m 00000aa5 +CSEG skip_IO@op_fetch_modify@11336 00000aa5 +CSEG skip_store@store_modify@11382 00000ab1 +CSEG do_io@store_modify@11382 00000abb +CSEG ROR_o 00000ad6 +CSEG ROR_m 00000adc +CSEG skip_IO@op_fetch_modify@11618 00000adc +CSEG skip_store@store_modify@11664 00000ae8 +CSEG do_io@store_modify@11664 00000af2 +CSEG DEC_o 00000b0d +CSEG DEC_m 00000b13 +CSEG skip_IO@op_fetch_modify@11900 00000b13 +CSEG skip_store@store_modify@11946 00000b1f +CSEG do_io@store_modify@11946 00000b29 +CSEG INC_o 00000b44 +CSEG INC_m 00000b4a +CSEG skip_IO@op_fetch_modify@12182 00000b4a +CSEG skip_store@store_modify@12228 00000b56 +CSEG do_io@store_modify@12228 00000b60 +CSEG STA_o 00000b9f +EQU STA_m 00000ba3 +CSEG skip_store@store_reg@12649 00000ba9 +CSEG do_io@store_reg@12649 00000bb3 +EQU STX_m 00000bca +CSEG STX_o 00000bc6 +CSEG skip_store@store_reg@12850 00000bd0 +CSEG do_io@store_reg@12850 00000bda +EQU STY_m 00000bef +CSEG STY_o 00000beb +CSEG skip_store@store_reg@12997 00000bf5 +CSEG do_io@store_reg@12997 00000bff +SET io_version 00000340 +CSEG ior_tab 00000e80 +CSEG iow_tab 00000e90 +CSEG io_reset 00000c0e +CSEG rs_IO_ext 00001568 +CSEG t1_rs 00000da2 +CSEG irq_rs 00000e59 +CSEG lcd_rs 00000c7f +CSEG spi_rs 00000fae +CSEG i2c_rs 0000113f +CSEG ltch_rs 00000f05 +EQU reset_delay 00000c21 +EQU reset_10ms_expired 00000c28 +EQU t_reset_10ms_expired 00000c24 +EQU x_reset_delay 00000c29 +EQU l_reset_10ms_expired 00000c28 +SET io_select 00000007 +SET io_strobe_pol 00000000 +SET io_sel_direct 00000006 +CSEG lcd_rd 00000c37 +EQU lcd_rd_scan 00000c50 +EQU t_lcd_rd_scan 00000c41 +CSEG ir_retry 00000e63 +EQU lcd_rd_adr 00000c4e +EQU l_lcd_rd_scan 00000c50 +CSEG lcd_wrt 00000c5b +EQU lcd_wrt_scan 00000c74 +EQU t_lcd_wrt_scan 00000c65 +CSEG iw_retry 00000e65 +EQU lcd_wrt_adr 00000c72 +EQU l_lcd_wrt_scan 00000c74 +CSEG iw_exit 00000e68 +CSEG lcd_rs_force 00000cc7 +CSEG lcd_init 00000cb2 +EQU lcd_rs_init 00000c91 +EQU x_lcd_rs_init 00000c9a +EQU lcd_rs_text 00000c98 +EQU t_lcd_rs_text 00000c96 +EQU l_lcd_rs_text 00000c99 +CSEG lcd_rs_wrt 00000ccc +EQU lcd_rs_readback 00000ca0 +CSEG lcd_rs_rd 00000cee +EQU x_lcd_rs_readback 00000ca9 +EQU lcd_rs_rd_fail 00000ca8 +EQU t_lcd_rs_rd_fail 00000ca6 +EQU l_lcd_rs_rd_fail 00000ca8 +EQU lcd_rs_fail 00000cb1 +EQU t_lcd_rs_fail 00000cad +CSEG lcd_fail 00000cbd +CSEG prtstr 00001983 +EQU l_lcd_rs_fail 00000cb1 +EQU rs_lcd_delay 00000cc8 +CSEG lcd_rs_fwrt 00000ce2 +EQU lcd_rs_busy 00000ccf +EQU lcd_rs_timeout 00000cd5 +EQU t_lcd_rs_timeout 00000cd2 +EQU l_lcd_rs_timeout 00000cd5 +EQU x_lcd_rs_busy 00000cdf +EQU lcd_rs_adr 00000ce0 +EQU lcd_rs_rd_busy 00000cf0 +EQU lcd_rs_rd_timeout 00000cf6 +EQU t_lcd_rs_rd_timeout 00000cf3 +EQU l_lcd_rs_rd_timeout 00000cf6 +EQU x_lcd_rs_rd_busy 00000d00 +EQU lcd_rs_rd_adr 00000d01 +CSEG acia_rx 00000d0e +EQU rx_irq_clear 00000d19 +EQU t_rx_irq_clear 00000d15 +EQU l_rx_irq_clear 00000d19 +EQU acia_rx_ena 00000d3d +EQU t_acia_rx_ena 00000d1c +EQU acia_rx_empty 00000d3b +EQU t_acia_rx_empty 00000d20 +EQU acia_rx_more 00000d2f +EQU t_acia_rx_more 00000d29 +EQU acia_rx_int 00000d2e +EQU t_acia_rx_int 00000d2d +EQU l_acia_rx_int 00000d2e +EQU l_acia_rx_more 00000d2f +EQU acia_flow 00000d3b +EQU t_acia_flow 00000d32 +EQU acia_send_xon 00000d3b +EQU t_acia_send_xon 00000d36 +EQU l_acia_send_xon 00000d3b +EQU l_acia_flow 00000d3b +EQU l_acia_rx_empty 00000d3b +EQU l_acia_rx_ena 00000d3d +CSEG acia_tx 00000d3f +CSEG iw_retry_ext 00000d42 +EQU tx_irq_clear 00000d50 +EQU t_tx_irq_clear 00000d4c +EQU l_tx_irq_clear 00000d50 +EQU acia_tx_more 00000d62 +EQU t_acia_tx_more 00000d5c +EQU acia_tx_int 00000d61 +EQU t_acia_tx_int 00000d60 +EQU l_acia_tx_int 00000d61 +EQU l_acia_tx_more 00000d62 +CSEG t1r_adr 00000d65 +CSEG t1w_adr 00000d69 +CSEG t1r_data 00000d6c +EQU t1r_data_word 00000d79 +EQU t_t1r_data_word 00000d70 +EQU l_t1r_data_word 00000d7e +EQU t1r_data_ctl 00000d7d +EQU t_t1r_data_ctl 00000d7a +EQU l_t1r_data_ctl 00000d7e +CSEG t1w_data 00000d80 +EQU t1w_data_word 00000d8d +EQU t_t1w_data_word 00000d84 +EQU l_t1w_data_word 00000da1 +EQU t1w_data_ctl 00000da1 +EQU t_t1w_data_ctl 00000d8e +EQU l_t1w_data_ctl 00000da1 +CSEG tcdn_r 00000dc5 +CSEG tcdn_w 00000dc9 +CSEG ir_mask 00000dce +CSEG iw_mask 00000dd2 +EQU mask_irq_clear 00000de2 +EQU t_mask_irq_clear 00000de0 +EQU l_mask_irq_clear 00000de3 +CSEG ir_flag 00000de4 +CSEG iw_flag 00000deb +EQU flag_irq_clear 00000dfe +EQU t_flag_irq_clear 00000dfd +EQU l_flag_irq_clear 00000dfe +CSEG ir_vector 00000dff +EQU ir_vect_internal 00000e21 +EQU t_ir_vect_internal 00000e07 +EQU ir_vect_b2 00000e0d +EQU t_ir_vect_b2 00000e0b +EQU l_ir_vect_b2 00000e0d +EQU ir_vect_b1 00000e12 +EQU t_ir_vect_b1 00000e10 +EQU l_ir_vect_b1 00000e12 +EQU ir_vect_b0 00000e17 +EQU t_ir_vect_b0 00000e15 +EQU l_ir_vect_b0 00000e17 +EQU ir_vect_clr_int 00000e21 +EQU t_ir_vect_clr_int 00000e20 +EQU l_ir_vect_clr_int 00000e21 +EQU l_ir_vect_internal 00000e21 +CSEG ir_diag 00000e23 +CSEG iw_diag 00000e2b +EQU iw_diag_enter 00000e47 +EQU t_iw_diag_enter 00000e2d +EQU iw_diag_irq 00000e39 +EQU t_iw_diag_irq 00000e38 +EQU l_iw_diag_irq 00000e39 +CSEG debugger 00001624 +EQU l_iw_diag_enter 00000e47 +CSEG diag_reset 00000e56 +CSEG soft_reset 000019cb +CSEG ir_exit 00000e75 +CSEG rs_exit 00000e76 +CSEG alignfromhere@align@15529 00000e77 +CSEG spr_data 00000f90 +CSEG io65xx_rd 00000f11 +CSEG ltch_rd 00000eee +CSEG iorE0 00000ee4 +CSEG iordreg 00000f50 +CSEG spw_data 00000f75 +CSEG io65xx_wrt 00000f31 +CSEG ltch_wrt 00000efa +CSEG iowE0 00000ee9 +CSEG iowtreg 00000f55 +CSEG iorE0_tab 00000ea0 +CSEG iowE0_tab 00000eb0 +CSEG ior_int_tab 00000ec0 +CSEG i2c_stat 00001135 +CSEG i2c_data_rd 000010ce +CSEG spr_dat_lst 00000faa +CSEG dmr_stat 00001098 +CSEG dmr_data 000010b2 +CSEG iow_int_tab 00000ed0 +CSEG i2c_cmd 0000110d +CSEG i2c_data_wrt 000010e2 +CSEG spw_cmd 00000f5a +CSEG dmw_cmd 00001080 +CSEG dmw_data 0000109c +CSEG spi_vss 00000ee0 +CSEG phi2_syncloop@phi2_sync@16060 00000f15 +CSEG phi2_synctable@phi2_sync@16060 00000f1c +CSEG phi2_syncloop@phi2_sync@16173 00000f35 +CSEG phi2_synctable@phi2_sync@16173 00000f3c +EQU spi_in 00000016 +EQU spi_ddr 00000017 +EQU spi_out 00000018 +EQU spi_sck 00000007 +EQU spi_miso 00000006 +EQU spi_mosi 00000005 +EQU spw_cmd_sshld 00000f6b +EQU t_spw_cmd_sshld 00000f60 +EQU l_spw_cmd_sshld 00000f6b +CSEG wait_spdr@wait_spi@16462 00000f85 +CSEG wait_spdr@wait_spi@16545 00000fa0 +CSEG wait_spdr@out_spi@16631 00000fba +CSEG wait_spdr@in_spi@16638 00000fbd +EQU spi_rs_fail 00000fc6 +EQU t_spi_rs_fail 00000fc2 +CSEG spi_fail 00000fcd +EQU l_spi_rs_fail 00000fc6 +CSEG dma_spi_rb 00000fd5 +EQU dma_spi_rssh 00000fef +EQU t_dma_spi_rssh 00000fd9 +EQU spi_drb_retry 00000fe4 +EQU t_spi_drb_retry 00000fdf +CSEG dma_spi_rb1 00000ff2 +EQU l_spi_drb_retry 00000fe4 +EQU t_spi_drb 00000fea +EQU spi_drb 00000fef +EQU l_spi_drb 00000fef +EQU l_dma_spi_rssh 00000fef +EQU spi_drb_loop 0000100b +CSEG wait_spdr@in_spi@16827 00001012 +CSEG dma_spi_wb 0000102d +EQU dma_spi_wssh 00001047 +EQU t_dma_spi_wssh 00001031 +EQU spi_dwb_retry 0000103c +EQU t_spi_dwb_retry 00001037 +CSEG dma_spi_wb1 0000104a +EQU l_spi_dwb_retry 0000103c +EQU t_spi_dwb 00001042 +EQU spi_dwb 00001047 +EQU l_spi_dwb 00001047 +EQU l_dma_spi_wssh 00001047 +EQU spi_dwb_loop 00001061 +CSEG wait_spdr@out_spi@17043 0000106d +CSEG dma_ct_end 00001093 +CSEG dma_cmd_tab 0000108b +EQU dmw_cmd_valid 00001088 +EQU t_dmw_cmd_valid 00001083 +EQU l_dmw_cmd_valid 00001088 +CSEG dma_cmd_inv 00001088 +CSEG dma_set_tab 00001093 +CSEG dma_i2c_wb 000011ac +CSEG dma_i2c_rb 00001156 +CSEG dma_eep_save 000013e3 +CSEG dma_eep_load 00001431 +EQU dmw_data_valid 000010ad +EQU t_dmw_data_valid 000010a4 +EQU l_dmw_data_valid 000010ad +EQU dmr_tab_end 000010b7 +EQU t_dmr_tab_end 000010b6 +EQU l_dmr_tab_end 000010b7 +EQU i2c_in 00000013 +EQU i2c_ddr 00000014 +EQU i2c_out 00000015 +EQU i2c_scl 00000000 +EQU i2c_sda 00000001 +EQU i2c_int 00000002 +EQU i2c_res 00000003 +EQU i2c_clk 00000014 +CSEG i2c_open 000010c3 +CSEG i2c_open_rs 000010c7 +EQU i2c_read_ok 000010df +EQU t_i2c_read_ok 000010d2 +CSEG i2c_putack 00001296 +CSEG i2c_read 00001274 +EQU l_i2c_read_ok 000010e0 +EQU i2c_adr 000010fa +EQU t_i2c_adr 000010e7 +CSEG i2c_start 00001221 +EQU i2c_start_ack 000010f2 +EQU t_i2c_start_ack 000010f0 +EQU l_i2c_start_ack 000010f5 +CSEG i2c_stop 000012b2 +EQU l_i2c_adr 000010fa +EQU i2_wrt_ok 0000110c +EQU t_i2_wrt_ok 000010fd +CSEG i2c_write 0000123a +EQU i2c_write_ack 00001104 +EQU t_i2c_write_ack 00001102 +EQU l_i2c_write_ack 00001107 +EQU l_i2_wrt_ok 0000110c +EQU i2c_cmd_012 00001123 +EQU t_i2c_cmd_012 00001112 +EQU i2c_cmd_stop 00001116 +EQU t_i2c_cmd_stop 00001114 +CSEG i2c_send_stop 00001128 +CSEG i2c_cmd_exit 00001125 +EQU l_i2c_cmd_stop 00001116 +EQU i2c_start_100 0000111d +EQU t_i2c_start_100 00001117 +CSEG i2c_reset 00001207 +EQU l_i2c_start_100 0000111d +EQU l_i2c_cmd_012 00001123 +EQU i2c_cmd_reset 00001125 +EQU t_i2c_cmd_reset 00001124 +EQU l_i2c_cmd_reset 00001125 +EQU i2c_not_stop 00001134 +EQU t_i2c_not_stop 0000112a +EQU l_i2c_not_stop 00001134 +CSEG i2c_reset_rs 00001208 +EQU i2c_rs_fail 0000114d +EQU t_i2c_rs_fail 00001149 +CSEG i2c_fail 0000114e +EQU l_i2c_rs_fail 0000114d +EQU i2c_drb_retry 00001161 +EQU t_i2c_drb_retry 0000115c +CSEG dma_i2c_rb1 0000116f +EQU l_i2c_drb_retry 00001161 +EQU t_i2c_drb 00001167 +EQU i2c_drb 0000116c +EQU l_i2c_drb 0000116c +CSEG dma_i2c_rbfail 0000116c +EQU i2c_drb_loop 00001188 +EQU x_i2c_drb_loop 0000119f +EQU i2c_dwb_retry 000011b7 +EQU t_i2c_dwb_retry 000011b2 +CSEG dma_i2c_wb1 000011c5 +EQU l_i2c_dwb_retry 000011b7 +EQU t_i2c_dwb 000011bd +EQU i2c_dwb 000011c2 +EQU l_i2c_dwb 000011c2 +CSEG dma_i2c_rwfail 000011c2 +EQU i2c_dwb_loop 000011da +EQU i2c_dwb_ack 000011f1 +EQU t_i2c_dwb_ack 000011eb +EQU l_i2c_dwb_ack 000011fc +EQU i2c_dwb_end_nak 000011fc +EQU t_i2c_dwb_end_nak 000011fb +EQU l_i2c_dwb_end_nak 000011fc +SET loop_cycles 00000001 +CSEG i2c_400kHz@wait_i2c@18081 0000120c +EQU i2c_stuck 00001214 +EQU t_i2c_stuck 00001212 +EQU l_i2c_stuck 0000121d +EQU i2c_sda_stuck 0000121b +EQU t_i2c_sda_stuck 00001219 +EQU l_i2c_sda_stuck 0000121c +EQU start_prev_ack 00001233 +EQU t_start_prev_ack 00001223 +CSEG i2c_400kHz@wait_i2c@18184 00001227 +CSEG i2c_400kHz@wait_i2c@18224 00001230 +EQU l_start_prev_ack 00001233 +CSEG i2c_400kHz@wait_i2c@18270 00001237 +CSEG i_wrtloop 0000123c +CSEG i2c_400kHz@wait_i2c@18313 00001240 +CSEG i_wrt0 00001247 +CSEG i_wrt1 00001249 +CSEG i2c_400kHz@wait_i2c@18359 0000124c +CSEG i2c_400kHz@wait_i2c@18399 00001255 +CSEG i2c_getack 0000125b +CSEG i2c_400kHz@wait_i2c@18441 0000125f +CSEG i2c_400kHz@wait_i2c@18479 00001265 +CSEG i2c_400kHz@wait_i2c@18519 0000126d +CSEG i_rdloop 00001275 +CSEG i2c_400kHz@wait_i2c@18561 0000127a +CSEG i2c_400kHz@wait_i2c@18599 0000127f +CSEG i2c_400kHz@wait_i2c@18637 00001285 +CSEG i2c_400kHz@wait_i2c@18677 0000128d +CSEG i2c_400kHz@wait_i2c@18724 0000129a +CSEG i_pack1 000012a1 +CSEG i_pack2 000012a3 +CSEG i2c_400kHz@wait_i2c@18770 000012a6 +CSEG i2c_400kHz@wait_i2c@18810 000012af +CSEG i2c_400kHz@wait_i2c@18848 000012b7 +CSEG i2c_400kHz@wait_i2c@18886 000012bc +CSEG i2c_400kHz@wait_i2c@18924 000012c2 +CSEG i2c_400kHz@wait_i2c@18964 000012ca +CSEG eep_open 000012cf +CSEG wait_spdr@out_spi@19076 000012dc +CSEG wait_spdr@in_spi@19083 000012df +CSEG eep_no_device 000012ea +CSEG err_no_eep 000014c7 +CSEG skip_main 00001c25 +CSEG eep_write 000012ef +EQU eep_new_slot 00001307 +EQU t_eep_new_slot 000012f1 +EQU eep_find_slot 000012f3 +EQU eep_write_wait 000012f3 +EQU x_eep_write_wait 000012f5 +EQU x_eep_find_slot 00001306 +EQU eep_slot_allocate 00001303 +EQU t_eep_slot_allocate 000012fc +EQU l_eep_slot_allocate 00001303 +CSEG eep_full 00001337 +EQU l_eep_new_slot 00001307 +EQU t_eep_write_open 0000130b +EQU eep_write_open 0000132b +EQU eep_write_ready 0000130d +CSEG wait_spdr@out_spi@19218 00001310 +CSEG wait_spdr@in_spi@19225 00001313 +CSEG wait_spdr@out_spi@19241 0000131c +CSEG wait_spdr@out_spi@19251 00001322 +CSEG wait_spdr@out_spi@19258 00001325 +CSEG wait_spdr@out_spi@19265 00001328 +EQU l_eep_write_open 0000132b +CSEG wait_spdr@out_spi@19293 0000132c +EQU t_eep_write_buf 00001332 +EQU eep_write_buf 00001334 +EQU l_eep_write_buf 00001334 +CSEG err_eep_full 000014c0 +CSEG eep_write_err 0000133a +CSEG eep_int_close 0000135b +CSEG discard_serial_stream 00001bdd +CSEG eep_write_close 00001340 +EQU eep_close_nxt_slot 00001345 +EQU t_eep_close_nxt_slot 00001344 +EQU l_eep_close_nxt_slot 00001345 +EQU eep_close_last_slot 00001348 +EQU t_eep_close_last_slot 00001347 +EQU l_eep_close_last_slot 00001348 +CSEG eep_close 0000134b +EQU eep_find_slot2 0000135d +EQU eep_write_wait2 0000135d +EQU x_eep_write_wait2 0000135f +EQU eep_free_slot 0000136a +EQU t_eep_free_slot 00001364 +EQU l_eep_free_slot 0000136a +EQU eep_write_wait4 0000136c +EQU x_eep_write_wait4 0000136e +CSEG eep_load_prog 0000136f +CSEG eep_prog 000014b2 +CSEG PrintHex 00001989 +EQU eep_scan_loop 0000137a +EQU x_eep_scan_loop 00001387 +EQU eep_load_bad_prog 00001386 +EQU t_eep_load_bad_prog 00001381 +CSEG eep_notfound 000014ac +EQU l_eep_load_bad_prog 00001386 +CSEG eep_read 000013b9 +EQU eep_file_incompat 00001392 +EQU t_eep_file_incompat 0000138d +CSEG bad_format 000014f3 +EQU l_eep_file_incompat 00001392 +EQU eep_load_loop 00001393 +EQU eep_load_byte 00001398 +EQU eep_load_pc 000013b2 +EQU t_eep_load_pc 000013af +EQU l_eep_load_pc 000013b2 +CSEG eep_loaded 000014b8 +EQU eep_next_slot 000013d4 +EQU t_eep_next_slot 000013bb +EQU eep_read_first 000013bf +EQU t_eep_read_first 000013bd +EQU l_eep_read_first 000013bf +EQU eep_find_prog 000013c1 +EQU x_eep_find_prog 000013c9 +CSEG eep_read_overrun 000013da +CSEG wait_spdr@out_spi@19705 000013cc +CSEG wait_spdr@out_spi@19712 000013cf +CSEG wait_spdr@out_spi@19719 000013d2 +EQU l_eep_next_slot 000013d4 +CSEG wait_spdr@in_spi@19753 000013d5 +CSEG err_corrupt 000014d3 +CSEG eep_app_read_exit 0000148c +EQU t_eep_ds_inv 000013f1 +EQU eep_ds_inv 000013f2 +EQU l_eep_ds_inv 000013f2 +EQU eep_app_save_data 00001414 +EQU eep_app_save_adr 00001418 +EQU t_eep_app_save_adr 00001416 +EQU x_eep_app_save_data 00001428 +EQU l_eep_app_save_adr 00001418 +CSEG eep_saved 000014bc +EQU t_eep_dl_inv 0000143f +EQU eep_dl_inv 00001440 +EQU l_eep_dl_inv 00001440 +EQU eep_app_scan_loop 0000144c +EQU x_eep_app_scan_loop 00001458 +EQU eep_app_load_bad_prog 00001457 +EQU t_eep_app_load_bad_prog 00001453 +EQU l_eep_app_load_bad_prog 00001457 +EQU eep_app_file_incompat 00001462 +EQU t_eep_app_file_incompat 0000145e +CSEG eep_app_read_exit2 0000148a +EQU l_eep_app_file_incompat 00001462 +EQU eep_app_load_loop 00001471 +EQU eep_app_load_adr 00001475 +EQU t_eep_app_load_adr 00001473 +EQU x_eep_app_load_loop 00001484 +EQU l_eep_app_load_adr 00001475 +CSEG eep_info1 0000148f +CSEG eep_info2 00001499 +CSEG eep_info3 0000149b +CSEG eep_info4 000014a1 +CSEG eep_none 000014a9 +CSEG save_wait 000014d9 +CSEG save_ok 000014e7 +CSEG save_abort 000014ec +EQU i_stop 00001501 +EQU x_i_stop 00001502 +EQU t0_esc_expired 0000150b +EQU t_t0_esc_expired 00001508 +EQU l_t0_esc_expired 0000150b +EQU t0_reg_expired 00001512 +EQU t_t0_reg_expired 0000150f +EQU l_t0_reg_expired 00001512 +EQU t0_tcdn_expired 0000151c +EQU t_t0_tcdn_expired 00001519 +EQU l_t0_tcdn_expired 0000151c +EQU t0_tcdn_irq 00001525 +EQU t_t0_tcdn_irq 00001524 +EQU l_t0_tcdn_irq 00001525 +EQU debug_start 00001542 +EQU t_debug_start 00001529 +EQU t0_dma 0000153a +EQU t_t0_dma 0000152b +EQU l_t0_dma 0000153a +EQU l_debug_start 00001542 +CSEG end_command 00001945 +EQU inv_op_irq_clear 00001556 +EQU t_inv_op_irq_clear 00001555 +EQU l_inv_op_irq_clear 00001556 +EQU t_deb_stop_unexp 0000155f +CSEG brkpt_chk_pc 00001b67 +EQU deb_stop_unexp 00001567 +CSEG show_regs 000019f5 +CSEG inv_instr 00001c9e +EQU l_deb_stop_unexp 00001567 +SET rs_ddr_done 00000001 +EQU clear_mem 000015d3 +EQU t_clear_mem 000015c0 +EQU memory_clear 000015c4 +EQU brkpt_reset 000015cf +EQU l_clear_mem 000015d8 +CSEG emu_msg 00001ca6 +CSEG built_msg 00001cb3 +EQU rspo_autoload 0000161d +EQU t_rspo_autoload 000015e2 +EQU reset_autoload 0000161d +EQU t_reset_autoload 000015e9 +EQU eep_load_ok 0000161d +EQU t_eep_load_ok 000015ee +CSEG load_reset_vector 000019e9 +EQU pc_load_ok 0000161a +EQU t_pc_load_ok 000015f1 +EQU eep_load_string 000015f6 +EQU x_eep_load_string 0000160c +EQU eep_load_special 00001609 +EQU t_eep_load_special 000015fd +EQU eep_auto_cr 00001606 +EQU t_eep_auto_cr 00001605 +EQU l_eep_auto_cr 00001606 +EQU eep_auto_quote 00001609 +EQU t_eep_auto_quote 00001608 +EQU l_eep_auto_quote 00001609 +EQU l_eep_load_special 00001609 +CSEG end_exit 0000194f +EQU l_pc_load_ok 0000161d +EQU l_eep_load_ok 0000161d +EQU l_reset_autoload 0000161d +EQU l_rspo_autoload 0000161d +CSEG PrintChr 00001992 +CSEG show_prompt 00001a2d +EQU debug_main 00001624 +EQU deb_wait4input 00001624 +EQU deb_timer_update 0000163a +EQU t_deb_timer_update 00001628 +EQU deb_esc_timer_update 00001633 +EQU t_deb_esc_timer_update 0000162e +EQU l_deb_esc_timer_update 00001633 +EQU deb_reg_timer_update 0000163a +EQU t_deb_reg_timer_update 00001637 +EQU l_deb_reg_timer_update 0000163a +EQU l_deb_timer_update 0000163a +EQU deb_true_esc 00001648 +EQU t_deb_true_esc 0000163e +CSEG erase2eol 00001973 +EQU l_deb_true_esc 00001648 +EQU deb_show_regs 0000165b +EQU t_deb_show_regs 0000164e +EQU deb_regs_run 00001659 +EQU t_deb_regs_run 00001650 +CSEG escape 00001979 +EQU l_deb_regs_run 0000165b +EQU l_deb_show_regs 0000165b +EQU deb_read_buf 00001678 +EQU t_deb_read_buf 00001661 +EQU deb_flow 00001675 +EQU t_deb_flow 0000166c +EQU deb_send_xon 00001675 +EQU t_deb_send_xon 00001670 +EQU l_deb_send_xon 00001675 +EQU l_deb_flow 00001675 +EQU x_deb_wait4input 00001682 +EQU l_deb_read_buf 00001681 +EQU deb_read_direct 0000167f +EQU t_deb_read_direct 0000167c +EQU l_deb_read_direct 00001681 +EQU x_debug_main 0000194d +EQU deb_esc_seq 0000168f +EQU t_deb_esc_seq 00001686 +EQU l_deb_esc_seq 0000194c +EQU deb_del2bs 00001695 +EQU t_deb_del2bs 00001694 +EQU l_deb_del2bs 00001695 +EQU deb_bs 000016a4 +EQU t_deb_bs 00001697 +EQU deb_bs_ok 000016a3 +EQU t_deb_bs_ok 00001699 +CSEG space 0000197b +EQU deb_bs_quote 000016a3 +EQU t_deb_bs_quote 000016a1 +EQU l_deb_bs_quote 000016a3 +EQU l_deb_bs_ok 000016a3 +EQU l_deb_bs 000016a4 +EQU deb_echo 000016b1 +EQU t_deb_echo 000016a8 +EQU deb_lower_case 000016af +EQU t_deb_lower_case 000016ae +EQU l_deb_lower_case 000016af +EQU l_deb_echo 000016b1 +EQU deb_string_mark 000016b7 +EQU t_deb_string_mark 000016b5 +EQU l_deb_string_mark 000016b7 +EQU deb_esc 000016bf +EQU t_deb_esc 000016b9 +EQU deb_esc_disabled 000016bc +EQU t_deb_esc_disabled 000016ba +EQU l_deb_esc_disabled 000016bc +EQU l_deb_esc 000016bf +EQU deb_step 000016d0 +EQU t_deb_step 000016c3 +CSEG disasm 00001a35 +EQU deb_step_inv 000016c9 +EQU t_deb_step_inv 000016c8 +EQU l_deb_step_inv 000016c9 +CSEG emu_start 00001910 +EQU l_deb_step 000016d0 +EQU deb_cr 0000194c +EQU t_deb_cr 000016d3 +EQU deb_empty 000016e0 +EQU t_deb_empty 000016d5 +EQU t_deb_shortcut 000016da +EQU deb_shortcut 000016e0 +EQU l_deb_shortcut 000016e0 +EQU l_deb_empty 000016e0 +EQU alter_reg 00001714 +EQU t_alter_reg 000016ee +EQU alter_rega 000016f4 +EQU t_alter_rega 000016f1 +CSEG get_byte 00001ac2 +EQU l_alter_rega 000016f4 +EQU alter_regx 000016f9 +EQU t_alter_regx 000016f6 +EQU l_alter_regx 000016f9 +EQU alter_regy 000016fe +EQU t_alter_regy 000016fb +EQU l_alter_regy 000016fe +EQU alter_spointer 00001703 +EQU t_alter_spointer 00001700 +EQU l_alter_spointer 00001703 +EQU alter_status 0000170e +EQU t_alter_status 00001705 +EQU l_alter_status 0000170e +EQU alter_pc 00001713 +EQU t_alter_pc 00001710 +CSEG get_adr 00001ae3 +EQU l_alter_pc 00001713 +CSEG invalid_command 00001930 +EQU l_alter_reg 00001714 +EQU br_util 0000176d +EQU t_br_util 00001717 +EQU br_info 0000171f +EQU t_br_info 0000171a +CSEG brkpt_info 00001b0d +EQU l_br_info 0000171f +EQU br_set 0000174e +EQU t_br_set 00001721 +EQU br_set_already 00001724 +EQU br_already_set 0000172c +EQU t_br_already_set 0000172a +EQU l_br_already_set 0000172c +EQU br_set_free 0000172f +EQU br_set_slot 00001747 +EQU t_br_set_slot 00001735 +EQU l_br_set_slot 00001747 +EQU l_br_set 0000174e +EQU br_clr 0000176c +EQU t_br_clr 00001750 +EQU br_clr_parse 00001750 +CSEG br_inv_cmd 0000176c +EQU br_clr_all 00001762 +EQU t_br_clr_all 0000175b +CSEG brkpt_clr_all 00001b35 +EQU br_clr_none_msg 00001761 +EQU t_br_clr_none_msg 0000175e +CSEG bpt_info_none 00001cca +EQU l_br_clr_none_msg 00001761 +EQU l_br_clr_all 00001762 +EQU br_clr_slot 0000176c +EQU t_br_clr_slot 00001765 +CSEG brkpt_clr_one 00001b42 +EQU l_br_clr_slot 0000176c +EQU l_br_clr 0000176c +EQU l_br_util 0000176d +EQU show_disasm 00001790 +EQU t_show_disasm 0000176f +EQU dis_next 0000177a +EQU t_dis_next 00001772 +EQU l_dis_next 0000177d +EQU dis_loop 00001780 +EQU l_show_disasm 00001790 +EQU eep_util 0000183e +EQU t_eep_util 00001793 +EQU eep_info 0000179c +EQU t_eep_info 00001796 +CSEG eep_auto_info 00001c73 +CSEG eep_cmd_info 00001c38 +EQU l_eep_info 0000179c +EQU eep_save 000017e0 +EQU t_eep_save 0000179f +EQU eep_save_inv_cmd 000017a3 +EQU t_eep_save_inv_cmd 000017a2 +EQU l_eep_save_inv_cmd 000017a3 +EQU eep_save_record 000017ac +EQU eep_wait_colon 000017ac +CSEG read_serial_esc 00001b94 +CSEG read_byte_esc 00001c31 +EQU eep_save_adr 000017cd +EQU t_eep_save_adr 000017b8 +CSEG eep_prsv 000017db +EQU eep_save_data 000017c8 +EQU t_eep_save_data 000017bc +EQU eep_save_data_loop 000017bc +EQU eep_save_error_checksum 000017c7 +EQU t_eep_save_error_checksum 000017c3 +CSEG err_chksum 00001cc1 +EQU l_eep_save_error_checksum 000017c7 +EQU l_eep_save_data 000017cc +EQU l_eep_save_adr 000017da +EQU eep_save_complete 000017d6 +EQU t_eep_save_complete 000017d1 +EQU l_eep_save_complete 000017da +EQU x_eep_save_record 000017db +EQU l_eep_save 000017e0 +EQU eep_load 000017eb +EQU t_eep_load 000017e2 +CSEG eep_inv_cmd 000017ea +EQU l_eep_load 000017eb +EQU eep_del 0000181a +EQU t_eep_del 000017ed +EQU eep_del_loop 000017f3 +EQU eep_del_slot 00001801 +EQU t_eep_del_slot 000017f8 +EQU eep_del_wait 000017ff +EQU x_eep_del_wait 00001801 +EQU l_eep_del_slot 00001801 +EQU eep_del_free 00001810 +EQU t_eep_del_free 00001807 +EQU l_eep_del_free 00001819 +EQU l_eep_del 0000181a +EQU eep_autoload 0000183e +EQU t_eep_autoload 0000181c +EQU eep_auto_parse 0000181d +EQU eep_auto_number 0000182a +EQU t_eep_auto_number 00001824 +CSEG get_wbyte 00001ad3 +CSEG eep_auto_write 00001c95 +EQU eep_auto_parse2 00001827 +EQU l_eep_auto_number 0000182a +EQU eep_auto_next 0000183a +EQU t_eep_auto_next 0000182c +CSEG eep_auto_invalid 0000183d +EQU eep_auto_string 0000182f +EQU t_eep_string_end 00001834 +EQU eep_string_end 00001835 +EQU l_eep_string_end 00001835 +EQU l_eep_auto_next 0000183a +EQU l_eep_autoload 0000183e +EQU l_eep_util 0000183e +EQU show_mem 00001887 +EQU t_show_mem 00001841 +CSEG skip_get_adr 00001864 +EQU show_next 00001855 +EQU t_show_next 0000184b +EQU show_nxt_100 0000184f +EQU t_show_nxt_100 0000184d +EQU l_show_nxt_100 00001851 +EQU l_show_next 00001855 +EQU show_previous 00001862 +EQU t_show_previous 00001857 +EQU show_prev_100 0000185b +EQU t_show_prev_100 00001859 +EQU l_show_prev_100 0000185d +EQU l_show_previous 00001862 +EQU show_mem_line 0000186d +CSEG colon 0000197d +EQU show_mem_data 00001873 +EQU show_mem_brk 0000187b +EQU t_show_mem_brk 0000187a +CSEG brkpt_chk 00001b55 +EQU l_show_mem_brk 0000187b +CSEG RevHex 0000195e +EQU l_show_mem 00001887 +EQU write_mem 000018b7 +EQU t_write_mem 00001889 +EQU write_next 00001891 +EQU t_write_next 0000188c +EQU l_write_next 00001897 +CSEG get_wadr 00001af8 +EQU write_mem_dryrun 00001898 +EQU x_write_mem_dryrun 0000189f +EQU write_mem_realrun 000018a2 +EQU x_write_mem_realrun 000018b0 +CSEG brkpt_chk_write 00001b7e +EQU l_write_mem 000018b7 +EQU load_mem 000018fa +EQU t_load_mem 000018ba +EQU load_mem_record 000018c2 +EQU wait_colon 000018c2 +EQU load_mem_data 000018ea +EQU t_load_mem_data 000018d5 +EQU load_data 000018d7 +EQU load_error_checksum 000018e9 +EQU t_load_error_checksum 000018e5 +EQU l_load_error_checksum 000018e9 +EQU l_load_mem_data 000018f8 +EQU load_complete 000018f4 +EQU t_load_complete 000018ec +EQU load_pc 000018ef +EQU t_load_pc 000018ee +EQU l_load_pc 000018ef +EQU l_load_complete 000018f8 +EQU x_load_mem_record 000018f9 +EQU l_load_mem 000018fa +EQU halt_emu 00001901 +EQU t_halt_emu 000018fc +EQU l_halt_emu 00001901 +EQU start_emu 00001920 +EQU t_start_emu 00001903 +EQU emu_start_brk 0000191b +EQU t_emu_start_brk 0000191a +EQU l_emu_start_brk 0000191b +EQU l_start_emu 00001920 +EQU exit_deb 00001929 +EQU t_exit_deb 00001922 +EQU l_exit_deb 00001929 +EQU deb_reset 00001930 +EQU t_deb_reset 0000192b +EQU l_deb_reset 00001930 +EQU deb_invalid 00001939 +EQU inv_string_mark 0000193f +EQU t_inv_string_mark 0000193d +EQU l_inv_string_mark 0000193f +EQU l_deb_cr 0000194c +CSEG revx_dgt 00001962 +CSEG RevChr 00001967 +EQU rvs_video_off 00001972 +EQU t_rvs_video_off 0000196a +CSEG esc91 00001976 +CSEG prtc 0000199a +EQU l_rvs_video_off 00001972 +EQU print_string 00001983 +EQU x_print_string 00001988 +CSEG prtx_dgt 0000198d +EQU reverse_video_off 0000199a +EQU t_reverse_video_off 00001994 +EQU l_reverse_video_off 0000199a +EQU prt_fifo 000019b3 +EQU t_prt_fifo 0000199d +EQU prt_fifo_full 000019a1 +EQU l_prt_fifo 000019c8 +EQU prt_fifo_disabled 000019b5 +EQU x_prt_fifo_disabled 000019c1 +EQU prt_fifo_wait_udre 000019bc +EQU x_prt_fifo_wait_udre 000019be +EQU prt_wait_udre 000019c5 +EQU x_prt_wait_udre 000019c7 +EQU sr_chk_tdre 000019d8 +EQU t_sr_chk_tdre 000019d2 +EQU sr_set_tdre 000019d8 +EQU t_sr_set_tdre 000019d5 +EQU l_sr_set_tdre 000019d8 +EQU l_sr_chk_tdre 000019d8 +EQU show_reg_run 00001a03 +EQU t_show_reg_run 00001a01 +EQU l_show_reg_run 00001a04 +EQU show_runmode 00001a31 +EQU t_show_runmode 00001a2f +EQU l_show_runmode 00001a32 +EQU show_dis_brk 00001a3f +EQU t_show_dis_brk 00001a3d +EQU l_show_dis_brk 00001a3f +EQU dis_immediate 00001a56 +EQU t_dis_immediate 00001a54 +EQU l_dis_immediate 00001a56 +EQU dis_pre_indirect 00001a5a +EQU t_dis_pre_indirect 00001a58 +EQU l_dis_pre_indirect 00001a5a +EQU dis_bitnum 00001a63 +EQU t_dis_bitnum 00001a5c +EQU l_dis_bitnum 00001a63 +EQU dis_data_one 00001a6d +EQU t_dis_data_one 00001a67 +EQU l_dis_data_one 00001a6d +EQU dis_data_abs 00001a7c +EQU t_dis_data_abs 00001a6f +EQU l_dis_data_abs 00001a7c +EQU dis_data_rel 00001a7f +EQU t_dis_data_rel 00001a7e +CSEG dis_rel 00001aab +EQU l_dis_data_rel 00001a7f +EQU dis_x 00001a87 +EQU t_dis_x 00001a83 +EQU l_dis_x 00001a87 +EQU dis_y 00001a8d +EQU t_dis_y 00001a89 +EQU l_dis_y 00001a8d +EQU dis_i 00001a91 +EQU t_dis_i 00001a8f +EQU l_dis_i 00001a91 +EQU dis_xi 00001a99 +EQU t_dis_xi 00001a93 +EQU l_dis_xi 00001a99 +EQU dis_iy 00001aa1 +EQU t_dis_iy 00001a9b +EQU l_dis_iy 00001aa1 +EQU dis_a 00001aa5 +EQU t_dis_a 00001aa3 +EQU l_dis_a 00001aa5 +EQU dis_nv 00001aaa +EQU t_dis_nv 00001aa7 +EQU l_dis_nv 00001aaa +EQU dis_rel_sign 00001ab4 +EQU t_dis_rel_sign 00001ab3 +EQU l_dis_rel_sign 00001ab4 +CSEG get_hex 00001ab9 +EQU hex_a_f 00001ac1 +EQU t_hex_a_f 00001abc +CSEG inv_cmd 00001adc +EQU l_hex_a_f 00001ac1 +EQU byte_parse 00001ac2 +EQU adr_parse 00001ae3 +EQU adr_nibble 00001aeb +EQU x_adr_nibble 00001af7 +EQU adr_shift_nibble 00001af0 +EQU wadr_parse 00001af8 +EQU wadr_nibble 00001b00 +EQU x_wadr_nibble 00001b0c +EQU wadr_shift_nibble 00001b05 +EQU br_find_actv 00001b10 +EQU br_info_none 00001b1e +EQU t_br_info_none 00001b1a +EQU l_br_info_none 00001b34 +EQU br_info_all 00001b22 +EQU t_br_info_slot 00001b28 +EQU br_info_slot 00001b31 +EQU l_br_info_slot 00001b31 +EQU br_clr_all_slots 00001b38 +EQU br_clr_all_msg 00001b41 +EQU t_br_clr_all_msg 00001b3e +EQU l_br_clr_all_msg 00001b41 +EQU t_br_clr_one_slot 00001b48 +EQU br_clr_one_slot 00001b54 +EQU l_br_clr_one_slot 00001b54 +EQU br_chk_adr 00001b57 +EQU br_slot_match 00001b64 +EQU t_br_slot_match 00001b5d +EQU t_br_slot_valid 00001b61 +EQU br_slot_valid 00001b63 +EQU l_br_slot_valid 00001b63 +EQU l_br_slot_match 00001b64 +EQU br_pc_adr 00001b6c +EQU br_pc_match 00001b79 +EQU t_br_pc_match 00001b72 +EQU t_br_pc_valid 00001b76 +EQU br_pc_valid 00001b78 +EQU l_br_pc_valid 00001b78 +CSEG br_chkp_exit 00001b7b +EQU l_br_pc_match 00001b79 +EQU br_chkw_adr 00001b82 +EQU br_slotw_match 00001b8f +EQU t_br_slotw_match 00001b88 +EQU t_br_slotw_valid 00001b8c +EQU br_slotw_valid 00001b8e +EQU l_br_slotw_valid 00001b8e +CSEG br_chkw_exit 00001b91 +EQU l_br_slotw_match 00001b8f +EQU wait_ser_data 00001b96 +EQU esc_read_buf 00001bb2 +EQU t_esc_read_buf 00001b9c +EQU esc_flow 00001baf +EQU t_esc_flow 00001ba6 +EQU esc_send_xon 00001baf +EQU t_esc_send_xon 00001baa +EQU l_esc_send_xon 00001baf +EQU l_esc_flow 00001baf +EQU x_wait_ser_data 00001bb9 +EQU l_esc_read_buf 00001bb8 +EQU esc_read_direct 00001bb8 +EQU t_esc_read_direct 00001bb6 +EQU l_esc_read_direct 00001bb8 +EQU read_abort 00001bcb +EQU t_read_abort 00001bbd +EQU esc_read_load 00001bc6 +EQU t_esc_read_load 00001bc1 +EQU l_esc_read_load 00001bcb +CSEG eep_close_err 00001bc9 +EQU l_read_abort 00001bcb +CSEG load_hex 00001bcc +EQU load_a_f 00001bd5 +EQU t_load_a_f 00001bd0 +CSEG inv_hex 00001bd6 +EQU l_load_a_f 00001bd5 +EQU discard_serial 00001be0 +EQU disc_read_buf 00001c02 +EQU t_disc_read_buf 00001be6 +EQU disc_flow 00001bf9 +EQU t_disc_flow 00001bf0 +EQU disc_send_xon 00001bf9 +EQU t_disc_send_xon 00001bf4 +EQU l_disc_send_xon 00001bf9 +EQU l_disc_flow 00001bf9 +EQU disc_read_keepalive 00001c01 +EQU t_disc_read_keepalive 00001bff +EQU l_disc_read_keepalive 00001c01 +EQU l_disc_read_buf 00001c0e +EQU disc_read_direct 00001c0e +EQU t_disc_read_direct 00001c06 +EQU disc_read_keepalive2 00001c0e +EQU t_disc_read_keepalive2 00001c0c +EQU l_disc_read_keepalive2 00001c0e +EQU l_disc_read_direct 00001c0e +EQU disc_timer_update 00001c1d +EQU t_disc_timer_update 00001c12 +EQU disc_esc_timer_update 00001c1d +EQU t_disc_esc_timer_update 00001c18 +EQU l_disc_esc_timer_update 00001c1d +EQU l_disc_timer_update 00001c1d +EQU x_discard_serial 00001c22 +EQU eep_get_free 00001c3e +EQU eep_inc_free 00001c48 +EQU t_eep_inc_free 00001c43 +EQU eep_100_free 00001c48 +EQU t_eep_100_free 00001c45 +EQU l_eep_100_free 00001c48 +EQU l_eep_inc_free 00001c48 +EQU eep_list 00001c50 +EQU eep_pslots 00001c51 +EQU eep_next 00001c5c +EQU t_eep_next 00001c56 +EQU eep_inc_same 00001c59 +EQU t_eep_inc_same 00001c58 +EQU l_eep_inc_same 00001c59 +EQU eep_find_low 00001c5c +EQU t_eep_find_low 00001c5a +EQU l_eep_find_low 00001c5c +EQU l_eep_next 00001c5c +EQU x_eep_list 00001c70 +EQU eep_list_index 00001c68 +EQU t_eep_list_index 00001c63 +EQU l_eep_list_index 00001c68 +EQU eep_no_auto 00001c80 +EQU t_eep_no_auto 00001c7c +EQU l_eep_no_auto 00001c94 +EQU eep_auto_info_string 00001c94 +EQU t_eep_auto_info_string 00001c87 +EQU eep_auto_info_str2 00001c8b +EQU l_eep_auto_info_string 00001c94 +EQU eep_auto_wait 00001c9b +EQU x_eep_auto_wait 00001c9d diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.obj b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.obj new file mode 100644 index 00000000..2009ff82 Binary files /dev/null and b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/6502_emu.obj differ diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/avrBuild.bat b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/avrBuild.bat new file mode 100644 index 00000000..9eb427f2 --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/avrBuild.bat @@ -0,0 +1 @@ +avrasm2 -fI -W+ie -C V2E 6502_emu.asm -o 6502_emu.hex -d 6502_emu.obj -e 6502_emu.eep -w -m 6502_emu.map -S labels.tmp -l 6502_emu.lst diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/labels.tmp b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/labels.tmp new file mode 100644 index 00000000..5c213c5e --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/labels.tmp @@ -0,0 +1,395 @@ + + 2.1.43 + ATmega32 + E:\0_AVRProjects\AVR_6502\6502_Emu_328p + + + + 6502_emu.asm + + sam.inc + 6502_Emu_config.inc + m32def.inc + 6502_Emu_NMOS.inc + 6502_Emu_IO.inc + + + 6502_emu.obj + + + 6502_emu.hex + 6502_emu.eep + + + 6502_emu.map + 6502_emu.lst + + + 6502_emu.asm211 + 6502_emu.asm214 + 6502_emu.asm215 + 6502_emu.asm230 + 6502_emu.asm231 + 6502_emu.asm232 + 6502_emu.asm233 + 6502_emu.asm235 + 6502_emu.asm237 + 6502_emu.asm239 + 6502_emu.asm240 + 6502_emu.asm241 + 6502_emu.asm242 + 6502_emu.asm243 + 6502_emu.asm244 + 6502_emu.asm245 + 6502_emu.asm246 + 6502_emu.asm247 + 6502_emu.asm250 + 6502_emu.asm252 + 6502_emu.asm255 + 6502_emu.asm256 + 6502_emu.asm257 + 6502_emu.asm259 + 6502_emu.asm260 + 6502_emu.asm262 + 6502_emu.asm264 + 6502_emu.asm268 + 6502_emu.asm271 + 6502_emu.asm272 + 6502_emu.asm275 + 6502_emu.asm278 + 6502_emu.asm286 + 6502_emu.asm289 + 6502_emu.asm290 + 6502_emu.asm291 + 6502_emu.asm292 + 6502_emu.asm293 + 6502_emu.asm294 + 6502_emu.asm296 + 6502_emu.asm297 + 6502_emu.asm881 + 6502_Emu_NMOS.inc744 + 6502_Emu_NMOS.inc670 + 6502_emu.asm663 + 6502_Emu_IO.inc890 + 6502_Emu_IO.inc878 + 6502_Emu_IO.inc884 + 6502_Emu_IO.inc872 + 6502_emu.asm671 + 6502_emu.asm737 + 6502_emu.asm475 + 6502_emu.asm552 + 6502_emu.asm2065 + 6502_emu.asm617 + 6502_emu.asm618 + 6502_emu.asm620 + 6502_emu.asm621 + 6502_emu.asm622 + 6502_emu.asm623 + 6502_emu.asm625 + 6502_emu.asm627 + 6502_emu.asm628 + 6502_emu.asm629 + 6502_emu.asm630 + 6502_emu.asm631 + 6502_Emu_NMOS.inc61 + 6502_Emu_NMOS.inc1290 + 6502_Emu_NMOS.inc844 + 6502_Emu_NMOS.inc852 + 6502_Emu_NMOS.inc859 + 6502_Emu_NMOS.inc866 + 6502_Emu_NMOS.inc881 + 6502_Emu_NMOS.inc888 + 6502_Emu_NMOS.inc897 + 6502_Emu_NMOS.inc906 + 6502_Emu_NMOS.inc915 + 6502_Emu_NMOS.inc924 + 6502_Emu_NMOS.inc932 + 6502_Emu_NMOS.inc939 + 6502_Emu_NMOS.inc954 + 6502_Emu_NMOS.inc976 + 6502_Emu_NMOS.inc988 + 6502_Emu_NMOS.inc1009 + 6502_Emu_NMOS.inc1018 + 6502_Emu_NMOS.inc1027 + 6502_Emu_NMOS.inc1034 + 6502_Emu_NMOS.inc1041 + 6502_Emu_NMOS.inc1055 + 6502_Emu_NMOS.inc1063 + 6502_Emu_NMOS.inc1071 + 6502_Emu_NMOS.inc1079 + 6502_Emu_NMOS.inc1087 + 6502_Emu_NMOS.inc1095 + 6502_Emu_NMOS.inc1110 + 6502_Emu_NMOS.inc1114 + 6502_Emu_NMOS.inc1118 + 6502_Emu_NMOS.inc1122 + 6502_Emu_NMOS.inc1126 + 6502_Emu_NMOS.inc1130 + 6502_Emu_NMOS.inc1134 + 6502_Emu_NMOS.inc1138 + 6502_Emu_NMOS.inc1142 + 6502_Emu_NMOS.inc1154 + 6502_Emu_NMOS.inc1164 + 6502_Emu_NMOS.inc1192 + 6502_Emu_NMOS.inc1206 + 6502_Emu_NMOS.inc1232 + 6502_Emu_NMOS.inc1553 + 6502_Emu_NMOS.inc1761 + 6502_Emu_NMOS.inc1758 + 6502_Emu_NMOS.inc1813 + 6502_Emu_NMOS.inc1615 + 6502_Emu_NMOS.inc1625 + 6502_Emu_NMOS.inc1612 + 6502_Emu_NMOS.inc1841 + 6502_Emu_NMOS.inc1701 + 6502_Emu_NMOS.inc1698 + 6502_Emu_NMOS.inc1827 + 6502_Emu_NMOS.inc1582 + 6502_Emu_NMOS.inc1579 + 6502_Emu_NMOS.inc1856 + 6502_Emu_NMOS.inc1925 + 6502_Emu_NMOS.inc1911 + 6502_Emu_NMOS.inc1918 + 6502_Emu_NMOS.inc1745 + 6502_Emu_NMOS.inc1732 + 6502_Emu_NMOS.inc1719 + 6502_Emu_NMOS.inc1742 + 6502_Emu_NMOS.inc1716 + 6502_Emu_NMOS.inc1729 + 6502_Emu_NMOS.inc1683 + 6502_Emu_NMOS.inc1653 + 6502_Emu_NMOS.inc1680 + 6502_Emu_NMOS.inc1650 + 6502_Emu_NMOS.inc1871 + 6502_Emu_NMOS.inc1668 + 6502_Emu_NMOS.inc1781 + 6502_Emu_NMOS.inc1665 + 6502_Emu_NMOS.inc1778 + 6502_Emu_NMOS.inc1886 + 6502_emu.asm778 + 6502_Emu_NMOS.inc1581 + 6502_Emu_IO.inc378 + 6502_Emu_NMOS.inc1594 + 6502_Emu_NMOS.inc1592 + 6502_Emu_NMOS.inc1601 + 6502_Emu_NMOS.inc1614 + 6502_Emu_NMOS.inc1628 + 6502_Emu_NMOS.inc1627 + 6502_Emu_NMOS.inc1652 + 6502_Emu_NMOS.inc1667 + 6502_Emu_NMOS.inc1682 + 6502_Emu_NMOS.inc1700 + 6502_Emu_NMOS.inc1718 + 6502_Emu_NMOS.inc1731 + 6502_Emu_NMOS.inc1744 + 6502_Emu_NMOS.inc1760 + 6502_Emu_NMOS.inc1780 + 6502_Emu_NMOS.inc1799 + 6502_Emu_NMOS.inc1796 + 6502_Emu_NMOS.inc1815 + 6502_Emu_NMOS.inc1816 + 6502_Emu_IO.inc376 + 6502_Emu_IO.inc387 + 6502_Emu_NMOS.inc1829 + 6502_Emu_NMOS.inc1830 + 6502_Emu_NMOS.inc1843 + 6502_Emu_NMOS.inc1844 + 6502_Emu_NMOS.inc1858 + 6502_Emu_NMOS.inc1859 + 6502_Emu_NMOS.inc1873 + 6502_Emu_NMOS.inc1874 + 6502_Emu_NMOS.inc1888 + 6502_Emu_NMOS.inc1889 + 6502_Emu_NMOS.inc1913 + 6502_Emu_NMOS.inc1920 + 6502_Emu_NMOS.inc1927 + 6502_Emu_config.inc194 + 6502_Emu_config.inc213 + 6502_Emu_IO.inc400 + 6502_emu.asm820 + 6502_Emu_IO.inc864 + 6502_Emu_IO.inc1115 + 6502_Emu_IO.inc508 + 6502_Emu_IO.inc1288 + 6502_Emu_IO.inc1804 + 6502_Emu_config.inc364 + 6502_Emu_IO.inc464 + 6502_Emu_IO.inc1136 + 6502_Emu_IO.inc485 + 6502_Emu_IO.inc1141 + 6502_Emu_IO.inc1147 + 6502_Emu_IO.inc568 + 6502_Emu_IO.inc559 + 6502_Emu_IO.inc576 + 6502_Emu_IO.inc599 + 6502_Emu_IO.inc565 + 6502_emu.asm2071 + 6502_Emu_IO.inc594 + 6502_Emu_IO.inc630 + 6502_Emu_IO.inc721 + 6502_Emu_IO.inc744 + 6502_Emu_IO.inc801 + 6502_Emu_IO.inc806 + 6502_Emu_IO.inc810 + 6502_Emu_IO.inc830 + 6502_Emu_IO.inc901 + 6502_Emu_IO.inc906 + 6502_Emu_IO.inc920 + 6502_Emu_IO.inc925 + 6502_Emu_IO.inc959 + 6502_Emu_IO.inc967 + 6502_Emu_IO.inc1001 + 6502_Emu_IO.inc1049 + 6502_Emu_IO.inc1058 + 6502_emu.asm1070 + 6502_Emu_IO.inc1109 + 6502_emu.asm2164 + 6502_Emu_IO.inc1154 + 6502_Emu_IO.inc1156 + 6502_Emu_IO.inc1256 + 6502_Emu_config.inc374 + 6502_Emu_config.inc354 + 6502_Emu_config.inc334 + 6502_Emu_IO.inc1176 + 6502_Emu_IO.inc1232 + 6502_Emu_config.inc378 + 6502_Emu_config.inc359 + 6502_Emu_config.inc337 + 6502_Emu_IO.inc1180 + 6502_Emu_config.inc236 + 6502_Emu_config.inc256 + 6502_Emu_config.inc277 + 6502_Emu_IO.inc1788 + 6502_Emu_IO.inc1630 + 6502_Emu_IO.inc1282 + 6502_Emu_IO.inc1524 + 6502_Emu_IO.inc1552 + 6502_Emu_config.inc296 + 6502_Emu_IO.inc1725 + 6502_Emu_IO.inc1657 + 6502_Emu_IO.inc1205 + 6502_Emu_IO.inc1488 + 6502_Emu_IO.inc1530 + 6502_Emu_config.inc322 + 6502_Emu_IO.inc1308 + 6502_Emu_IO.inc1311 + 6502_Emu_IO.inc1336 + 6502_Emu_IO.inc1394 + 6502_Emu_IO.inc1419 + 6502_Emu_IO.inc1510 + 6502_Emu_IO.inc1501 + 6502_Emu_IO.inc1498 + 6502_Emu_IO.inc1518 + 6502_Emu_IO.inc1905 + 6502_Emu_IO.inc1817 + 6502_Emu_IO.inc2582 + 6502_Emu_IO.inc2669 + 6502_Emu_IO.inc1615 + 6502_Emu_IO.inc1617 + 6502_Emu_IO.inc2155 + 6502_Emu_IO.inc2138 + 6502_Emu_IO.inc2096 + 6502_Emu_IO.inc2170 + 6502_Emu_IO.inc2108 + 6502_Emu_IO.inc1758 + 6502_Emu_IO.inc1753 + 6502_Emu_IO.inc2062 + 6502_Emu_IO.inc2064 + 6502_Emu_IO.inc1814 + 6502_Emu_IO.inc1839 + 6502_Emu_IO.inc1836 + 6502_Emu_IO.inc1927 + 6502_Emu_IO.inc1924 + 6502_Emu_IO.inc2110 + 6502_Emu_IO.inc2116 + 6502_Emu_IO.inc2118 + 6502_Emu_IO.inc2125 + 6502_Emu_IO.inc2139 + 6502_Emu_IO.inc2161 + 6502_Emu_IO.inc2163 + 6502_Emu_IO.inc2197 + 6502_Emu_IO.inc2235 + 6502_Emu_IO.inc2793 + 6502_emu.asm2960 + 6502_Emu_IO.inc2241 + 6502_Emu_IO.inc2328 + 6502_Emu_IO.inc2791 + 6502_Emu_IO.inc2333 + 6502_Emu_IO.inc2390 + 6502_emu.asm2884 + 6502_Emu_IO.inc2346 + 6502_Emu_IO.inc2365 + 6502_Emu_IO.inc2418 + 6502_Emu_IO.inc2788 + 6502_emu.asm2081 + 6502_Emu_IO.inc2787 + 6502_Emu_IO.inc2515 + 6502_Emu_IO.inc2801 + 6502_Emu_IO.inc2789 + 6502_Emu_IO.inc2572 + 6502_Emu_IO.inc2797 + 6502_Emu_IO.inc2777 + 6502_Emu_IO.inc2790 + 6502_Emu_IO.inc2768 + 6502_Emu_IO.inc2782 + 6502_Emu_IO.inc2783 + 6502_Emu_IO.inc2784 + 6502_Emu_IO.inc2785 + 6502_Emu_IO.inc2786 + 6502_Emu_IO.inc2798 + 6502_Emu_IO.inc2799 + 6502_Emu_IO.inc2800 + 6502_emu.asm2000 + 6502_emu.asm2716 + 6502_emu.asm2221 + 6502_emu.asm3108 + 6502_emu.asm3110 + 6502_emu.asm3111 + 6502_emu.asm2197 + 6502_emu.asm2012 + 6502_emu.asm2092 + 6502_emu.asm2279 + 6502_emu.asm2048 + 6502_emu.asm2056 + 6502_emu.asm2059 + 6502_emu.asm2300 + 6502_emu.asm1922 + 6502_emu.asm2480 + 6502_emu.asm2528 + 6502_emu.asm1973 + 6502_emu.asm2593 + 6502_emu.asm1449 + 6502_emu.asm2639 + 6502_emu.asm3119 + 6502_emu.asm2658 + 6502_emu.asm3054 + 6502_emu.asm2990 + 6502_emu.asm2790 + 6502_emu.asm2977 + 6502_emu.asm1578 + 6502_emu.asm3114 + 6502_emu.asm1595 + 6502_emu.asm2504 + 6502_emu.asm3090 + 6502_emu.asm1686 + 6502_emu.asm1734 + 6502_emu.asm2062 + 6502_emu.asm2687 + 6502_emu.asm2024 + 6502_emu.asm2558 + 6502_emu.asm2751 + 6502_emu.asm2028 + 6502_emu.asm2034 + 6502_emu.asm2052 + 6502_emu.asm2102 + 6502_emu.asm2085 + 6502_emu.asm2440 + 6502_emu.asm2464 + 6502_emu.asm2515 + 6502_emu.asm2740 + 6502_emu.asm2774 + 6502_emu.asm2848 + 6502_emu.asm2859 + 6502_emu.asm2872 + + diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/license.txt b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/license.txt new file mode 100644 index 00000000..818433ec --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/license.txt @@ -0,0 +1,674 @@ + GNU GENERAL PUBLIC LICENSE + Version 3, 29 June 2007 + + Copyright (C) 2007 Free Software Foundation, Inc. + Everyone is permitted to copy and distribute verbatim copies + of this license document, but changing it is not allowed. + + Preamble + + The GNU General Public License is a free, copyleft license for +software and other kinds of works. + + The licenses for most software and other practical works are designed +to take away your freedom to share and change the works. By contrast, +the GNU General Public License is intended to guarantee your freedom to +share and change all versions of a program--to make sure it remains free +software for all its users. We, the Free Software Foundation, use the +GNU General Public License for most of our software; it applies also to +any other work released this way by its authors. You can apply it to +your programs, too. + + When we speak of free software, we are referring to freedom, not +price. Our General Public Licenses are designed to make sure that you +have the freedom to distribute copies of free software (and charge for +them if you wish), that you receive source code or can get it if you +want it, that you can change the software or use pieces of it in new +free programs, and that you know you can do these things. + + To protect your rights, we need to prevent others from denying you +these rights or asking you to surrender the rights. Therefore, you have +certain responsibilities if you distribute copies of the software, or if +you modify it: responsibilities to respect the freedom of others. + + For example, if you distribute copies of such a program, whether +gratis or for a fee, you must pass on to the recipients the same +freedoms that you received. You must make sure that they, too, receive +or can get the source code. And you must show them these terms so they +know their rights. + + Developers that use the GNU GPL protect your rights with two steps: +(1) assert copyright on the software, and (2) offer you this License +giving you legal permission to copy, distribute and/or modify it. + + For the developers' and authors' protection, the GPL clearly explains +that there is no warranty for this free software. For both users' and +authors' sake, the GPL requires that modified versions be marked as +changed, so that their problems will not be attributed erroneously to +authors of previous versions. + + Some devices are designed to deny users access to install or run +modified versions of the software inside them, although the manufacturer +can do so. This is fundamentally incompatible with the aim of +protecting users' freedom to change the software. The systematic +pattern of such abuse occurs in the area of products for individuals to +use, which is precisely where it is most unacceptable. Therefore, we +have designed this version of the GPL to prohibit the practice for those +products. If such problems arise substantially in other domains, we +stand ready to extend this provision to those domains in future versions +of the GPL, as needed to protect the freedom of users. + + Finally, every program is threatened constantly by software patents. +States should not allow patents to restrict development and use of +software on general-purpose computers, but in those that do, we wish to +avoid the special danger that patents applied to a free program could +make it effectively proprietary. To prevent this, the GPL assures that +patents cannot be used to render the program non-free. + + The precise terms and conditions for copying, distribution and +modification follow. + + TERMS AND CONDITIONS + + 0. Definitions. + + "This License" refers to version 3 of the GNU General Public License. + + "Copyright" also means copyright-like laws that apply to other kinds of +works, such as semiconductor masks. + + "The Program" refers to any copyrightable work licensed under this +License. Each licensee is addressed as "you". "Licensees" and +"recipients" may be individuals or organizations. + + To "modify" a work means to copy from or adapt all or part of the work +in a fashion requiring copyright permission, other than the making of an +exact copy. The resulting work is called a "modified version" of the +earlier work or a work "based on" the earlier work. + + A "covered work" means either the unmodified Program or a work based +on the Program. + + To "propagate" a work means to do anything with it that, without +permission, would make you directly or secondarily liable for +infringement under applicable copyright law, except executing it on a +computer or modifying a private copy. Propagation includes copying, +distribution (with or without modification), making available to the +public, and in some countries other activities as well. + + To "convey" a work means any kind of propagation that enables other +parties to make or receive copies. Mere interaction with a user through +a computer network, with no transfer of a copy, is not conveying. + + An interactive user interface displays "Appropriate Legal Notices" +to the extent that it includes a convenient and prominently visible +feature that (1) displays an appropriate copyright notice, and (2) +tells the user that there is no warranty for the work (except to the +extent that warranties are provided), that licensees may convey the +work under this License, and how to view a copy of this License. If +the interface presents a list of user commands or options, such as a +menu, a prominent item in the list meets this criterion. + + 1. Source Code. + + The "source code" for a work means the preferred form of the work +for making modifications to it. "Object code" means any non-source +form of a work. + + A "Standard Interface" means an interface that either is an official +standard defined by a recognized standards body, or, in the case of +interfaces specified for a particular programming language, one that +is widely used among developers working in that language. + + The "System Libraries" of an executable work include anything, other +than the work as a whole, that (a) is included in the normal form of +packaging a Major Component, but which is not part of that Major +Component, and (b) serves only to enable use of the work with that +Major Component, or to implement a Standard Interface for which an +implementation is available to the public in source code form. A +"Major Component", in this context, means a major essential component +(kernel, window system, and so on) of the specific operating system +(if any) on which the executable work runs, or a compiler used to +produce the work, or an object code interpreter used to run it. + + The "Corresponding Source" for a work in object code form means all +the source code needed to generate, install, and (for an executable +work) run the object code and to modify the work, including scripts to +control those activities. However, it does not include the work's +System Libraries, or general-purpose tools or generally available free +programs which are used unmodified in performing those activities but +which are not part of the work. For example, Corresponding Source +includes interface definition files associated with source files for +the work, and the source code for shared libraries and dynamically +linked subprograms that the work is specifically designed to require, +such as by intimate data communication or control flow between those +subprograms and other parts of the work. + + The Corresponding Source need not include anything that users +can regenerate automatically from other parts of the Corresponding +Source. + + The Corresponding Source for a work in source code form is that +same work. + + 2. Basic Permissions. + + All rights granted under this License are granted for the term of +copyright on the Program, and are irrevocable provided the stated +conditions are met. This License explicitly affirms your unlimited +permission to run the unmodified Program. The output from running a +covered work is covered by this License only if the output, given its +content, constitutes a covered work. This License acknowledges your +rights of fair use or other equivalent, as provided by copyright law. + + You may make, run and propagate covered works that you do not +convey, without conditions so long as your license otherwise remains +in force. You may convey covered works to others for the sole purpose +of having them make modifications exclusively for you, or provide you +with facilities for running those works, provided that you comply with +the terms of this License in conveying all material for which you do +not control copyright. Those thus making or running the covered works +for you must do so exclusively on your behalf, under your direction +and control, on terms that prohibit them from making any copies of +your copyrighted material outside their relationship with you. + + Conveying under any other circumstances is permitted solely under +the conditions stated below. Sublicensing is not allowed; section 10 +makes it unnecessary. + + 3. Protecting Users' Legal Rights From Anti-Circumvention Law. + + No covered work shall be deemed part of an effective technological +measure under any applicable law fulfilling obligations under article +11 of the WIPO copyright treaty adopted on 20 December 1996, or +similar laws prohibiting or restricting circumvention of such +measures. + + When you convey a covered work, you waive any legal power to forbid +circumvention of technological measures to the extent such circumvention +is effected by exercising rights under this License with respect to +the covered work, and you disclaim any intention to limit operation or +modification of the work as a means of enforcing, against the work's +users, your or third parties' legal rights to forbid circumvention of +technological measures. + + 4. Conveying Verbatim Copies. + + You may convey verbatim copies of the Program's source code as you +receive it, in any medium, provided that you conspicuously and +appropriately publish on each copy an appropriate copyright notice; +keep intact all notices stating that this License and any +non-permissive terms added in accord with section 7 apply to the code; +keep intact all notices of the absence of any warranty; and give all +recipients a copy of this License along with the Program. + + You may charge any price or no price for each copy that you convey, +and you may offer support or warranty protection for a fee. + + 5. Conveying Modified Source Versions. + + You may convey a work based on the Program, or the modifications to +produce it from the Program, in the form of source code under the +terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified + it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is + released under this License and any conditions added under section + 7. This requirement modifies the requirement in section 4 to + "keep intact all notices". + + c) You must license the entire work, as a whole, under this + License to anyone who comes into possession of a copy. This + License will therefore apply, along with any applicable section 7 + additional terms, to the whole of the work, and all its parts, + regardless of how they are packaged. This License gives no + permission to license the work in any other way, but it does not + invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display + Appropriate Legal Notices; however, if the Program has interactive + interfaces that do not display Appropriate Legal Notices, your + work need not make them do so. + + A compilation of a covered work with other separate and independent +works, which are not by their nature extensions of the covered work, +and which are not combined with it such as to form a larger program, +in or on a volume of a storage or distribution medium, is called an +"aggregate" if the compilation and its resulting copyright are not +used to limit the access or legal rights of the compilation's users +beyond what the individual works permit. Inclusion of a covered work +in an aggregate does not cause this License to apply to the other +parts of the aggregate. + + 6. Conveying Non-Source Forms. + + You may convey a covered work in object code form under the terms +of sections 4 and 5, provided that you also convey the +machine-readable Corresponding Source under the terms of this License, +in one of these ways: + + a) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by the + Corresponding Source fixed on a durable physical medium + customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product + (including a physical distribution medium), accompanied by a + written offer, valid for at least three years and valid for as + long as you offer spare parts or customer support for that product + model, to give anyone who possesses the object code either (1) a + copy of the Corresponding Source for all the software in the + product that is covered by this License, on a durable physical + medium customarily used for software interchange, for a price no + more than your reasonable cost of physically performing this + conveying of source, or (2) access to copy the + Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the + written offer to provide the Corresponding Source. This + alternative is allowed only occasionally and noncommercially, and + only if you received the object code with such an offer, in accord + with subsection 6b. + + d) Convey the object code by offering access from a designated + place (gratis or for a charge), and offer equivalent access to the + Corresponding Source in the same way through the same place at no + further charge. You need not require recipients to copy the + Corresponding Source along with the object code. If the place to + copy the object code is a network server, the Corresponding Source + may be on a different server (operated by you or a third party) + that supports equivalent copying facilities, provided you maintain + clear directions next to the object code saying where to find the + Corresponding Source. Regardless of what server hosts the + Corresponding Source, you remain obligated to ensure that it is + available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided + you inform other peers where the object code and Corresponding + Source of the work are being offered to the general public at no + charge under subsection 6d. + + A separable portion of the object code, whose source code is excluded +from the Corresponding Source as a System Library, need not be +included in conveying the object code work. + + A "User Product" is either (1) a "consumer product", which means any +tangible personal property which is normally used for personal, family, +or household purposes, or (2) anything designed or sold for incorporation +into a dwelling. In determining whether a product is a consumer product, +doubtful cases shall be resolved in favor of coverage. For a particular +product received by a particular user, "normally used" refers to a +typical or common use of that class of product, regardless of the status +of the particular user or of the way in which the particular user +actually uses, or expects or is expected to use, the product. A product +is a consumer product regardless of whether the product has substantial +commercial, industrial or non-consumer uses, unless such uses represent +the only significant mode of use of the product. + + "Installation Information" for a User Product means any methods, +procedures, authorization keys, or other information required to install +and execute modified versions of a covered work in that User Product from +a modified version of its Corresponding Source. The information must +suffice to ensure that the continued functioning of the modified object +code is in no case prevented or interfered with solely because +modification has been made. + + If you convey an object code work under this section in, or with, or +specifically for use in, a User Product, and the conveying occurs as +part of a transaction in which the right of possession and use of the +User Product is transferred to the recipient in perpetuity or for a +fixed term (regardless of how the transaction is characterized), the +Corresponding Source conveyed under this section must be accompanied +by the Installation Information. But this requirement does not apply +if neither you nor any third party retains the ability to install +modified object code on the User Product (for example, the work has +been installed in ROM). + + The requirement to provide Installation Information does not include a +requirement to continue to provide support service, warranty, or updates +for a work that has been modified or installed by the recipient, or for +the User Product in which it has been modified or installed. Access to a +network may be denied when the modification itself materially and +adversely affects the operation of the network or violates the rules and +protocols for communication across the network. + + Corresponding Source conveyed, and Installation Information provided, +in accord with this section must be in a format that is publicly +documented (and with an implementation available to the public in +source code form), and must require no special password or key for +unpacking, reading or copying. + + 7. Additional Terms. + + "Additional permissions" are terms that supplement the terms of this +License by making exceptions from one or more of its conditions. +Additional permissions that are applicable to the entire Program shall +be treated as though they were included in this License, to the extent +that they are valid under applicable law. If additional permissions +apply only to part of the Program, that part may be used separately +under those permissions, but the entire Program remains governed by +this License without regard to the additional permissions. + + When you convey a copy of a covered work, you may at your option +remove any additional permissions from that copy, or from any part of +it. (Additional permissions may be written to require their own +removal in certain cases when you modify the work.) You may place +additional permissions on material, added by you to a covered work, +for which you have or can give appropriate copyright permission. + + Notwithstanding any other provision of this License, for material you +add to a covered work, you may (if authorized by the copyright holders of +that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the + terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or + author attributions in that material or in the Appropriate Legal + Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or + requiring that modified versions of such material be marked in + reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or + authors of the material; or + + e) Declining to grant rights under trademark law for use of some + trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that + material by anyone who conveys the material (or modified versions of + it) with contractual assumptions of liability to the recipient, for + any liability that these contractual assumptions directly impose on + those licensors and authors. + + All other non-permissive additional terms are considered "further +restrictions" within the meaning of section 10. If the Program as you +received it, or any part of it, contains a notice stating that it is +governed by this License along with a term that is a further +restriction, you may remove that term. If a license document contains +a further restriction but permits relicensing or conveying under this +License, you may add to a covered work material governed by the terms +of that license document, provided that the further restriction does +not survive such relicensing or conveying. + + If you add terms to a covered work in accord with this section, you +must place, in the relevant source files, a statement of the +additional terms that apply to those files, or a notice indicating +where to find the applicable terms. + + Additional terms, permissive or non-permissive, may be stated in the +form of a separately written license, or stated as exceptions; +the above requirements apply either way. + + 8. Termination. + + You may not propagate or modify a covered work except as expressly +provided under this License. Any attempt otherwise to propagate or +modify it is void, and will automatically terminate your rights under +this License (including any patent licenses granted under the third +paragraph of section 11). + + However, if you cease all violation of this License, then your +license from a particular copyright holder is reinstated (a) +provisionally, unless and until the copyright holder explicitly and +finally terminates your license, and (b) permanently, if the copyright +holder fails to notify you of the violation by some reasonable means +prior to 60 days after the cessation. + + Moreover, your license from a particular copyright holder is +reinstated permanently if the copyright holder notifies you of the +violation by some reasonable means, this is the first time you have +received notice of violation of this License (for any work) from that +copyright holder, and you cure the violation prior to 30 days after +your receipt of the notice. + + Termination of your rights under this section does not terminate the +licenses of parties who have received copies or rights from you under +this License. If your rights have been terminated and not permanently +reinstated, you do not qualify to receive new licenses for the same +material under section 10. + + 9. Acceptance Not Required for Having Copies. + + You are not required to accept this License in order to receive or +run a copy of the Program. Ancillary propagation of a covered work +occurring solely as a consequence of using peer-to-peer transmission +to receive a copy likewise does not require acceptance. However, +nothing other than this License grants you permission to propagate or +modify any covered work. These actions infringe copyright if you do +not accept this License. Therefore, by modifying or propagating a +covered work, you indicate your acceptance of this License to do so. + + 10. Automatic Licensing of Downstream Recipients. + + Each time you convey a covered work, the recipient automatically +receives a license from the original licensors, to run, modify and +propagate that work, subject to this License. You are not responsible +for enforcing compliance by third parties with this License. + + An "entity transaction" is a transaction transferring control of an +organization, or substantially all assets of one, or subdividing an +organization, or merging organizations. If propagation of a covered +work results from an entity transaction, each party to that +transaction who receives a copy of the work also receives whatever +licenses to the work the party's predecessor in interest had or could +give under the previous paragraph, plus a right to possession of the +Corresponding Source of the work from the predecessor in interest, if +the predecessor has it or can get it with reasonable efforts. + + You may not impose any further restrictions on the exercise of the +rights granted or affirmed under this License. For example, you may +not impose a license fee, royalty, or other charge for exercise of +rights granted under this License, and you may not initiate litigation +(including a cross-claim or counterclaim in a lawsuit) alleging that +any patent claim is infringed by making, using, selling, offering for +sale, or importing the Program or any portion of it. + + 11. Patents. + + A "contributor" is a copyright holder who authorizes use under this +License of the Program or a work on which the Program is based. The +work thus licensed is called the contributor's "contributor version". + + A contributor's "essential patent claims" are all patent claims +owned or controlled by the contributor, whether already acquired or +hereafter acquired, that would be infringed by some manner, permitted +by this License, of making, using, or selling its contributor version, +but do not include claims that would be infringed only as a +consequence of further modification of the contributor version. For +purposes of this definition, "control" includes the right to grant +patent sublicenses in a manner consistent with the requirements of +this License. + + Each contributor grants you a non-exclusive, worldwide, royalty-free +patent license under the contributor's essential patent claims, to +make, use, sell, offer for sale, import and otherwise run, modify and +propagate the contents of its contributor version. + + In the following three paragraphs, a "patent license" is any express +agreement or commitment, however denominated, not to enforce a patent +(such as an express permission to practice a patent or covenant not to +sue for patent infringement). To "grant" such a patent license to a +party means to make such an agreement or commitment not to enforce a +patent against the party. + + If you convey a covered work, knowingly relying on a patent license, +and the Corresponding Source of the work is not available for anyone +to copy, free of charge and under the terms of this License, through a +publicly available network server or other readily accessible means, +then you must either (1) cause the Corresponding Source to be so +available, or (2) arrange to deprive yourself of the benefit of the +patent license for this particular work, or (3) arrange, in a manner +consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have +actual knowledge that, but for the patent license, your conveying the +covered work in a country, or your recipient's use of the covered work +in a country, would infringe one or more identifiable patents in that +country that you have reason to believe are valid. + + If, pursuant to or in connection with a single transaction or +arrangement, you convey, or propagate by procuring conveyance of, a +covered work, and grant a patent license to some of the parties +receiving the covered work authorizing them to use, propagate, modify +or convey a specific copy of the covered work, then the patent license +you grant is automatically extended to all recipients of the covered +work and works based on it. + + A patent license is "discriminatory" if it does not include within +the scope of its coverage, prohibits the exercise of, or is +conditioned on the non-exercise of one or more of the rights that are +specifically granted under this License. You may not convey a covered +work if you are a party to an arrangement with a third party that is +in the business of distributing software, under which you make payment +to the third party based on the extent of your activity of conveying +the work, and under which the third party grants, to any of the +parties who would receive the covered work from you, a discriminatory +patent license (a) in connection with copies of the covered work +conveyed by you (or copies made from those copies), or (b) primarily +for and in connection with specific products or compilations that +contain the covered work, unless you entered into that arrangement, +or that patent license was granted, prior to 28 March 2007. + + Nothing in this License shall be construed as excluding or limiting +any implied license or other defenses to infringement that may +otherwise be available to you under applicable patent law. + + 12. No Surrender of Others' Freedom. + + If conditions are imposed on you (whether by court order, agreement or +otherwise) that contradict the conditions of this License, they do not +excuse you from the conditions of this License. If you cannot convey a +covered work so as to satisfy simultaneously your obligations under this +License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you +to collect a royalty for further conveying from those to whom you convey +the Program, the only way you could satisfy both those terms and this +License would be to refrain entirely from conveying the Program. + + 13. Use with the GNU Affero General Public License. + + Notwithstanding any other provision of this License, you have +permission to link or combine any covered work with a work licensed +under version 3 of the GNU Affero General Public License into a single +combined work, and to convey the resulting work. The terms of this +License will continue to apply to the part which is the covered work, +but the special requirements of the GNU Affero General Public License, +section 13, concerning interaction through a network will apply to the +combination as such. + + 14. Revised Versions of this License. + + The Free Software Foundation may publish revised and/or new versions of +the GNU General Public License from time to time. Such new versions will +be similar in spirit to the present version, but may differ in detail to +address new problems or concerns. + + Each version is given a distinguishing version number. If the +Program specifies that a certain numbered version of the GNU General +Public License "or any later version" applies to it, you have the +option of following the terms and conditions either of that numbered +version or of any later version published by the Free Software +Foundation. If the Program does not specify a version number of the +GNU General Public License, you may choose any version ever published +by the Free Software Foundation. + + If the Program specifies that a proxy can decide which future +versions of the GNU General Public License can be used, that proxy's +public statement of acceptance of a version permanently authorizes you +to choose that version for the Program. + + Later license versions may give you additional or different +permissions. However, no additional obligations are imposed on any +author or copyright holder as a result of your choosing to follow a +later version. + + 15. Disclaimer of Warranty. + + THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY +APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT +HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY +OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, +THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR +PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM +IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF +ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + + 16. Limitation of Liability. + + IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING +WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS +THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY +GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE +USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF +DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD +PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), +EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF +SUCH DAMAGES. + + 17. Interpretation of Sections 15 and 16. + + If the disclaimer of warranty and limitation of liability provided +above cannot be given local legal effect according to their terms, +reviewing courts shall apply local law that most closely approximates +an absolute waiver of all civil liability in connection with the +Program, unless a warranty or assumption of liability accompanies a +copy of the Program in return for a fee. + + END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + + If you develop a new program, and you want it to be of the greatest +possible use to the public, the best way to achieve this is to make it +free software which everyone can redistribute and change under these terms. + + To do so, attach the following notices to the program. It is safest +to attach them to the start of each source file to most effectively +state the exclusion of warranty; and each file should have at least +the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify + it under the terms of the GNU General Public License as published by + the Free Software Foundation, either version 3 of the License, or + (at your option) any later version. + + This program is distributed in the hope that it will be useful, + but WITHOUT ANY WARRANTY; without even the implied warranty of + MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + GNU General Public License for more details. + + You should have received a copy of the GNU General Public License + along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + + If the program does terminal interaction, make it output a short +notice like this when it starts in an interactive mode: + + Copyright (C) + This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. + This is free software, and you are welcome to redistribute it + under certain conditions; type `show c' for details. + +The hypothetical commands `show w' and `show c' should show the appropriate +parts of the General Public License. Of course, your program's commands +might be different; for a GUI interface, you would use an "about box". + + You should also get your employer (if you work as a programmer) or school, +if any, to sign a "copyright disclaimer" for the program, if necessary. +For more information on this, and how to apply and follow the GNU GPL, see +. + + The GNU General Public License does not permit incorporating your program +into proprietary programs. If your program is a subroutine library, you +may consider it more useful to permit linking proprietary applications with +the library. If this is what you want to do, use the GNU Lesser General +Public License instead of this License. But first, please read +. diff --git a/trunk/AVRProjects/AVR_6502/6502_Emu_328p/m32def.inc b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/m32def.inc new file mode 100644 index 00000000..82f5b930 --- /dev/null +++ b/trunk/AVRProjects/AVR_6502/6502_Emu_328p/m32def.inc @@ -0,0 +1,815 @@ +;***** THIS IS A MACHINE GENERATED FILE - DO NOT EDIT ******************** +;***** Created: 2011-02-09 12:03 ******* Source: ATmega32.xml ************ +;************************************************************************* +;* A P P L I C A T I O N N O T E F O R T H E A V R F A M I L Y +;* +;* Number : AVR000 +;* File Name : "m32def.inc" +;* Title : Register/Bit Definitions for the ATmega32 +;* Date : 2011-02-09 +;* Version : 2.35 +;* Support E-mail : avr@atmel.com +;* Target MCU : ATmega32 +;* +;* DESCRIPTION +;* When including this file in the assembly program file, all I/O register +;* names and I/O register bit names appearing in the data book can be used. +;* In addition, the six registers forming the three data pointers X, Y and +;* Z have been assigned names XL - ZH. Highest RAM address for Internal +;* SRAM is also defined +;* +;* The Register names are represented by their hexadecimal address. +;* +;* The Register Bit names are represented by their bit number (0-7). +;* +;* Please observe the difference in using the bit names with instructions +;* such as "sbr"/"cbr" (set/clear bit in register) and "sbrs"/"sbrc" +;* (skip if bit in register set/cleared). The following example illustrates +;* this: +;* +;* in r16,PORTB ;read PORTB latch +;* sbr r16,(1<. +; +; contact info at http://2m5.de or email K@2m5.de +; +.set sam_version = 810 +; Version: 26.12.2010 +; requires a current version of AVRASM2 +; see "sam_examples.asm" for usage examples +; +; +;---------------------------------------------------------------- +; +; IF-(THEN)-ELSE-END +; +; All need a common label as the last and mostly only parameter. +; Further if-then-else-end can be nested by asigning a different label. +; The macros create additional labels as needed: +; for example @0 = test creates t_test & l_test +; test = end of the THEN case +; t_test = begin of the THEN case +; l_test = end of the ELSE case +; Condition dependent code execution: +; true = code after the IFxx or IFxx_far macro is executed +; false = code after the ELSE macro is executed, if ELSE exists +; all = remainder of the code is skipped up to the END macro +; +; +; IFxx(_yy) (,)