Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update with new features #13

Open
wants to merge 9 commits into
base: master
Choose a base branch
from
8 changes: 7 additions & 1 deletion avrdude.py
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,8 @@ def __init__(self):
self.baudrate = ""
self.configFile = ""
self.autoEraseFlash = True
self.verify = True
self.verbose = 0

def upload(self, target, timeout = 15):
#assemble argument array
Expand All @@ -26,8 +28,12 @@ def upload(self, target, timeout = 15):
cmd.append("-b" + self.baudrate)
if self.configFile:
cmd.append("-C" + self.configFile)
if self.autoEraseFlash:
if self.autoEraseFlash is False:
cmd.append("-D")
if self.verify is False:
cmd.append("-V")
for i in range(self.verbose):
cmd.append("-v")
if target.bootloader:
cmd.append("-Uflash:w:" + target.bootloader + ":i")
if target.extFuse:
Expand Down
60 changes: 60 additions & 0 deletions configuration.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,60 @@
# Configuration file for Rambo-Uploader

# Path to avrdude
avrdude_path="C:/avrdude-5.11-w32-libusb/avrdude.exe"
# Type of ICSP programmer for Atmega32u2.
m32u2_icsp_programmer="jtag2isp"
# Type of ICSP programmer for Atmega2560
m2560_icsp_programmer="jtag2isp"
# Type of programming through serial
serial_programmer="wiring"
# Port (USB serial number) of ICSP Programmer connected to Atmega32u2
m32u2_icsp_port="usb:402671"
# Port (USB serial number) of ICSP Programmer connected to Atmega2560
m2560_icsp_port="usb:402903"
# Path to Atmega32u2 bootloader
m32u2_bootloader_path="C:/RAMBo/bootloaders/RAMBo-usbserial-DFU-combined-32u2.HEX"
# Path to Atmega2560 bootloader
m2560_bootloader_path="C:/RAMbo/bootloaders/stk500boot_v2_mega2560.hex"
# Serial port for Test Jig Controller. Set to None to use serial number
#controller_port="COM24"
controller_port=None
# Serial number for Test Jig controller
controller_snr="6403635343035130E0E0"
# Serial port for Device Under Test. Set to None to auto-detect
#target_port="COM25"
target_port=None
# List of RAMBo board serial numbers to ignore if auto-detecting target. Useful if you have printers connected to the same PC.
ignore_rambo_snr=("64033353730351A0D1C0", )
# Program the Atmega32u2 and Atmega2560 through ICSP (required if the fuses are not yet set or bootloader not flashed yet)
icsp_program=True
# Verify flash after ICSP programming
icsp_verify=True
# Delay before testing after we power on the power supply. Some power supply require a bit of time before they provide power.
powering_delay=1

# Path to the test firmware
test_firmware_path="C:/RAMBo/bootloaders/test_firmware.hex"
# Path to the final retail firmware
vendor_firmware_path="C:/RAMBo/bootloaders/vendor_firmware.hex"

# Database settings
database_type="log"

if database_type == "postgres":
from postgresdb import PostgresDatabase
import os

# Open our file outside of git repo which has database location, password, etc
dbfile = open( os.path.split(os.path.realpath(__file__))[0]+'/postgres_info.txt', 'r')
postgresInfo = dbfile.read()
dbfile.close()
database = PostgresDatabase(postgresInfo)
elif database_type == "log":
from logdb import LogDatabase

database = LogDatabase("results.log")
else:
from nodb import NoDatabase

database = NoDatabase()
29 changes: 29 additions & 0 deletions logdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import datetime

class LogDatabase():
def __init__(self, path):
self.path = path
self.fd = None

def open(self):
if self.fd is None:
self.fd = open(self.path, 'a')

def isOpen(self):
return self.fd is not None

def close(self):
if self.fd:
self.fd.close()
self.fd = None

def post(self, serial, results, version, details):
was_open = self.isOpen()
self.open()
self.fd.write("******************* %s ********************\n" %datetime.datetime.now())
self.fd.write("Serial number : %s\n" % (serial))
self.fd.write("Version : %s\n" % (version))
self.fd.write("%s\n%s\n\n" % (results, details))
self.fd.flush()
if not was_open:
self.close()
15 changes: 15 additions & 0 deletions nodb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,15 @@
class NoDatabase():
def __init__(self):
self.opened = False

def open(self):
self.opened = True

def isOpen(self):
return self.opened

def close(self):
self.opened = False

def post(self, serial, results, version, details):
pass
29 changes: 29 additions & 0 deletions postgresdb.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
import psycopg2

class PostgresDatabase():
def __init__(self, info):
self.info = info
self.storage = None

def open(self):
if not self.isOpen():
self.storage = psycopg2.connect(Self.info)
if self.storage is None:
raise Exception("Could not open database")

def isOpen(self):
return self.storage is not None

def close(self):
if self.storage:
self.storage.close()
self.storage = None

def post(self, serial, results, version, details):
was_open = self.isOpen()
self.open()
cursor = self.storage.cursor()
cursor.execute("""INSERT INTO testdata(serial, timestamp, testresults, testversion, testdetails) VALUES (%s, %s, %s, %s, %s)""", (serial, 'now', results, version, details))
self.storage.commit()
if not was_open:
self.close()
Loading