示例#1
0
def filename(ids):
    p = {}
    for k in ids.keys():
        v = ids.getAttribute(k)
        if len(v) > 0:
            p[k] = "_".join(v)
    fmt = "stm32{family}-{name}"
    index = DeviceMerger._get_index_for_id(stm_groups, ids[0])
    if index == -1 or "size" in stm_groups[index].keys():
        fmt += "-{size}"
    if index == -1 or "pin" in stm_groups[index].keys():
        fmt += "-{pin}"
    return fmt.format(**p)
示例#2
0
 def filename(ids):
     p = {}
     for k in ids.keys():
         v = []
         for b in ids.getAttribute(k):
             if b == "": b = 'n'
             v.append(b)
         if k in ['type', 'pin']: v.sort()
         if len(v) > 0:
             p[k] = "_".join(v)
     fmt = "at{family}"
     index = DeviceMerger._get_index_for_id(avr_groups, ids[0])
     if index == -1:
         fmt += "-{name}-{type}"
     else:
         keys = avr_groups[index].keys()
         if 'name' in keys:
             fmt += "-{name}"
         if 'type' in keys:
             fmt += "-{type}"
         if 'pin' in keys:
             fmt += "-{pin}"
     return fmt.format(**p)
示例#3
0
    devices = {}
    for dev in devs:
        ld_path = os.path.join(os.path.dirname(__file__), 'raw-device-data',
                               'nrf-devices', 'nrf', (dev.lower() + '_*.ld'))
        files = glob.glob(ld_path)
        for filename in files:
            device = NRFDeviceTree.from_file(filename)
            if device is None: continue
            devices[device.ids.string] = device
            if device_depth > 0:
                device_depth -= 1
            else:
                exit(1)

    mergedDevices = DeviceMerger.merge(nrf_groups,
                                       [d.copy() for d in devices.values()])

    def filename(ids):
        p = {}
        for k in ids.keys():
            v = []
            for b in ids.getAttribute(k):
                if b == "": b = 'n'
                v.append(b)
            if k in ['type', 'pin']: v.sort()
            if len(v) > 0:
                p[k] = "_".join(v)
        fmt = "{platform}{family}{series}"
        return fmt.format(**p)

    folder = os.path.join(os.path.dirname(__file__), '..', '..', 'devices',
示例#4
0
    devs = []

    for arg in sys.argv[1:]:
        if arg.startswith('--log='):
            loglevel = arg.replace('--log=', '')
            continue
        devs.append(arg)

    dfg.logger.configure_logger(loglevel)

    for dev in devs:
        xml_path = os.path.join(os.path.dirname(__file__), '..', '..', '..',
                                'AVR_devices', (dev + '*'))
        files = glob.glob(xml_path)
        for file in files:
            # deal with this here, rather than rewrite half the name merging
            if os.path.basename(file) != "ATtiny28.xml":
                part = AVRDeviceReader(file)
                device = Device(part)
                devices.append(device)

    merger = DeviceMerger(devices)
    merger.mergedByPlatform('avr')

    folder = os.path.join(os.path.dirname(__file__), '..', '..', 'devices',
                          'avr')

    for dev in merger.mergedDevices:
        writer = AVRDeviceWriter(dev)
        writer.write(folder)
示例#5
0
            filtered_device = fam
            filtered_family = fam[:7]
        else:
            LOGGER.error(
                "Invalid family! Valid input is '{}', found '{}'".format(
                    ", ".join(supported_families), fam))
            exit(1)

    if filtered_device is None:
        LOGGER.error("Please provide a device family: '{}'".format(
            ", ".join(supported_families)))
        exit(1)

    devicesFromFamily = STMDeviceReader.getDevicesFromFamily(filtered_family)

    for deviceName in [
            d for d in devicesFromFamily if d.startswith(filtered_device)
    ]:
        device = STMDeviceReader(deviceName)
        devices.append(Device(device))

    merger = DeviceMerger(devices)
    merger.mergedByPlatform('stm32')

    folder = os.path.join(os.path.dirname(__file__), '..', '..', 'devices',
                          'stm32')

    for dev in merger.mergedDevices:
        writer = STMDeviceWriter(dev)
        writer.write(folder)