[realtek-ambz] Selectively update GCC to v10.3.1

This commit is contained in:
Kuba Szczodrzyński
2023-03-12 22:27:26 +01:00
parent ff8ac6036c
commit 5de98ed56c
5 changed files with 117 additions and 15 deletions

View File

@@ -137,6 +137,33 @@ def find_pkg_root(self, path: str, spec: PackageSpec):
return path
def get_os_specifiers():
system = platform.system().lower()
arch = platform.machine().lower()
if not arch: # issue #4353
arch = "x86"
bits = platform.architecture()[0]
if "aarch64" in arch:
arch = "arm"
bits = 64
elif "arm" in arch:
arch = "arm"
bits = 32
elif "64" not in arch:
arch = "x86"
bits = 32
else:
arch = "x86"
bits = 64
return [
f"{system}_{arch}_{bits}", # linux_x86_64
f"{system}_{bits}", # linux_64
system, # windows
arch, # arm
"any",
]
class LibretuyaPlatform(PlatformBase):
boards_base: Dict[str, dict] = {}
custom_opts: Dict[str, object] = {}
@@ -176,12 +203,17 @@ class LibretuyaPlatform(PlatformBase):
# set specific compiler versions
if "toolchains" in package_obj:
toolchains = package_obj["toolchains"]
if "arm" in platform.machine():
(toolchain, version) = toolchains["arm"].split("@")
elif "aarch64" in platform.machine():
(toolchain, version) = toolchains["arm64"].split("@")
else:
(toolchain, version) = toolchains["x86_64"].split("@")
toolchain_version = None
specifiers = get_os_specifiers()
for spec in specifiers:
toolchain_version = toolchains.get(spec)
if toolchain_version:
break
if not toolchain_version:
raise RuntimeError(
f"Toolchain not found for the current platform: {specifiers}"
)
(toolchain, version) = toolchain_version.split("@")
self.packages[f"toolchain-{toolchain}"]["version"] = version
# mark framework SDK as required