summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAlex Evans <715855+mmalex@users.noreply.github.com>2023-07-25 20:56:28 +0100
committerAlex Evans <715855+mmalex@users.noreply.github.com>2023-07-25 20:56:28 +0100
commit46a14bb12136bba0b98423edd41b4139fe806325 (patch)
treebc96623a04a5c132168ea37cf10f1ba3756e94e1
parent049da6bcbc4ce97169308f78684f9339fc4b7ac2 (diff)
downloadplinky-46a14bb12136bba0b98423edd41b4139fe806325.tar.gz
fix build process to use binmaker.py that calls uf2conv and also commit a built version...
-rw-r--r--.gitignore3
-rw-r--r--binmaker.py13
-rw-r--r--plink09z.binbin0 -> 1048576 bytes
-rw-r--r--plink09z.uf2bin0 -> 873472 bytes
-rwxr-xr-xuf2conv.py58
5 files changed, 46 insertions, 28 deletions
diff --git a/.gitignore b/.gitignore
index 8bef224..c0e1dab 100644
--- a/.gitignore
+++ b/.gitignore
@@ -7,4 +7,5 @@ hw/WIP_inputfix/fp-info-cache
bootloader/Release
sw/Release
bootloader/Debug
-sw/Debug \ No newline at end of file
+sw/Debug
+__pycache__/ \ No newline at end of file
diff --git a/binmaker.py b/binmaker.py
index 4e3b6e2..ee98fa9 100644
--- a/binmaker.py
+++ b/binmaker.py
@@ -35,6 +35,19 @@ def main():
except IOError as e:
print(f"Failed to write file: {e}")
exit(2)
+ fname = f"plink{ver1}{ver2}{ver3}.uf2"
+ print(f'outputting {fname}...')
+ # python ../../uf2conv.py -o ${ProjName}.uf2 -c -f STM32L4 ${ProjName}.hex
+ class DotAccessibleObject:
+ def __getattr__(self, key): return False
+ uf2args = DotAccessibleObject()
+ uf2args.output=fname
+ uf2args.convert=True
+ uf2args.family='STM32L4'
+ uf2args.input='sw/Release/plinkyblack.hex'
+ uf2args.base='0x2000'
+ import uf2conv
+ uf2conv.uf2conv(uf2args)
if __name__ == "__main__":
diff --git a/plink09z.bin b/plink09z.bin
new file mode 100644
index 0000000..5a76076
--- /dev/null
+++ b/plink09z.bin
Binary files differ
diff --git a/plink09z.uf2 b/plink09z.uf2
new file mode 100644
index 0000000..d84cfc2
--- /dev/null
+++ b/plink09z.uf2
Binary files differ
diff --git a/uf2conv.py b/uf2conv.py
index 45258aa..6378813 100755
--- a/uf2conv.py
+++ b/uf2conv.py
@@ -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()