From 000715b51dd504312ccaceaadfc21ec5c536e04b Mon Sep 17 00:00:00 2001 From: George Hotz Date: Fri, 9 Mar 2018 14:30:28 -0800 Subject: [PATCH] start work on pedal canloader --- board/pedal/main.c | 7 +++++++ tests/pedal/enter_canloader.py | 8 ++++++++ 2 files changed, 15 insertions(+) create mode 100755 tests/pedal/enter_canloader.py diff --git a/board/pedal/main.c b/board/pedal/main.c index f7c0cc84a5a5c0..4e543c3269ecd5 100644 --- a/board/pedal/main.c +++ b/board/pedal/main.c @@ -121,6 +121,13 @@ void CAN1_RX0_IRQHandler() { #endif uint32_t address = CAN->sFIFOMailBox[0].RIR>>21; if (address == CAN_GAS_INPUT) { + // softloader entry + if (CAN->sFIFOMailBox[0].RDLR == 0xdeadface && CAN->sFIFOMailBox[0].RDHR == 0x0ab00b1e) { + enter_bootloader_mode = ENTER_SOFTLOADER_MAGIC; + NVIC_SystemReset(); + } + + // normal packet uint8_t *dat = (uint8_t *)&CAN->sFIFOMailBox[0].RDLR; uint8_t *dat2 = (uint8_t *)&CAN->sFIFOMailBox[0].RDHR; uint16_t value_0 = (dat[0] << 8) | dat[1]; diff --git a/tests/pedal/enter_canloader.py b/tests/pedal/enter_canloader.py new file mode 100755 index 00000000000000..ed68eaeb6396de --- /dev/null +++ b/tests/pedal/enter_canloader.py @@ -0,0 +1,8 @@ +#!/usr/bin/env python +from panda import Panda + +if __name__ == "__main__": + p = Panda() + p.set_safety_mode(0x1337) + p.can_send(0x200, "\xce\xfa\xad\xde\x1e\x0b\xb0\x0a", 0) +