pedal usbflash works

This commit is contained in:
George Hotz 2018-03-09 17:47:13 -08:00
parent 585d0f9e6a
commit f7a0ab09bf
2 changed files with 10 additions and 4 deletions

View File

@ -18,7 +18,11 @@ DFU_UTIL = "dfu-util"
CERT = ../../certs/debug
CFLAGS += "-DALLOW_DEBUG"
all: obj/bootstub.bin obj/$(PROJ_NAME).bin
usbflash: obj/$(PROJ_NAME).bin
../../tests/pedal/enter_canloader.py
PYTHONPATH=../../ python -c "from python import Panda; p = Panda(); assert(p.bootstub); p.flash('obj/$(PROJ_NAME).bin', reconnect=False)"
recover: obj/bootstub.bin obj/$(PROJ_NAME).bin
$(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08004000 -D obj/$(PROJ_NAME).bin
$(DFU_UTIL) -d 0483:df11 -a 0 -s 0x08000000:leave -D obj/bootstub.bin

View File

@ -170,7 +170,7 @@ class Panda(object):
assert(self._handle != None)
print("connected")
def reset(self, enter_bootstub=False, enter_bootloader=False):
def reset(self, enter_bootstub=False, enter_bootloader=False, reconnect=True):
# reset
try:
if enter_bootloader:
@ -184,6 +184,8 @@ class Panda(object):
pass
if not enter_bootloader:
self.close()
if reconnect == False:
return
time.sleep(1.0)
success = False
# wait up to 15 seconds
@ -203,7 +205,7 @@ class Panda(object):
if not success:
raise Exception("reset failed")
def flash(self, fn=None, code=None):
def flash(self, fn=None, code=None, reconnect=True):
if not self.bootstub:
self.reset(enter_bootstub=True)
assert(self.bootstub)
@ -247,7 +249,7 @@ class Panda(object):
# reset
print("flash: resetting")
self.reset()
self.reset(reconnect=reconnect)
def recover(self):
self.reset(enter_bootloader=True)