zephyr: selectable serial device for recovery

This commit adds a choice for the device to use for serial recovery.

Signed-off-by: Emanuele Di Santo <emdi@nordicsemi.no>
Signed-off-by: Andrzej Puzdrowski <andrzej.puzdrowski@nordicsemi.no>

fixup
This commit is contained in:
Emanuele Di Santo 2018-07-20 11:39:57 +02:00 committed by Carles Cufí
parent 68b3053694
commit c4bf78009c
3 changed files with 26 additions and 0 deletions

View File

@ -127,6 +127,23 @@ menuconfig MCUBOOT_SERIAL
if MCUBOOT_SERIAL
choice
prompt "Serial device"
default BOOT_SERIAL_UART if !BOARD_NRF52840_PCA10059
default BOOT_SERIAL_CDC_ACM if BOARD_NRF52840_PCA10059
config BOOT_SERIAL_UART
bool "UART"
# SERIAL and UART_INTERRUPT_DRIVEN already selected
config BOOT_SERIAL_CDC_ACM
bool "CDC ACM"
select USB
select USB_DEVICE_STACK
select USB_CDC_ACM
endchoice
config BOOT_MAX_LINE_INPUT_LEN
int "Maximum command line length"
default 512

View File

@ -20,6 +20,7 @@
#include <misc/__assert.h>
#include <flash.h>
#include <drivers/system_timer.h>
#include <usb/usb_device.h>
#include <soc.h>
#include "target.h"
@ -66,6 +67,10 @@ static void do_boot(struct boot_rsp *rsp)
rsp->br_hdr->ih_hdr_size);
irq_lock();
sys_clock_disable();
#ifdef CONFIG_BOOT_SERIAL_CDC_ACM
/* Disable the USB to prevent it from firing interrupts */
usb_disable();
#endif
__set_MSP(vt->msp);
((void (*)(void))vt->reset)();
}

View File

@ -188,7 +188,11 @@ boot_uart_fifo_getline(char **line)
static int
boot_uart_fifo_init(void)
{
#ifdef CONFIG_BOOT_SERIAL_UART
uart_dev = device_get_binding(CONFIG_UART_CONSOLE_ON_DEV_NAME);
#elif CONFIG_BOOT_SERIAL_CDC_ACM
uart_dev = device_get_binding(CONFIG_CDC_ACM_PORT_NAME);
#endif
u8_t c;
if (!uart_dev) {