[core] Update ltchiptool to v4.0.0

This commit is contained in:
Kuba Szczodrzyński
2023-03-26 17:44:40 +02:00
parent bd75b54dce
commit 2a7f1b52a0
5 changed files with 10 additions and 7 deletions

View File

@@ -8,6 +8,7 @@ from subprocess import PIPE, Popen
from typing import Dict
from ltchiptool import Family, get_version
from ltchiptool.util.misc import sizeof
from platformio.platform.base import PlatformBase
from platformio.platform.board import PlatformBoardConfig
from SCons.Script import DefaultEnvironment, Environment
@@ -121,8 +122,10 @@ def env_print_info(
# Print custom flash layout
if env.get("FLASH_IS_CUSTOM", False):
print("CUSTOM FLASH LAYOUT:")
for k, v in board.get("flash").items():
print(f" - {k}: {v}")
for name, layout in board.get("flash").items():
(_, _, length) = v.partition("+")
length = int(length, 16)
print(f" - {name}: {layout} ({sizeof(length)})")
def env_parse_custom_options(env: Environment, platform: PlatformBase):

View File

@@ -93,7 +93,7 @@ def env_generate_linker_script(env: Environment, board: PlatformBoardConfig, nam
with open(input, "r") as f:
ldscript = f.read()
def transform(match: re.Match[str]):
def transform(match: re.Match):
key = match[1]
if key in env:
return env[key]

View File

@@ -43,7 +43,7 @@ void UpdateClass::cleanup(uint8_t ardErr, uf2_err_t uf2Err) {
printErrorContext1();
#endif
free(ctx); // NULL in constructor
uf2_ctx_free(ctx); // NULL in constructor
ctx = NULL;
uf2_info_free(info); // NULL in constructor
info = NULL;

View File

@@ -101,7 +101,7 @@
},
"tool-ltchiptool": {
"type": "uploader",
"version": "https://github.com/libretuya/ltchiptool#v2.0.2",
"version": "https://github.com/libretuya/ltchiptool#v4.0.0a0",
"version_prefix": true,
"note": "This is used only for C/C++ code from ltchiptool."
},

View File

@@ -17,7 +17,7 @@ from platformio.platform.base import PlatformBase
from platformio.platform.board import PlatformBoardConfig
from semantic_version import SimpleSpec, Version
LTCHIPTOOL_VERSION = "^3.0.0"
LTCHIPTOOL_VERSION = "^4.0.0"
# Install & import tools
@@ -27,7 +27,7 @@ def check_ltchiptool(install: bool):
print("Installing/updating ltchiptool")
system(
f"{sys.executable} -m pip install -U --force-reinstall "
f'"ltchiptool >= {LTCHIPTOOL_VERSION}, < 4.0"'
f'"ltchiptool >= {LTCHIPTOOL_VERSION}, < 5.0"'
)
# unload all modules from the old version