canfestival/canfestival.py
changeset 976 0ba3d9cd61e8
parent 974 0d32a8748814
child 1003 de812e258213
equal deleted inserted replaced
975:8d99a1f819cb 976:0ba3d9cd61e8
   398                     if child["name"] == "CAN_Driver":
   398                     if child["name"] == "CAN_Driver":
   399                         child["type"] = local_canfestival_config.DLL_LIST
   399                         child["type"] = local_canfestival_config.DLL_LIST
   400         return infos
   400         return infos
   401     
   401     
   402     def GetCanDriver(self):
   402     def GetCanDriver(self):
   403         can_driver = self.CanFestivalInstance.getCAN_Driver()
   403         res = self.CanFestivalInstance.getCAN_Driver()
   404         if not can_driver :
   404         if not res :
   405             can_driver = local_canfestival_config.DLL_LIST[0]
   405             return ""
   406         can_drv_ext = self.GetCTRoot().GetBuilder().extension
   406         return res
   407         return "libcanfestival_" + can_driver + can_drv_ext
       
   408         
   407         
   409     def CTNGenerate_C(self, buildpath, locations):
   408     def CTNGenerate_C(self, buildpath, locations):
   410         can_driver_name = self.GetCanDriver()
   409         can_driver = self.GetCanDriver()
       
   410         if can_driver is not None:
       
   411             can_drivers = local_canfestival_config.DLL_LIST
       
   412             if can_driver not in can_drivers :
       
   413                 can_driver = can_drivers[0]
       
   414             can_drv_ext = self.GetCTRoot().GetBuilder().extension
       
   415             can_driver_name = "libcanfestival_" + can_driver + can_drv_ext
       
   416         else:
       
   417             can_driver_name = ""
       
   418 
   411         
   419         
   412         format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())),
   420         format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())),
   413                        "candriver" : can_driver_name,
   421                        "candriver" : can_driver_name,
   414                        "nodes_includes" : "",
   422                        "nodes_includes" : "",
   415                        "board_decls" : "",
   423                        "board_decls" : "",
   502         f.write(cf_main)
   510         f.write(cf_main)
   503         f.close()
   511         f.close()
   504 
   512 
   505         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
   513         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
   506         
   514         
   507         if can_driver_name:
   515         if can_driver is not None:
   508             can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
   516             can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
   509             if os.path.exists(can_driver_path):
   517             if os.path.exists(can_driver_path):
   510                 res += ((can_driver_name, file(can_driver_path,"rb")),)
   518                 res += ((can_driver_name, file(can_driver_path,"rb")),)
   511 
   519 
   512         return res
   520         return res