mirror of
https://github.com/platformio/platformio-core.git
synced 2025-08-01 10:54:27 +02:00
Return to esptool-mk uploader.
This commit is contained in:
@@ -5,9 +5,7 @@
|
|||||||
Builder for Espressif MCUs
|
Builder for Espressif MCUs
|
||||||
"""
|
"""
|
||||||
|
|
||||||
import os
|
|
||||||
from os.path import join
|
from os.path import join
|
||||||
from platform import system
|
|
||||||
|
|
||||||
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
from SCons.Script import (COMMAND_LINE_TARGETS, AlwaysBuild, Builder, Default,
|
||||||
DefaultEnvironment)
|
DefaultEnvironment)
|
||||||
@@ -69,38 +67,40 @@ env.Replace(
|
|||||||
|
|
||||||
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
|
SIZEPRINTCMD='"$SIZETOOL" -B -d $SOURCES',
|
||||||
|
|
||||||
UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool.py"),
|
UPLOADER=join("$PIOPACKAGES_DIR", "tool-esptool", "esptool"),
|
||||||
UPLOADERFLAGS=[
|
UPLOADERFLAGS=[
|
||||||
"--port", "$UPLOAD_PORT",
|
"-vv",
|
||||||
"--baud", "$UPLOAD_SPEED",
|
"-cd", "none",
|
||||||
"write_flash",
|
"-cb", "$UPLOAD_SPEED",
|
||||||
"0x00000", join("$BUILD_DIR", "firmware.elf-0x00000.bin"),
|
"-cp", "$UPLOAD_PORT",
|
||||||
"0x40000", join("$BUILD_DIR", "firmware.elf-0x40000.bin")
|
"-ca", "0x00000",
|
||||||
|
"-cf", "${SOURCES[0]}",
|
||||||
|
"-ca", "0x40000",
|
||||||
|
"-cf", "${SOURCES[1]}"
|
||||||
],
|
],
|
||||||
UPLOADCMD='python $UPLOADER $UPLOADERFLAGS'
|
UPLOADCMD='$UPLOADER $UPLOADERFLAGS'
|
||||||
)
|
)
|
||||||
|
|
||||||
env.Append(
|
env.Append(
|
||||||
BUILDERS=dict(
|
BUILDERS=dict(
|
||||||
ElfToBin=Builder(
|
ElfToBin=Builder(
|
||||||
action=" ".join([
|
action=" ".join([
|
||||||
"python", "$UPLOADER", "elf2image", "$SOURCES"
|
"$UPLOADER",
|
||||||
|
"-eo", "$SOURCES",
|
||||||
|
"-bo", "${TARGETS[0]}",
|
||||||
|
"-bs", ".text",
|
||||||
|
"-bs", ".data",
|
||||||
|
"-bs", ".rodata",
|
||||||
|
"-bc", "-ec",
|
||||||
|
"-eo", "$SOURCES",
|
||||||
|
"-es", ".irom0.text", "${TARGETS[1]}",
|
||||||
|
"-ec", "-v"
|
||||||
]),
|
]),
|
||||||
suffix=".bin"
|
suffix=".bin"
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
)
|
)
|
||||||
|
|
||||||
if system() == "Windows":
|
|
||||||
paths = []
|
|
||||||
for path in os.environ['PATH'].split(";"):
|
|
||||||
if "python" in path.lower():
|
|
||||||
paths.append(path)
|
|
||||||
|
|
||||||
env.AppendENVPath(
|
|
||||||
"PATH", ";".join(paths)
|
|
||||||
)
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Configure SDK
|
# Configure SDK
|
||||||
#
|
#
|
||||||
@@ -133,7 +133,10 @@ target_elf = env.BuildFirmware()
|
|||||||
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
if "uploadlazy" in COMMAND_LINE_TARGETS:
|
||||||
target_firm = join("$BUILD_DIR", "firmware.bin")
|
target_firm = join("$BUILD_DIR", "firmware.bin")
|
||||||
else:
|
else:
|
||||||
target_firm = env.ElfToBin(target_elf)
|
target_firm = env.ElfToBin(
|
||||||
|
[join("$BUILD_DIR", "firmware_00000"),
|
||||||
|
join("$BUILD_DIR", "firmware_40000")], target_elf)
|
||||||
|
|
||||||
|
|
||||||
#
|
#
|
||||||
# Target: Print binary size
|
# Target: Print binary size
|
||||||
|
Reference in New Issue
Block a user