mirror of
https://github.com/dragonpilot/dragonpilot.git
synced 2026-02-20 06:44:08 +08:00
869f12321 Hyundai: counter check (#530) a4390713e gitignore for route logs ac1b64e62 Fix CAN Ignition for Black Panda and Uno (#526) 273e3882f When initializing all the CAN busses, make sure the are also cleared (#527) c2bea78f6 Fix python library on Windows (#523) 0a123b181 that too ba6355d4c unused lines c9102c00e Chrysler: use can packer in safety tests (#522) 9874e7335 Abstract steering safety tests for Toyota and Chrysler (#520) 2299ecffc Block 0xe5 (Honda Bosch) at the panda/uno. Only allow static values. (#515) 351730611 Subaru: fix steer torque scaling (#501) 0bc864b3d Make torque-based steering state global (#518) d9355c414 Make cruise_engaged_prev a global + test case for it (#519) 211537641 Abstract sample speed test (#516) 11dc9054f remove unused function e5a586eea Abstract gas interceptor tests (#517) 1dbed65e3 Safety Test Refactor: Honda (#495) 0632710ac base class for different panda safety tests bd98fe603 safety tests: use shorter function name ba59ada0e No ESP in non-white (#514) c3336180b Fix the CAN init fix (#513) 884afa0ef Safety Test Refactor: Chrysler and Volkswagen PQ (#508) d77b72d16 Safety Test Refactor: Nissan (#510) 4c7755c47 Match Panda DFU entry fix in "make recover" process (#509) 0336f625d Pedal gas pressed safety limits (#507) 715b1a169 Hyundai-Kia-Genesis (HKG) (#503) 6f105e827 Safety Test Refactor: Subaru (#502) 57cc954f2 Safety Test Refactor: GM (#504) dd01c3b9c Safety Test Refactor: Hyundai (#505) 592c2c864 add support to can_unique.py for Cabana CSV format. (#506) ccf13b7af No more infinite while loops in CAN init (#499) 6c442b4c3 Safety Test Refactor: Volkswagen MQB (#493) f07a6ee7c panda recover should go through bootstub first (#498) 8cc3a3570 remove cadillac (#496) 62e4d3c36 Chrysler: fix missing button signal on TX (#490) abce8f32b Safety Test Refactor: Toyota + support code (#491) 500370aec Make sure relay faults make it to the health packet (#492) bc90b60f9 toyota: use universal gas pressed bit (#488) 74d10ccd3 Fixed possible race condition (#487) a05361ebc cleanup safety_replay dockerfile (#486) fe73dcc91 Openpilot-tools is deprecated (#484) da8e00f11 TX message guaranteed delivery (#421) d8f618492 Add ISO number for longitudinal limits flag comment 6a60b7811 touch ups 2ce65361d comments on unsafe flags d88013450 remove from there as well 055ea07ee remove that unsafe flag since it isn't implemented and it's unclear how to 4e98bbe8c Apply unsafe allow gas mode to all cars. (#480) 0c2c14949 Fixing libusb busy error (#174) 753c42cf5 Update Board Mac SDK Install script to work on clean mac (#146) b9a9ea395 Unsafe gas disengage mods, fix test compile warning (#481) 08ef92d58 Safety model for Volkswagen PQ35/PQ46/NMS (#474) 51e0a55d6 Support code for unsafe mode unit tests (#478) 5325b62bb current_safety_mode 7908b7224 update updating unsafe mode 98503e866 disable stock honda AEB in unsafe mode (#477) 01b2ccbed one more 9a30265a8 weak steering while not engaged 577f10b1a added options for unsafe mode 83cf7bf4c update comment 4556e7494 enable unsafe mode, toggle for use by forks that so choose de89fcdc4 Nissan leaf (#473) git-subtree-dir: panda git-subtree-split: 869f1232186f440eb388df82b85b88d346899199
99 lines
2.6 KiB
Python
Executable File
99 lines
2.6 KiB
Python
Executable File
#!/usr/bin/env python3
|
|
|
|
import sys
|
|
import time
|
|
import requests
|
|
import json
|
|
import io
|
|
|
|
def flash_release(path=None, st_serial=None):
|
|
from panda import Panda, PandaDFU, ESPROM, CesantaFlasher
|
|
from zipfile import ZipFile
|
|
|
|
def status(x):
|
|
print("\033[1;32;40m"+x+"\033[00m")
|
|
|
|
if st_serial == None:
|
|
# look for Panda
|
|
panda_list = Panda.list()
|
|
if len(panda_list) == 0:
|
|
raise Exception("panda not found, make sure it's connected and your user can access it")
|
|
elif len(panda_list) > 1:
|
|
raise Exception("Please only connect one panda")
|
|
st_serial = panda_list[0]
|
|
print("Using panda with serial %s" % st_serial)
|
|
|
|
if path == None:
|
|
print("Fetching latest firmware from github.com/commaai/panda-artifacts")
|
|
r = requests.get("https://raw.githubusercontent.com/commaai/panda-artifacts/master/latest.json")
|
|
url = json.loads(r.text)['url']
|
|
r = requests.get(url)
|
|
print("Fetching firmware from %s" % url)
|
|
path = io.StringIO(r.content)
|
|
|
|
zf = ZipFile(path)
|
|
zf.printdir()
|
|
|
|
version = zf.read("version")
|
|
status("0. Preparing to flash "+version)
|
|
|
|
code_bootstub = zf.read("bootstub.panda.bin")
|
|
code_panda = zf.read("panda.bin")
|
|
|
|
code_boot_15 = zf.read("boot_v1.5.bin")
|
|
code_boot_15 = code_boot_15[0:2] + "\x00\x30" + code_boot_15[4:]
|
|
|
|
code_user1 = zf.read("user1.bin")
|
|
code_user2 = zf.read("user2.bin")
|
|
|
|
# enter DFU mode
|
|
status("1. Entering DFU mode")
|
|
panda = Panda(st_serial)
|
|
panda.enter_bootloader()
|
|
time.sleep(1)
|
|
|
|
# program bootstub
|
|
status("2. Programming bootstub")
|
|
dfu = PandaDFU(PandaDFU.st_serial_to_dfu_serial(st_serial))
|
|
dfu.program_bootstub(code_bootstub)
|
|
time.sleep(1)
|
|
|
|
# flash main code
|
|
status("3. Flashing main code")
|
|
panda = Panda(st_serial)
|
|
panda.flash(code=code_panda)
|
|
panda.close()
|
|
|
|
# flashing ESP
|
|
if panda.is_white():
|
|
status("4. Flashing ESP (slow!)")
|
|
align = lambda x, sz=0x1000: x+"\xFF"*((sz-len(x)) % sz)
|
|
esp = ESPROM(st_serial)
|
|
esp.connect()
|
|
flasher = CesantaFlasher(esp, 230400)
|
|
flasher.flash_write(0x0, align(code_boot_15), True)
|
|
flasher.flash_write(0x1000, align(code_user1), True)
|
|
flasher.flash_write(0x81000, align(code_user2), True)
|
|
flasher.flash_write(0x3FE000, "\xFF"*0x1000)
|
|
flasher.boot_fw()
|
|
del flasher
|
|
del esp
|
|
time.sleep(1)
|
|
else:
|
|
status("4. No ESP in non-white panda")
|
|
|
|
# check for connection
|
|
status("5. Verifying version")
|
|
panda = Panda(st_serial)
|
|
my_version = panda.get_version()
|
|
print("dongle id: %s" % panda.get_serial()[0])
|
|
print(my_version, "should be", version)
|
|
assert(str(version) == str(my_version))
|
|
|
|
# done!
|
|
status("6. Success!")
|
|
|
|
if __name__ == "__main__":
|
|
flash_release(*sys.argv[1:])
|
|
|