[realtek-ambz] Move C++ flags to SDK builder

This commit is contained in:
Kuba Szczodrzyński
2022-06-13 17:08:20 +02:00
parent 85b5b1df91
commit 4d1c8357b4
4 changed files with 32 additions and 24 deletions

View File

@@ -12,6 +12,14 @@ LT_ARDUINO_DIR = join(platform.get_dir(), "arduino", "libretuya")
assert isdir(API_DIR)
assert isdir(LT_ARDUINO_DIR)
# Flags
env.Append(
CPPDEFINES=[
("ARDUINO", 10812),
"ARDUINO_SDK",
]
)
# Sources - ArduinoCore-API
env.AddLibrary(
name="arduino_api",

View File

@@ -17,31 +17,8 @@ env.SConscript("../arduino-common.py", exports="env")
# Flags
env.Append(
CXXFLAGS=[
# borrowed from RtlDuino/development/rtl87xx/platform.txt
"-std=c++11",
"-mcpu=cortex-m4",
"-mthumb",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
"-g2",
"-w",
"-O2",
"-MMD",
"-fdata-sections",
"-ffunction-sections",
"-fmessage-length=0",
"-fno-common",
"-fno-exceptions",
"-fno-rtti",
"-fno-short-enums",
"-fomit-frame-pointer",
"-fsigned-char",
],
CPPDEFINES=[
("ARDUINO", 10812),
"ARDUINO_AMEBA",
"ARDUINO_SDK",
"ARDUINO_ARCH_AMBZ",
# the SDK declares bool if not defined before
# which conflicts with C++ built-in bool

View File

@@ -27,6 +27,27 @@ env.Append(
"-fomit-frame-pointer",
"-fsigned-char",
],
CXXFLAGS=[
# borrowed from RtlDuino/development/rtl87xx/platform.txt
"-std=c++11",
"-mcpu=cortex-m4",
"-mthumb",
"-mfloat-abi=hard",
"-mfpu=fpv4-sp-d16",
"-g2",
"-w",
"-O2",
"-MMD",
"-fdata-sections",
"-ffunction-sections",
"-fmessage-length=0",
"-fno-common",
"-fno-exceptions",
"-fno-rtti",
"-fno-short-enums",
"-fomit-frame-pointer",
"-fsigned-char",
],
CPPDEFINES=[
# LibreTuya configuration
("LT_HAS_LWIP", "1"),
@@ -59,7 +80,6 @@ env.Append(
"-g",
"--specs=nano.specs",
"-nostartfiles",
"-Wl,-Map=" + join("$BUILD_DIR", "${PROGNAME}.map"),
"-Os",
"-Wl,--gc-sections",
"-Wl,--cref",

View File

@@ -70,6 +70,9 @@ def env_add_defaults(env, platform, board):
("MCU", "${MCU}"),
("FAMILY", "${FAMILY}"),
],
LINKFLAGS=[
"-Wl,-Map=" + join("$BUILD_DIR", "${PROGNAME}.map"),
],
)