Beispiel #1
0
                "--flash_mode", "$BOARD_FLASH_MODE",
                "--flash_freq", "${__get_board_f_flash(__env__)}",
                "--flash_size", "${__get_flash_size(__env__)}",
                "--path", '"%s"' % join(
                    platform.get_package_dir("toolchain-xtensa"), "bin"),
                "--out", "$TARGET"
            ]), "Building $TARGET"),
            suffix=".bin"
        )
    )
)

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

flatten_cppdefines = env.Flatten(env['CPPDEFINES'])

#
# SDK
#
if "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK3" in flatten_cppdefines:
    env.Append(
        CPPDEFINES=[("NONOSDK3V0", 1)],
        LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK3V0")]
    )
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22x" in flatten_cppdefines:
    env.Append(
        CPPDEFINES=[("NONOSDK22x", 1)],
        LIBPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lib", "NONOSDK22x")]
    )
elif "PIO_FRAMEWORK_ARDUINO_ESPRESSIF_SDK22y" in flatten_cppdefines:
Beispiel #2
0
        join(FRAMEWORK_DIR, "Src", "App", "oneshotconfig", "lib_gcc")
    ])

#
# Linker requires preprocessing with correct RAM|ROM sizes
#

if not board.get("build.ldscript", ""):
    print("Warning! Cannot find linker script for the current target!\n")
    env.Replace(LDSCRIPT_PATH=join("ldscripts", "ldscript.ld"))

#
# Process configuration flags
#

cpp_defines = env.Flatten(env.get("CPPDEFINES", []))

process_standard_library_configuration(cpp_defines)

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

env.Append(LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")])

#
# Target: Build Core Library
#

libs = []

platform_exclude_dirs = [
Beispiel #3
0
        "-Tesp8266.rom.ld",
        "-Tesp8266.peripherals.ld",
    ],
    COMPONENT_ADD_LDFLAGS=[
#        "-L$COMPONENT_PATH/lib",
#        "$(addprefix -l,$(LIBS))",
#        "-L$COMPONENT_PATH/ld",
        "-Tesp8266_out.ld",
        "-Tesp8266_common_out.ld",
        "-Wl,--no-check-sections",
        "-u", "call_user_start",
        "$LINKER_SCRIPTS",
    ],
)

if "PIO_FRAMEWORK_ESP_IDF_ENABLE_EXCEPTIONS" in env.Flatten(
        env.get("CPPDEFINES", [])):

    # remove unnecessary flag defined in main.py that disables exceptions
    try:
        index = env['CXXFLAGS'].index("-fno-exceptions")
        if index > 0:
            env['CXXFLAGS'].remove("-fno-exceptions")
    except IndexError:
        pass

    env.Append(
        CPPDEFINES=[
            ("CONFIG_CXX_EXCEPTIONS", 1),
            ("CONFIG_CXX_EXCEPTIONS_EMG_POOL_SIZE", 0)
        ],
Beispiel #4
0
        "-mcpu=%s" % board.get("build.cpu"),
        "-nostdlib"
    ],
    CPPDEFINES=["USE_HAL_DRIVER", ("F_CPU", "$BOARD_F_CPU")],
    CXXFLAGS=["-fno-rtti", "-fno-exceptions"],
    LINKFLAGS=[
        "-Os", "-Wl,--gc-sections,--relax", "-mthumb",
        "-mcpu=%s" % board.get("build.cpu"), "--specs=nano.specs",
        "--specs=nosys.specs"
    ],
    LIBS=["c", "gcc", "m", "stdc++", "nosys"])

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

cpp_flags = env.Flatten(env.get("CPPDEFINES", []))

if "F103xC" in cpp_flags:
    env.Append(CPPDEFINES=["STM32F103xE"])
elif "F103x8" in cpp_flags:
    env.Append(CPPDEFINES=["STM32F103xB"])

env.Append(CPPPATH=[
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Include"),
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "CMSIS", "Device", "ST",
         MCU_FAMILY.upper() + "xx", "Include"),
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers",
         MCU_FAMILY.upper() + "xx_HAL_Driver", "Inc"),
    join(FRAMEWORK_DIR, FRAMEWORK_CORE, "Drivers", "BSP", "Components",
         "Common")
],
Beispiel #5
0
    CPPDEFINES=CPPDEFINES,
    LIBS=["m"],
    LIBSOURCE_DIRS=[join(FRAMEWORK_DIR, "libraries")],
    CPPPATH=[join(FRAMEWORK_DIR, "cores", build_core)])

#
# Take into account bootloader size
#

if (build_core in ("MiniCore", "MegaCore", "MightyCore", "MajorCore")
        and board.get("hardware.uart", "uart0") != "no_bootloader"):
    upload_section = board.get("upload")
    upload_section["maximum_size"] -= board.get("bootloader.size",
                                                get_bootloader_size())
elif build_core in ("tiny", "tinymodern"):
    flatten_defines = env.Flatten(env["CPPDEFINES"])
    extra_defines = []
    if "CLOCK_SOURCE" not in flatten_defines:
        extra_defines.append(("CLOCK_SOURCE", 0))
    if "NEOPIXELPORT" not in flatten_defines:
        extra_defines.append(("NEOPIXELPORT", "PORTA"))

    if extra_defines:
        env.AppendUnique(CPPDEFINES=extra_defines)

# copy CCFLAGS to ASFLAGS (-x assembler-with-cpp mode)
env.Append(ASFLAGS=env.get("CCFLAGS", [])[:])

#
# Target: Build Core Library
#
        "wps", "axtls", "espnow", "smartconfig", "airkiss", "wpa2",
        "stdc++", "m", "c", "gcc"
    ],

    LIBSOURCE_DIRS=[
        join(FRAMEWORK_DIR, "libraries")
    ],

    LINKFLAGS=[
        "-Wl,-wrap,system_restart_local",
        "-Wl,-wrap,spi_flash_read"
    ]
)


if "PIO_FRAMEWORK_ARDUINO_LWIP2_LOW_MEMORY" in env.Flatten(env['CPPDEFINES']):
    env.Append(
        CPPDEFINES=[("TCP_MSS", 536)],
        CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
        LIBS=["lwip2"]
    )
elif "PIO_FRAMEWORK_ARDUINO_LWIP2_HIGHER_BANDWIDTH" in \
        env.Flatten(env['CPPDEFINES']):
    env.Append(
        CPPDEFINES=[("TCP_MSS", 1460)],
        CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip2", "include")],
        LIBS=["lwip2_1460"]
    )
else:
    env.Append(
        CPPPATH=[join(FRAMEWORK_DIR, "tools", "sdk", "lwip", "include")],
Beispiel #7
0
    LIBS=[
        "arm_cortex%sl_math" % board.get("build.cpu")[7:9].upper(),
        "c", "m", "gcc", "stdc++", "c"  # two libc in order to fix linker error
    ],

    LIBPATH=[
        variant_dir,
        join(CMSIS_DIR, "Lib", "GCC")
    ]
)

#
# Configure Serial interface
#

if "PIO_FRAMEWORK_ARDUINO_SERIAL_DISABLED" in env.Flatten(
        env.get("CPPDEFINES", [])):
    env['CPPDEFINES'].remove("FFFFFHAL_UART_MODULE_ENABLED")

elif "PIO_FRAMEWORK_ARDUINO_SERIAL_WITHOUT_GENERIC" in env.Flatten(
        env.get("CPPDEFINES", [])):
    env.Append(CPPDEFINES=["HWSERIAL_NONE"])

#
# Configure standard library
#

if "PIO_FRAMEWORK_ARDUINO_STANDARD_LIB" in env.Flatten(
        env.get("CPPDEFINES", [])):
    env['LINKFLAGS'].remove("--specs=nano.specs")
if "PIO_FRAMEWORK_ARDUINO_NANOLIB_FLOAT_PRINTF" in env.Flatten(
        env.get("CPPDEFINES", [])):
    join(FRAMEWORK_DIR, "component", "common", "mbed", "targets", "cmsis"),
    join(FRAMEWORK_DIR, "component", "common", "mbed", "targets", "hal",
         "rtl8711b"),
    join(FRAMEWORK_DIR, "component", "common", "network", "websocket"),
],
           LIBPATH=[
               FRAMEWORK_DIR +
               "/component/soc/realtek/8711b/misc/bsp/lib/common/GCC",
               env["PLATFORM_DIR"] + "/scripts/ld/sdk-ameba-v4.0b",
           ],
           LIBS=[
               "_platform", "_wps", "_rtlstd", "_dct", "m", "c", "nosys",
               "_websocket", "_http", "_mdns"
           ])

if "PIO_FRAMEWORK_AMEBAZ_USE_MP" in env.Flatten(env["CPPDEFINES"]):
    env.Append(LIBS=["_wlan_mp"])
else:
    env.Append(LIBS=["_wlan"])

env.Replace(
    LDSCRIPT_PATH=[
        env["PLATFORM_DIR"] +
        "/scripts/ld/sdk-ameba-v4.0b/rlx8711B-symbol-v02-img2_xip1.ld",
    ],
    PICK=join(AMEBA_TOOLDIR, "pick" + EXECUTABLE_SUFFIX),
    PAD=join(AMEBA_TOOLDIR, "padding" + EXECUTABLE_SUFFIX),
    CHKSUM=join(AMEBA_TOOLDIR, "checksum" + EXECUTABLE_SUFFIX),
    OTA=join(AMEBA_TOOLDIR, "ota" + EXECUTABLE_SUFFIX),
)
Beispiel #9
0
    else:
        symbols.append(s)

env.Replace(CPPDEFINES=symbols)

env.Append(LIBS=["c", "stdc++"])  # temporary fix for the linker issue

# restore external build flags
if "build.extra_flags" in env.BoardConfig():
    env.ProcessFlags(env.BoardConfig().get("build.extra_flags"))
# remove base flags
env.ProcessUnFlags(env.get("BUILD_UNFLAGS"))
# apply user flags
env.ProcessFlags(env.get("BUILD_FLAGS"))

MBED_RTOS = "PIO_FRAMEWORK_MBED_RTOS_PRESENT" in env.Flatten(
    env.get("CPPDEFINES", []))

if MBED_RTOS:
    env.Append(CPPDEFINES=["MBED_CONF_RTOS_PRESENT"])

#
# Process libraries
#

# There is no difference in processing between lib and feature
libs = mbed_config.get("libs").copy()
libs.update(mbed_config.get("features"))

#
# Process Core files from framework
#