Merge branch 'master' into structure-refactor
This commit is contained in:
@@ -3,8 +3,10 @@
|
|||||||
"f_cpu": "120000000L",
|
"f_cpu": "120000000L",
|
||||||
"prefix": "arm-none-eabi-",
|
"prefix": "arm-none-eabi-",
|
||||||
"bkota": {
|
"bkota": {
|
||||||
"encryption": "none",
|
"encryption": "aes256",
|
||||||
"compression": "gzip"
|
"compression": "gzip",
|
||||||
|
"key": "0123456789ABCDEF0123456789ABCDEF",
|
||||||
|
"iv": "0123456789ABCDEF"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"connectivity": [
|
"connectivity": [
|
||||||
|
|||||||
@@ -83,6 +83,7 @@ queue.AppendPrivate(
|
|||||||
"-Wno-comment",
|
"-Wno-comment",
|
||||||
"-Wno-char-subscripts",
|
"-Wno-char-subscripts",
|
||||||
"-Wno-missing-braces",
|
"-Wno-missing-braces",
|
||||||
|
"-Wno-return-type",
|
||||||
],
|
],
|
||||||
CFLAGS=[
|
CFLAGS=[
|
||||||
"-Wno-format",
|
"-Wno-format",
|
||||||
|
|||||||
@@ -26,6 +26,7 @@ queue.AppendPublic(
|
|||||||
("ERRNO", "1"), # for LwIP
|
("ERRNO", "1"), # for LwIP
|
||||||
"MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED", # enable PSK in mbedTLS
|
"MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED", # enable PSK in mbedTLS
|
||||||
# "MBEDTLS_DEBUG_C",
|
# "MBEDTLS_DEBUG_C",
|
||||||
|
"MBED_PERIPHERALNAMES_H", # see fixups/cmsis.h
|
||||||
],
|
],
|
||||||
LINKFLAGS=[
|
LINKFLAGS=[
|
||||||
"-mcpu=cortex-m4",
|
"-mcpu=cortex-m4",
|
||||||
|
|||||||
@@ -31,6 +31,7 @@ env.Append(
|
|||||||
"-fdata-sections", # place each function or data item into its own section
|
"-fdata-sections", # place each function or data item into its own section
|
||||||
"-ffunction-sections", # place each function or data item into its own section
|
"-ffunction-sections", # place each function or data item into its own section
|
||||||
"-fno-strict-aliasing", # (don't) assume the strictest aliasing rules applicable
|
"-fno-strict-aliasing", # (don't) assume the strictest aliasing rules applicable
|
||||||
|
"-fno-inline-functions", # (don't) consider all functions for inlining
|
||||||
# Preprocessor Options
|
# Preprocessor Options
|
||||||
"-MMD", # output a rule suitable for make describing the dependencies of the main source file
|
"-MMD", # output a rule suitable for make describing the dependencies of the main source file
|
||||||
# Code Generation Options
|
# Code Generation Options
|
||||||
@@ -96,6 +97,7 @@ queue.AppendPublic(
|
|||||||
CXXFLAGS=[
|
CXXFLAGS=[
|
||||||
"-Wno-literal-suffix",
|
"-Wno-literal-suffix",
|
||||||
"-Wno-write-strings",
|
"-Wno-write-strings",
|
||||||
|
"-Wno-psabi",
|
||||||
],
|
],
|
||||||
CPPDEFINES=[
|
CPPDEFINES=[
|
||||||
("LIBRETUYA", 1),
|
("LIBRETUYA", 1),
|
||||||
|
|||||||
7
cores/beken-72xx/base/fixups/gcc10.c
Normal file
7
cores/beken-72xx/base/fixups/gcc10.c
Normal file
@@ -0,0 +1,7 @@
|
|||||||
|
/* Copyright (c) Kuba Szczodrzyński 2023-03-13. */
|
||||||
|
|
||||||
|
// Compiling with GCC 10.3.1 requires this or it will produce linker errors.
|
||||||
|
// See:
|
||||||
|
// - https://github.com/purduesigbots/pros/issues/153#issuecomment-519335375
|
||||||
|
// - https://stackoverflow.com/a/64664385
|
||||||
|
void __sync_synchronize(void) {}
|
||||||
50
cores/realtek-ambz/base/fixups/cmsis.h
Normal file
50
cores/realtek-ambz/base/fixups/cmsis.h
Normal file
@@ -0,0 +1,50 @@
|
|||||||
|
/* Copyright (c) Kuba Szczodrzyński 2023-03-12. */
|
||||||
|
|
||||||
|
// Fix for PeripheralNames.h producing errors on GCC newer than 5.x.x.
|
||||||
|
// The struct pointer casts are replaced with register addresses, which fixes compilation.
|
||||||
|
// On older versions, this change doesn't make any difference.
|
||||||
|
// MBED_PERIPHERALNAMES_H is defined in the SDK builder, to eliminate PeripheralNames.h completely.
|
||||||
|
|
||||||
|
#include_next "cmsis.h"
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
extern "C" {
|
||||||
|
#endif
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
UART_0 = (int)UART0_REG_BASE,
|
||||||
|
UART_1 = (int)UART1_REG_BASE,
|
||||||
|
UART_2 = (int)UART2_REG_BASE,
|
||||||
|
} UARTName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
ADC0_0 = 0,
|
||||||
|
ADC0_1,
|
||||||
|
ADC0_2,
|
||||||
|
ADC0_3
|
||||||
|
} ADCName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
SPI_0 = (int)SPI0_REG_BASE,
|
||||||
|
SPI_1 = (int)SPI1_REG_BASE,
|
||||||
|
} SPIName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
I2C_0 = (int)I2C0_REG_BASE,
|
||||||
|
I2C_1 = (int)I2C1_REG_BASE,
|
||||||
|
} I2CName;
|
||||||
|
|
||||||
|
typedef enum {
|
||||||
|
PWM_0 = 1,
|
||||||
|
PWM_1,
|
||||||
|
PWM_2,
|
||||||
|
PWM_3,
|
||||||
|
PWM_4,
|
||||||
|
PWM_5
|
||||||
|
} PWMName;
|
||||||
|
|
||||||
|
#ifdef __cplusplus
|
||||||
|
}
|
||||||
|
#endif
|
||||||
21
cores/realtek-ambz/base/fixups/machine/endian.h
Normal file
21
cores/realtek-ambz/base/fixups/machine/endian.h
Normal file
@@ -0,0 +1,21 @@
|
|||||||
|
/* Copyright (c) Kuba Szczodrzyński 2023-03-12. */
|
||||||
|
|
||||||
|
#include_next <machine/endian.h>
|
||||||
|
|
||||||
|
#pragma once
|
||||||
|
|
||||||
|
// GCC versions newer than 5.x.x specify the LITTLE_ENDIAN macro
|
||||||
|
// as an alias to _LITTLE_ENDIAN (which in turn holds the actual numeric value).
|
||||||
|
// Realtek's rtl8711b_crypto.h redefines _LITTLE_ENDIAN as a macro without
|
||||||
|
// any value, which makes comparisons like '#if BYTE_ORDER == LITTLE_ENDIAN' impossible.
|
||||||
|
|
||||||
|
#if __GNUC__ > 5
|
||||||
|
#undef _LITTLE_ENDIAN
|
||||||
|
#undef _BIG_ENDIAN
|
||||||
|
#undef LITTLE_ENDIAN
|
||||||
|
#undef BIG_ENDIAN
|
||||||
|
#undef BYTE_ORDER
|
||||||
|
#define LITTLE_ENDIAN 1234
|
||||||
|
#define BIG_ENDIAN 4321
|
||||||
|
#define BYTE_ORDER LITTLE_ENDIAN
|
||||||
|
#endif
|
||||||
@@ -24,9 +24,7 @@
|
|||||||
"version": "https://github.com/libretuya/framework-realtek-amb1#v2022.06.21",
|
"version": "https://github.com/libretuya/framework-realtek-amb1#v2022.06.21",
|
||||||
"version_prefix": true,
|
"version_prefix": true,
|
||||||
"toolchains": {
|
"toolchains": {
|
||||||
"x86_64": "gccarmnoneeabi@~1.50201.0",
|
"any": "gccarmnoneeabi@~1.100301.0"
|
||||||
"arm": "gccarmnoneeabi@~1.50401.211104",
|
|
||||||
"arm64": "gccarmnoneeabi@~1.50401.210715"
|
|
||||||
},
|
},
|
||||||
"libraries": {
|
"libraries": {
|
||||||
"lwip": {
|
"lwip": {
|
||||||
@@ -43,9 +41,7 @@
|
|||||||
"version": "https://github.com/libretuya/framework-realtek-ambz2#v2022.11.17",
|
"version": "https://github.com/libretuya/framework-realtek-ambz2#v2022.11.17",
|
||||||
"version_prefix": true,
|
"version_prefix": true,
|
||||||
"toolchains": {
|
"toolchains": {
|
||||||
"x86_64": "gccarmnoneeabi@~1.100301.0",
|
"any": "gccarmnoneeabi@~1.100301.0"
|
||||||
"arm": "gccarmnoneeabi@~1.100301.0",
|
|
||||||
"arm64": "gccarmnoneeabi@~1.100301.0"
|
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
"framework-beken-bdk": {
|
"framework-beken-bdk": {
|
||||||
@@ -54,9 +50,7 @@
|
|||||||
"version": "https://github.com/libretuya/framework-beken-bdk#v2021.06.07",
|
"version": "https://github.com/libretuya/framework-beken-bdk#v2021.06.07",
|
||||||
"version_prefix": true,
|
"version_prefix": true,
|
||||||
"toolchains": {
|
"toolchains": {
|
||||||
"x86_64": "gccarmnoneeabi@~1.40804.0",
|
"any":"gccarmnoneeabi@~1.100301.0"
|
||||||
"arm": "gccarmnoneeabi@~1.40803.0",
|
|
||||||
"arm64": "gccarmnoneeabi@~1.40803.0"
|
|
||||||
},
|
},
|
||||||
"libraries": {
|
"libraries": {
|
||||||
"lwip": {
|
"lwip": {
|
||||||
|
|||||||
45
platform.py
45
platform.py
@@ -74,6 +74,33 @@ if dirname(__file__) in sys.path:
|
|||||||
ltchiptool.lt_set_path(dirname(__file__))
|
ltchiptool.lt_set_path(dirname(__file__))
|
||||||
|
|
||||||
|
|
||||||
|
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):
|
class LibretuyaPlatform(PlatformBase):
|
||||||
custom_opts: Dict[str, object] = None
|
custom_opts: Dict[str, object] = None
|
||||||
versions: Dict[str, str] = None
|
versions: Dict[str, str] = None
|
||||||
@@ -139,13 +166,17 @@ class LibretuyaPlatform(PlatformBase):
|
|||||||
# set specific compiler versions
|
# set specific compiler versions
|
||||||
if "toolchains" in package_obj:
|
if "toolchains" in package_obj:
|
||||||
toolchains = package_obj["toolchains"]
|
toolchains = package_obj["toolchains"]
|
||||||
if "arm" in platform.machine():
|
toolchain_version = None
|
||||||
(toolchain, version) = toolchains["arm"].split("@")
|
specifiers = get_os_specifiers()
|
||||||
elif "aarch64" in platform.machine():
|
for spec in specifiers:
|
||||||
(toolchain, version) = toolchains["arm64"].split("@")
|
toolchain_version = toolchains.get(spec)
|
||||||
else:
|
if toolchain_version:
|
||||||
(toolchain, version) = toolchains["x86_64"].split("@")
|
break
|
||||||
version = versions.get("toolchain") or version
|
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
|
self.packages[f"toolchain-{toolchain}"]["version"] = version
|
||||||
|
|
||||||
# gather library dependencies
|
# gather library dependencies
|
||||||
|
|||||||
Reference in New Issue
Block a user