@@ -353,7 +353,74 @@ def wifi41DFwDownload(self):
353353 pass
354354
355355 def EigenFwDownload (self ):
356- pass
356+ tmp_path = tempfile .mkdtemp ()
357+ logger .info ("tmp_path: " , tmp_path )
358+ fdir1 = str (self .fw_filepath .parent )
359+ shutil .copytree (fdir1 , str (Path (tmp_path ) / "fw" ))
360+ shutil .copytree (str (EXES_PATH / "Eigen" ), str (tmp_path / "Eigen" ))
361+
362+ try :
363+ config = configparser .ConfigParser (interpolation = None )
364+ logger .info ('quec_download_config.ini path: {}' .format (str (Path (tmp_path ) / "fw/quec_download_config.ini" )))
365+ config .read (str (Path (tmp_path ) / "fw/quec_download_config.ini" ))
366+ File_Count = int (config .get ('File' , 'File_Count' ))
367+ ql .set_value ("File_Count" , File_Count )
368+
369+ ap_application_addr = config .get ('File_1' , 'START_ADDR' )
370+ ap_application_max = config .get ('File_1' , 'MAX_SIZE' )
371+ ql .set_value ("flexfile2" , ap_application_addr + " " + ap_application_max )
372+
373+ ap_updater_addr = config .get ('File_2' , 'START_ADDR' )
374+ ap_updater_max = config .get ('File_2' , 'MAX_SIZE' )
375+ ql .set_value ("flexfile3" , ap_updater_addr + " " + ap_updater_max )
376+
377+ customer_fs_addr = config .get ('File_3' , 'START_ADDR' )
378+ customer_fs_max = config .get ('File_3' , 'MAX_SIZE' )
379+ ql .set_value ("flexfile4" , customer_fs_addr + " " + customer_fs_max )
380+
381+ if File_Count == 4 :
382+ customer_backup_fs_addr = config .get ('File_4' , 'START_ADDR' )
383+ customer_backup_fs_max = config .get ('File_4' , 'MAX_SIZE' )
384+
385+ binpkg_config = configparser .ConfigParser (interpolation = None )
386+ binpkg_config_ini = str (Path (tmp_path ) / "Eigen/config.ini" )
387+ binpkg_config .read (binpkg_config_ini )
388+
389+ binpkg_config .set ('package_info' , 'arg_pkg_path_val' , str (Path (tmp_path ) / "fw" / self .fw_filepath .name ))
390+
391+ binpkg_config .set ('bootloader' , 'blpath' , str (Path (tmp_path ) / "blloadskip = 0" ))
392+ binpkg_config .set ('system' , 'syspath' , str (Path (tmp_path ) / "sysloadskip = 0" ))
393+ binpkg_config .set ('cp_system' , 'cp_syspath' , str (Path (tmp_path ) / "cp_sysloadskip = 0" ))
394+
395+ binpkg_config .set ('flexfile2' , 'filepath' ,
396+ str (Path (tmp_path ) / "fw/ap_application.bin" ))
397+ binpkg_config .set ('flexfile2' , 'burnaddr' , ap_application_addr )
398+
399+ binpkg_config .set ('flexfile3' , 'filepath' , str (Path (tmp_path ) / "fw/ap_updater.bin" ))
400+ binpkg_config .set ('flexfile3' , 'burnaddr' , ap_updater_addr )
401+
402+ binpkg_config .set ('flexfile4' , 'filepath' , str (Path (tmp_path ) / "fw/customer_fs.bin" ))
403+ binpkg_config .set ('flexfile4' , 'burnaddr' , customer_fs_addr )
404+ if File_Count == 4 :
405+ binpkg_config .set ('flexfile5' , 'filepath' ,
406+ str (Path (tmp_path ) / "fw/customer_backup_fs.bin" ))
407+ binpkg_config .set ('flexfile5' , 'burnaddr' , customer_backup_fs_addr )
408+ else :
409+ binpkg_config .remove_section ('flexfile5' )
410+
411+ except Exception as e :
412+ raise Exception (tr ("please check if the firmware is ok." ))
413+
414+ binpkg_config = extra ['binpkg_config' ]
415+ binpkg_config_ini = extra ['binpkg_config_ini' ]
416+ binpkg_config .set ('config' , 'line_0_com' , self .com_info ['port' ])
417+ with open (binpkg_config_ini , "w+" , encoding = 'utf-8' ) as f :
418+ binpkg_config .write (f )
419+
420+ return self .fw_download (
421+ str (Path (tmp_path ) / "Eigen/flashtoolcli1.exe" ),
422+ str (Path (tmp_path ) / "fw" / self .fw_filepath .name )
423+ )
357424
358425 def fw_download (self , download_exe_path , fw_filepath ):
359426 logger .info ('enter FwDownloadHandler.fw_download method.' )
@@ -377,7 +444,8 @@ def fw_download(self, download_exe_path, fw_filepath):
377444 cmd = [download_exe_path , self .com_info ['port' ][3 :], '115200' , fw_filepath ]
378445 logger .info ('------------------BG95 download downloading factory package(mbn)------------------' )
379446 elif self .platform .upper () == "EIGEN" :
380- pass
447+ cmd = [download_name , '--cfgfile ' + self .binpkg_config_ini , '--port="%s"' % comport ]
448+ print ('------------------Eigen downloading upgrade package(binpkg): ------------------' )
381449 elif self .platform .upper () == "FCM360W" :
382450 cmd = [download_exe_path , '-p' , self .com_info ['port' ][3 :], '-b' , "921600" , '-file' , fw_filepath ]
383451 print ('------------------ FCM360W downloading factory package: ------------------' )
0 commit comments