platformio / platform-atmelavr

Atmel AVR: development platform for PlatformIO
https://registry.platformio.org/platforms/platformio/atmelavr
Apache License 2.0
136 stars 104 forks source link

Upgrade Digistump / Digispark Arduino Core #239

Closed maxgerhardt closed 3 years ago

maxgerhardt commented 3 years ago

Currently PlatformIO is using the package

https://github.com/platformio/platform-atmelavr/blob/dec3edd5f16c79a62bcc91fed7d04618b04721fe/platform.json#L62-L67

which maps to the latest version of this repository: https://github.com/digistump/DigistumpArduino/

However, this repo is practically dead since 4 years. Users have e.g. also noticed lots of compile warnings when using this core (https://github.com/platformio/platform-atmelavr/issues/233).

Thankfully, @ArminJo has created a successor of the core, improving and maintaining it at https://github.com/ArminJo/DigistumpArduino/.

This includes a new version of the core as well as the upload tool, Micronucleus, along with updated bootloader files. The versioning was continued, from the latest 1.6.7 in the old core it's now 1.7.1 in the noew core.

The build logic is the same as for the old core and PlatformIO can build this core by using the already created PlatformIO framework package for it (https://github.com/ArminJo/DigistumpArduino/raw/master/framework-arduino-avr-digistump-1.7.1.zip). Also, packages for the newer Micronucleus upload tool are available and already PlatformIO compatible. But, they need a slight adjustmen in the upload flags.

To currently use the new core, one has to do

[env:digispark-tiny]
platform = atmelavr
board = digispark-tiny
framework = arduino
platform_packages = 
    framework-arduino-avr-digistump@https://github.com/ArminJo/DigistumpArduino/raw/master/framework-arduino-avr-digistump-1.7.1.zip

if additionally wanting the updated micronucleus tool

[env:digispark-tiny]
platform = atmelavr
board = digispark-tiny
framework = arduino
platform_packages = 
    framework-arduino-avr-digistump@https://github.com/ArminJo/DigistumpArduino/raw/master/framework-arduino-avr-digistump-1.7.1.zip
    tool-micronucleus@https://github.com/ArminJo/DigistumpArduino/raw/master/tools/micronucleus-cli-2.5-pio-x86_64-mingw32.zip
upload_protocol = custom
upload_flags =
   --no-ansi
   --run
   --timeout
   60
upload_command = $PROJECT_PACKAGES_DIR/tool-micronucleus/micronucleus $UPLOAD_FLAGS $SOURCE

So since @ArminJo's repo is basically a better continuation of the abandoned original core, I'd vow for his core to be included as standard for the Digispark devices in platform-atmelavr.

valeros commented 3 years ago

As usual, many thanks to @maxgerhardt for such an excellently described request! I've switched the platform to @ArminJo's packages so it will be publicly available in the next release on the platform by the end of this week.