Exemplo n.º 1
0
    def CreateBitWithSw(self, appBuildConfig: str, procName: str, outFile: str):
        """
        Create a bit file that contains the freshly built software. This command can only be used after the
        ImportProjects() command was called.

        :param appBuildConfig: Application configuration to use (usually "Debug" or "Release")
        :param procName: Name of the processor to use (e.g. soc_i/microblaze_0)
        :param outFile: Path of the output .bit file to write (relative to the HW project dir)
        """
        with TempWorkDir("/".join([self.workspace, self.hwName])):
            mmi = list(filter(lambda x: x.endswith(".mmi"), os.listdir()))[0]
            prefix = mmi.split(".")[0]
            mmi = os.path.abspath(os.curdir) + "/" + mmi
            bitin = os.path.abspath(os.curdir) + "/" + prefix + ".bit"
        appDir = "/".join([self.workspace, self.appName, appBuildConfig])
        with TempWorkDir(appDir):
            try:
                elfName = list(filter(lambda x: x.endswith(".elf"), os.listdir()))[0]
            except IndexError:
                raise Exception("No ELF file found in application directory " + appDir)
            elf = os.path.abspath(os.curdir) + "/" + elfName
        with TempWorkDir("/".join([self.workspace, self.hwName])):
            call = ExtAppCall(".",
                              "{} -meminfo {} -data {} -bit {} -proc {} -out {} -force".format(self._updatememCmd, mmi,
                                                                                        elf, bitin, procName,
                                                                                        outFile))
            call.run_sync()
            self._UpdateStdOut(call)
Exemplo n.º 2
0
 def _UpdateStdOut(self, call : ExtAppCall):
     self.stderr = call.get_stderr()
     self.stdout = call.get_stdout()
     self.allStdOut += self.stdout
     #Remove expected error messages
     stderr = self.stderr
     stderr = stderr.replace("Xlib:  extension \"RANDR\" missing on display \":1\".","").strip() #Expected error from xvfb
     if len(stderr) != 0:
         raise SdkStdErrNotEmpty("STDERR not empty:\n<includes expected errors!>\n" + self.stderr)
     if call.get_exit_code() != 0:
         raise SdkExitCodeNotZero("Command exited with code {}".format(call.get_exit_code()))
Exemplo n.º 3
0
 def _RunSdk(self, tclString : str, debug : bool = False):
     with TempWorkDir(self.workspace):
         with TempFile("__sdk.tcl") as f:
             #Write Temporary TCL
             f.write("setws .\n")    #Set workspace
             f.write(tclString)
             f.flush()
             if not debug:
                 call = ExtAppCall(".", "{}  __sdk.tcl".format(self._xsctCmd))
                 call.run_sync()
                 self._UpdateStdOut(call)
             else:
                 os.system("{}  __sdk.tcl".format(self._xsctCmd))
    def _RunVivado(self, workDir : str, args : str):
        #Windows
        if sys.platform.startswith("win"):
            vivadoCmd = "bin/vivado.bat"
        #Other OS not yet supported
        elif sys.platform.startswith("linux"):
            vivadoCmd = "bin/vivado"
        else:
            raise Exception("OS Not Supported")

        call = ExtAppCall(workDir, "{}/{} -mode batch {}".format(self._vivado_path, vivadoCmd, args))
        call.run_sync()
        self.stderr = call.get_stderr()
        self.stdout = call.get_stdout()
        if len(self.stderr) != 0:
            raise Exception("STDERR not empty\n" + self.stderr)
        if call.get_exit_code() != 0:
            raise Exception("Command exited with code {}".format(call.get_exit_code()))