[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]