Closed MCUdude closed 4 years ago
@valeros thanks for adding initial support for megaTinyCore. I pulled the latest Github version and discovered a few issues I've fixed now. This script now works as expected.
Thanks a lot!
@valeros I'm not sure where to discuss this, but is there anything else needed before we have "proper" megaTinyCore support?
I did have a look in the platform.txt file, and there are a few macros passed from boards.txt that has to be included in the PlatformIO build as well. There is the -DCLOCK_SOURCE={build.clocksource}
field that determines if we're using an internal or external oscillator, and there are -DMILLIS_USE_TIMER{build.millistimer}
to determine what timer to use for millis.
IMO the clock source part could and should be dealt with by using build_hardware.oscillator = internal/external
, and the millis timer is already defined in every ATtiny manifest file in this repo. It's only a matter of unflagging and "reflagging" a new millis timer.
There are also some version dependent macros found here.
I see you already specified default values -DMILLIS_USE_TIMER*
and -DUARTBAUD5V
in the extra_flags
field. Is it a bad approach? Users can simply override values by using the build_unflags
option. As an alternative, we can write down all possible values in documentation and add default ones only if user didn't specify anything. Something similar to the configuration system in ASR605x. But again, this will introduce additional maintenance efforts since someone will need to keep track of the changes in each new release to keep the docs relevant.
I see you already specified default values -DMILLIS_USE_TIMER* and -DUARTBAUD5V in the extra_flags field. Is it a bad approach?
These are default and should be fine for most users. For those who need different values, it's easy to unflag. I think this is the best approach.
The only thing that needs to be dealt with is the oscillator option. It should default to internal
(CLOCKSOURCE=0), and it should be possible to override this using build_hardware.oscillator = external
(CLOCKSOURCE=2) without having to deal with CLOCKSOURCE at all, just like with MegaCoreX
Thanks, added oscillator settings for megatinycore
.
@valeros what is left to do before a new release is ready (apart from fixing #15)? I only have a few tinyAVR-0/1 boards, so I'm not able to test all targets. Maybe you could reach out to the various issues that request tinyAVR-0/1 support and ask if people could help out and test the latest development version?
If everything seems OK to you, then we can publish a new release once the issue 15 is resolved.
OK, I'd like to test some basic things first on a few boards I have. I'll report back here in a few days!
I can confirm that I'm able to calculate and write fuses and upload to ATtiny817 and ATtiny3217, which means that the foundation is OK, and probably works for the rest of the targets too.
Note that bootloader support is not present at the moment. It's a bit more tricky than on the megaAVR-0's, since the UPDI pin is multiplexed with the reset line. But my impression is that most users don't use a bootloader for the tinyAVR-0/1 series anyway.
What's missing now is only some documentation on the PlatformIO docs site, similar docs that we have for Mighty/Mega/Mini/Major/MicroCore.
Note that this script isn't properly tested yet, because #12 isn't merged yet, and I wasn't able to get it to work when manually adding these manifest files locally.
The only real difference between the fuses on megaAVR-0 and tinyAVR-0/1 is the SYSCFG0 fuse. megaAVR-0 has a dedicated UPDI pin that's always a UPDI pin, but the tinyAVR-0/1's have it multiplexed with the reset pin (that can also be a GPIO.
This means that when calculating fuses for megaAVR-0 you can reassign the reset pin with this line:
But for tinyAVR-0/1's it's going to be like this:
https://github.com/platformio/platform-atmelavr/issues/83 related.