Open Traumflug opened 11 years ago
I can't speak for the details but this is definitely the kind of thing that would be good to include. Having the core be as generic as possible is useful.
Traumflug, can you comment on how you've tested these changes? It can be easy to break things on some board in making this kind of modification, so the more boards you can try out, the more likely it will be that the patch will be accepted.
I think it would be really nice if this got merged. Traumflug I will be happy to test it for you. I got several Arduinos I can try it on and some other atmega chips as well.
I like this too Il giorno 01/feb/2013 15:15, "Kristian Lauszus" notifications@github.com ha scritto:
I think it would be really nice if this got merged. Traumflug I will be happy to test it for you as well if you as well. I got several Arduinos I can try it on.
— Reply to this email directly or view it on GitHubhttps://github.com/arduino/Arduino/issues/1258#issuecomment-12995702.
Traumflug, can you comment on how you've tested these changes?
These patches were made by verification with the avr-libc headers. Looking into them one can see there is a comparably small number of base architectures plus a few chip-specific modifications. Atmel was nice enough to give the same register names to all chips with the same feature, so you simply check for the presence of a register definition to find out wether a feature exists.
Regarding testing: for obvious reasons I couldn't do that by try and error on a dozen ATmegas with a hundred pieces of software :-) They run for about a year so far on those RepRap controllers which are not based on the ATmega2560. Only two or three different softwares but a fairly large number of users.
P.S.: Testing is simple: you can download and install this package: https://github.com/Traumflug/Generation_7_Electronics/blob/Gen7-Arduino-IDE-Support-2.1/release%20documents/Gen7%20Arduino%20IDE%20Support%202.1.zip?raw=true Installation instructions are inside the package.
To use the Gen7 library, which differs from the standard one only by the above patch, adjust this line in your boards.txt file (inside the Arduino IDE folder):
<your board>.build.variant=gen7
Sorry, I should have been more specific. I'm not asking you to test hundreds of programs on dozens of Arduino boards. But if you've checked that it doesn't break anything obvious on the processors on the official Arduino boards (ATmega328, ATmega2560, and ATmega32U4), that would be good to know. We've had patches like this in that past that, in trying to get things to work on e.g. the ATmega644, have broken analogRead() completely on, say, the Arduino Mega. We'd obviously like to avoid something like that.
Obviously. I must admit, I own a whole bunch of Arduino-like RepRap controllers, but not a single original Arduino.
In case there are known failed attempts I can help debugging, of course. By reading avr-libc headers even more closely.
@Lauszus: did you have a chance to test the patch on some of your Arduinos?
@damellis: Is there a list of the ATmega types Arduino cares about? If I could get such a list I could write sort of a unit test to make sure the same code is compiled with or without the patch.
No I havn't tested it yet. I can test it on an Uno, Mega and Leonardo. Just tell me what you want me to test and I will have a look at it!
The most important AVR's are the ATmega328P, ATmega2560, and ATmega32U4. It would also be good to check the ATmega168 and ATmega8, as they're on older boards.
I can confirm that all the interrupts are working on ATmega328P, ATmega2560, and ATmega32U4.
But INTERNAL1V1 and INTERNAL2V56 is getting defined when you are using an ATmega328P or ATmega32U4, so that has to be fixed.
Two years ago I started Generation 7 Electronics, which is pretty close to an Arduino from the programmers view. Back then there was no support for 20 MHz chips, ATmega644 (without P) and ATmega644P, so I had to tweak the library fork made for the Sanguino. Today, things have changed, thanks a lot. I just rebased my derivate to Arduino 1.0.3 and I think the patch has become small enough to deserve incorporation into the general Arduino library.
My strategy is to check not for chip names, but for their features. This way you become compatible to virtually all ATmegas and ATtinys existing, even the rare ones, and without long chains of #if defined().
For the result, please see this patch against the 1.0.3 tag:
What do you think? Given this could go into this repo I could give up my derivate, making things for many users much easier. Not only Gen7 users, but any user of a rare AVR.