Skip to content

Commit

Permalink
Make SDI printf monitors clearer
Browse files Browse the repository at this point in the history
  • Loading branch information
maxgerhardt committed Dec 1, 2024
1 parent 9078ce4 commit 35d657f
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 9 deletions.
10 changes: 6 additions & 4 deletions builder/main.py
Original file line number Diff line number Diff line change
Expand Up @@ -320,13 +320,15 @@ def generate_openocd_action(args: List[str], action_name:str):
], "Restting Device"),
"Reset (ISP)"
)
if upload_protocol == "minichlink":
# make minichlink SDI printf monitor show up even when it's not the selected upload protocol
if upload_protocol == "minichlink" or "ch32v003fun" in frameworks or len(frameworks) == 0:
env.AddPlatformTarget(
"sdi_printf_monitor", None, generate_minichlink_action([
"-T"
], "Starting SDI Printf Monitor"),
"Minichlink Monitor SDI Printf"
"Monitor SDI Printf (ch32v003fun)"
)
if upload_protocol == "minichlink":
env.AddPlatformTarget(
"enable_flash_protection", None, generate_minichlink_action([
"-P"
Expand All @@ -346,13 +348,13 @@ def generate_openocd_action(args: List[str], action_name:str):
"sdi_printf", None, generate_wlink_action([
"sdi-print enable"
], "Enabling SDI Printf"),
"Enable SDI Printf"
"Enable SDI Printf (NoneSDK)"
)
env.AddPlatformTarget(
"disable_sdi_printf", None, generate_wlink_action([
"sdi-print disable"
], "Disabling SDI Printf"),
"Disable SDI Printf"
"Disable SDI Printf (NoneSDK)"
)

#
Expand Down
9 changes: 4 additions & 5 deletions platform.py
Original file line number Diff line number Diff line change
Expand Up @@ -82,21 +82,21 @@ def configure_default_packages(self, variables, targets):
sys_type = util.get_systype()
# until toolchain is not yet approved in PIO registry: redirect packages at will here
# (temporary)
selected_frameworks = variables.get("pioframework", [])
frameworks = variables.get("pioframework", [])
gcc_branch = "#gcc12"
# Mac toolchain is broken.
# Linux toolchain misses libprintf.a.
# Force usage of GCC8 again until they fix their stuff.
FORCE_DOWNGRADE_TO_GCC8 = True
if "arduino" in selected_frameworks or FORCE_DOWNGRADE_TO_GCC8:
if "arduino" in frameworks or FORCE_DOWNGRADE_TO_GCC8:
# we downgrade the GCC version to just 8 because with 12, there are build errors.
gcc_branch = ""
self.packages["toolchain-riscv"]["version"] = Ch32vPlatform.riscv_toolchain[sys_type] + gcc_branch
if not variables.get("board"):
return super().configure_default_packages(variables, targets)
# The FreeRTOS, Harmony LiteOS and RT-Thread package needs the
# NoneSDK as a base package
if any([framework in selected_frameworks for framework in ("freertos", "harmony-liteos", "rt-thread", "tencent-os")]):
if any([framework in frameworks for framework in ("freertos", "harmony-liteos", "rt-thread", "tencent-os")]):
self.packages["framework-wch-noneos-sdk"]["optional"] = False
# upload via USB bootloader wanted? (called "isp" in our platform)
# then activate package
Expand All @@ -105,14 +105,13 @@ def configure_default_packages(self, variables, targets):
default_protocol = board_config.get("upload.protocol") or ""
if variables.get("upload_protocol", default_protocol) == "isp":
self.packages["tool-wchisp"]["optional"] = False
elif variables.get("upload_protocol", default_protocol) == "minichlink":
if variables.get("upload_protocol", default_protocol) == "minichlink" or "ch32v003fun" in frameworks or len(frameworks) == 0:
self.packages["tool-minichlink"]["optional"] = False
self.packages["tool-minichlink"]["version"] = Ch32vPlatform.minichlink_tool[sys_type]
#elif variables.get("upload_protocol", default_protocol) == "wlink":
# Always update the link to the tool-wlink tool, because for all uploads we want to have the "Enable SDI Print" available
self.packages["tool-wlink"]["optional"] = False
self.packages["tool-wlink"]["version"] = Ch32vPlatform.wlink_tool[sys_type]
frameworks = variables.get("pioframework", [])
build_core = variables.get("board_build.core", board_config.get("build.core", "arduino"))
if "arduino" in frameworks:
if build_core == "ch32v003":
Expand Down

0 comments on commit 35d657f

Please sign in to comment.