Skip to content

Commit

Permalink
Add tool-vnproch55x
Browse files Browse the repository at this point in the history
  • Loading branch information
ivankravets committed Apr 11, 2022
1 parent 81bf8cc commit 6402cc7
Show file tree
Hide file tree
Showing 2 changed files with 13 additions and 5 deletions.
11 changes: 6 additions & 5 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -51,6 +51,7 @@ def _parseSdccFlags(flags):


env = DefaultEnvironment()
platform = env.PioPlatform()
board_config = env.BoardConfig()

env.Replace(
Expand All @@ -62,7 +63,7 @@ def _parseSdccFlags(flags):
OBJCOPY="sdobjcopy",
OBJSUFFIX=".rel",
LIBSUFFIX=".lib",
SIZETOOL=join(env.PioPlatform().get_dir(), "builder", "size.py"),
SIZETOOL=join(platform.get_dir(), "builder", "size.py"),

SIZECHECKCMD='$PYTHONEXE $SIZETOOL $SOURCES',
SIZEPRINTCMD='"$PYTHONEXE" $SIZETOOL $SOURCES',
Expand Down Expand Up @@ -147,15 +148,15 @@ def _parseSdccFlags(flags):
if upload_protocol == "stcgal":
f_cpu_khz = int(board_config.get("build.f_cpu").strip('L')) / 1000
stcgal_protocol = board_config.get("upload.stcgal_protocol")
stcgal = join(env.PioPlatform().get_package_dir("tool-stcgal") or "", "stcgal.py")
env.Replace(
UPLOADER=join(platform.get_package_dir("tool-stcgal") or "", "stcgal.py"),
UPLOADERFLAGS=[
"-P", stcgal_protocol,
"-p", "$UPLOAD_PORT",
"-t", int(f_cpu_khz),
"-a"
],
UPLOADCMD='"$PYTHONEXE" %s $UPLOADERFLAGS $SOURCE' % stcgal)
UPLOADCMD='"$PYTHONEXE" "$UPLOADER" $UPLOADERFLAGS $SOURCE')

upload_actions = [
env.VerboseAction(env.AutodetectUploadPort,
Expand All @@ -166,11 +167,11 @@ def _parseSdccFlags(flags):
# CH55x upload tool
elif upload_protocol == "ch55x":
env.Replace(
UPLOADER="ch55xtool.py",
UPLOADER="vnproch55x",
UPLOADERFLAGS=[
"-f"
],
UPLOADCMD="$PYTHONEXE $UPLOADER $UPLOADERFLAGS $BUILD_DIR/${PROGNAME}.bin")
UPLOADCMD="$UPLOADER $UPLOADERFLAGS $BUILD_DIR/${PROGNAME}.bin")

upload_actions = [
env.VerboseAction(" ".join(["$OBJCOPY","-I","ihex","-O","binary",
Expand Down
7 changes: 7 additions & 0 deletions platform.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,8 +27,15 @@
},
"tool-stcgal": {
"type": "uploader",
"optional": true,
"owner": "platformio",
"version": "~1.104.0"
},
"tool-vnproch55x": {
"type": "uploader",
"optional": true,
"owner": "platformio",
"version": "~1.0.220407"
}
}
}

0 comments on commit 6402cc7

Please sign in to comment.