示例#1
0
    lfuse = lfuse or hex(get_lfuse(target, f_cpu, oscillator, bod, eesave))
    hfuse = hfuse or hex(get_hfuse(target, uart, oscillator, bod, eesave))
    efuse = efuse or get_efuse(target, uart, bod)

fuses_cmd = [
    "avrdude", "-p", "$BOARD_MCU", "-C",
    '"%s"' % join(platform.get_package_dir("tool-avrdude"), "avrdude.conf"),
    "-c", "$UPLOAD_PROTOCOL", "$UPLOAD_FLAGS"
]

if not is_target_without_bootloader(target):
    fuses_cmd.append("-e")

fuses_cmd.extend([
    "-Ulock:w:%s:m" % lock,
    "-Uhfuse:w:%s:m" % hfuse,
    "-Ulfuse:w:%s:m" % lfuse
])

if efuse:
    efuse = efuse if isinstance(efuse, str) else hex(efuse)
    fuses_cmd.append("-Uefuse:w:%s:m" % efuse)

print("Selected fuses: [lfuse = %s, hfuse = %s%s]" %
      (lfuse, hfuse, ", efuse = %s" % efuse if efuse else ""))

fuses_action = env.VerboseAction(" ".join(fuses_cmd), "Setting fuses")

Return("fuses_action")
示例#2
0
    join("$PLATFORMFW_DIR", "variants", BOARD_OPTIONS['build.variant']))

env.Append(CPPDEFINES=[
    "ARDUINO=%d" % ARDUINO_VERSION,
    "ARDUINO_%s" % BOARD_OPTIONS['build.board']
] + ARDUINO_USBDEFINES,
           CPPPATH=[join("$BUILD_DIR", "core"),
                    join("$BUILD_DIR", "variant")])

if "BOARD_MCU" not in env:
    env.Replace(BOARD_MCU=BOARD_OPTIONS['build.mcu'])
if "BOARD_F_CPU" not in env:
    env.Replace(BOARD_F_CPU=BOARD_OPTIONS['build.f_cpu'])
if "UPLOAD_PROTOCOL" not in env:
    env.Replace(UPLOAD_PROTOCOL=BOARD_OPTIONS['upload.protocol'])
if "UPLOAD_SPEED" not in env:
    env.Replace(UPLOAD_SPEED=BOARD_OPTIONS['upload.speed'])

libs = []

#
# Target: Build Core Library
#

libs.append(
    env.BuildLibrary(
        join("$BUILD_DIR", "core"),
        join("$PLATFORMFW_DIR", "cores", BOARD_OPTIONS['build.core'])))

Return("libs")
示例#3
0
文件: bootloader.py 项目: OS-Q/P111
    BOOTUPLOADER="avrdude",
    BOOTUPLOADERFLAGS=[
        "-p",
        "$BOARD_MCU",
        "-C",
        '"%s"' % join(env.PioPlatform().get_package_dir("tool-avrdude") or "",
                      "avrdude.conf"),
    ],
    BOOTFLAGS=[
        '-Uflash:w:"%s":i' % bootloader_path,
        "-Ulock:w:%s:m" % lock_bits
    ],
    UPLOADBOOTCMD="$BOOTUPLOADER $BOOTUPLOADERFLAGS $UPLOAD_FLAGS $BOOTFLAGS",
)

if env.subst("$UPLOAD_PROTOCOL") != "custom":
    env.Append(BOOTUPLOADERFLAGS=["-c", "$UPLOAD_PROTOCOL"])
else:
    print(
        "Warning: The `custom` upload protocol is used! The upload and fuse flags may "
        "conflict!\nMore information: "
        "https://docs.platformio.org/en/latest/platforms/atmelavr.html"
        "#overriding-default-bootloader-command\n")

bootloader_actions = [
    fuses_action,
    env.VerboseAction("$UPLOADBOOTCMD", "Uploading bootloader"),
]

Return("bootloader_actions")
示例#4
0
        [
            join(ULP_BUILD_DIR, "ulp_main.ld"),
            join(ULP_BUILD_DIR, "ulp_main.h")
        ], symbol_file,
        ulp_env.VerboseAction(
            '"$PYTHONEXE" "%s" -s $SOURCE -o %s' % (gen_script, build_suffix),
            "Exporting ULP linker and header files"))


def create_static_lib(bin_file):
    return ulp_env.StaticLibrary(join(ULP_BUILD_DIR, "ulp_main"), [bin_file])


ulp_src_files = collect_src_files(join(ulp_env.subst("$PROJECT_DIR"), "ulp"))
objects = ulp_env.AsToObj(ulp_env.PreprocAs(ulp_src_files))
ulp_elf = ulp_env.BuildElf(join(ULP_BUILD_DIR, "ulp_main"), objects)
raw_ulp_binary = ulp_env.UlpElfToBin(ulp_elf)
ulp_bin = ulp_env.ConvertBin(raw_ulp_binary)
global_symbols = generate_global_symbols(ulp_elf)
export_files = generate_export_files(global_symbols)

ulp_lib = create_static_lib(ulp_bin)

ulp_env.Depends(ulp_lib, export_files)
ulp_env.Depends(ulp_elf, preprocess_ld_script())

# ULP sources must be built before the files in "src" folder
ulp_env.Requires(join("$BUILD_DIR", "${PROGNAME}.elf"), ulp_lib)

Return("ulp_lib")