diff options
| author | Alex Evans <715855+mmalex@users.noreply.github.com> | 2023-07-25 20:56:28 +0100 |
|---|---|---|
| committer | Alex Evans <715855+mmalex@users.noreply.github.com> | 2023-07-25 20:56:28 +0100 |
| commit | 46a14bb12136bba0b98423edd41b4139fe806325 (patch) | |
| tree | bc96623a04a5c132168ea37cf10f1ba3756e94e1 /uf2conv.py | |
| parent | 049da6bcbc4ce97169308f78684f9339fc4b7ac2 (diff) | |
| download | plinky-46a14bb12136bba0b98423edd41b4139fe806325.tar.gz | |
fix build process to use binmaker.py that calls uf2conv and also commit a built version...
Diffstat (limited to 'uf2conv.py')
| -rwxr-xr-x | uf2conv.py | 58 |
1 files changed, 31 insertions, 27 deletions
@@ -235,34 +235,8 @@ def write_file(name, buf): f.write(buf) print("Wrote %d bytes to %s" % (len(buf), name)) - -def main(): +def uf2conv(args): global appstartaddr, familyid - def error(msg): - print(msg) - sys.exit(1) - parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.') - parser.add_argument('input', metavar='INPUT', type=str, nargs='?', - help='input file (HEX, BIN or UF2)') - parser.add_argument('-b' , '--base', dest='base', type=str, - default="0x2000", - help='set base address of application for BIN format (default: 0x2000)') - parser.add_argument('-o' , '--output', metavar="FILE", dest='output', type=str, - help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible') - parser.add_argument('-d' , '--device', dest="device_path", - help='select a device path to flash') - parser.add_argument('-l' , '--list', action='store_true', - help='list connected devices') - parser.add_argument('-c' , '--convert', action='store_true', - help='do not flash, just convert') - parser.add_argument('-D' , '--deploy', action='store_true', - help='just flash, do not convert') - parser.add_argument('-f' , '--family', dest='family', type=str, - default="0x0", - help='specify familyID - number or name (default: 0x0)') - parser.add_argument('-C' , '--carray', action='store_true', - help='convert binary file to a C array, not UF2') - args = parser.parse_args() appstartaddr = int(args.base, 0) if args.family.upper() in families: @@ -313,5 +287,35 @@ def main(): write_file(d + "/NEW.UF2", outbuf) + +def main(): + global appstartaddr, familyid + def error(msg): + print(msg) + sys.exit(1) + parser = argparse.ArgumentParser(description='Convert to UF2 or flash directly.') + parser.add_argument('input', metavar='INPUT', type=str, nargs='?', + help='input file (HEX, BIN or UF2)') + parser.add_argument('-b' , '--base', dest='base', type=str, + default="0x2000", + help='set base address of application for BIN format (default: 0x2000)') + parser.add_argument('-o' , '--output', metavar="FILE", dest='output', type=str, + help='write output to named file; defaults to "flash.uf2" or "flash.bin" where sensible') + parser.add_argument('-d' , '--device', dest="device_path", + help='select a device path to flash') + parser.add_argument('-l' , '--list', action='store_true', + help='list connected devices') + parser.add_argument('-c' , '--convert', action='store_true', + help='do not flash, just convert') + parser.add_argument('-D' , '--deploy', action='store_true', + help='just flash, do not convert') + parser.add_argument('-f' , '--family', dest='family', type=str, + default="0x0", + help='specify familyID - number or name (default: 0x0)') + parser.add_argument('-C' , '--carray', action='store_true', + help='convert binary file to a C array, not UF2') + args = parser.parse_args() + uf2conv(args) + if __name__ == "__main__": main() |
