canfestival/canfestival.py
changeset 974 0d32a8748814
parent 960 d72a866cf9b0
child 976 0ba3d9cd61e8
equal deleted inserted replaced
973:211e78636b6b 974:0d32a8748814
   397                 for child in element["children"]:
   397                 for child in element["children"]:
   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 CTNGenerate_C(self, buildpath, locations):
   402     def GetCanDriver(self):
   403         can_driver = self.CanFestivalInstance.getCAN_Driver()
   403         can_driver = self.CanFestivalInstance.getCAN_Driver()
   404         if not can_driver :
   404         if not can_driver :
   405             can_driver = local_canfestival_config.DLL_LIST[0]
   405             can_driver = local_canfestival_config.DLL_LIST[0]
   406         can_drv_ext = self.GetCTRoot().GetBuilder().extension
   406         can_drv_ext = self.GetCTRoot().GetBuilder().extension
   407         can_driver_name = "libcanfestival_" + can_driver + can_drv_ext
   407         return "libcanfestival_" + can_driver + can_drv_ext
       
   408         
       
   409     def CTNGenerate_C(self, buildpath, locations):
       
   410         can_driver_name = self.GetCanDriver()
   408         
   411         
   409         format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())),
   412         format_dict = {"locstr" : "_".join(map(str,self.GetCurrentLocation())),
   410                        "candriver" : can_driver_name,
   413                        "candriver" : can_driver_name,
   411                        "nodes_includes" : "",
   414                        "nodes_includes" : "",
   412                        "board_decls" : "",
   415                        "board_decls" : "",
   498         f = open(cf_main_path,'w')
   501         f = open(cf_main_path,'w')
   499         f.write(cf_main)
   502         f.write(cf_main)
   500         f.close()
   503         f.close()
   501 
   504 
   502         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
   505         res = [(cf_main_path, local_canfestival_config.getCFLAGS(CanFestivalPath))],local_canfestival_config.getLDFLAGS(CanFestivalPath), True
   503 
   506         
   504         can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
   507         if can_driver_name:
   505         if os.path.exists(can_driver_path):
   508             can_driver_path = os.path.join(CanFestivalPath,"drivers",can_driver,can_driver_name)
   506             res += ((can_driver_name, file(can_driver_path,"rb")),)
   509             if os.path.exists(can_driver_path):
       
   510                 res += ((can_driver_name, file(can_driver_path,"rb")),)
   507 
   511 
   508         return res
   512         return res
   509 
   513