Skip to content

Commit

Permalink
Merge branch 'release/v1.7.0'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Feb 7, 2023
2 parents e4ce0e8 + b517a02 commit ab0c685
Show file tree
Hide file tree
Showing 12 changed files with 52 additions and 27 deletions.
2 changes: 1 addition & 1 deletion boards/avr_iot_wg.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"upload": {
"maximum_ram_size": 6144,
"maximum_size": 49152,
"protocol": "curiosity_updi"
"protocol": "pkobn_updi"
},
"url": "https://www.microchip.com/developmenttools/ProductDetails/AC164160",
"vendor": "Microchip"
Expand Down
2 changes: 1 addition & 1 deletion boards/curiosity_nano_4809.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"upload": {
"maximum_ram_size": 6144,
"maximum_size": 49152,
"protocol": "curiosity_updi"
"protocol": "pkobn_updi"
},
"url": "https://www.microchip.com/developmenttools/ProductDetails/DM320115",
"vendor": "Microchip"
Expand Down
9 changes: 7 additions & 2 deletions builder/bootloader.py
Original file line number Diff line number Diff line change
Expand Up @@ -81,8 +81,13 @@ def get_suitable_optiboot_binary(framework_dir, board_config):
"-p",
"$BOARD_MCU",
"-C",
os.path.join(env.PioPlatform().get_package_dir(
"tool-avrdude-megaavr") or "", "avrdude.conf"),
os.path.join(
env.PioPlatform().get_package_dir(
"tool-avrdude" if core in ("MegaCoreX", "megatinycore") else "tool-avrdude-megaavr"
)
or "",
"avrdude.conf",
),
],
BOOTFLAGS=["-U", "flash:w:%s:i" % bootloader_path],
UPLOADBOOTCMD="$BOOTUPLOADER $BOOTUPLOADERFLAGS $UPLOAD_FLAGS $BOOTFLAGS",
Expand Down
13 changes: 7 additions & 6 deletions builder/frameworks/arduino.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@

from SCons.Script import DefaultEnvironment

from platformio.package.version import pepver_to_semver

env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()
Expand Down Expand Up @@ -78,19 +80,18 @@
#

if build_core in ("dxcore", "megatinycore"):
package_version = platform.get_package_version(
package_version = pepver_to_semver(platform.get_package_version(
"framework-arduino-megaavr-%s" % build_core
)
major, minor, patch = package_version.split(".")
))

core_macro_name = build_core.upper()
env.Append(
CCFLAGS=["-mrelax"],
CPPDEFINES=[
(core_macro_name, '\\"%s\\"' % package_version),
("%s_MAJOR" % core_macro_name, "%sUL" % major),
("%s_MINOR" % core_macro_name, "%sUL" % minor),
("%s_PATCH" % core_macro_name, "%sUL" % patch),
("%s_MAJOR" % core_macro_name, "%sUL" % package_version.major),
("%s_MINOR" % core_macro_name, "%sUL" % package_version.minor),
("%s_PATCH" % core_macro_name, "%sUL" % package_version.patch),
("%s_RELEASED" % core_macro_name, 1),
"CORE_ATTACH_ALL",
]
Expand Down
5 changes: 4 additions & 1 deletion builder/fuses.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,7 +223,10 @@ def calculate_fuses(board_config, predefined_fuses):
"$BOARD_MCU",
"-C",
os.path.join(
env.PioPlatform().get_package_dir("tool-avrdude-megaavr") or "",
env.PioPlatform().get_package_dir(
"tool-avrdude" if core in ("MegaCoreX", "megatinycore") else "tool-avrdude-megaavr"
)
or "",
"avrdude.conf",
),
],
Expand Down
11 changes: 9 additions & 2 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -73,8 +73,15 @@ def BeforeUpload(target, source, env): # pylint: disable=W0613,W0621
UPLOADER="avrdude",
UPLOADERFLAGS=[
"-p", "$BOARD_MCU", "-C",
join(env.PioPlatform().get_package_dir(
"tool-avrdude-megaavr") or "", "avrdude.conf"),
join(
env.PioPlatform().get_package_dir(
"tool-avrdude"
if env.BoardConfig().get("build.core", "") in ("MegaCoreX", "megatinycore")
else "tool-avrdude-megaavr"
)
or "",
"avrdude.conf",
),
"-c", "$UPLOAD_PROTOCOL"
],
UPLOADCMD="$UPLOADER $UPLOADERFLAGS -U flash:w:$SOURCES:i",
Expand Down
3 changes: 1 addition & 2 deletions examples/arduino-blink/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.pioenvs
.piolibdeps
.pio
3 changes: 1 addition & 2 deletions examples/arduino-external-libs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.pioenvs
.piolibdeps
.pio
3 changes: 1 addition & 2 deletions examples/arduino-internal-libs/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.pioenvs
.piolibdeps
.pio
3 changes: 1 addition & 2 deletions examples/native-blink/.gitignore
Original file line number Diff line number Diff line change
@@ -1,2 +1 @@
.pioenvs
.piolibdeps
.pio
6 changes: 3 additions & 3 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"type": "git",
"url": "https://github.com/platformio/platform-atmelmegaavr.git"
},
"version": "1.6.0",
"version": "1.7.0",
"frameworks": {
"arduino": {
"package": "framework-arduino-megaavr",
Expand All @@ -42,13 +42,13 @@
"type": "framework",
"optional": true,
"owner": "platformio",
"version": "~1.0.10"
"version": "~1.1.1"
},
"framework-arduino-megaavr-megatinycore": {
"type": "framework",
"optional": true,
"owner": "platformio",
"version": "~2.5.0"
"version": "~2.6.5"
},
"framework-arduino-megaavr-dxcore": {
"type": "framework",
Expand Down
19 changes: 16 additions & 3 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -32,12 +32,25 @@ def configure_default_packages(self, variables, targets):
self.packages[framework_package]["optional"] = False
self.packages["framework-arduino-megaavr"]["optional"] = True

if build_core in ("MegaCoreX", "megatinycore", "dxcore"):
if build_core in ("MegaCoreX", "megatinycore"):
# MegaCoreX and megatinycore require AVRDUDE v7.1 currently available
# only in atmelavr platform
self.packages.pop("tool-avrdude-megaavr", None)
self.packages["tool-avrdude"] = {
"type": "uploader",
"optional": True,
"owner": "platformio",
"version": "~1.70100.0"
}

if build_core in ("megatinycore", "dxcore"):
self.packages["toolchain-atmelavr"]["version"] = "~3.70300.0"
self.packages["tool-avrdude-megaavr"]["version"] = "~3.60300.0"

if any(t in targets for t in ("fuses", "bootloader")):
self.packages["tool-avrdude-megaavr"]["optional"] = False
if build_core in ("MegaCoreX", "megatinycore"):
self.packages["tool-avrdude"]["optional"] = False
else:
self.packages["tool-avrdude-megaavr"]["optional"] = False

return super().configure_default_packages(
variables, targets)

0 comments on commit ab0c685

Please sign in to comment.