Replaced build script with Makefile and removed upload script as it is now in tools
This commit is contained in:
parent
a56fba1fef
commit
21024c642b
16
Makefile
Normal file
16
Makefile
Normal file
|
@ -0,0 +1,16 @@
|
|||
BUILDDIR=.build
|
||||
_BIN= fib.bin
|
||||
BIN = $(patsubst %,$(BUILDDIR)/%,$(_BIN))
|
||||
|
||||
$(BUILDDIR)/%.bin: src/%.z80
|
||||
@zasm -w -i $< -o $@
|
||||
|
||||
$(BUILDDIR):
|
||||
@mkdir $(BUILDDIR)
|
||||
|
||||
all: $(BUILDDIR) $(BIN)
|
||||
|
||||
.PHONE: clean
|
||||
|
||||
clean:
|
||||
@rm -df $(BUILDDIR)/*.bin $(BUILDDIR)/*.lst .build
|
3
build.sh
3
build.sh
|
@ -1,3 +0,0 @@
|
|||
#!/bin/bash
|
||||
mkdir -p .build && zasm -i src/fib.z80 -o .build/fib.bin
|
||||
ls -al .build/fib.bin
|
47
upload.py
47
upload.py
|
@ -1,47 +0,0 @@
|
|||
#!/usr/bin/env python3
|
||||
import serial
|
||||
import os
|
||||
import sys
|
||||
import time
|
||||
|
||||
def progressbar(it, prefix="", size=60, file=sys.stdout):
|
||||
count = len(it)
|
||||
def show(j):
|
||||
x = int(size*j/count)
|
||||
file.write("%s[%s%s] %i/%i\r" % (prefix, "#"*x, "."*(size-x), j, count))
|
||||
file.flush()
|
||||
show(0)
|
||||
for i, item in enumerate(it):
|
||||
yield item
|
||||
show(i+1)
|
||||
file.write("\n")
|
||||
file.flush()
|
||||
|
||||
def main():
|
||||
if len(sys.argv) == 2:
|
||||
# ser = serial.Serial("COM3", timeout=1, write_timeout=1)
|
||||
ser = serial.Serial("/dev/ttyUSB0", timeout=1, write_timeout=1, baudrate=115200)
|
||||
if ser.is_open:
|
||||
path = sys.argv[1]
|
||||
size = os.path.getsize(path)
|
||||
|
||||
with open(path, "rb") as f:
|
||||
for i in progressbar(range(size), "Upload: ", 40):
|
||||
byte = f.read(1)
|
||||
ser.write(byte)
|
||||
|
||||
if byte == b'#':
|
||||
ser.write(b'#\n')
|
||||
|
||||
time.sleep(0.002)
|
||||
|
||||
print(ser.readline())
|
||||
ser.close()
|
||||
|
||||
else:
|
||||
print("Failed to open serial port")
|
||||
else:
|
||||
print("Please provide file to upload")
|
||||
|
||||
if "__main__":
|
||||
main()
|
Reference in New Issue
Block a user