diff options
author | Kevin O'Connor <kevin@koconnor.net> | 2022-09-02 04:28:59 +0300 |
---|---|---|
committer | Kevin O'Connor <kevin@koconnor.net> | 2022-09-02 04:51:28 +0300 |
commit | c08b14f71874df0d513e2d6b1ae25c94849cb518 (patch) | |
tree | 19ddd5b75d54729ea14bd02c7c9d2fe2d3583baf | |
parent | eed08b867b78ea0c9e630c2ce570cc3e89d993de (diff) |
serial_irq: Support side channel for entering bootloaderwork-serialboot-20220901
Add a mechanism to request the bootloader when using serial input.
Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
-rw-r--r-- | src/Kconfig | 2 | ||||
-rw-r--r-- | src/generic/serial_irq.c | 3 | ||||
-rw-r--r-- | src/lpc176x/Kconfig | 1 | ||||
-rw-r--r-- | src/stm32/Kconfig | 1 |
4 files changed, 7 insertions, 0 deletions
diff --git a/src/Kconfig b/src/Kconfig index 08a57c16f..b6a7c1d16 100644 --- a/src/Kconfig +++ b/src/Kconfig @@ -44,6 +44,8 @@ source "src/simulator/Kconfig" # Generic configuration options for serial ports config SERIAL bool +config SERIAL_BOOTLOADER_SIDECHANNEL + bool config SERIAL_BAUD depends on SERIAL int "Baud rate for serial port" if LOW_LEVEL_OPTIONS diff --git a/src/generic/serial_irq.c b/src/generic/serial_irq.c index c2b23864e..3f31a342e 100644 --- a/src/generic/serial_irq.c +++ b/src/generic/serial_irq.c @@ -79,6 +79,9 @@ console_task(void) if (ret > 0) command_dispatch(receive_buf, pop_count); if (ret) { + if (CONFIG_SERIAL_BOOTLOADER_SIDECHANNEL && ret < 0 && pop_count == 32 + && !memcmp(receive_buf, " \x1c Request Serial Bootloader!!!~", 32)) + bootloader_request(); console_pop_input(pop_count); if (ret > 0) command_send_ack(); diff --git a/src/lpc176x/Kconfig b/src/lpc176x/Kconfig index def71fb0b..d20c4dec1 100644 --- a/src/lpc176x/Kconfig +++ b/src/lpc176x/Kconfig @@ -14,6 +14,7 @@ config LPC_SELECT select HAVE_CHIPID select HAVE_GPIO_HARD_PWM select HAVE_STEPPER_BOTH_EDGE + select SERIAL_BOOTLOADER_SIDECHANNEL config BOARD_DIRECTORY string diff --git a/src/stm32/Kconfig b/src/stm32/Kconfig index 1634d8ad2..96383ce39 100644 --- a/src/stm32/Kconfig +++ b/src/stm32/Kconfig @@ -14,6 +14,7 @@ config STM32_SELECT select HAVE_STRICT_TIMING select HAVE_CHIPID select HAVE_STEPPER_BOTH_EDGE + select SERIAL_BOOTLOADER_SIDECHANNEL config BOARD_DIRECTORY string |