Skip to content

Commit 2ca0a68

Browse files
committed
loader: fix build for boards without USB CDC
1 parent ac2135b commit 2ca0a68

File tree

1 file changed

+4
-1
lines changed

1 file changed

+4
-1
lines changed

loader/main.c

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@
44
* SPDX-License-Identifier: Apache-2.0
55
*/
66

7+
#include "zephyr/sys/printk.h"
78
#include <zephyr/logging/log.h>
89
LOG_MODULE_REGISTER(app);
910

@@ -68,7 +69,7 @@ static int loader(const struct shell *sh)
6869
return -EINVAL;
6970
}
7071

71-
#if CONFIG_SHELL
72+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm) && CONFIG_SHELL
7273
uint8_t debug = endptr[1];
7374
if (debug != 0 && strcmp(k_thread_name_get(k_current_get()), "main") == 0) {
7475
// disables default shell on UART
@@ -173,6 +174,7 @@ static int loader(const struct shell *sh)
173174
#if CONFIG_SHELL
174175
SHELL_CMD_REGISTER(sketch, NULL, "Run sketch", loader);
175176

177+
#if DT_NODE_HAS_PROP(DT_PATH(zephyr_user), cdc_acm)
176178
static int enable_shell_usb(void)
177179
{
178180
bool log_backend = CONFIG_SHELL_BACKEND_SERIAL_LOG_LEVEL > 0;
@@ -187,6 +189,7 @@ static int enable_shell_usb(void)
187189
return 0;
188190
}
189191
#endif
192+
#endif
190193

191194
int main(void)
192195
{

0 commit comments

Comments
 (0)