can I use a hex file compiled for attiny4 and it will work on attiny10?
I assume it will, I just wanted to double check with the guru's on here to make sure.
Yes, I am 99.9% sure.
It is much safer to build the source code for the correct AVR in the first place.
thanks for the fast reply, I use linux toolchain now, but have not setup any scripts for compiling asm yet... so I did a quick test on AVR Studio 4 with a windows box (just what I had laying around) and when I selected "select debug platform and device" and changed from tiny4 to tiny10 and also changed the .def to include the attiny10 header, some blinky LED code compiled to the same hex output. I could not find any other place to set the target in AVR Studio 4, I assume for ASM projects the only place you can change your target is the "select debug platform and device" selection. Their was no option in "Project Options" to change the target device as you would have in a "C code" project. I think the only difference between tiny4 and tiny10 is the tiny10 has an ADC and more flash memory space, but I figured the 512 and 1024 memory space was addressed and organized the same across both chips so the hex from a tiny4 should always work on a tiny10. Was not sure if their was any gotcha's on this though.
If by "linux toolchain" you mean "avr-gcc" then you do know that already contains an assembler? If you invoke avr-gcc with a .c file then, yes, that gets compiled by the C compiler but if you invoke it with a .S file that gets preprocessed (so #includes, #defines and stuff) and then it gets passed to the assembler. So you don't need AS4 and the Atmel assembler as GCC (or more correctly binutils) already has the avr-as assembler.
thanks for the fast response clawson, yes I know the linux toolchain does have an assembler, thus far I had only done C projects on the linux toolchain, which I have some scripts I created for quick and easy compiling... Since I had not setup any scripts or done any asm projects in linux yet, I just quickly tested on a Windows box that already has AVR Studio 4 installed. I don't plan on using windows, just did that for a quick test. My intentions are to use the linux toolchain for assembly projects going forward.
One difference between the two devices besides memory size is the Device Signature.
Jim Wagner Oregon Research Electronics, Consulting Div. Tangent, OR, USA http://www.orelectronics.net
If you compare the differences of the header files with the register definitions you probably have a nice overview of any differences.
I like meld for such source code comparisons. http://meldmerge.org/
The differences I see are:
- Some on the top of the file (date's file names, #incude __AVR___ otection.
- tn10 has a bunc of extra defines for the ADC. (Green difference in the right margin).
- tn10 has an extra interrupt vector fro the ADC.
- tn10 has more Flash.
- signatures are different.
All the other #define macro's are exactly the same. Not even a difference in trailing whitespace. (Can be turned on/off in preferences)...
Fun part about meld is though:
I did that in less time than it took to write this post, and I have never used or even looked at the datasheets of those tiny processors.
I only use the mega's. :)
Doing magic with a USD 7 Logic Analyser: https://www.avrfreaks.net/comment/2421756#comment-2421756
Bunch of old projects with AVR's: http://www.hoevendesign.com
© 2018 Microchip Technology Inc.