def prepare(self): if self.tree.get('**/runner/boot_from_flash').get(): # Boot from flash, we need to generate the flash image # containing the application binary. # This will generate SLM files used by the RTL platform # to preload the flash. comps = [] fs = self.tree.get('**/fs') if fs is not None: comps = fs.get('files').get() if plp_flash_stimuli.genFlashImage( slmStim=self.tree.get('**/runner/flash_slm_file').get(), bootBinary=self.get_json().get('**/loader/binaries').get_elem(0).get(), comps=comps, verbose=self.tree.get('**/runner/verbose').get(), archi=self.tree.get('**/pulp_chip_family').get(), flashType=self.tree.get('**/runner/flash_type').get()): return -1 else: stim = runner.stim_utils.stim() for binary in self.get_json().get('**/loader/binaries').get_dict(): stim.add_binary(binary) stim.gen_stim_64('vectors/stim.txt') return 0
def prepare(self): comps = [] comps_conf = self.get_json().get('**/fs/files') if comps_conf is not None: comps = comps_conf.get_dict() if len(comps) != 0 is not None or ( self.get_json().get_child_bool('**/runner/boot_from_flash') and self.get_json().get_child_str('**/runner/boot-mode') == 'dev_hyper'): encrypted = self.get_json().get_child_str('**/efuse/encrypted') aes_key = self.get_json().get_child_str('**/efuse/aes_key') aes_iv = self.get_json().get_child_str('**/efuse/aes_iv') if plp_flash_stimuli.genFlashImage( raw_stim=self.get_flash_preload_file(), bootBinary=self.get_json().get( '**/runner/binaries').get_elem(0).get(), comps=comps, verbose=self.get_json().get('**/runner/verbose').get(), archi=self.get_json().get('**/pulp_chip_family').get(), flashType=self.get_json().get( '**/runner/flash_type').get(), encrypt=encrypted, aesKey=aes_key, aesIv=aes_iv): return -1 if self.flash(): return -1 return 0
def prepare(self): if self.args.debug_syms: for binary in self.get_json().get('**/runner/binaries').get_dict(): if os.system('pulp-pc-info --file %s --all-file %s' % (binary, binary + '.debugInfo')) != 0: raise Exception( 'Error while generating debug symbols information, make sure the toolchain and the binaries are accessible ' ) comps = [] comps_conf = self.get_json().get('**/flash/fs/files') if comps_conf is not None: comps = comps_conf.get_dict() if self.gen_rom_stimuli: stim = runner.stim_utils.stim( verbose=self.get_json().get_child_bool('**/runner/verbose')) stim.add_binary(self.boot_binary) stim.add_area(self.get_json().get_child_int('**/rom/base'), self.get_json().get_child_int('**/rom/size')) stim.gen_stim_bin('stimuli/rom.bin') if self.gen_flash_stimuli: encrypted = self.get_json().get_child_str('**/efuse/encrypted') aes_key = self.get_json().get_child_str('**/efuse/aes_key') aes_iv = self.get_json().get_child_str('**/efuse/aes_iv') binary = self.get_json().get('**/runner/binaries').get_dict() if len(binary) > 0: binary = binary[0] else: binary = None if plp_flash_stimuli.genFlashImage( raw_stim=self.get_flash_preload_file(), bootBinary=binary, comps=comps, verbose=self.get_json().get('**/runner/verbose').get(), archi=self.get_json().get('**/pulp_chip_family').get(), flashType=self.get_json().get( '**/runner/flash_type').get(), encrypt=encrypted, aesKey=aes_key, aesIv=aes_iv): return -1 if self.get_json().get('**/efuse') is not None: efuse = runner.stim_utils.Efuse( self.get_json(), verbose=self.get_json().get('**/runner/verbose').get()) efuse.gen_stim_txt('efuse_preload.data') return 0
def prepare(self): self.__check_env() if self.get_json().get('**/runner/boot_from_flash').get(): # Boot from flash, we need to generate the flash image # containing the application binary. # This will generate SLM files used by the RTL platform # to preload the flash. comps = [] fs = self.get_json().get('**/fs') if fs is not None: comps_conf = self.get_json().get('**/flash/fs/files') if comps_conf is not None: comps = comps_conf.get_dict() encrypted = self.get_json().get_child_str('**/efuse/encrypted') aes_key = self.get_json().get_child_str('**/efuse/aes_key') aes_iv = self.get_json().get_child_str('**/efuse/aes_iv') if plp_flash_stimuli.genFlashImage( slmStim=self.get_json().get('**/runner/flash_slm_file').get(), bootBinary=self.get_json().get('**/runner/binaries').get_elem(0).get(), comps=comps, verbose=self.get_json().get('**/runner/verbose').get(), archi=self.get_json().get('**/pulp_chip_family').get(), flashType=self.get_json().get('**/runner/flash_type').get(), encrypt=encrypted, aesKey=aes_key, aesIv=aes_iv): return -1 else: stim = runner.stim_utils.stim(verbose=self.get_json().get('**/runner/verbose').get()) for binary in self.get_json().get('**/runner/binaries').get_dict(): stim.add_binary(binary) stim.gen_stim_slm_64('vectors/stim.txt') if self.get_json().get('**/efuse') is not None: efuse = runner.stim_utils.Efuse(self.get_json(), verbose=self.get_json().get('**/runner/verbose').get()) efuse.gen_stim_txt('efuse_preload.data') return 0
def prepare(self): comps = [] comps_conf = self.get_json().get('**/fs/files') if comps_conf is not None: comps = comps_conf.get_dict() if comps_conf is not None or self.get_json().get_child_bool( '**/runner/boot_from_flash'): if plp_flash_stimuli.genFlashImage( raw_stim=self.get_flash_preload_file(), bootBinary=self.get_json().get( '**/loader/binaries').get_elem(0).get(), comps=comps, verbose=self.tree.get('**/runner/verbose').get(), archi=self.tree.get('**/pulp_chip_family').get(), flashType=self.tree.get('**/runner/flash_type').get()): return -1 return 0
def prepare(self): if not os.path.exists('stdout'): os.makedirs('stdout') os.environ['PULP_CORE'] = self.pulpCore binary = self.get_json().get('**/loader/binaries').get_elem(0).get() if binary != None: print('Generating stimuli for binary: ' + binary) try: os.makedirs('vectors') except: pass try: os.makedirs('slm_files') except: pass if self.pulpArchi.find('pulpino') != -1: slmScript = 's19toslm-pulpino.py' elif self.pulpArchi.find( 'mia' ) != -1: # or self.pulpArchi.find('vivosoc2') != -1: TODO this has been added because s19toslm.py is needed for boot from flash on the board but the other version is needed for slm stimuli slmScript = 's19toslm.py' elif self.pulpArchi.find('pulp3') != -1: slmScript = 's19toslm-pulp3.py' else: slmScript = 's19toslm-new.py' if execCmd("objcopy --srec-len 1 --output-target=srec %s %s.s19" % (binary, os.path.basename(binary))) != 0: return -1 if execCmd("parse_s19.pl %s.s19 > ./vectors/stim.txt" % (os.path.basename(binary))) != 0: return -1 if execCmd("cd slm_files && %s ../%s.s19 %s %s" % (slmScript, os.path.basename(binary), self.pulpArchi.replace('-riscv', ''), self.config.getOption('coreArchi'))) != 0: return -1 if self.config.getOption('bootBinary') != None: # If we boot from rom and a boot binary is specified, this means it comes from the SDK, and we have to generate the CDE file bootBinary = self.config.getOption('bootBinary') if execCmd( "objcopy --srec-len 1 --output-target=srec %s %s.s19" % (bootBinary, os.path.basename(bootBinary))) != 0: return -1 if execCmd("cd slm_files && s19toboot.py ../%s.s19 %s" % (os.path.basename(bootBinary), self.pulpArchi.replace('-riscv', ''))) != 0: return -1 try: os.remove('boot') except: pass try: os.makedirs('boot') except: pass if execCmd("cp slm_files/boot_code.cde boot") != 0: return -1 comps = [] fs = self.system_tree.get_config('fs') if fs is not None: comps = fs.get('files') if self.pulpArchi.find('gap') != -1: if self.system_tree.get('boot_from_rom'): flashType = 'spi' if self.config.getOption('hyper') or self.config.getOption( 'load') == 'hyper': flashType = 'hyper' if plp_flash_stimuli.genFlashImage( slmStim='slm_files/flash_stim.slm', bootBinary=binary, comps=comps, verbose=True, archi=self.pulpArchi, encrypt=self.config.getOption('encrypt'), aesKey=self.aesKey, aesIv=self.aesIv, flashType=flashType): return -1 else: if self.system_tree.get('boot_from_rom'): if plp_flash_stimuli.genFlashImage( slmStim='slm_files/flash_stim.slm', bootBinary=binary, comps=comps, verbose=True, archi=self.pulpArchi, encrypt=self.config.getOption('encrypt'), aesKey=self.aesKey, aesIv=self.aesIv, flashType='spi'): return -1 if self.config.getOption( 'load') == 'hyper' or self.config.getOption('hyper'): if plp_flash_stimuli.genFlashImage( slmStim='slm_files/hyper_flash_stim.slm', bootBinary=binary, comps=comps, verbose=True, archi=self.pulpArchi, encrypt=self.config.getOption('encrypt'), aesKey=self.aesKey, aesIv=self.aesIv, flashType='hyper'): return -1 if self.config.getOption('flash') != None: self.genFlashStimuli(self.config.getOption('flash')) if self.config.getOption('adc') != None: self.genAdcStimuli(self.config.getOption('adc')) return 0