Exemplo n.º 1
0
 def flash(action, ctx, args):
     """
     Run esptool to flash the entire project, from an argfile generated by the build system
     """
     ensure_build_directory(args, ctx.info_name)
     esp_port = args.port or _get_default_serial_port(args)
     run_target(action, args, {'ESPBAUD': str(args.baud),'ESPPORT': esp_port})
Exemplo n.º 2
0
    def build_target(target_name, ctx, args):
        """
        Execute the target build system to build target 'target_name'

        Calls ensure_build_directory() which will run cmake to generate a build
        directory (with the specified generator) as needed.
        """
        ensure_build_directory(args, ctx.info_name)
        run_target(target_name, args)
Exemplo n.º 3
0
    def flash(action, ctx, args):
        """
        Run esptool to flash the entire project, from an argfile generated by the build system
        """
        if args.port is None:
            args.port = _get_default_serial_port()

        run_target(action, args, {"ESPPORT": args.port,
                                  "ESPBAUD": str(args.baud)})
Exemplo n.º 4
0
    def build_target(target_name: str, ctx: Context, args: PropertyDict) -> None:
        """
        Execute the target build system to build target 'target_name'

        Calls ensure_build_directory() which will run cmake to generate a build
        directory (with the specified generator) as needed.
        """
        hints = not args.no_hints
        ensure_build_directory(args, ctx.info_name)
        run_target(target_name, args, force_progression=GENERATORS[args.generator].get('force_progression', False), hints=hints)
Exemplo n.º 5
0
    def dfu_flash_target(target_name, ctx, args, path):
        ensure_build_directory(args, ctx.info_name)

        try:
            run_target(target_name, args, {"ESP_DFU_PATH": path})
        except FatalError:
            # Cannot capture the error from dfu-util here so the best advise is:
            print('Please have a look at the "Device Firmware Upgrade through USB" chapter in API Guides of the '
                  'ESP-IDF documentation for solving common dfu-util issues.')
            raise
Exemplo n.º 6
0
    def flash(action, ctx, args):
        """
        Run esptool to flash the entire project, from an argfile generated by the build system
        """
        ensure_build_directory(args, ctx.info_name)
        project_desc = _get_project_desc(ctx, args)
        if project_desc['target'] == 'linux':
            yellow_print('skipping flash since running on linux...')
            return

        esp_port = args.port or _get_default_serial_port(args)
        run_target(action, args, {'ESPBAUD': str(args.baud), 'ESPPORT': esp_port})
Exemplo n.º 7
0
    def size_target(target_name, ctx, args):
        """
        Builds the app and then executes a size-related target passed in 'target_name'.
        `tool_error_handler` handler is used to suppress errors during the build,
        so size action can run even in case of overflow.

        """
        def tool_error_handler(e):
            pass

        ensure_build_directory(args, ctx.info_name)
        run_target('all', args, custom_error_handler=tool_error_handler)
        run_target(target_name, args)
Exemplo n.º 8
0
 def ota_targets(target_name, ctx, args):
     """
     Execute the target build system to build target 'target_name'.
     Additionally set global variables for baud and port.
     Calls ensure_build_directory() which will run cmake to generate a build
     directory (with the specified generator) as needed.
     """
     args.port = args.port or _get_default_serial_port(args)
     ensure_build_directory(args, ctx.info_name)
     run_target(target_name, args, {
         'ESPBAUD': str(args.baud),
         'ESPPORT': args.port
     })
Exemplo n.º 9
0
    def fallback_target(target_name, ctx, args):
        """
        Execute targets that are not explicitly known to idf.py
        """
        ensure_build_directory(args, ctx.info_name)

        try:
            subprocess.check_output(GENERATORS[args.generator]["dry_run"] + [target_name], cwd=args.build_dir)

        except Exception:
            raise FatalError(
                'command "%s" is not known to idf.py and is not a %s target' % (target_name, args.generator))

        run_target(target_name, args)
Exemplo n.º 10
0
    def size_target(target_name: str, ctx: Context, args: PropertyDict) -> None:
        """
        Builds the app and then executes a size-related target passed in 'target_name'.
        `tool_error_handler` handler is used to suppress errors during the build,
        so size action can run even in case of overflow.

        """

        def tool_error_handler(e: int, stdout: str, stderr: str) -> None:
            print_hints(stdout, stderr)

        hints = not args.no_hints
        ensure_build_directory(args, ctx.info_name)
        run_target('all', args, force_progression=GENERATORS[args.generator].get('force_progression', False),
                   custom_error_handler=tool_error_handler, hints=hints)
        run_target(target_name, args)
Exemplo n.º 11
0
    def fallback_target(target_name: str, ctx: Context, args: PropertyDict) -> None:
        """
        Execute targets that are not explicitly known to idf.py
        """
        ensure_build_directory(args, ctx.info_name)

        try:
            subprocess.check_output(GENERATORS[args.generator]['dry_run'] + [target_name], cwd=args.build_dir)

        except Exception:
            if target_name in ['clang-check', 'clang-html-report']:
                raise FatalError('command "{}" requires an additional plugin "pyclang". '
                                 'Please install it via "pip install --upgrade pyclang"'.format(target_name))

            raise FatalError(
                'command "%s" is not known to idf.py and is not a %s target' % (target_name, args.generator))

        run_target(target_name, args)
Exemplo n.º 12
0
 def dfu_target(target_name, ctx, args):
     ensure_build_directory(args, ctx.info_name)
     run_target(target_name, args)
Exemplo n.º 13
0
 def dfu_list_target(target_name: str, ctx: Context,
                     args: PropertyDict) -> None:
     ensure_build_directory(args, ctx.info_name)
     run_target(target_name, args)
Exemplo n.º 14
0
 def dfu_target(target_name: str, ctx: Context, args: PropertyDict,
                part_size: str) -> None:
     ensure_build_directory(args, ctx.info_name)
     run_target(target_name, args,
                {'ESP_DFU_PART_SIZE': part_size} if part_size else {})
Exemplo n.º 15
0
 def dfu_target(target_name, ctx, args, part_size):
     ensure_build_directory(args, ctx.info_name)
     run_target(target_name, args,
                {'ESP_DFU_PART_SIZE': part_size} if part_size else {})