def createTarget(device): # Build path to target directory and config file. if device == uidef.kMcuDevice_iMXRT102x: cpu = "MIMXRT1021" elif device == uidef.kMcuDevice_iMXRT105x: cpu = "MIMXRT1052" elif device == uidef.kMcuDevice_iMXRT106x: cpu = "MIMXRT1062" else: pass targetBaseDir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'targets', cpu) targetConfigFile = os.path.join(targetBaseDir, 'bltargetconfig.py') # Check for existing target directory. if not os.path.isdir(targetBaseDir): raise ValueError("Missing target directory at path %s" % targetBaseDir) # Check for config file existence. if not os.path.isfile(targetConfigFile): raise RuntimeError("Missing target config file at path %s" % targetConfigFile) # Build locals dict by copying our locals and adjusting file path and name. targetConfig = locals().copy() targetConfig['__file__'] = targetConfigFile targetConfig['__name__'] = 'bltargetconfig' # Execute the target config script. execfile(targetConfigFile, globals(), targetConfig) # Create the target object. tgt = target.Target(**targetConfig) return tgt
def createTarget(device, exeBinRoot): cpu = "MIMXRT1052" if device == uidef.kMcuDevice_iMXRT500: cpu = "MIMXRT595" elif device == uidef.kMcuDevice_iMXRT600: cpu = "MIMXRT685" elif device == uidef.kMcuDevice_iMXRT1011: cpu = "MIMXRT1011" elif device == uidef.kMcuDevice_iMXRT1015: cpu = "MIMXRT1015" elif device == uidef.kMcuDevice_iMXRT102x: cpu = "MIMXRT1021" elif device == uidef.kMcuDevice_iMXRT1024: cpu = "MIMXRT1024" elif device == uidef.kMcuDevice_iMXRT105x: cpu = "MIMXRT1052" elif device == uidef.kMcuDevice_iMXRT106x: cpu = "MIMXRT1062" elif device == uidef.kMcuDevice_iMXRT1064: cpu = "MIMXRT1064" elif device == uidef.kMcuDevice_iMXRT117x: cpu = "MIMXRT1176" elif device in uidef.kMcuDevice_Niobe4minis: cpu = "LPC55S16" elif device in uidef.kMcuDevice_Niobe4s: cpu = "LPC55S69" elif device in uidef.kMcuDevice_Kinetis: cpu = "MKxx" else: pass targetBaseDir = os.path.join(os.path.dirname(os.path.dirname(__file__)), 'targets', cpu) # Check for existing target directory. if not os.path.isdir(targetBaseDir): targetBaseDir = os.path.join(os.path.dirname(exeBinRoot), 'src', 'targets', cpu) if not os.path.isdir(targetBaseDir): raise ValueError("Missing target directory at path %s" % targetBaseDir) targetConfigFile = os.path.join(targetBaseDir, 'bltargetconfig.py') # Check for config file existence. if not os.path.isfile(targetConfigFile): raise RuntimeError("Missing target config file at path %s" % targetConfigFile) # Build locals dict by copying our locals and adjusting file path and name. targetConfig = locals().copy() targetConfig['__file__'] = targetConfigFile targetConfig['__name__'] = 'bltargetconfig' # Execute the target config script. execfile(targetConfigFile, globals(), targetConfig) # Create the target object. tgt = target.Target(**targetConfig) return tgt, targetBaseDir