serial_irq: Support side channel for entering bootloader

Add a mechanism to request the bootloader when using serial input.

Signed-off-by: Kevin O'Connor <kevin@koconnor.net>
This commit is contained in:
Kevin O'Connor 2022-09-01 21:28:59 -04:00
parent ba38897a35
commit 84ec2813ab
4 changed files with 7 additions and 0 deletions

View File

@ -44,6 +44,8 @@ source "src/simulator/Kconfig"
# Generic configuration options for serial ports # Generic configuration options for serial ports
config SERIAL config SERIAL
bool bool
config SERIAL_BOOTLOADER_SIDECHANNEL
bool
config SERIAL_BAUD config SERIAL_BAUD
depends on SERIAL depends on SERIAL
int "Baud rate for serial port" if LOW_LEVEL_OPTIONS int "Baud rate for serial port" if LOW_LEVEL_OPTIONS

View File

@ -79,6 +79,9 @@ console_task(void)
if (ret > 0) if (ret > 0)
command_dispatch(receive_buf, pop_count); command_dispatch(receive_buf, pop_count);
if (ret) { 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); console_pop_input(pop_count);
if (ret > 0) if (ret > 0)
command_send_ack(); command_send_ack();

View File

@ -14,6 +14,7 @@ config LPC_SELECT
select HAVE_CHIPID select HAVE_CHIPID
select HAVE_GPIO_HARD_PWM select HAVE_GPIO_HARD_PWM
select HAVE_STEPPER_BOTH_EDGE select HAVE_STEPPER_BOTH_EDGE
select SERIAL_BOOTLOADER_SIDECHANNEL
config BOARD_DIRECTORY config BOARD_DIRECTORY
string string

View File

@ -14,6 +14,7 @@ config STM32_SELECT
select HAVE_STRICT_TIMING select HAVE_STRICT_TIMING
select HAVE_CHIPID select HAVE_CHIPID
select HAVE_STEPPER_BOTH_EDGE select HAVE_STEPPER_BOTH_EDGE
select SERIAL_BOOTLOADER_SIDECHANNEL
config BOARD_DIRECTORY config BOARD_DIRECTORY
string string