Open gpshead opened 3 years ago
Reasonable; will need to mirror that change on all parts (note that for parts currently handled by the disastrous "tinymodern" core, which is getting axed in the near future, they will get this no sooner than when they're handled by the main core through a variants file, like they always should have been). Will consider adding a menu option for it as well - I will note that we have a general prohibition against adding features that are not accessible from the Arduino IDE.
The correct solution for this is a menu option. Per #481 disabling the ADC was also suggested. This makes sense as well. What would be very useful, IMO is to:
I think the best solution is to structure the core so that the millis code only gets linked in when millis is called somewhere in the user code. That's what I did for MicroCore and PicoCore.
The way to implement is to have the millis() function, the interrupt handler, and the initialization all in the same .o. If the linker never sees a call to millis(), it won't pull in the .o in order to resolve the symbol. https://github.com/nerdralph/picoCore/blob/master/avr/cores/picocore/millis.S
picocore uses the WDT to avoid tying up a timer. It would be a bit more work, but the concept is the same when one of the timer/counters is used.
That would work except that it would also break PWM, or else someone uising both analogWrite() and milis() would get hit with the initialization twice.
Note that this work is ready for 2.0.0 except for the menu option (which is part of boards.txt which currently doesn't exist in working form for 2.0.0 - A script is being written to generate the boards.txt as it was made apparent that the boards.txt for ATTinyCore (unlike the newer parts) is not viable to maintain by hand.
This will be scaled back for 2.0.0
We can pass
-D DISABLEMILLIS
to the compiler to turn off TIMER0 use and millis/micros support. ButINITIALIZE_SECONDARY_TIMERS
is a blind#define
in header files likevariants/tinyX5/pins_arduino.h
so it cannot be disabled at compile time without modifying the framework.Guard it with an
#ifndef INITIALIZE_SECONDARY_TIMERS
perhaps?