I make and sell a variant of the USBtiny AVR programmer. It uses an ATtiny2313 clocked at 12 MHz and does bit-banged USB using hand-tuned assembly language (that someone else wrote – it’s an open hardware / open firmware project).
In an attempt to reduce costs, I’d like to shift from using the 2313 to using an ATtiny84 instead.
I can figure out how to adjust the firmware for the different pins. But the big(ger) question is whether that hand-tuned assembly language will run the same way on the 84.
Other than pins and registers, is the entire ATtiny chip range cross compatible from a software perspective otherwise?
As described in the AVR 8-bit Instruction Set document, only “Reduced Core tinyAVR” parts have different timing from the others. Parts that fall under this designation are the ATtiny4, ATtiny5, ATtiny9, and ATtiny10.
Both the ‘2313 and ’84 are “avr25” architecture as defined by GCC, so their instruction sets are 100% compatible.
Sep 14 ’14 at 18:46
Short answer is: No some ATtiny chips support more instructions than others. Also some chips support different internal hardware than others. The majority of the instructions is identical though.
You can check the device’s supported instruction set at the end of the device’s “complete” datasheet against your current code. And you can check the Instruction Set Manual for more details.
Of course the compiler / assembler should throw errors when you are trying to use hardware / instructions that do not exist in the device. Just configure to compile for the other device. A good source should compile without any warnings and errors, but should be done first before trying to port to the other device.
This application only uses GPIO and USI – which I believe is present on both chips. I believe I can finesse the hardware differences between the two. I just didn’t want to have to redo a bunch of very finely tuned assembly language.
Sep 14 ’14 at 18:46