Skip to content

Commit

Permalink
Merge branch 'release/v5.1.1'
Browse files Browse the repository at this point in the history
  • Loading branch information
valeros committed Aug 26, 2022
2 parents a28daed + bc3b2ad commit 7a69f63
Show file tree
Hide file tree
Showing 8 changed files with 22 additions and 79 deletions.
1 change: 1 addition & 0 deletions .github/stale.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ exemptLabels:
- feature
- enhancement
- board request
- package update
# Label to use when marking an issue as stale
staleLabel: stale
# Comment to post when marking an issue as stale. Set to `false` to disable
Expand Down
8 changes: 4 additions & 4 deletions boards/denky_d4.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"flash_mode": "qio",
"mcu": "esp32",
"variant": "ch_denky"
},
Expand All @@ -26,11 +26,11 @@
],
"name": "Denky D4 (PICO-V3-02)",
"upload": {
"flash_size": "4MB",
"flash_size": "8MB",
"maximum_ram_size": 327680,
"maximum_size": 4194304,
"maximum_size": 8388608,
"require_upload_port": true,
"speed": 460800
"speed": 2000000
},
"url": "https://en.wikipedia.org/wiki/ESP32",
"vendor": "Denky"
Expand Down
3 changes: 2 additions & 1 deletion boards/dfrobot_beetle_esp32c3.json
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@
"core": "esp32",
"extra_flags": [
"-DARDUINO_ESP32C3_DEV",
"-DARDUINO_USB_MODE=1"
"-DARDUINO_USB_MODE=1",
"-DARDUINO_USB_CDC_ON_BOOT=1"
],
"f_cpu": "160000000L",
"f_flash": "80000000L",
Expand Down
4 changes: 2 additions & 2 deletions boards/esp32-s3-devkitc-1.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,10 +13,10 @@
],
"f_cpu": "240000000L",
"f_flash": "80000000L",
"flash_mode": "dio",
"flash_mode": "qio",
"hwids": [
[
"0X303A",
"0x303A",
"0x1001"
]
],
Expand Down
2 changes: 1 addition & 1 deletion boards/lolin_c3_mini.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
]
],
"mcu": "esp32c3",
"variant": "esp32c3"
"variant": "lolin_c3_mini"
},
"connectivity": [
"wifi"
Expand Down
60 changes: 4 additions & 56 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -160,18 +160,6 @@ def __fetch_fs_size(target, source, env):
return (target, source)


def merge_binaries(source, target, env, for_signature):
return " ".join([
'"$PYTHONEXE"',
join(platform.get_package_dir("tool-esptoolpy") or "", "esptool.py"),
"--chip", mcu, "merge_bin",
"-o", "$TARGET",
"--flash_mode", "$BOARD_FLASH_MODE",
"--flash_size", board.get("upload.flash_size", "4MB"),
"$ESP32_APP_OFFSET", "$SOURCES"
] + ['"%s"' % itm for img in env.get("FLASH_EXTRA_IMAGES", []) for itm in img])


env = DefaultEnvironment()
platform = env.PioPlatform()
board = env.BoardConfig()
Expand All @@ -181,21 +169,6 @@ def merge_binaries(source, target, env, for_signature):
if mcu == "esp32c3":
toolchain_arch = "riscv32-esp"

# Arduino core v2.0.4 contains updated bootloader images that have innacurate default
# headers. This results in bootloops if firmware is flashed via OpenOCD (e.g. debugging
# or uploading via debug tools). For this reason, before uploading or debugging we need
# to merge binaries via esptoolpy so that the image headers will be adjusted according to
# --flash-size and --flash-mode arguments.
# Note: This behavior doesn't occur if uploading is done via esptoolpy, as esptoolpy
# overrides the binary image headers before flashing.
firmware_merge_required = bool(
env.get("PIOFRAMEWORK", []) == ["arduino"]
and (
"debug" in env.GetBuildType()
or env.subst("$UPLOAD_PROTOCOL") in board.get("debug.tools", {})
)
)

if "INTEGRATION_EXTRA_DATA" not in env:
env["INTEGRATION_EXTRA_DATA"] = {}

Expand Down Expand Up @@ -291,10 +264,6 @@ def merge_binaries(source, target, env, for_signature):
source_factory=env.Dir,
suffix=".bin",
),
MergeBin=Builder(
generator=merge_binaries,
suffix=".bin",
),
)
)

Expand All @@ -306,7 +275,6 @@ def merge_binaries(source, target, env, for_signature):
#

target_elf = None
target_firm_merged = None
if "nobuild" in COMMAND_LINE_TARGETS:
target_elf = join("$BUILD_DIR", "${PROGNAME}.elf")
if set(["uploadfs", "uploadfsota"]) & set(COMMAND_LINE_TARGETS):
Expand All @@ -325,14 +293,6 @@ def merge_binaries(source, target, env, for_signature):
else:
target_firm = env.ElfToBin(
join("$BUILD_DIR", "${PROGNAME}"), target_elf)
if firmware_merge_required:
# Note: Default offset address must be set to 0x0 because debugging
# relies on OpenOCD that requires merged firmware
env["INTEGRATION_EXTRA_DATA"].update(
{"application_offset": "0x0", "merged_firmware": True}
)
target_firm_merged = env.MergeBin(join(
"$BUILD_DIR", "${PROGNAME}_merged"), target_firm)
env.Depends(target_firm, "checkprogsize")

env.AddPlatformTarget("buildfs", target_firm, target_firm, "Build Filesystem Image")
Expand Down Expand Up @@ -408,8 +368,8 @@ def merge_binaries(source, target, env, for_signature):
"--chip", mcu,
"--port", '"$UPLOAD_PORT"',
"--baud", "$UPLOAD_SPEED",
"--before", "default_reset",
"--after", "hard_reset",
"--before", board.get("upload.before_reset", "default_reset"),
"--after", board.get("upload.after_reset", "hard_reset"),
"write_flash", "-z",
"--flash_mode", "${__get_board_flash_mode(__env__)}",
"--flash_freq", "${__get_board_f_flash(__env__)}",
Expand Down Expand Up @@ -470,10 +430,6 @@ def merge_binaries(source, target, env, for_signature):


elif upload_protocol in debug_tools:
if firmware_merge_required:
# Only merged firmware with proper headers will work when uploading is done via
# debug probes. The firmware offset address must be adjusted to 0x0 accordingly.
target_firm = target_firm_merged
openocd_args = ["-d%d" % (2 if int(ARGUMENTS.get("PIOVERBOSE", 0)) else 1)]
openocd_args.extend(
debug_tools.get(upload_protocol).get("server").get("arguments", []))
Expand All @@ -487,13 +443,12 @@ def merge_binaries(source, target, env, for_signature):
"$FS_START"
if "uploadfs" in COMMAND_LINE_TARGETS
else board.get(
"upload.offset_address",
"0x0" if firmware_merge_required else "$ESP32_APP_OFFSET"
"upload.offset_address", "$ESP32_APP_OFFSET"
)
),
]
)
if "uploadfs" not in COMMAND_LINE_TARGETS and not firmware_merge_required:
if "uploadfs" not in COMMAND_LINE_TARGETS:
for image in env.get("FLASH_EXTRA_IMAGES", []):
openocd_args.extend(
[
Expand Down Expand Up @@ -551,13 +506,6 @@ def merge_binaries(source, target, env, for_signature):
print("Warning! '-Wl,-T' option for specifying linker scripts is deprecated. "
"Please use 'board_build.ldscript' option in your 'platformio.ini' file.")

#
# A temporary workaround to propagate additional data to the debug configuration routine
#

Import("projenv")
projenv["INTEGRATION_EXTRA_DATA"] = env.get("INTEGRATION_EXTRA_DATA")

#
# Default targets
#
Expand Down
2 changes: 1 addition & 1 deletion 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-espressif32.git"
},
"version": "5.1.0",
"version": "5.1.1",
"frameworks": {
"arduino": {
"package": "framework-arduinoespressif32",
Expand Down
21 changes: 7 additions & 14 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -261,23 +261,16 @@ def configure_debug_session(self, debug_config):
if any(ignore_conds):
return

merged_firmware = build_extra_data.get("merged_firmware", False)
load_cmds = []
if not merged_firmware:
load_cmds.extend([
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=to_unix_path(item["path"]), offset=item["offset"]
)
for item in flash_images
])

load_cmds = [
'monitor program_esp "{{{path}}}" {offset} verify'.format(
path=to_unix_path(item["path"]), offset=item["offset"]
)
for item in flash_images
]
load_cmds.append(
'monitor program_esp "{%s.bin}" %s verify'
% (
to_unix_path(
debug_config.build_data["prog_path"][:-4]
+ ("_merged" if merged_firmware else "")
),
to_unix_path(debug_config.build_data["prog_path"][:-4]),
build_extra_data.get("application_offset", "0x10000"),
)
)
Expand Down

0 comments on commit 7a69f63

Please sign in to comment.