SIMPLELINK-LOWPOWER-F3-SDK: Compilation Error When Using EWARM

Part Number: SIMPLELINK-LOWPOWER-F3-SDK

Hello TI Team,

<Usage Conditions>

  • SIMPLELINK-LOWPOWER-F3-SDK: v9.20.00.81
  • IAR Embedded Workbench: v9.70.2 (Japanese Version) *
    • This is the version listed in the release notes.
<Description>
When compiling, an error message is output and compilation cannot be completed (see below).
[Commands Runner] SysConfig CLI completed successfully		
Traceback (most recent call last):		
  File "commands_runner.py", line 286, in <module>		
  File "commands_runner.py", line 212, in main		
  File "commands_runner.py", line 80, in log		
UnicodeEncodeError: 'cp932' codec can't encode character '\u2014' in position 63: illegal multibyte sequence		
[PYI-17048:ERROR] Failed to execute script 'commands_runner' due to unhandled exception!

We have confirmed that the error disappears if the Windows OS language is changed from Japanese to English. However, since we use the same PC for other IDEs as well, we are concerned about the potential impact.

Please provide a method that does not require changing the Windows OS language.

Thank you.

 

  • Hello hrkunied,

    What example are you attempting to build?  You should be able to find the $(SIMPLELINK_LOWPOWER_F3_SDK_INSTALL_DIR)/tools/ble/oad/commands_runner command from inside your IAR pre-build commands.  You will find the source from simplelink_lowpower_f3_sdk_9_20_00_81\tools\ble\oad\ and here are some suggestions for fixing the issue.  If you don't want to make the build scripts UTF-8 then here are some options you can try to modify commands_runner.py

    import sys
    import io
    
    # --------------------------------------------------------------------
    # Force UTF‑8 output on Windows consoles that use cp932 (or any other
    # non‑UTF‑8 code page).  Errors are replaced so the script never crashes
    # because of an unrepresentable character (e.g. EM‑dash).
    # --------------------------------------------------------------------
    sys.stdout = io.TextIOWrapper(
        sys.stdout.buffer,
        encoding="utf-8",
        errors="replace",      # or "ignore" if you prefer to drop the char
        line_buffering=True,
    )
    
    sys.stderr = io.TextIOWrapper(
        sys.stderr.buffer,
        encoding="utf-8",
        errors="replace",
        line_buffering=True,
    )
    

    # After reading the file (around line 136)
    with open(cfg_file, 'r', encoding='utf-8') as f:
        lines = f.readlines()
    
    # Replace any EM‑dash (or other problematic Unicode chars) with a normal hyphen
    lines = [line.replace('\u2014', '-') for line in lines]

    Regards,
    Ryan