added tool to automatically flash a badge attached
This commit is contained in:
parent
f3b14ba4de
commit
8189a7687d
|
@ -0,0 +1,3 @@
|
|||
# rule for NXP LPC134X-Flash
|
||||
|
||||
SUBSYSTEM=="block", ATTRS{idVendor}=="04cc", ATTRS{idProduct}=="0003", SYMLINK+="lpcflash/%k", MODE="0666"
|
|
@ -0,0 +1,6 @@
|
|||
1. place the udev rules 42-nxp-flash.rules in /etc/udev/rules.d/ and restart udevd
|
||||
2. run tools/autoflash from the project directory
|
||||
3. attach badges to flash
|
||||
4. legen ... wait for it ... dary ;)
|
||||
5. if autoflash says "flashed", remove the badge
|
||||
|
|
@ -0,0 +1,37 @@
|
|||
#!/usr/bin/env python
|
||||
# -*- coding: utf8 -*-
|
||||
|
||||
import os
|
||||
import time
|
||||
|
||||
flashed = []
|
||||
|
||||
while True:
|
||||
filelist = []
|
||||
try:
|
||||
filelist = os.listdir("/dev/lpcflash")
|
||||
except:
|
||||
pass
|
||||
oldflashed = flashed
|
||||
flashed = []
|
||||
for x in oldflashed:
|
||||
if x in filelist:
|
||||
flashed.append(file)
|
||||
else:
|
||||
print "removed %s" % file
|
||||
filelist = [x for x in filelist if x not in flashed]
|
||||
for file in filelist:
|
||||
try:
|
||||
firmware = open("firmware.bin", "r")
|
||||
dev = open("/dev/lpcflash/%s" % file, "w")
|
||||
dev.seek(0x800)
|
||||
dev.write(firmware.read())
|
||||
firmware.close()
|
||||
dev.close()
|
||||
print "flashed %s" % file
|
||||
except Exception, ex:
|
||||
print "error!"
|
||||
print ex
|
||||
flashed.append(file)
|
||||
time.sleep(1)
|
||||
|
Loading…
Reference in New Issue