aboutsummaryrefslogtreecommitdiffstats
path: root/src
diff options
context:
space:
mode:
authorEric Callahan <arksine.code@gmail.com>2022-05-31 06:55:13 -0400
committerKevinOConnor <kevin@koconnor.net>2022-06-03 14:51:01 -0400
commit129091d81176c8a361802a19fc9ee6c567d2f558 (patch)
tree5d5bd3472a9316ac24caa1aa9c1de51aa9ea0586 /src
parent8b1e3c3fb25e3d3fbec49158ba9dba9b07c9be00 (diff)
downloadkutter-129091d81176c8a361802a19fc9ee6c567d2f558.tar.gz
kutter-129091d81176c8a361802a19fc9ee6c567d2f558.tar.xz
kutter-129091d81176c8a361802a19fc9ee6c567d2f558.zip
canbus: use "try_request_canboot" method
Signed-off-by: Eric Callahan <arksine.code@gmail.com>
Diffstat (limited to 'src')
-rw-r--r--src/generic/canbus.c16
-rw-r--r--src/stm32/internal.h3
2 files changed, 4 insertions, 15 deletions
diff --git a/src/generic/canbus.c b/src/generic/canbus.c
index a9bf3c8b..a1f112ac 100644
--- a/src/generic/canbus.c
+++ b/src/generic/canbus.c
@@ -95,10 +95,6 @@ console_sendf(const struct command_encoder *ce, va_list args)
#define CANBUS_CMD_REQUEST_BOOTLOADER 0x02
#define CANBUS_RESP_NEED_NODEID 0x20
-// CanBoot definitions
-#define CANBOOT_SIGNATURE 0x21746f6f426e6143
-#define CANBOOT_REQUEST 0x5984E3FA6CA1589B
-
// Helper to verify a UUID in a command matches this chip's UUID
static int
can_check_uuid(uint32_t id, uint32_t len, uint8_t *data)
@@ -166,17 +162,7 @@ can_process_request_bootloader(uint32_t id, uint32_t len, uint8_t *data)
{
if (!can_check_uuid(id, len, data))
return;
- uint32_t *bl_vectors = (uint32_t *)(CONFIG_FLASH_START & 0xFF000000);
- uint64_t *boot_sig = (uint64_t *)(bl_vectors[1] - 9);
- uint64_t *req_sig = (uint64_t *)bl_vectors[0];
- if (boot_sig == (void *)ALIGN((size_t)boot_sig, 8) &&
- *boot_sig == CANBOOT_SIGNATURE &&
- req_sig == (void *)ALIGN((size_t)req_sig, 8))
- {
- irq_disable();
- *req_sig = CANBOOT_REQUEST;
- NVIC_SystemReset();
- }
+ try_request_canboot();
}
// Handle an "admin" command
diff --git a/src/stm32/internal.h b/src/stm32/internal.h
index f0535ab9..0033942d 100644
--- a/src/stm32/internal.h
+++ b/src/stm32/internal.h
@@ -42,4 +42,7 @@ struct cline lookup_clock_line(uint32_t periph_base);
uint32_t get_pclock_frequency(uint32_t periph_base);
void gpio_clock_enable(GPIO_TypeDef *regs);
+// armcm_timer.c
+void try_request_canboot(void);
+
#endif // internal.h