[core] Update PIO builders to new structure
This commit is contained in:
@@ -1,14 +1,86 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-05-16.
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-04-23.
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
from os.path import join
|
||||
|
||||
env = DefaultEnvironment()
|
||||
board = env.BoardConfig()
|
||||
platform = env.PioPlatform()
|
||||
import click
|
||||
from ltchiptool import Family
|
||||
from SCons.Script import DefaultEnvironment, Environment
|
||||
|
||||
# support passing "arduino" as framework
|
||||
frameworks = board.get("frameworks")
|
||||
framework = next(fw for fw in frameworks if "arduino" in fw)
|
||||
builder = platform.frameworks[framework]["script"]
|
||||
builder = builder.rpartition("/")[2]
|
||||
env.SConscript(builder, exports="env")
|
||||
# Let everyone know we're using the Arduino framework
|
||||
env: Environment = DefaultEnvironment()
|
||||
env["ARDUINO"] = True
|
||||
|
||||
# Add base cores' sources first
|
||||
env.SConscript("base.py")
|
||||
|
||||
family: Family = env["FAMILY_OBJ"]
|
||||
|
||||
# Add common sources among all families
|
||||
env.AddCoreSources(
|
||||
name="common_arduino",
|
||||
path=join("$COMMON_DIR", "arduino", "src"),
|
||||
)
|
||||
env.AddArduinoLibraries(
|
||||
name="common_arduino",
|
||||
path=join("$COMMON_DIR", "arduino", "libraries"),
|
||||
)
|
||||
# Add sources for this family and each parent
|
||||
found = False
|
||||
for f in family.inheritance:
|
||||
code = f"{f.code}_arduino"
|
||||
path = join("$CORES_DIR", f.name, "arduino")
|
||||
# Add libraries first, to put the include paths after core sources
|
||||
env.AddArduinoLibraries(name=code, path=join(path, "libraries"))
|
||||
found = found or env.AddCoreSources(name=code, path=join(path, "src"))
|
||||
|
||||
# Fail if Arduino core wasn't found
|
||||
if not found:
|
||||
click.secho(
|
||||
f"Platform '{family.name}' doesn't support Arduino framework - "
|
||||
"the Arduino core source files are absent.",
|
||||
fg="red",
|
||||
)
|
||||
exit(1)
|
||||
|
||||
# Sources - ArduinoCore-API
|
||||
env.AddExternalLibrary("arduino_api")
|
||||
|
||||
# Sources - board variant
|
||||
env.AddLibrary(
|
||||
name="board_${VARIANT}",
|
||||
base_dir="$BOARD_DIR",
|
||||
srcs=[
|
||||
"+<variant.cpp>",
|
||||
],
|
||||
includes=[
|
||||
"!<.>",
|
||||
],
|
||||
)
|
||||
|
||||
# Flags & linker options
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
("LIBRETUYA_ARDUINO", 1),
|
||||
("ARDUINO", 10812),
|
||||
("ARDUINO_SDK", 1),
|
||||
("ARDUINO_ARCH_${FAMILY_CODE}", 1),
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"--specs=nosys.specs",
|
||||
"-Wl,--as-needed",
|
||||
"-Wl,--build-id=none",
|
||||
"-Wl,--cref",
|
||||
"-Wl,--no-enum-size-warning",
|
||||
"-Wl,--no-undefined",
|
||||
"-Wl,--warn-common",
|
||||
# wrappers from posix/time.c
|
||||
"-Wl,-wrap,gettimeofday",
|
||||
"-Wl,-wrap,settimeofday",
|
||||
],
|
||||
)
|
||||
# Arduino core uses __libc_init_array
|
||||
if "-nostartfiles" in env["LINKFLAGS"]:
|
||||
env["LINKFLAGS"].remove("-nostartfiles")
|
||||
|
||||
# Build all libraries
|
||||
env.BuildLibraries()
|
||||
|
||||
84
builder/frameworks/base.py
Normal file
84
builder/frameworks/base.py
Normal file
@@ -0,0 +1,84 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2023-02-26.
|
||||
|
||||
from os.path import join
|
||||
|
||||
import click
|
||||
from ltchiptool import Family
|
||||
from platformio.platform.base import PlatformBase
|
||||
from platformio.platform.board import PlatformBoardConfig
|
||||
from SCons.Errors import UserError
|
||||
from SCons.Script import DefaultEnvironment, Environment
|
||||
|
||||
env: Environment = DefaultEnvironment()
|
||||
board: PlatformBoardConfig = env.BoardConfig()
|
||||
platform: PlatformBase = env.PioPlatform()
|
||||
|
||||
# Environment variables, include paths, etc.
|
||||
env.ConfigureEnvironment(platform, board)
|
||||
family: Family = env["FAMILY_OBJ"]
|
||||
|
||||
# Flash layout defines
|
||||
env.AddFlashLayout(board)
|
||||
|
||||
# Configure each family first (add CPP defines, prepend fixups' paths)
|
||||
for f in family.inheritance:
|
||||
path = env.AddFamily(f)
|
||||
env.AddCoreConfig(name=f.code, path=join(path, "base"))
|
||||
if "ARDUINO" in env:
|
||||
env.AddCoreConfig(name=f"{f.code}_arduino", path=join(path, "arduino", "src"))
|
||||
|
||||
# Include SDK builder scripts
|
||||
# The script will call BuildLibraries(safe=True) to secure the include paths
|
||||
found = False
|
||||
for f in family.inheritance:
|
||||
try:
|
||||
env.SConscript(f"../family/{f.name}.py", must_exist=True)
|
||||
found = True
|
||||
except UserError:
|
||||
pass
|
||||
|
||||
# Fail if no SDK builder was found
|
||||
if not found:
|
||||
click.secho(
|
||||
f"Platform '{family.name}' is currently not supported - "
|
||||
"no SDK builder script could be found.",
|
||||
fg="red",
|
||||
)
|
||||
exit(1)
|
||||
|
||||
# Add common sources among all families
|
||||
env.AddCoreSources(
|
||||
name="common",
|
||||
path=join("$COMMON_DIR", "base"),
|
||||
)
|
||||
# Add sources for this family and each parent
|
||||
for f in family.inheritance:
|
||||
path = join("$CORES_DIR", f.name, "base")
|
||||
env.AddCoreSources(name=f.code, path=path)
|
||||
|
||||
# Sources - external libraries
|
||||
env.AddExternalLibrary("ltchiptool") # uf2ota source code
|
||||
env.AddExternalLibrary("flashdb")
|
||||
env.AddExternalLibrary("printf")
|
||||
|
||||
# Flags & linker options
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
("LIBRETUYA", 1),
|
||||
("LT_VERSION", env.ReadLTVersion(platform.get_dir(), platform.version)),
|
||||
("LT_BOARD", "${VARIANT}"),
|
||||
("F_CPU", board.get("build.f_cpu")),
|
||||
("MCU", "${MCU}"),
|
||||
("FAMILY", "F_${FAMILY}"),
|
||||
],
|
||||
LINKFLAGS=[
|
||||
'"-Wl,-Map=' + join("$BUILD_DIR", "${PROGNAME}.map") + '"',
|
||||
],
|
||||
LIBS=[
|
||||
"stdc++",
|
||||
"supc++",
|
||||
],
|
||||
)
|
||||
|
||||
# Build everything from the base core
|
||||
env.BuildLibraries()
|
||||
@@ -1,41 +0,0 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-06-14.
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
# SDK options
|
||||
env.Replace(
|
||||
LIB_BDK_DRIVER_SKIP=[
|
||||
# using printf library wrappers instead
|
||||
"uart/printf.c",
|
||||
]
|
||||
)
|
||||
|
||||
env.SConscript("beken-72xx-sdk.py", exports="env")
|
||||
env.SConscript("../arduino-common.py", exports="env")
|
||||
|
||||
# Flags
|
||||
env.Append(
|
||||
CCFLAGS=[
|
||||
"-Wno-write-strings",
|
||||
"-Wno-char-subscripts",
|
||||
"-Wno-missing-braces",
|
||||
"-Wno-attributes",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
# LibreTuya configuration
|
||||
("LT_ARD_HAS_WIFI", "1"),
|
||||
("LT_ARD_HAS_MD5", "1"),
|
||||
# macros
|
||||
# mbedtls_net_set_nonblock is commented out in tls_net.c
|
||||
("mbedtls_net_set_nonblock", "net_set_nonblock"),
|
||||
],
|
||||
LINKFLAGS=[
|
||||
# stdio wrappers (port/printf/printf.c)
|
||||
"-Wl,-wrap,bk_printf",
|
||||
],
|
||||
)
|
||||
|
||||
# Build all libraries
|
||||
env.BuildLibraries()
|
||||
@@ -1,599 +0,0 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-06-13.
|
||||
|
||||
from os.path import join
|
||||
|
||||
from ltchiptool.soc.bk72xx.binary import to_offset
|
||||
from SCons.Script import Builder, DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
board = env.BoardConfig()
|
||||
|
||||
ROOT_DIR = join("$SDK_DIR", "beken378")
|
||||
APP_DIR = join(ROOT_DIR, "app")
|
||||
DRIVER_DIR = join(ROOT_DIR, "driver")
|
||||
FUNC_DIR = join(ROOT_DIR, "func")
|
||||
|
||||
# Load sys_config.h into env
|
||||
env.LoadConfig(join("$FAMILY_DIR", "config", "sys_config.h"))
|
||||
|
||||
# Define vars used during build
|
||||
SOC_BK7231 = 1
|
||||
SOC_BK7231U = 2
|
||||
SOC_BK7221U = 3
|
||||
SOC_BK7251 = 3
|
||||
SOC_BK7271 = 4
|
||||
SOC_BK7231N = 5
|
||||
SOC_BK7236 = 6
|
||||
SOC_NAMES = {
|
||||
SOC_BK7231: "bk7231",
|
||||
SOC_BK7231U: "bk7231u",
|
||||
SOC_BK7251: "bk7251",
|
||||
SOC_BK7271: "bk7271",
|
||||
SOC_BK7231N: "bk7231n",
|
||||
SOC_BK7236: "bk7236",
|
||||
}
|
||||
SOC = env.Cfg("CFG_SOC_NAME")
|
||||
WPA_VERSION = "wpa_supplicant_2_9" if env.Cfg("CFG_USE_WPA_29") else "hostapd-2.5"
|
||||
|
||||
# Flags
|
||||
env.Append(
|
||||
CCFLAGS=[
|
||||
"-mcpu=arm968e-s",
|
||||
"-march=armv5te",
|
||||
"-mthumb",
|
||||
"-mthumb-interwork",
|
||||
"-g",
|
||||
"-O2",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fno-strict-aliasing",
|
||||
"-fsigned-char",
|
||||
"-Wno-comment",
|
||||
"-Werror=implicit-function-declaration",
|
||||
],
|
||||
CFLAGS=[
|
||||
"-std=gnu99",
|
||||
"-nostdlib",
|
||||
"-Wall",
|
||||
"-Wno-format",
|
||||
"-Wno-unknown-pragmas",
|
||||
],
|
||||
CXXFLAGS=[
|
||||
"-std=gnu++11",
|
||||
"-MMD",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
"-Wno-literal-suffix",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
# LibreTuya configuration
|
||||
("LT_HAS_LWIP", "1"),
|
||||
("LT_HAS_LWIP2", "1"),
|
||||
("LT_HAS_FREERTOS", "1"),
|
||||
("LT_HAS_MBEDTLS", "1"),
|
||||
# SDK options
|
||||
("CFG_OS_FREERTOS", "1"),
|
||||
("MBEDTLS_CONFIG_FILE", r"\"tls_config.h\""),
|
||||
("WIFI_BLE_COEXIST", "1"),
|
||||
("WOLFSSL_BEKEN", env.Cfg("CFG_WPA3")),
|
||||
"MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED",
|
||||
("INCLUDE_xTaskGetHandle", "1"),
|
||||
],
|
||||
ASFLAGS=[
|
||||
"-mcpu=arm968e-s",
|
||||
"-march=armv5te",
|
||||
"-marm",
|
||||
"-mthumb-interwork",
|
||||
"-g",
|
||||
"-x",
|
||||
"assembler-with-cpp",
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-mcpu=arm968e-s",
|
||||
"-marm",
|
||||
"-mthumb-interwork",
|
||||
"-g",
|
||||
"-nostartfiles",
|
||||
"--specs=nano.specs",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,-wrap,_free_r",
|
||||
"-Wl,-wrap,_malloc_r",
|
||||
"-Wl,-wrap,calloc",
|
||||
"-Wl,-wrap,free",
|
||||
"-Wl,-wrap,malloc",
|
||||
"-Wl,-wrap,realloc",
|
||||
"-Wl,-wrap,zalloc",
|
||||
"-Wl,-wrap,_realloc_r",
|
||||
"-Wl,-wrap,printf",
|
||||
"-Wl,-wrap,puts",
|
||||
"-Wl,-wrap,snprintf",
|
||||
"-Wl,-wrap,sprintf",
|
||||
"-Wl,-wrap,vsnprintf",
|
||||
"-Wl,-wrap,bk_flash_get_info",
|
||||
"-Wl,-wrap,bk_flash_erase",
|
||||
"-Wl,-wrap,bk_flash_write",
|
||||
"-Wl,-wrap,bk_flash_read",
|
||||
],
|
||||
)
|
||||
|
||||
srcs_core = []
|
||||
srcs_fixups = []
|
||||
|
||||
# Fix for BK7231T's bootloader compatibility
|
||||
if board.get("build.bkboot_version") == "1.0.5-bk7231s":
|
||||
env.Append(CPPDEFINES=[("CFG_SUPPORT_BOOTLOADER", "1")])
|
||||
srcs_fixups.append("+<boot_handlers_105_bk7231s.S>")
|
||||
else:
|
||||
srcs_core.append("+<driver/entry/boot_handlers.S>")
|
||||
|
||||
# Sources - from framework-beken-bdk/beken378/beken_src.mk
|
||||
env.AddLibrary(
|
||||
name="bdk_core",
|
||||
base_dir=ROOT_DIR,
|
||||
srcs=[
|
||||
"+<app/app.c>",
|
||||
"+<app/config/param_config.c>",
|
||||
"+<driver/entry/boot_vectors.S>",
|
||||
"+<func/wlan_ui/wlan_ui.c>",
|
||||
*srcs_core,
|
||||
],
|
||||
includes=[
|
||||
"+<app>",
|
||||
"+<app/config>",
|
||||
"+<common>",
|
||||
"+<driver/entry>",
|
||||
"+<driver/intc>",
|
||||
"+<release>",
|
||||
"+<../release>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - parent family fixups
|
||||
env.AddLibrary(
|
||||
name="${FAMILY_PARENT_CODE}_fixups",
|
||||
base_dir="$PARENT_DIR/fixups",
|
||||
srcs=[
|
||||
"+<arch_main.c>",
|
||||
"+<ate_app.c>",
|
||||
"+<clock_cal.c>",
|
||||
"+<clock_rtos.c>",
|
||||
"+<intc.c>",
|
||||
"+<wrap_BkDriverFlash.c>",
|
||||
*srcs_fixups,
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - family fixups
|
||||
env.AddLibrary(
|
||||
name="${FAMILY_CODE}_fixups",
|
||||
base_dir="$FAMILY_DIR/fixups",
|
||||
srcs=[
|
||||
"+<temp_detect.c>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - app module
|
||||
env.AddLibrary(
|
||||
name="bdk_app",
|
||||
base_dir=APP_DIR,
|
||||
srcs=[
|
||||
"+<http/*.c>",
|
||||
"+<net_work/*.c>",
|
||||
"+<standalone-ap/*.c>",
|
||||
"+<standalone-station/*.c>",
|
||||
"+<video_work/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<http>",
|
||||
"+<net_work>",
|
||||
"+<standalone-ap>",
|
||||
"+<standalone-station>",
|
||||
"+<video_work>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - drivers
|
||||
env.AddLibrary(
|
||||
name="bdk_driver",
|
||||
base_dir=DRIVER_DIR,
|
||||
srcs=[
|
||||
"+<driver.c>",
|
||||
"+<calendar/*.c>",
|
||||
"+<common/*.c>",
|
||||
"+<dma/*.c>",
|
||||
"+<fft/*.c>",
|
||||
"+<flash/*.c>",
|
||||
"+<general_dma/*.c>",
|
||||
"+<gpio/*.c>",
|
||||
"+<i2c/*.c>",
|
||||
"+<i2s/*.c>",
|
||||
"+<icu/*.c>",
|
||||
"+<irda/*.c>",
|
||||
"+<jpeg/*.c>",
|
||||
"+<macphy_bypass/*.c>",
|
||||
"+<phy/*.c>",
|
||||
"+<pwm/*.c>",
|
||||
"-<pwm/pwm_bk7271.c>",
|
||||
"-<pwm/pwm_new.c>",
|
||||
"+<qspi/*.c>",
|
||||
"+<rw_pub/*.c>",
|
||||
"+<saradc/*.c>",
|
||||
"+<security/*.c>",
|
||||
"+<spidma/*.c>",
|
||||
"+<sys_ctrl/*.c>",
|
||||
"+<uart/*.c>",
|
||||
"+<wdt/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<common>",
|
||||
"+<common/reg>",
|
||||
"+<dma>",
|
||||
"+<flash>",
|
||||
"+<general_dma>",
|
||||
"+<gpio>",
|
||||
"+<i2c>",
|
||||
"+<icu>",
|
||||
"+<include>",
|
||||
"+<jpeg>",
|
||||
"+<phy>",
|
||||
"+<pwm>",
|
||||
"+<rc_beken>",
|
||||
"+<rw_pub>",
|
||||
"+<spi>",
|
||||
"+<spidma>",
|
||||
"+<sys_ctrl>",
|
||||
"+<uart>",
|
||||
"+<usb>",
|
||||
"+<../ip/**>",
|
||||
],
|
||||
options=dict(CCFLAGS=["-Wno-unused-variable"]),
|
||||
)
|
||||
|
||||
# Sources - functional components
|
||||
env.AddLibrary(
|
||||
name="bdk_func",
|
||||
base_dir=FUNC_DIR,
|
||||
srcs=[
|
||||
"+<func.c>",
|
||||
"+<airkiss/*.c>",
|
||||
"+<base64/*.c>",
|
||||
"+<ble_wifi_exchange/*.c>",
|
||||
"+<camera_intf/*.c>",
|
||||
"+<hostapd_intf/*.c>",
|
||||
"+<joint_up/*.c>",
|
||||
"+<lwip_intf/dhcpd/*.c>",
|
||||
"+<misc/*.c>",
|
||||
"-<misc/fake_clock.c>", # fixups
|
||||
"+<net_param_intf/*.c>",
|
||||
"+<power_save/*.c>",
|
||||
"+<rwnx_intf/*.c>",
|
||||
"+<saradc_intf/*.c>",
|
||||
"+<security/*.c>",
|
||||
"+<sim_uart/*.c>",
|
||||
"+<spidma_intf/*.c>",
|
||||
"+<temp_detect/*.c>",
|
||||
"+<usb_plug/*.c>",
|
||||
"+<user_driver/*.c>",
|
||||
"-<user_driver/BkDriverQspi.c>",
|
||||
"+<utf8/*.c>",
|
||||
"+<video_transfer/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<base64>",
|
||||
"+<ble_wifi_exchange>",
|
||||
"+<camera_intf>",
|
||||
"+<easy_flash>",
|
||||
"+<easy_flash/inc>",
|
||||
"+<easy_flash/port>",
|
||||
"+<ethernet_intf>",
|
||||
"+<include>",
|
||||
"+<joint_up>",
|
||||
"+<lwip_intf>", # for config/lwipopts.h
|
||||
"+<power_save>",
|
||||
"+<rf_test>",
|
||||
"+<rf_use>",
|
||||
"+<rwnx_intf>",
|
||||
"+<saradc_intf>",
|
||||
"+<sensor>",
|
||||
"+<spidma_intf>",
|
||||
"+<temp_detect>",
|
||||
"+<uart_debug>",
|
||||
"+<usb>",
|
||||
"+<user_driver>",
|
||||
"+<utf8>",
|
||||
"+<video_transfer>",
|
||||
f"+<{WPA_VERSION}/bk_patch>",
|
||||
f"+<{WPA_VERSION}/hostapd>",
|
||||
f"+<{WPA_VERSION}/src>",
|
||||
f"+<{WPA_VERSION}/src/ap>",
|
||||
f"+<{WPA_VERSION}/src/common>",
|
||||
f"+<{WPA_VERSION}/src/drivers>",
|
||||
f"+<{WPA_VERSION}/src/utils>",
|
||||
f"+<{WPA_VERSION}/wpa_supplicant>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - FreeRTOS
|
||||
env.AddLibrary(
|
||||
name="bdk_freertos_thumb",
|
||||
base_dir=ROOT_DIR,
|
||||
srcs=[
|
||||
"+<os/**/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<os/*>",
|
||||
],
|
||||
)
|
||||
env.AddLibrary(
|
||||
name="bdk_freertos_arm",
|
||||
base_dir="$SDK_DIR",
|
||||
srcs=[
|
||||
"+<FreeRTOSv9.0.0/FreeRTOS/Source/**/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<FreeRTOSv9.0.0/FreeRTOS/Source/include>",
|
||||
"+<FreeRTOSv9.0.0/FreeRTOS/Source/portable/Keil/ARM968es>",
|
||||
],
|
||||
options=dict(
|
||||
CCFLAGS=[
|
||||
# build FreeRTOS port in ARM mode
|
||||
"+<-marm>",
|
||||
"-<-mthumb>",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
# Sources - lwIP 2.1.3
|
||||
env.AddLibraryLwIP(version="2.1.3", port="bdk")
|
||||
|
||||
# Sources - mbedTLS 2.6.0
|
||||
env.AddLibrary(
|
||||
name="bdk_mbedtls",
|
||||
base_dir=join(FUNC_DIR, "mbedtls"),
|
||||
srcs=[
|
||||
"+<mbedtls/library/*.c>",
|
||||
"+<mbedtls_ui/*.c>",
|
||||
"+<mbedtls-port/src/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<mbedtls/include>",
|
||||
"+<mbedtls_ui>",
|
||||
"+<mbedtls-port/inc>",
|
||||
],
|
||||
options=dict(
|
||||
CCFLAGS=[
|
||||
"-Wno-unused-variable",
|
||||
"-Wno-implicit-function-declaration",
|
||||
],
|
||||
CFLAGS=["-<-Wall>"],
|
||||
),
|
||||
)
|
||||
|
||||
# Sources - chip-specific drivers
|
||||
if SOC in [SOC_BK7231U, SOC_BK7251]:
|
||||
env.AddLibrary(
|
||||
name="bdk_driver_spi",
|
||||
base_dir=join(DRIVER_DIR, "spi"),
|
||||
srcs=[
|
||||
"+<spi.c>",
|
||||
"+<spi_master.c>",
|
||||
"+<spi_slave.c>",
|
||||
],
|
||||
)
|
||||
if SOC in [SOC_BK7231N]:
|
||||
env.AddLibrary(
|
||||
name="bdk_driver_spi",
|
||||
base_dir=join(DRIVER_DIR, "spi"),
|
||||
srcs=[
|
||||
"+<spi_bk7231n.c>",
|
||||
"+<spi_master_bk7231n.c>",
|
||||
"+<spi_slave_bk7231n.c>",
|
||||
],
|
||||
)
|
||||
if SOC in [SOC_BK7251]:
|
||||
env.AddLibrary(
|
||||
name="bdk_bk7251",
|
||||
base_dir=ROOT_DIR,
|
||||
srcs=[
|
||||
"+<driver/audio/*.c>",
|
||||
"+<driver/sdcard/*.c>",
|
||||
"+<func/audio/*.c>",
|
||||
"+<func/sd_music/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<driver/audio>",
|
||||
"+<driver/sdcard>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - enabled through config
|
||||
if env.Cfg("CFG_SDIO"):
|
||||
env.AddLibrary(
|
||||
name="bdk_driver_sdio",
|
||||
base_dir=ROOT_DIR,
|
||||
srcs=[
|
||||
"+<driver/sdio/*.c>",
|
||||
"+<func/sdio_intf/*.c>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("CFG_BK_AWARE"):
|
||||
env.AddLibrary(
|
||||
name="bdk_driver_sdio",
|
||||
base_dir="$SDK_DIR",
|
||||
srcs=[
|
||||
"+<beken378/func/bk_aware/*.c>",
|
||||
"+<demos/wifi/bk_aware/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<beken378/func/bk_aware>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("CFG_USE_SDCARD_HOST"):
|
||||
env.AddLibrary(
|
||||
name="bdk_func_fatfs",
|
||||
base_dir=join(FUNC_DIR, "fatfs"),
|
||||
srcs=[
|
||||
"+<*.c>",
|
||||
"-<test_fatfs.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<.>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("CFG_WPA3"):
|
||||
env.AddLibrary(
|
||||
name="bdk_wolfssl",
|
||||
base_dir=join(FUNC_DIR, "wolfssl"),
|
||||
srcs=[
|
||||
"+<wolfcrypt/src/ecc.c>",
|
||||
"+<wolfcrypt/src/memory.c>",
|
||||
"+<wolfcrypt/src/random.c>",
|
||||
"+<wolfcrypt/src/sha256.c>",
|
||||
"+<wolfcrypt/src/tfm.c>",
|
||||
"+<wolfcrypt/src/wolfmath.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<.>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("CFG_SUPPORT_BLE") and env.Cfg("CFG_BLE_VERSION") == env.Cfg(
|
||||
"BLE_VERSION_4_2"
|
||||
):
|
||||
env.AddLibrary(
|
||||
name="bdk_ble_4_2",
|
||||
base_dir=join(DRIVER_DIR, "ble"),
|
||||
srcs=[
|
||||
"+<**/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<.>",
|
||||
"+<**/include>",
|
||||
"+<beken_ble_sdk/mesh/src/dbg>",
|
||||
"+<config>",
|
||||
"+<modules/**>",
|
||||
"+<plactform/arch>",
|
||||
"+<plactform/driver/*>",
|
||||
"+<profiles/*/api>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("CFG_SUPPORT_BLE") and env.Cfg("CFG_BLE_VERSION") == env.Cfg(
|
||||
"BLE_VERSION_5_x"
|
||||
):
|
||||
env.AddLibrary(
|
||||
name="bdk_ble_5_x",
|
||||
base_dir=join(DRIVER_DIR, "ble_5_x_rw"),
|
||||
srcs=[
|
||||
"+<**/*.c>",
|
||||
"-<ble_pub/app/src/app_ble_task.c>",
|
||||
"-<platform/7231n/nvds/src/nvds.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<**/api>",
|
||||
"+<arch/**>",
|
||||
"+<ble_lib/ip/ble/**>",
|
||||
"+<ble_lib/ip/hci/src>",
|
||||
"+<ble_lib/ip/sch/import>",
|
||||
"+<ble_lib/modules/*/src>",
|
||||
"+<ble_pub/prf>",
|
||||
"+<ble_pub/ui>",
|
||||
"+<platform/7231n/**>",
|
||||
"-<platform/7231n/nvds/**>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("ATSVR_CFG"):
|
||||
env.AddLibrary(
|
||||
name="bdk_atsvr",
|
||||
base_dir=join(FUNC_DIR, "at_server"),
|
||||
srcs=[
|
||||
"+<**/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<.>",
|
||||
"+<*>",
|
||||
],
|
||||
)
|
||||
if env.Cfg("CFG_USB") or env.Cfg("CFG_USE_SDCARD_HOST"):
|
||||
env.AddLibrary(
|
||||
name="bdk_driver_usb",
|
||||
base_dir=ROOT_DIR,
|
||||
srcs=[
|
||||
"+<driver/usb/*.c>",
|
||||
"+<func/usb/*.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<driver/usb/**>",
|
||||
],
|
||||
)
|
||||
|
||||
# Libs & linker config
|
||||
env.Append(
|
||||
LIBPATH=[
|
||||
join("$SDK_DIR", "beken378", "lib"),
|
||||
join("$SDK_DIR", "beken378", "func", "airkiss"),
|
||||
],
|
||||
LIBS=[
|
||||
"airkiss",
|
||||
"sensor",
|
||||
"usb",
|
||||
# "wpa", # this is compiled from func/hostapd_intf/hostapd_intf.c
|
||||
f"ble_{SOC_NAMES[SOC]}",
|
||||
f"cal_{SOC_NAMES[SOC]}",
|
||||
f"rf_test_{SOC_NAMES[SOC]}",
|
||||
f"rf_use_{SOC_NAMES[SOC]}",
|
||||
f"rwnx_{SOC_NAMES[SOC]}",
|
||||
f"supplicant_{SOC_NAMES[SOC]}",
|
||||
f"uart_debug_{SOC_NAMES[SOC]}",
|
||||
"gcc",
|
||||
"g",
|
||||
"c",
|
||||
"m",
|
||||
"nosys",
|
||||
],
|
||||
)
|
||||
|
||||
# Misc options
|
||||
env.Replace(
|
||||
SIZEPROGREGEXP=r"^(?:\.vectors|\.text|\.rodata|\.data|\.ARM\.exidx)\s+([0-9]+).*",
|
||||
SIZEDATAREGEXP=r"^(?:\.vectors|\.data|\.bss)\s+([0-9]+).*",
|
||||
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
|
||||
SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES",
|
||||
)
|
||||
|
||||
# Calculate RBL header offset
|
||||
app_offs = int(env["FLASH_APP_OFFSET"], 16)
|
||||
app_size = int(board.get("build.bkrbl_size_app"), 16)
|
||||
rbl_offs = to_offset(app_size) - 102
|
||||
env.Replace(FLASH_RBL_OFFSET=f"0x{app_offs + rbl_offs:06X}")
|
||||
|
||||
# Build all libraries
|
||||
env.BuildLibraries()
|
||||
|
||||
# Main firmware outputs and actions
|
||||
env.Replace(
|
||||
# linker command (encryption + packaging)
|
||||
LINK="${LTCHIPTOOL} link2bin ${VARIANT} '' ''",
|
||||
# UF2OTA input list
|
||||
UF2OTA=[
|
||||
# app binary image (enc+crc), OTA1 (uploader) only
|
||||
(
|
||||
"app",
|
||||
"${BUILD_DIR}/${MCULC}_app_${FLASH_APP_OFFSET}.crc",
|
||||
"",
|
||||
"",
|
||||
),
|
||||
# app RBL header (crc), OTA1 (uploader) only
|
||||
(
|
||||
f"app+{rbl_offs}",
|
||||
"${BUILD_DIR}/${MCULC}_app_${FLASH_RBL_OFFSET}.rblh",
|
||||
"", # not used for OTA2
|
||||
"",
|
||||
),
|
||||
# OTA RBL package, OTA2 (uf2ota lib) only
|
||||
(
|
||||
"", # not used for OTA1
|
||||
"",
|
||||
"download",
|
||||
"${BUILD_DIR}/${MCULC}_app.ota.rbl",
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -1,56 +0,0 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-04-22.
|
||||
|
||||
from SCons.Script import DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
|
||||
# SDK options
|
||||
env.Replace(AMBZ_NO_POLARSSL=True)
|
||||
env.Replace(
|
||||
LIB_AMBZ_SDK_SKIP=[
|
||||
"component/common/api/wifi/wifi_ind.c",
|
||||
]
|
||||
)
|
||||
|
||||
env.SConscript("realtek-ambz-sdk.py", exports="env")
|
||||
env.SConscript("../arduino-common.py", exports="env")
|
||||
|
||||
# Flags
|
||||
env.Append(
|
||||
CPPDEFINES=[
|
||||
"ARDUINO_AMEBA",
|
||||
"ARDUINO_ARCH_AMBZ",
|
||||
# the SDK declares bool if not defined before
|
||||
# which conflicts with C++ built-in bool
|
||||
# so it's either -fpermissive or this:
|
||||
("bool", "bool"),
|
||||
# LibreTuya configuration
|
||||
("LT_ARD_HAS_WIFI", "1"),
|
||||
("LT_ARD_HAS_MD5", "1"),
|
||||
("LT_ARD_HAS_SOFTSERIAL", "1"),
|
||||
# not broken anymore with printf() library
|
||||
("LT_PRINTF_BROKEN", "0"),
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-Wl,--undefined=InfraStart",
|
||||
# stdio wrappers (port/printf/printf.c)
|
||||
"-Wl,-wrap,rtl_printf",
|
||||
"-Wl,-wrap,rtl_sprintf",
|
||||
"-Wl,-wrap,rtl_snprintf",
|
||||
"-Wl,-wrap,rtl_vsnprintf",
|
||||
"-Wl,-wrap,rtl_vsnprintf_r",
|
||||
"-Wl,-wrap,rtl_vprintf",
|
||||
"-Wl,-wrap,rtl_vfprintf",
|
||||
"-Wl,-wrap,DiagPrintf",
|
||||
"-Wl,-wrap,DiagSPrintf",
|
||||
"-Wl,-wrap,DiagSnPrintf",
|
||||
"-Wl,-wrap,prvDiagPrintf",
|
||||
"-Wl,-wrap,prvDiagSPrintf",
|
||||
"-Wl,-wrap,VSprintf",
|
||||
"-Wl,-wrap,LOG_PRINTF",
|
||||
"-Wl,-wrap,__rtl_vfprintf_r_v1_00",
|
||||
],
|
||||
)
|
||||
|
||||
# Build all libraries
|
||||
env.BuildLibraries()
|
||||
@@ -1,308 +0,0 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-04-20.
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import Builder, DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
board = env.BoardConfig()
|
||||
|
||||
# Flags
|
||||
env.Append(
|
||||
CCFLAGS=[
|
||||
"-mcpu=cortex-m4",
|
||||
"-mthumb",
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-g2",
|
||||
"-w",
|
||||
"-O2",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fmessage-length=0",
|
||||
"-fno-common",
|
||||
"-fno-short-enums",
|
||||
"-fomit-frame-pointer",
|
||||
"-fsigned-char",
|
||||
],
|
||||
CFLAGS=[
|
||||
"-std=gnu99",
|
||||
"-Wno-pointer-sign",
|
||||
],
|
||||
CXXFLAGS=[
|
||||
# borrowed from RtlDuino/development/rtl87xx/platform.txt
|
||||
"-std=gnu++11",
|
||||
"-MMD",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
# LibreTuya configuration
|
||||
("LT_HAS_LWIP", "1"),
|
||||
("LT_HAS_LWIP2", "1"),
|
||||
("LT_HAS_FREERTOS", "1"),
|
||||
("LT_HAS_MBEDTLS", "1"),
|
||||
("LT_PRINTF_BROKEN", "1"), # printf does not handle %.3f properly
|
||||
# other options
|
||||
"M3",
|
||||
"CONFIG_PLATFORM_8711B",
|
||||
("ERRNO", "1"), # for LwIP
|
||||
"MBEDTLS_KEY_EXCHANGE__SOME__PSK_ENABLED", # enable PSK in mbedTLS
|
||||
# "MBEDTLS_DEBUG_C",
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-mcpu=cortex-m4",
|
||||
"-mthumb",
|
||||
"-mfloat-abi=hard",
|
||||
"-mfpu=fpv4-sp-d16",
|
||||
"-g",
|
||||
"--specs=nano.specs",
|
||||
"-nostartfiles",
|
||||
"-Os",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,--cref",
|
||||
"-Wl,--entry=Reset_Handler",
|
||||
"-Wl,--no-enum-size-warning",
|
||||
"-Wl,--no-wchar-size-warning",
|
||||
"-Wl,-wrap,malloc",
|
||||
"-Wl,-wrap,free",
|
||||
"-Wl,-wrap,realloc",
|
||||
"-Wl,-wrap,rom_psk_CalcGTK",
|
||||
"-Wl,-wrap,rom_psk_CalcPTK",
|
||||
"-Wl,-wrap,CalcMIC",
|
||||
"-Wl,-wrap,CheckMIC",
|
||||
"-Wl,-wrap,aes_80211_encrypt",
|
||||
"-Wl,-wrap,aes_80211_decrypt",
|
||||
"-Wl,-wrap,DecGTK",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - from SDK project/realtek_amebaz_va0_example/GCC-RELEASE/application.mk
|
||||
# - "console" is disabled as it introduces build error, and is generally useless
|
||||
# - "utilities example" are also not really needed
|
||||
env.AddLibrary(
|
||||
name="ambz_sdk",
|
||||
base_dir="$SDK_DIR",
|
||||
srcs=[
|
||||
# NOTE: a fixup is used instead, to remove default main()
|
||||
# "+<component/soc/realtek/8711b/cmsis/device/app_start.c>",
|
||||
"+<component/soc/realtek/8711b/fwlib/ram_lib/startup.c>",
|
||||
"+<component/soc/realtek/8711b/cmsis/device/system_8195a.c>",
|
||||
"+<component/soc/realtek/8711b/app/monitor/ram/rtl_trace.c>",
|
||||
"+<component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_eap_config.c>",
|
||||
"+<component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_p2p_config.c>",
|
||||
"+<component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/wifi_wps_config.c>",
|
||||
"+<component/common/api/wifi/wifi_conf.c>",
|
||||
"+<component/common/api/wifi/wifi_ind.c>",
|
||||
"+<component/common/api/wifi/wifi_promisc.c>",
|
||||
"+<component/common/api/wifi/wifi_simple_config.c>",
|
||||
"+<component/common/api/wifi/wifi_util.c>",
|
||||
"+<component/common/api/lwip_netconf.c>",
|
||||
"+<component/common/drivers/wlan/realtek/src/osdep/lwip_intf.c>",
|
||||
"+<component/common/network/dhcp/dhcps.c>",
|
||||
"+<component/common/network/ssl/ssl_ram_map/ssl_ram_map.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/MemMang/heap_5.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F/port.c>",
|
||||
# "+<component/os/freertos/freertos_v8.1.2/Source/portable/IAR/ARM_CM4F/portasm.s>",
|
||||
"+<component/os/freertos/cmsis_os.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/croutine.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/event_groups.c>",
|
||||
"+<component/os/freertos/freertos_service.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/list.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/queue.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/tasks.c>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/timers.c>",
|
||||
"+<component/os/os_dep/device_lock.c>",
|
||||
"+<component/os/os_dep/osdep_service.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/analogin_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/dma_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/efuse_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/flash_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/gpio_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/gpio_irq_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/i2c_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/i2s_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/nfc_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/pinmap.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/pinmap_common.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/port_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/pwmout_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/rtc_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/serial_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/sleep.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/spi_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/sys_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/timer_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/us_ticker.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/us_ticker_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/wait_api.c>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b/wdt_api.c>",
|
||||
"+<component/soc/realtek/8711b/fwlib/ram_lib/rtl8710b_dsleepcfg.c>",
|
||||
"+<component/soc/realtek/8711b/fwlib/ram_lib/rtl8710b_dstandbycfg.c>",
|
||||
"+<component/soc/realtek/8711b/fwlib/ram_lib/rtl8710b_intfcfg.c>",
|
||||
"+<component/soc/realtek/8711b/misc/rtl8710b_ota.c>",
|
||||
"+<component/soc/realtek/8711b/fwlib/ram_lib/rtl8710b_pinmapcfg.c>",
|
||||
"+<component/soc/realtek/8711b/fwlib/ram_lib/rtl8710b_sleepcfg.c>",
|
||||
"+<component/common/utilities/cJSON.c>",
|
||||
"+<component/common/utilities/xml.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<project/realtek_amebaz_va0_example/inc>",
|
||||
"+<component/os/freertos>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/include>",
|
||||
"+<component/os/freertos/freertos_v8.1.2/Source/portable/GCC/ARM_CM4F>",
|
||||
"+<component/os/os_dep/include>",
|
||||
"+<component/common/api/network/include>",
|
||||
"+<component/common/api>",
|
||||
"+<component/common/api/platform>",
|
||||
"+<component/common/api/wifi>",
|
||||
"+<component/common/api/wifi/rtw_wpa_supplicant/src>",
|
||||
"+<component/common/api/wifi/rtw_wowlan>",
|
||||
"+<component/common/api/wifi/rtw_wpa_supplicant/wpa_supplicant>",
|
||||
"+<component/common/application>",
|
||||
"+<component/common/drivers/wlan/realtek/include>",
|
||||
"+<component/common/drivers/wlan/realtek/src/osdep>",
|
||||
"+<component/common/drivers/wlan/realtek/wlan_ram_map/rom>",
|
||||
"+<component/common/file_system>",
|
||||
"+<component/common/network>",
|
||||
"+<component/common/network/ssl/mbedtls-2.4.0/include>",
|
||||
"+<component/common/network/ssl/ssl_ram_map/rom>",
|
||||
"+<component/common/utilities>",
|
||||
"+<component/soc/realtek/8711b/app/monitor/include>",
|
||||
"+<component/soc/realtek/8711b/cmsis>",
|
||||
"+<component/soc/realtek/8711b/cmsis/device>",
|
||||
"+<component/soc/realtek/8711b/fwlib>",
|
||||
"+<component/soc/realtek/8711b/fwlib/include>",
|
||||
"+<component/soc/realtek/8711b/swlib/std_lib/include>",
|
||||
"+<component/soc/realtek/8711b/swlib/std_lib/libc/rom/string>",
|
||||
"+<component/soc/realtek/8711b/swlib/rtl_lib>",
|
||||
"+<component/soc/realtek/8711b/misc>",
|
||||
"+<component/common/mbed/api>",
|
||||
"+<component/common/mbed/hal>",
|
||||
"+<component/common/mbed/hal_ext>",
|
||||
"+<component/common/mbed/targets/cmsis>",
|
||||
"+<component/common/mbed/targets/hal/rtl8711b>",
|
||||
# keep PolarSSL headers for ROM crypto functions
|
||||
"+<component/common/network/ssl/polarssl-1.3.8/include>",
|
||||
# includes that are missing in the vanilla SDK makefiles
|
||||
"+<component/common/drivers/sdio/realtek/sdio_host/inc>",
|
||||
"+<component/common/file_system/fatfs>",
|
||||
"+<component/common/file_system/fatfs/r0.10c/include>",
|
||||
"+<component/common/network/mdns>",
|
||||
"+<component/common/network/libwsclient>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - lwIP 2.1.3
|
||||
env.AddLibraryLwIP(version="2.1.3", port="amb1")
|
||||
|
||||
# Sources - mbedTLS
|
||||
env.AddLibrary(
|
||||
name="ambz_mbedtls",
|
||||
base_dir="$SDK_DIR",
|
||||
srcs=[
|
||||
# mbedTLS from SDK
|
||||
"+<component/common/network/ssl/mbedtls-2.4.0/library/*.c>",
|
||||
# replace these with fixups
|
||||
"-<component/common/network/ssl/mbedtls-2.4.0/library/net_sockets.c>",
|
||||
"-<component/common/network/ssl/mbedtls-2.4.0/library/ssl_tls.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<component/common/network/ssl/mbedtls-2.4.0/include>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - family fixups
|
||||
env.AddLibrary(
|
||||
name="ambz_fixups",
|
||||
base_dir="$FAMILY_DIR/fixups",
|
||||
srcs=[
|
||||
"+<app_start_patch.c>",
|
||||
"+<cmsis_ipsr.c>",
|
||||
"+<log_uart.c>",
|
||||
"+<net_sockets.c>", # fix non-blocking sockets (Realtek disabled this for unknown reason)
|
||||
"+<ssl_tls.c>", # rtl sdk defines S1 and S2 which conflicts here
|
||||
"+<wifi_mode.c>",
|
||||
],
|
||||
)
|
||||
|
||||
# Libs & linker config
|
||||
env.Append(
|
||||
LIBPATH=[
|
||||
# fmt: off
|
||||
join("$SDK_DIR", "component", "soc", "realtek", "8711b", "misc", "bsp", "lib", "common", "GCC"),
|
||||
# fmt: on
|
||||
],
|
||||
LIBS=[
|
||||
"_platform",
|
||||
"_wlan",
|
||||
"_wps",
|
||||
"_p2p",
|
||||
"_dct",
|
||||
# use lib_rtlstd.a without some __aeabi functions
|
||||
"_rtlstd_patch",
|
||||
"m",
|
||||
"c",
|
||||
"nosys",
|
||||
"gcc",
|
||||
"_websocket",
|
||||
"_http",
|
||||
"_mdns",
|
||||
],
|
||||
)
|
||||
|
||||
# Misc options
|
||||
env.Replace(
|
||||
SIZEPROGREGEXP=r"^(?:\.ram_image2\.entry|\.ram_image2\.text|\.ram_image2\.data|\.xip_image2\.text)\s+([0-9]+).*",
|
||||
SIZEDATAREGEXP=r"^(?:\.ram_image2\.entry|\.ram_image2\.data|\.ram_image2\.bss|\.ram_image2\.skb\.bss)\s+([0-9]+).*",
|
||||
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
|
||||
SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES",
|
||||
)
|
||||
|
||||
env.Append(
|
||||
BUILDERS=dict(
|
||||
BinToObj=Builder(
|
||||
action=" ".join(
|
||||
[
|
||||
"$OBJCOPY",
|
||||
"-I binary",
|
||||
"-O elf32-littlearm",
|
||||
"-B arm",
|
||||
"$SOURCE",
|
||||
"$TARGET",
|
||||
],
|
||||
),
|
||||
)
|
||||
),
|
||||
)
|
||||
|
||||
# Bootloader library
|
||||
boot_all = board.get("build.amb_boot_all")
|
||||
target_boot = env.StaticLibrary(
|
||||
join("$BUILD_DIR", "boot_all"),
|
||||
env.BinToObj(
|
||||
join("$BUILD_DIR", "boot_all.o"),
|
||||
join("$BIN_DIR", boot_all),
|
||||
),
|
||||
)
|
||||
env.Prepend(LIBS=[target_boot])
|
||||
|
||||
# Build all libraries
|
||||
env.BuildLibraries()
|
||||
|
||||
# Main firmware outputs and actions
|
||||
env.Replace(
|
||||
# linker command (dual .bin outputs)
|
||||
LINK="${LTCHIPTOOL} link2bin ${VARIANT} xip1 xip2",
|
||||
# default output .bin name
|
||||
IMG_FW="image_${FLASH_OTA1_OFFSET}.ota1.bin",
|
||||
# UF2OTA input list
|
||||
UF2OTA=[
|
||||
(
|
||||
"ota1",
|
||||
"${BUILD_DIR}/image_${FLASH_OTA1_OFFSET}.ota1.bin",
|
||||
"ota2",
|
||||
"${BUILD_DIR}/image_${FLASH_OTA2_OFFSET}.ota2.bin",
|
||||
),
|
||||
],
|
||||
)
|
||||
@@ -1,477 +0,0 @@
|
||||
# Copyright (c) Kuba Szczodrzyński 2022-07-20.
|
||||
|
||||
from os.path import join
|
||||
|
||||
from SCons.Script import Builder, DefaultEnvironment
|
||||
|
||||
env = DefaultEnvironment()
|
||||
board = env.BoardConfig()
|
||||
|
||||
COMPONENT_DIR = join("$SDK_DIR", "component")
|
||||
|
||||
# Flags
|
||||
env.Append(
|
||||
CCFLAGS=[
|
||||
"-march=armv8-m.main+dsp",
|
||||
"-mthumb",
|
||||
"-mcmse",
|
||||
"-mfloat-abi=soft",
|
||||
"-g",
|
||||
"-gdwarf-3",
|
||||
"-Os",
|
||||
"-MMD",
|
||||
"-fstack-usage",
|
||||
"-fdata-sections",
|
||||
"-ffunction-sections",
|
||||
"-fmessage-length=0",
|
||||
"-fno-common",
|
||||
"-fno-short-enums",
|
||||
"-fomit-frame-pointer",
|
||||
"-fsigned-char",
|
||||
],
|
||||
CFLAGS=[
|
||||
"-std=gnu99",
|
||||
"-Wall",
|
||||
"-Wpointer-arith",
|
||||
"-Wundef",
|
||||
"-Wno-write-strings",
|
||||
"-Wno-maybe-uninitialized",
|
||||
],
|
||||
CXXFLAGS=[
|
||||
"-std=c++11",
|
||||
"-fno-exceptions",
|
||||
"-fno-rtti",
|
||||
"-fno-use-cxa-atexit",
|
||||
],
|
||||
CPPDEFINES=[
|
||||
# LibreTuya configuration
|
||||
("LT_HAS_LWIP", "1"),
|
||||
("LT_HAS_LWIP2", "1"),
|
||||
("LT_HAS_FREERTOS", "1"),
|
||||
("LT_HAS_MBEDTLS", "1"),
|
||||
# other options
|
||||
"__thumb2__",
|
||||
"CONFIG_PLATFORM_8710C",
|
||||
("__ARM_ARCH_8M_MAIN__", "1"),
|
||||
("CONFIG_BUILD_RAM", "1"),
|
||||
"V8M_STKOVF",
|
||||
],
|
||||
LINKFLAGS=[
|
||||
"-march=armv8-m.main+dsp",
|
||||
"-mthumb",
|
||||
"-mcmse",
|
||||
"-mfloat-abi=soft",
|
||||
"-g",
|
||||
"--specs=nosys.specs",
|
||||
"-nostartfiles",
|
||||
"-nodefaultlibs",
|
||||
"-nostdlib",
|
||||
"-Os",
|
||||
"-Wl,--gc-sections",
|
||||
"-Wl,--warn-section-align",
|
||||
"-Wl,--cref",
|
||||
"-Wl,--build-id=none",
|
||||
"-Wl,--use-blx",
|
||||
"-Wl,-no-enum-size-warning",
|
||||
# TODO fix wraps
|
||||
"-Wl,-wrap,strcat",
|
||||
"-Wl,-wrap,strchr",
|
||||
"-Wl,-wrap,strcmp",
|
||||
"-Wl,-wrap,strncmp",
|
||||
"-Wl,-wrap,strnicmp",
|
||||
"-Wl,-wrap,strcpy",
|
||||
"-Wl,-wrap,strncpy",
|
||||
"-Wl,-wrap,strlcpy",
|
||||
"-Wl,-wrap,strlen",
|
||||
"-Wl,-wrap,strnlen",
|
||||
"-Wl,-wrap,strncat",
|
||||
"-Wl,-wrap,strpbrk",
|
||||
"-Wl,-wrap,strspn",
|
||||
"-Wl,-wrap,strstr",
|
||||
"-Wl,-wrap,strtok",
|
||||
"-Wl,-wrap,strxfrm",
|
||||
"-Wl,-wrap,strsep",
|
||||
"-Wl,-wrap,strtod",
|
||||
"-Wl,-wrap,strtof",
|
||||
"-Wl,-wrap,strtold",
|
||||
"-Wl,-wrap,strtoll",
|
||||
"-Wl,-wrap,strtoul",
|
||||
"-Wl,-wrap,strtoull",
|
||||
"-Wl,-wrap,atoi",
|
||||
"-Wl,-wrap,atoui",
|
||||
"-Wl,-wrap,atol",
|
||||
"-Wl,-wrap,atoul",
|
||||
"-Wl,-wrap,atoull",
|
||||
"-Wl,-wrap,atof",
|
||||
"-Wl,-wrap,malloc",
|
||||
"-Wl,-wrap,realloc",
|
||||
"-Wl,-wrap,calloc",
|
||||
"-Wl,-wrap,free",
|
||||
"-Wl,-wrap,_malloc_r",
|
||||
"-Wl,-wrap,_calloc_r",
|
||||
"-Wl,-wrap,memcmp",
|
||||
"-Wl,-wrap,memcpy",
|
||||
"-Wl,-wrap,memmove",
|
||||
"-Wl,-wrap,memset",
|
||||
"-Wl,-wrap,printf",
|
||||
"-Wl,-wrap,sprintf",
|
||||
"-Wl,-wrap,puts",
|
||||
"-Wl,-wrap,putc",
|
||||
"-Wl,-wrap,putchar",
|
||||
"-Wl,-wrap,snprintf",
|
||||
"-Wl,-wrap,vsnprintf",
|
||||
"-Wl,-wrap,aesccmp_construct_mic_iv",
|
||||
"-Wl,-wrap,aesccmp_construct_mic_header1",
|
||||
"-Wl,-wrap,aesccmp_construct_ctr_preload",
|
||||
"-Wl,-wrap,rom_psk_CalcGTK",
|
||||
"-Wl,-wrap,rom_psk_CalcPTK",
|
||||
"-Wl,-wrap,aes_80211_encrypt",
|
||||
"-Wl,-wrap,aes_80211_decrypt",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - from SDK project/realtek_amebaz2_v0_example/GCC-RELEASE/application.is.mk
|
||||
# - without "utilities - example", "bluetooth - example" and "network - app - mqtt"
|
||||
env.AddLibrary(
|
||||
name="ambz2_sdk",
|
||||
base_dir=COMPONENT_DIR,
|
||||
srcs=[
|
||||
# libc api wrapper
|
||||
"+<soc/realtek/8710c/misc/utilities/source/ram/libc_wrap.c>",
|
||||
# cmsis
|
||||
"+<soc/realtek/8710c/cmsis/rtl8710c/source/ram/*.c>",
|
||||
"+<soc/realtek/8710c/cmsis/rtl8710c/source/ram_s/app_start.c>",
|
||||
# console
|
||||
"+<common/api/at_cmd/atcmd_bt.c>",
|
||||
"+<common/api/at_cmd/atcmd_lwip.c>",
|
||||
"+<common/api/at_cmd/atcmd_mp_ext2.c>",
|
||||
"+<common/api/at_cmd/atcmd_mp.c>",
|
||||
"+<common/api/at_cmd/atcmd_sys.c>",
|
||||
"+<common/api/at_cmd/atcmd_wifi.c>",
|
||||
"+<common/api/at_cmd/log_service.c>",
|
||||
"+<soc/realtek/8710c/app/shell/cmd_shell.c>",
|
||||
"+<soc/realtek/8710c/app/shell/ram_s/consol_cmds.c>",
|
||||
"+<soc/realtek/8710c/misc/driver/rtl_console.c>",
|
||||
# utilities
|
||||
"+<common/utilities/cJSON.c>",
|
||||
"+<common/utilities/http_client.c>",
|
||||
"+<common/utilities/xml.c>",
|
||||
# os
|
||||
"+<os/freertos/cmsis_os.c>",
|
||||
"+<os/freertos/freertos_cb.c>",
|
||||
"+<os/freertos/freertos_pmu.c>",
|
||||
"+<os/freertos/freertos_service.c>",
|
||||
"+<os/os_dep/device_lock.c>",
|
||||
"+<os/os_dep/osdep_service.c>",
|
||||
# os - freertos
|
||||
"+<os/freertos/freertos_v10.0.1/Source/*.c>",
|
||||
# os - freertos - portable
|
||||
"+<os/freertos/freertos_v10.0.1/Source/portable/MemMang/heap_5.c>",
|
||||
"+<os/freertos/freertos_v10.0.1/Source/portable/GCC/ARM_RTL8710C/port.c>",
|
||||
# peripheral - api
|
||||
"+<common/mbed/targets/hal/rtl8710c/*.c>",
|
||||
# peripheral - hal
|
||||
"+<soc/realtek/8710c/fwlib/source/ram/*.c>",
|
||||
"+<soc/realtek/8710c/fwlib/source/ram_ns/*.c>",
|
||||
"+<soc/realtek/8710c/fwlib/source/ram_s/hal_efuse.c>",
|
||||
"+<soc/realtek/8710c/fwlib/source/ram_s/hal_pinmux_nsc.c>",
|
||||
# peripheral - wlan
|
||||
# "+<common/drivers/wlan/realtek/src/core/option/rtw_opt_rf_para_rtl8710c.c>",
|
||||
# file_system - fatfs
|
||||
"+<common/file_system/fatfs/disk_if/src/flash_fatfs.c>",
|
||||
"+<common/file_system/fatfs/fatfs_ext/src/ff_driver.c>",
|
||||
"+<common/file_system/fatfs/r0.10c/src/diskio.c>",
|
||||
"+<common/file_system/fatfs/r0.10c/src/ff.c>",
|
||||
"+<common/file_system/fatfs/r0.10c/src/option/ccsbcs.c>",
|
||||
"+<common/file_system/ftl/ftl.c>",
|
||||
# TODO remove this
|
||||
"+<common/example/example_entry.c>",
|
||||
"+<common/example/wlan_fast_connect/example_wlan_fast_connect.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<$SDK_DIR/project/realtek_amebaz2_v0_example/inc>",
|
||||
"+<common/api/at_cmd>",
|
||||
"+<common/api/platform>",
|
||||
"+<common/api>",
|
||||
"+<common/application>",
|
||||
"+<common/example>",
|
||||
"+<common/file_system/dct>",
|
||||
"+<common/file_system/fatfs/r0.10c/include>",
|
||||
"+<common/file_system/fatfs>",
|
||||
"+<common/file_system/ftl>",
|
||||
"+<common/file_system>",
|
||||
"+<common/mbed/hal_ext>",
|
||||
"+<common/mbed/hal>",
|
||||
"+<common/mbed/targets/hal/rtl8710c>",
|
||||
"+<common/media/mmfv2>",
|
||||
"+<common/media/rtp_codec>",
|
||||
"+<common/test>",
|
||||
"+<common/utilities>",
|
||||
"+<os/freertos>",
|
||||
"+<os/freertos/freertos_v10.0.1/Source/include>",
|
||||
"+<os/freertos/freertos_v10.0.1/Source/portable/GCC/ARM_RTL8710C>",
|
||||
"+<os/os_dep/include>",
|
||||
"+<soc/realtek/8710c/app/rtl_printf/include>",
|
||||
"+<soc/realtek/8710c/app/shell>",
|
||||
"+<soc/realtek/8710c/app/stdio_port>",
|
||||
"+<soc/realtek/8710c/cmsis/cmsis-core/include>",
|
||||
"+<soc/realtek/8710c/cmsis/rtl8710c/include>",
|
||||
"+<soc/realtek/8710c/cmsis/rtl8710c/lib/include>",
|
||||
"+<soc/realtek/8710c/fwlib/include>",
|
||||
"+<soc/realtek/8710c/fwlib/lib/include>",
|
||||
"+<soc/realtek/8710c/mbed-drivers/include>",
|
||||
"+<soc/realtek/8710c/misc/driver>",
|
||||
"+<soc/realtek/8710c/misc/os>",
|
||||
"+<soc/realtek/8710c/misc/platform>",
|
||||
"+<soc/realtek/8710c/misc/utilities/include>",
|
||||
],
|
||||
options=dict(
|
||||
CCFLAGS=[
|
||||
"-Wno-int-conversion",
|
||||
"-Wno-unused-label",
|
||||
"-Wno-unused-but-set-variable",
|
||||
"-Wno-undef",
|
||||
"-Wno-pointer-sign",
|
||||
"-Wno-parentheses",
|
||||
"-Wno-implicit-function-declaration",
|
||||
"-Wno-misleading-indentation",
|
||||
# TODO remove this; only for example_wlan_fast_connect.c
|
||||
"-Wno-format-truncation",
|
||||
"-Wno-return-type",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
# Sources - network utilities
|
||||
env.AddLibrary(
|
||||
name="ambz2_net",
|
||||
base_dir=COMPONENT_DIR,
|
||||
srcs=[
|
||||
# network - api
|
||||
"+<common/api/lwip_netconf.c>",
|
||||
# network - api - wifi
|
||||
"+<common/api/wifi/*.c>",
|
||||
# network - api - wifi - rtw_wpa_supplicant
|
||||
"+<common/api/wifi/rtw_wpa_supplicant/src/crypto/tls_polarssl.c>",
|
||||
"+<common/api/wifi/rtw_wpa_supplicant/wpa_supplicant/*.c>",
|
||||
# network - app
|
||||
"+<soc/realtek/8710c/misc/platform/ota_8710c.c>",
|
||||
"+<common/api/network/src/ping_test.c>",
|
||||
"+<common/utilities/ssl_client.c>",
|
||||
"+<common/utilities/ssl_client_ext.c>",
|
||||
"+<common/utilities/tcptest.c>",
|
||||
"+<common/api/network/src/wlan_network.c>",
|
||||
# network - coap
|
||||
"+<common/network/coap/*.c>",
|
||||
# network - http
|
||||
"+<common/network/httpc/httpc_tls.c>",
|
||||
"+<common/network/httpd/httpd_tls.c>",
|
||||
# network
|
||||
"+<common/network/dhcp/dhcps.c>",
|
||||
"+<common/network/sntp/sntp.c>",
|
||||
# network - websocket
|
||||
"+<common/network/websocket/*.c>",
|
||||
# network - mdns
|
||||
"+<common/network/mDNS/mDNSPlatform.c>",
|
||||
# network - lwip - port
|
||||
"+<common/drivers/wlan/realtek/src/osdep/lwip_intf.c>",
|
||||
# network - ssl - ssl_ram_map
|
||||
"+<common/network/ssl/ssl_ram_map/rom/rom_ssl_ram_map.c>",
|
||||
"+<common/network/ssl/ssl_func_stubs/ssl_func_stubs.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<common/api/network/include>",
|
||||
"+<common/api/wifi>",
|
||||
"+<common/api/wifi/rtw_wpa_supplicant/src/crypto>",
|
||||
"+<common/api/wifi/rtw_wpa_supplicant/src>",
|
||||
"+<common/drivers/wlan/realtek/include>",
|
||||
"+<common/drivers/wlan/realtek/src/core/option>",
|
||||
"+<common/drivers/wlan/realtek/src/osdep>",
|
||||
"+<common/network>",
|
||||
"+<common/network/coap/include>",
|
||||
"+<common/network/http2/nghttp2-1.31.0/includes>",
|
||||
"+<common/network/libcoap/include>",
|
||||
"+<common/network/ssl/ssl_ram_map/rom>",
|
||||
],
|
||||
options=dict(
|
||||
CCFLAGS=[
|
||||
"-Wno-pointer-sign",
|
||||
"-Wno-unused-value",
|
||||
"-Wno-format",
|
||||
"-Wno-implicit-function-declaration",
|
||||
"-Wno-unused-function",
|
||||
"-Wno-parentheses",
|
||||
"-Wno-incompatible-pointer-types",
|
||||
"-Wno-array-bounds",
|
||||
"-Wno-stringop-overflow",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
# Sources - Bluetooth support
|
||||
env.AddLibrary(
|
||||
name="ambz2_bluetooth",
|
||||
base_dir=join(COMPONENT_DIR, "common", "bluetooth", "realtek", "sdk"),
|
||||
srcs=[
|
||||
"+<board/**/*.c>",
|
||||
"+<src/ble/profile/client/*.c>",
|
||||
"+<src/ble/profile/server/bas.c>",
|
||||
"+<src/ble/profile/server/dis.c>",
|
||||
"+<src/ble/profile/server/hids.c>",
|
||||
# "+<src/ble/profile/server/hids_kb.c>",
|
||||
# "+<src/ble/profile/server/hids_rmc.c>",
|
||||
"+<src/ble/profile/server/simple_ble_service.c>",
|
||||
"+<src/mcu/module/data_uart_cmd/user_cmd_parse.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<.>",
|
||||
"+<board/amebaz2/lib>",
|
||||
"+<board/amebaz2/src/data_uart>",
|
||||
"+<board/amebaz2/src/hci>",
|
||||
"+<board/amebaz2/src/os>",
|
||||
"+<board/amebaz2/src/vendor_cmd>",
|
||||
"+<board/amebaz2/src>",
|
||||
"+<board/common/inc>",
|
||||
"+<inc>",
|
||||
"+<inc/app>",
|
||||
"+<inc/bluetooth/gap>",
|
||||
"+<inc/bluetooth/profile/client>",
|
||||
"+<inc/bluetooth/profile/server>",
|
||||
"+<inc/bluetooth/profile>",
|
||||
"+<inc/os>",
|
||||
"+<inc/platform>",
|
||||
"+<inc/stack>",
|
||||
"+<src/mcu/module/data_uart_cmd>",
|
||||
],
|
||||
options=dict(
|
||||
CCFLAGS=[
|
||||
"-Wno-unused-function",
|
||||
"-Wno-unused-variable",
|
||||
"-Wno-implicit-function-declaration",
|
||||
],
|
||||
),
|
||||
)
|
||||
|
||||
|
||||
# Sources - lwIP 2.0.2
|
||||
env.AddLibrary(
|
||||
name="ambz2_lwip",
|
||||
base_dir=join(COMPONENT_DIR, "common", "network", "lwip", "lwip_v2.0.2"),
|
||||
srcs=[
|
||||
"+<port/realtek/freertos/*.c>",
|
||||
"+<src/api/*.c>",
|
||||
"+<src/apps/ping/*.c>",
|
||||
"+<src/apps/mdns/*.c>",
|
||||
"+<src/core/*.c>",
|
||||
"+<src/core/ipv4/*.c>",
|
||||
"+<src/core/ipv6/*.c>",
|
||||
"+<src/netif/ethernet.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<port/realtek>",
|
||||
"+<port/realtek/freertos>",
|
||||
"+<src/include>",
|
||||
"+<src/include/netif>",
|
||||
],
|
||||
)
|
||||
|
||||
# Sources - mbedTLS
|
||||
env.AddLibrary(
|
||||
name="ambz2_mbedtls",
|
||||
base_dir=join(COMPONENT_DIR, "common", "network", "ssl", "mbedtls-2.4.0"),
|
||||
srcs=[
|
||||
"+<library/aesni.c>",
|
||||
"+<library/blowfish.c>",
|
||||
"+<library/camellia.c>",
|
||||
"+<library/ccm.c>",
|
||||
"+<library/certs.c>",
|
||||
"+<library/cipher_wrap.c>",
|
||||
"+<library/cipher.c>",
|
||||
"+<library/cmac.c>",
|
||||
"+<library/debug.c>",
|
||||
"+<library/error.c>",
|
||||
"+<library/gcm.c>",
|
||||
"+<library/havege.c>",
|
||||
"+<library/md_wrap.c>",
|
||||
"+<library/md.c>",
|
||||
"+<library/md2.c>",
|
||||
"+<library/md4.c>",
|
||||
"+<library/memory_buffer_alloc.c>",
|
||||
"+<library/net_sockets.c>",
|
||||
"+<library/padlock.c>",
|
||||
"+<library/pkcs11.c>",
|
||||
"+<library/pkcs12.c>",
|
||||
"+<library/pkcs5.c>",
|
||||
"+<library/pkparse.c>",
|
||||
"+<library/platform.c>",
|
||||
"+<library/ripemd160.c>",
|
||||
"+<library/sha256.c>",
|
||||
"+<library/ssl_cache.c>",
|
||||
"+<library/ssl_ciphersuites.c>",
|
||||
"+<library/ssl_cli.c>",
|
||||
"+<library/ssl_cookie.c>",
|
||||
"+<library/ssl_srv.c>",
|
||||
"+<library/ssl_ticket.c>",
|
||||
"+<library/ssl_tls.c>",
|
||||
"+<library/threading.c>",
|
||||
"+<library/timing.c>",
|
||||
"+<library/version_features.c>",
|
||||
"+<library/version.c>",
|
||||
"+<library/x509_create.c>",
|
||||
"+<library/x509_crl.c>",
|
||||
"+<library/x509_crt.c>",
|
||||
"+<library/x509_csr.c>",
|
||||
"+<library/x509.c>",
|
||||
"+<library/x509write_crt.c>",
|
||||
"+<library/x509write_csr.c>",
|
||||
"+<library/xtea.c>",
|
||||
],
|
||||
includes=[
|
||||
"+<include>",
|
||||
],
|
||||
)
|
||||
|
||||
# Libs & linker config
|
||||
env.Append(
|
||||
LIBPATH=[
|
||||
# fmt: off
|
||||
join(COMPONENT_DIR, "soc", "realtek", "8710c", "misc", "bsp", "lib", "common", "GCC"),
|
||||
join(COMPONENT_DIR, "soc", "realtek", "8710c", "fwlib", "lib", "lib"),
|
||||
join(COMPONENT_DIR, "common", "bluetooth", "realtek", "sdk", "board", "amebaz2", "lib"),
|
||||
join(COMPONENT_DIR, "soc", "realtek", "8710c", "misc", "bsp", "ROM"),
|
||||
# fmt: on
|
||||
],
|
||||
LIBS=[
|
||||
"_soc_is",
|
||||
"_wlan",
|
||||
"_http",
|
||||
"_dct",
|
||||
"_eap",
|
||||
"_p2p",
|
||||
"_websocket",
|
||||
"_wps",
|
||||
"m",
|
||||
"c",
|
||||
"nosys",
|
||||
"gcc",
|
||||
# SCons trims the .a suffix automatically
|
||||
":hal_pmc.a.a",
|
||||
":btgap.a.a",
|
||||
],
|
||||
)
|
||||
|
||||
# Misc options
|
||||
env.Replace(
|
||||
SIZEPROGREGEXP=r"^(?:\.ram\..*?|\.psram\.[cd].*?|\.data|\.xip[\._].*?)\s+([0-9]+).*",
|
||||
SIZEDATAREGEXP=r"^(?:\.ram\..*?|\.data)\s+([0-9]+).*",
|
||||
SIZECHECKCMD="$SIZETOOL -A -d $SOURCES",
|
||||
SIZEPRINTCMD="$SIZETOOL -B -d $SOURCES",
|
||||
)
|
||||
|
||||
# Build all libraries
|
||||
env.BuildLibraries()
|
||||
|
||||
# Main firmware outputs and actions
|
||||
env.Replace(
|
||||
# TODO
|
||||
)
|
||||
Reference in New Issue
Block a user