diff --git a/src/Kconfig b/src/Kconfig index 08a57c16..b6a7c1d1 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 c2b23864..434a98bb 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 def71fb0..d20c4dec 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 1634d8ad..96383ce3 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