zephyr: Add better errors
Only one of the backends for the shell can be enabled at once, so add
BRANCH=None
TEST=zmake testall
Tested-by: Jeremy Bettis
#include <device.h>
#include <drivers/uart.h>
#include <shell/shell.h>
-#ifdef CONFIG_SHELL_BACKEND_DUMMY
-#include <shell/shell_dummy.h>
+#ifdef CONFIG_SHELL_BACKEND_DUMMY /* nocheck */
+#include <shell/shell_dummy.h> /* nocheck */
#endif
#include <shell/shell_uart.h>
#include <stdbool.h>
#include "usb_console.h"
#include "zephyr_console_shim.h"
+#if !defined(CONFIG_SHELL_BACKEND_SERIAL) && \
+ !defined(CONFIG_SHELL_BACKEND_DUMMY) /* nocheck */
+#error Must select either CONFIG_SHELL_BACKEND_SERIAL or \
+ CONFIG_SHELL_BACKEND_DUMMY /* nocheck */
+#endif
+#if defined(CONFIG_SHELL_BACKEND_SERIAL) && \
+ defined(CONFIG_SHELL_BACKEND_DUMMY) /* nocheck */
+#error Must select only one shell backend
+#endif
+
LOG_MODULE_REGISTER(shim_console, LOG_LEVEL_ERR);
static const struct device *uart_shell_dev =
@@ -218,8 +228,8 @@ static int init_ec_shell(const struct device *unused)
{
#if defined(CONFIG_SHELL_BACKEND_SERIAL)
shell_zephyr = shell_backend_uart_get_ptr();
-#elif defined(CONFIG_SHELL_BACKEND_DUMMY)
- shell_zephyr = shell_backend_dummy_get_ptr();
+#elif defined(CONFIG_SHELL_BACKEND_DUMMY) /* nocheck */
+ shell_zephyr = shell_backend_dummy_get_ptr(); /* nocheck */
#else
#error A shell backend must be enabled
#endif
