Skip to content

Commit

Permalink
pedal usbflash works
Browse files Browse the repository at this point in the history
  • Loading branch information
geohot committed Mar 10, 2018
1 parent 585d0f9 commit f7a0ab0
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 4 deletions.
6 changes: 5 additions & 1 deletion board/pedal/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -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

Expand Down
8 changes: 5 additions & 3 deletions python/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ def connect(self, claim=True, wait=False):
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:
Expand All @@ -184,6 +184,8 @@ def reset(self, enter_bootstub=False, enter_bootloader=False):
pass
if not enter_bootloader:
self.close()
if reconnect == False:
return
time.sleep(1.0)
success = False
# wait up to 15 seconds
Expand All @@ -203,7 +205,7 @@ def reset(self, enter_bootstub=False, enter_bootloader=False):
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)
Expand Down Expand Up @@ -247,7 +249,7 @@ def flash(self, fn=None, code=None):

# reset
print("flash: resetting")
self.reset()
self.reset(reconnect=reconnect)

def recover(self):
self.reset(enter_bootloader=True)
Expand Down

0 comments on commit f7a0ab0

Please sign in to comment.