Change of plans: Interim ATTinyCore, then The Big One #521
Replies: 4 comments 1 reply
-
Have you tried picoboot-lib yet? It's got auto tuning that gets saved the first time the bootloader runs, and is used to init OSCCAL on reset before jumping to the user code. It also exposes pb_txbyte() and pb_rxbyte() functions so user code can call the bootloader's bit-bang serial routines. |
Beta Was this translation helpful? Give feedback.
-
I have not had a chance to try it; in any event it doesn't get us a replacement for optiboot (and the fact that it's assembly makes it difficult for me to maintain if needed) since you're not planning to support all parts) - I am planning to do that once I have the core put back together with all boards compiling and a rebuilt boards.txt, and I can start thinking about what the bootloader space will look like. My current tuning solution involves a dedicated tuning sketch which could be uploaded alongside Optiboot; (tunes from certain charachter sent at a certain baud rate, or a 500 Hz squarewave; I'll include a tweaked version of ArduinoISP that will, after uploading, test for whether it's waiting for cal, and if so, cal it via squarewave; I'll use SPI pins for it so nothing would need to be connected or disconnected); The tuning sketch will go through the entire 0~255 range, and record the best settings for 2 or more target clock speeds (depending on board, eg, t85/861 get 8/16 and 8.25/16.5, most tinies get 8 and 12, the 841 gets 8, 12, and 16, and there's support for "user cal" of an arbitrary frequency if they really want that), and saves it before the version word in the flash (if it has a recognized bootloader) that isn't calibrated) or at the end of the EEPROM (if no bootloader) or repeatedly blinks unhappily and prints an error message if there's either an unrecognized bootloader, or if there's no bootloader and EESAVE is not set (meaning there is no way to persist the settings)..And if it's already calibrate, it would instead print a message to that effect. And some statistics for fun, of course - speed measured at OSCCAL=0, at OSCCAL=255, what factory cal was and what speed that came out to, and what the two tuned OSCCALs are and what speed they were measured at... (the question ofc is whether it is worth having it do more than that - there's the temptabion on the one hand to have it, say, save the delta at each step... and print those out (if tuned over serial, the serial turner program could also read that in, do the math on it, and print out the coefficients (on tinyAVR 0/1-series, the frequency is very closely approximated by f=ax^2 + bx + c, ex the 16 MHz osc on one of my 1614's is: f = 0.00032x^2 + 0.233x + 9.7335 in MHz - I suspect the same is true here). Now what would be really interesting would be to take samples across a wide range of voltages... so you could predict how the curve would change as V changed. Do the same for temperature. as well. If you could generalize between specimens (which one probably can to some extent) you could even say someything like "Well, at 5v and 25C I'm on target with OSCCAL of 75. But my on-board temperature sensor (which we cal'ed at the same time as the osc) indicates that I'm shivering down at around -20C, which explains why my three alkaline batteries are struggling to give me 3.4v, so i'd be closer to the target frequency if I cranked my OSCCAL iup/down by this many LSB... I think i have all the pins_arduino.h files modernized now, and have converted the 841 to use variants instead of the idiotic way the second core used to do it; Then the new micronucleus builds for the new parts need to happen. By then Im hoping y'all will have figured out which USB libraries approximate working, and which are basket cases, so I can include the working ones, and not include the non-working ones. Need to figure out how to make the USB libraries get the pin information from a central location - this thing with a separate file for each library is a thousand flavors of fail, it is not acceptable or sustainable. Why can't I have a pins_usb.h in each variant? Wouldn't that work? And I could even #include it when pins_arduino.h is processed if it's set to a mode with USB support so the sketch could see defines for what pin is used and stuff..... |
Beta Was this translation helpful? Give feedback.
-
OK, I didn't realize you want a bootloader that works on every MCU supported by ATTinyCore. For the tuner it sounds like you've done a lot of work to come up with something that works on many different AVRs at many different speeds. I try to have a single version of code without #ifdefs so that it is easy to maintain and debug. That often means leaving out support for parts that are significantly different than others. I've never liked the way Arduino does pin abstractions, and more than once when working on variant/pin definitions have gotten frustrated enough that I've had to leave the code and work on something else for a while. |
Beta Was this translation helpful? Give feedback.
-
Currently all parts that come in a version with at least 8k of flash have a bootloader binary for the 4k and larger sizes with references to same within boards.txt; So if I were to replace optiboot with picoboot, I'd need to be able to do it on all of those parts - otherwise it can at best be a "bonus" for people with certain parts (and, as it happens, parts that are pretty mediocre.) (I digress somewhat, but...) The 84 is an 841, only worse in almost every way except that it has hardware that can allow a slightly less lousy implementation of I2C master. and like, the 85 is only notable because the 8-pin parts are the red-haired-stepchildren of the AVR line - they haven't even refreshed the '85 line with the better oscillator like the 84, 861, etc got wgen the 84a/861a came out. If Amel/Microchip had more respect for 8-pin parts, and had released anything interesting in 8-pin packages in the past decade, we wouldn't be talking about the 85 constantly! The fact that they didn't give us an ATtiny812 was a real slap in the face. (especially since on of the few downsides of the new architecture is that, all else bring equal, code will be slightly larger there, because none of the peripheral registers (other than vports) are in the IO space.). If there was an 812, I guarantee you, that would be the internet's favorite 1-series tiny! Just like the 85 is the favorite classic tiny.. And, no 2-series 8-pin parts either. Is 8-pin AVR dead? |
Beta Was this translation helpful? Give feedback.
-
Okay, looking at how things are going made it clear that a different approach is needed. So my plan now is to:
And then, continue with the ongoing initiatives for the next major release. It is looking increasingly like this release will be a 2.0.0, as I think there is a bandaid that needs to be ripped off in the bootloader department, and a few other places.
Beta Was this translation helpful? Give feedback.
All reactions