Beispiel #1
0
def execute_test(target, ppath, args, arg_string):
    utils.push_dir(os.path.split(target)[0])
    reldir = target.replace(ppath, '')[1:]
    exe = os.path.basename(target)
    cmd = ".{}{} {}".format(os.path.sep, exe, arg_string)
    for n in range(int(args['--loop'])):
        print("= EXECUTING (#{}): {} {}".format(n + 1, reldir, arg_string))
        result = utils.run_shell2(
            cmd, args['-v'], "** ERROR: Test failed (#{} {} {} )**".format(
                n + 1, reldir, arg_string))
    utils.pop_dir
Beispiel #2
0
    def link(self, arguments, inf, local_external_setting, variant):
        # Run the linker
        base.ToolChain.link(self, arguments, inf, local_external_setting,
                            variant)

        # switch to the build variant output directory
        vardir = '_' + self._bld
        utils.push_dir(vardir)

        # Output Banner message
        self._printer.output("= Creating EEPROM (eep) file ...")

        # construct objcopy command
        options = '-O ihex -j .eeprom --set-section-flags=.eeprom=alloc,load --no-change-warnings --change-section-lma .eeprom=0'
        objcpy = '{} {} {} {}'.format(self._objcpy, options,
                                      self._final_output_name + '.elf',
                                      self._final_output_name + '.eep')

        # Generate the .HEX file
        if (arguments['-v']):
            self._printer.output(objcpy)
        if (utils.run_shell(self._printer, objcpy)):
            self._printer.output("=")
            self._printer.output(
                "= Build Failed: Failed to create .EEP file from the .ELF")
            self._printer.output("=")
            sys.exit(1)

        # Output Banner message
        self._printer.output("= Creating HEX file ...")

        # construct objcopy command
        options = '-O ihex -R .eeprom'
        objcpy = '{} {} {} {}'.format(self._objcpy, options,
                                      self._final_output_name + '.elf',
                                      self._final_output_name + '.hex')

        # Generate the .HEX file
        if (arguments['-v']):
            self._printer.output(objcpy)
        if (utils.run_shell(self._printer, objcpy)):
            self._printer.output("=")
            self._printer.output(
                "= Build Failed: Failed to create .HEX file from the .ELF")
            self._printer.output("=")
            sys.exit(1)

        # Return to project dir
        utils.pop_dir()
    def link(self, arguments, inf, local_external_setting, variant):
        # Run the linker
        base.ToolChain.link(self, arguments, inf, local_external_setting,
                            variant)

        # switch to the build variant output directory
        vardir = '_' + self._bld
        utils.push_dir(vardir)

        # Output Banner message
        self._printer.output("= Creating HEX file ...")

        # construct objcopy command
        options = '-O ihex '
        objcpy = '{} {} {} {}'.format(self._objcpy, options,
                                      self._final_output_name + '.elf',
                                      self._final_output_name + '.hex')

        # Generate the .HEX file
        if (arguments['-v']):
            self._printer.output(objcpy)
        if (utils.run_shell(self._printer, objcpy)):
            self._printer.output("=")
            self._printer.output(
                "= Build Failed: Failed to create .HEX file from the .ELF")
            self._printer.output("=")
            sys.exit(1)

        # Output Banner message
        self._printer.output("= Creating the download (.ZIP) file ...")

        # construct zip command
        options = 'dfu genpkg --dev-type 0x0052 --application'
        nrfutil = '{} {} {} {}'.format(self._nrfutil, options,
                                       self._final_output_name + '.hex',
                                       self._final_output_name + '.zip')

        # Generate the download file (aka the ZIP file)
        if (arguments['-v']):
            self._printer.output(nrfutil)
        if (utils.run_shell(self._printer, nrfutil)):
            self._printer.output("=")
            self._printer.output(
                "= Build Failed: Failed to create .ZIP file from the .HEX")
            self._printer.output("=")
            sys.exit(1)

        # Return to project dir
        utils.pop_dir()
Beispiel #4
0
def _build_project(full_path_of_build_script, verbose, bldopts, config,
                   xconfig, pkgroot):
    # reconcile config options
    cfg = None
    if (config):
        cfg = os.path.join(pkgroot, config)
    elif (xconfig):
        cfg = xconfig

    # Build the project
    utils.push_dir(os.path.dirname(full_path_of_build_script))
    cmd = full_path_of_build_script + ' ' + " ".join(bldopts)
    print("BUILDING: " + cmd)
    if (config):
        cmd = utils.concatenate_commands(cfg, cmd)
    utils.run_shell2(cmd, verbose, f"ERROR: Build failure ({cmd})")
    utils.pop_dir()
Beispiel #5
0
    def link(self, arguments, inf, local_external_setting, variant):
        # Run the linker
        base.ToolChain.link(self, arguments, inf, local_external_setting,
                            variant)

        # switch to the build variant output directory
        vardir = '_' + self._bld
        utils.push_dir(vardir)

        # Output Banner message
        self._printer.output("= Creating BIN file ...")

        # construct objcopy command
        options = '-O binary '
        objcpy = '{} {} {} {}'.format(self._objcpy, options,
                                      self._final_output_name + '.elf',
                                      self._final_output_name + '.bin')

        # Generate the .HEX file
        if (arguments['-v']):
            self._printer.output(objcpy)
        if (utils.run_shell(self._printer, objcpy)):
            self._printer.output("=")
            self._printer.output(
                "= Build Failed: Failed to create .BIN file from the .ELF")
            self._printer.output("=")
            sys.exit(1)

        # Output Banner message
        self._printer.output("= Running Print Size...")

        # construct zip command
        options = '--format=berkeley'
        printsz = '{} {} {}'.format(self._printsz, options,
                                    self._final_output_name + '.elf')

        # Run the 'size' command
        if (arguments['-v']):
            self._printer.output(printsz)
        utils.run_shell(self._printer, printsz)

        # Return to project dir
        utils.pop_dir()
Beispiel #6
0
    # Set quite & verbose modes
    utils.set_verbose_mode(args['-v'])

    # Default the projects/ dir path to the current working directory
    ppath = os.getcwd()

    # Project dir path is explicit set
    if (args['--path']):
        ppath = args['--path']

    # Set which build engine to use
    build_script = args['-x']

    # Get superset of projects to build
    utils.push_dir(ppath)
    utils.set_pkg_and_wrkspace_roots(ppath)
    pkgroot = NQBP_PKG_ROOT()
    all_prjs = utils.walk_file_list(build_script, ppath)

    # Get project list from a file
    if (args['--file']):
        try:
            inf = open(args['--file'], 'r')

            # process all entries in the file
            for line in inf:

                # drop comments and blank lines
                line = line.strip()
                if (line.startswith('#')):