Skip to content

Commit

Permalink
Enable Uart console and boot serial
Browse files Browse the repository at this point in the history
Signed-off-by: mateo-ligne-netatmo <[email protected]>
  • Loading branch information
mateo-ligne-netatmo committed Dec 16, 2021
1 parent 7062b50 commit a59fef4
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
4 changes: 2 additions & 2 deletions boot/zephyr/include/serial_adapter/serial_adapter.h
Original file line number Diff line number Diff line change
Expand Up @@ -21,12 +21,12 @@ int
console_out(int c);

void
console_write(const char *str, int cnt);
console_write_boot(const char *str, int cnt);

int
boot_console_init(void);

int
console_read(char *str, int str_cnt, int *newline);
console_read_boot(char *str, int str_cnt, int *newline);

#endif // SERIAL_ADAPTER
4 changes: 2 additions & 2 deletions boot/zephyr/main.c
Original file line number Diff line number Diff line change
Expand Up @@ -39,8 +39,8 @@
#include "serial_adapter/serial_adapter.h"

const struct boot_uart_funcs boot_funcs = {
.read = console_read,
.write = console_write
.read = console_read_boot,
.write = console_write_boot
};
#endif

Expand Down
10 changes: 5 additions & 5 deletions boot/zephyr/serial_adapter.c
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@
#include "bootutil/bootutil_log.h"
#include <usb/usb_device.h>

#if defined(CONFIG_BOOT_SERIAL_UART) && defined(CONFIG_UART_CONSOLE)
#error Zephyr UART console must been disabled if serial_adapter module is used.
#if DT_SAME_NODE(DT_CHOSEN(zephyr_uart_mcumgr), DT_CHOSEN(zephyr_console))
#error Zephyr UART console and boot serial UART must be two different devices
#endif

BOOT_LOG_MODULE_REGISTER(serial_adapter);
Expand Down Expand Up @@ -61,7 +61,7 @@ console_out(int c)
}

void
console_write(const char *str, int cnt)
console_write_boot(const char *str, int cnt)
{
int i;

Expand All @@ -73,7 +73,7 @@ console_write(const char *str, int cnt)
}

int
console_read(char *str, int str_size, int *newline)
console_read_boot(char *str, int str_size, int *newline)
{
char *line;
int len;
Expand Down Expand Up @@ -192,7 +192,7 @@ static int
boot_uart_fifo_init(void)
{
#ifdef CONFIG_BOOT_SERIAL_UART
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_console));
uart_dev = DEVICE_DT_GET(DT_CHOSEN(zephyr_uart_mcumgr));
#elif CONFIG_BOOT_SERIAL_CDC_ACM
uart_dev = DEVICE_DT_GET_ONE(zephyr_cdc_acm_uart);
#endif
Expand Down

0 comments on commit a59fef4

Please sign in to comment.