コード例 #1
0
ファイル: wm60x_sdk.py プロジェクト: OS-Q/P515
    "Common/crypto/math/pstm.c",
    "Common/crypto/symmetric/aesMatrix.c",
    "Common/crypto/symmetric/arc4.c",
    # bootup files for other compilers
    "Boot/armcc",
    "Boot/iccarm",
    # these files #include ALL .c files --> double definitions; ignore them
    "Drivers/wm_driver.c",
    "Common/wm_common.c"
]
platform_exclude_dirs_src_filter = " ".join(
    ["-<" + d + ">" for d in platform_exclude_dirs])

# build startup files
env.BuildSources(join("$BUILD_DIR", "SDKPlatformBoot"),
                 join(FRAMEWORK_DIR, "Platform"),
                 src_filter="+<*> " + platform_exclude_dirs_src_filter)

# build RTOS
env.BuildSources(join("$BUILD_DIR", "SDKRTOS"),
                 join(FRAMEWORK_DIR, "Src", "OS", "RTOS"),
                 src_filter="+<*> -<ports/port_m3.c> -<wm_rtos.c>"
                 )  #exclude port file meant for other compiler

network_exclude_dirs = [
    "lwip2.0.3.c", "lwip2.0.3/apps/*", "lwip2.0.3/core/timers.c",
    "lwip2.0.3/netif/ppp/*", "lwip2.0.3/netif/lowpan6.c",
    "lwip2.0.3/netif/slipif.c", "lwip2.0.3/core/ipv4/ip_frag.c"
]
network_exclude_dirs_src_filter = " ".join(
    ["-<" + d + ">" for d in network_exclude_dirs])
コード例 #2
0
process_usb_configuration(cpp_defines)
process_dosfs_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 = []

if "build.variant" in env.BoardConfig():
    env.Append(CPPPATH=[variant_dir])
    env.BuildSources(join("$BUILD_DIR", "FrameworkArduinoVariant"), variant_dir)

env.BuildSources(
    join("$BUILD_DIR", "FrameworkArduino"), join(FRAMEWORK_DIR, "cores", "stm32l4")
)

# CMSIS Device folder is not built because it's in the precompiled binary

#libraries
env.Prepend(LIBS=libs)
コード例 #3
0
process_usb_configuration(cpp_defines)
process_usb_speed_configuration(cpp_defines)
process_usart_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", "__cores__", "arduino"),
    join(FRAMEWORK_DIR, "libraries"),
])

#
# Target: Build Core Library
#

libs = []

if "build.variant" in env.BoardConfig():
    env.Append(CPPPATH=[variant_dir])
    env.BuildSources(join("$BUILD_DIR", "FrameworkArduinoVariant"),
                     variant_dir)

env.BuildSources(join("$BUILD_DIR", "FrameworkArduino"),
                 join(FRAMEWORK_DIR, "cores", "arduino"))

env.BuildSources(join("$BUILD_DIR", "SrcWrapper"),
                 join(FRAMEWORK_DIR, "libraries", "SrcWrapper"))

env.Prepend(LIBS=libs)
コード例 #4
0
ファイル: cmsis.py プロジェクト: zhou-peter/platform-ststm32
#
# Prepare build environment
#

# The final firmware is linked against standard library with two specifications:
# nano.specs - link against a reduced-size variant of libc
# nosys.specs - link against stubbed standard syscalls

env.Append(CPPPATH=[
    os.path.join(CMSIS_DIR, "CMSIS", "Core", "Include"),
    os.path.join(CMSIS_DEVICE_DIR, "Include")
],
           LINKFLAGS=["--specs=nano.specs", "--specs=nosys.specs"])

#
# Compile CMSIS sources
#

sources_path = os.path.join(CMSIS_DEVICE_DIR, "Source", "Templates")
prepare_startup_file(sources_path)

env.BuildSources(
    os.path.join("$BUILD_DIR", "FrameworkCMSIS"),
    sources_path,
    src_filter=[
        "-<*>",
        "+<%s>" %
        board.get("build.cmsis.system_file", "system_%sxx.c" % mcu[0:7]),
        "+<gcc/startup_%s.S>" % product_line.lower()
    ])
コード例 #5
0
ファイル: spl.py プロジェクト: OS-Q/P132
        sys.stderr.write(
            "Error: Could not parse library files for the target.\n")
        sys.stderr.write(result['err'])
        env.Exit(1)

    src_files = []
    includes = result['out']
    for inc in includes.split(" "):
        if "_" not in inc or ".h" not in inc or "conf" in inc:
            continue
        src_files.append(basename(inc).replace(".h", ".c").strip())

    return src_files


env.Append(CFLAGS=["--opt-code-size"],
           CPPDEFINES=["USE_STDPERIPH_DRIVER", "USE_STDINT"],
           CPPPATH=[
               join(FRAMEWORK_DIR, "Libraries", "inc"),
               "$PROJECTSRC_DIR",
           ])

#
# Target: Build Core Library
#

env.BuildSources(join("$BUILD_DIR", "SPL"),
                 join(FRAMEWORK_DIR, "Libraries", "src"),
                 src_filter=["-<*>"] +
                 [" +<%s>" % f for f in get_core_files()])
コード例 #6
0
env.Replace(LDSCRIPT_PATH=join(variant_dir, "linkscripts", "mt7687_flash.ld"))

#
# Process configuration flags
#

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

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

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

#
# Target: Build Core Library
#

libs = []

env.BuildSources(join("$BUILD_DIR", "FrameworkArduinoVariant"),
                 join(FRAMEWORK_DIR, "variants", "linkit_7697"))

env.BuildSources(join("$BUILD_DIR", "FrameworkArduino"),
                 join(FRAMEWORK_DIR, "cores", "arduino"))

env.Prepend(LIBS=libs)
コード例 #7
0
ファイル: arduino.py プロジェクト: OS-Q/P115
elif oscillator_type == "external" and build_core == "MegaCoreX":
    env.Append(CPPDEFINES=["USE_EXTERNAL_OSCILLATOR"])

#
# Target: Build Core Library
#

libs = []

if "build.variant" in board:
    variants_dir = join(
        "$PROJECT_DIR", board.get("build.variants_dir")) if board.get(
            "build.variants_dir", "") else join(FRAMEWORK_DIR, "variants")

    env.Append(
        CPPPATH=[
            join(variants_dir, board.get("build.variant"))
        ]
    )
    env.BuildSources(
        join("$BUILD_DIR", "FrameworkArduinoVariant"),
        join(variants_dir, board.get("build.variant"))
    )

libs.append(env.BuildLibrary(
    join("$BUILD_DIR", "FrameworkArduino"),
    join(FRAMEWORK_DIR, "cores", build_core)
))

env.Prepend(LIBS=libs)
コード例 #8
0
#
# Process configuration flags
#

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

# 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 = []

if "build.variant" in board_config:
    env.Append(CPPPATH=[inc_variant_dir], LIBPATH=[inc_variant_dir])
    env.BuildSources(join("$BUILD_DIR", "FrameworkArduinoVariant"),
                     variant_dir)

libs.append(
    env.BuildLibrary(join("$BUILD_DIR", "FrameworkArduino"),
                     join(FRAMEWORK_DIR, "cores", "bl602")))

env.Prepend(LIBS=libs)
コード例 #9
0
if board.get("build.stm32cube.custom_dsp_library", "no") == "no":
    process_dsp_lib()

#
# HAL libraries
#

# Generate a default stm32xxx_hal_conf.h
generate_hal_config_file()

env.BuildSources(
    os.path.join("$BUILD_DIR", "FrameworkHALDriver"),
    os.path.join(
        FRAMEWORK_DIR,
        "Drivers",
        MCU_FAMILY.upper() + "xx_HAL_Driver",
    ),
    src_filter="+<*> -<Src/*_template.c> -<Src/Legacy>",
)

#
# CMSIS library
#

if board.get("build.stm32cube.custom_system_setup", "no") == "no":
    sources_path = os.path.join(
        FRAMEWORK_DIR,
        "Drivers",
        "CMSIS",
        "Device",
コード例 #10
0
    env.Append(CPPPATH=[os.path.join(FRAMEWORK_DIR, "variants", variant)])

    libs.append(
        env.BuildLibrary(os.path.join("$BUILD_DIR", "FrameworkArduinoVariant"),
                         os.path.join(FRAMEWORK_DIR, "variants", variant)))

libs.append(
    env.BuildLibrary(os.path.join("$BUILD_DIR", "FrameworkArduino"),
                     os.path.join(FRAMEWORK_DIR, "cores", "rp2040")))

bootloader_src_file = board.get("build.arduino.earlephilhower.boot2_source",
                                "boot2_generic_03h_2_padded_checksum.S")

# Add bootloader file (boot2.o)
# Only build the needed .S file, exclude all others via src_filter.
env.BuildSources(
    os.path.join("$BUILD_DIR", "FrameworkArduinoBootloader"),
    os.path.join(FRAMEWORK_DIR, "boot2"),
    "-<*> +<%s>" % bootloader_src_file,
)
# Add include flags for all .S assembly file builds
env.Append(ASFLAGS=[
    "-I",
    os.path.join(FRAMEWORK_DIR, "pico-sdk", "src", "rp2040", "hardware_regs",
                 "include"), "-I",
    os.path.join(FRAMEWORK_DIR, "pico-sdk", "src", "common",
                 "pico_binary_info", "include")
])

env.Prepend(LIBS=libs)
コード例 #11
0
# Compile core part
#

lib_sources = dict()

for f in configuration.get("src_files"):
    lib_name = f.split(os.path.sep)[0]
    if lib_name not in lib_sources:
        lib_sources[lib_name] = ["-<*>"]
    lib_sources[lib_name].append("+<%s>" % "/".join(f.split(os.path.sep)[1:]))


for lib_name, src_filter in lib_sources.items():
    env.BuildSources(
        os.path.join("$BUILD_DIR", "FrameworkMbed" + lib_name),
        os.path.join(FRAMEWORK_DIR, lib_name),
        src_filter=src_filter,
    )

#
# mbed has its own independent merge process
#


def merge_firmwares(target, source, env):
    framework_processor.merge_apps(env.subst(source)[0], env.subst(target)[0])

    # some boards (e.g. nrf51 modify the resulting firmware)
    if framework_processor.has_target_hook():
        firmware_file = env.subst(os.path.join("$BUILD_DIR", "${PROGNAME}.hex"))
        if not os.path.isfile(firmware_file):
コード例 #12
0
import sys
from os.path import basename, isdir, isfile, join

from SCons.Script import DefaultEnvironment

from platformio.proc import exec_command

env = DefaultEnvironment()
platform = env.PioPlatform()
board_config = env.BoardConfig()

FRAMEWORK_DIR = platform.get_package_dir("F152")
assert isdir(FRAMEWORK_DIR)

env.Append(CFLAGS=["--model-small"],
           CPPPATH=[
               join(FRAMEWORK_DIR, "inc"),
               join(FRAMEWORK_DIR, "include"),
               "$PROJECTSRC_DIR",
           ])

env.BuildSources(join("$BUILD_DIR", "native"), join(FRAMEWORK_DIR, "src"))
コード例 #13
0
env.Append(CPPPATH=[
    FRAMEWORK_DIR,
    join(FRAMEWORK_DIR, "platformio", "variants", variant)
])

# If RTOS is enabled then some of the files from Core depdend on it
if MBED_RTOS:
    for d in mbed_config.get("libs").get("rtos").get("inc_dirs"):
        env.Append(CPPPATH=[join(FRAMEWORK_DIR, "rtos", d)])

core_src_files = mbed_config.get("core").get("s_sources") + mbed_config.get(
    "core").get("c_sources") + mbed_config.get("core").get("cpp_sources")

env.BuildSources(join("$BUILD_DIR", "FrameworkMbedCore"),
                 FRAMEWORK_DIR,
                 src_filter=["-<*>"] + [" +<%s>" % f for f in core_src_files])

if "nordicnrf5" in env.get("PIOPLATFORM"):
    softdevice_hex_path = join(FRAMEWORK_DIR,
                               mbed_config.get("softdevice_hex", ""))
    if softdevice_hex_path and isfile(softdevice_hex_path):
        env.Append(SOFTDEVICEHEX=softdevice_hex_path)
    else:
        print("Warning! Cannot find softdevice binary"
              "Firmware will be linked without it!")

#
# Generate linker script
#
コード例 #14
0
if "FUSES_CMD" not in env:
    for fuse in ("OSCCFG", "SYSCFG0", "BOOTEND"):
        if not bootloader_config.get(fuse, ""):
            sys.stderr.write("Error: Missing %s fuse value\n" % fuse)
            env.Exit(1)

    env.Replace(
        FUSES_CMD="-Ufuse2:w:%s:m -Ufuse5:w:%s:m -Ufuse8:w:%s:m" %
        (bootloader_config.get("OSCCFG"), bootloader_config.get("SYSCFG0"),
         bootloader_config.get("BOOTEND")))

#
# Target: Build Core Library
#

libs = []

if "build.variant" in board:
    variants_dir = join(
        "$PROJECT_DIR", board.get("build.variants_dir")) if board.get(
            "build.variants_dir", "") else join(FRAMEWORK_DIR, "variants")

    env.Append(CPPPATH=[join(variants_dir, board.get("build.variant"))])
    env.BuildSources(join("$BUILD_DIR", "FrameworkArduinoVariant"),
                     join(variants_dir, board.get("build.variant")))

env.BuildSources(join("$BUILD_DIR", "FrameworkArduino"),
                 join(FRAMEWORK_DIR, "cores", build_core))

env.Prepend(LIBS=libs)