Shell configuration interaction with MCUMGR dependency (Base64)

nRF Connect SDK v3.2.1, nRF9160dk


Hi,

I'm working on an application which connects to a MQTT broker over cellular network, and have MCUMGR enabled for firmware updates. I'm trying to integrate some sample shell code, which works fine in isolation, but is resulting in issues when I bring it over to my application.

When this option is present, it results in the board not showing any output when I monitor VCOM0.

# Configure dependencies for CONFIG_MCUMGR_TRANSPORT_UART
CONFIG_BASE64=y


Here's the main.c and prj.conf I used to test this.

# C++ standard
CONFIG_CPP=y
CONFIG_STD_CPP17=y
CONFIG_NEWLIB_LIBC=y
CONFIG_REQUIRES_FULL_LIBCPP=y


# Assert
CONFIG_POWEROFF=y
CONFIG_REBOOT=y
CONFIG_ASSERT=y
CONFIG_ASSERT_VERBOSE=y
CONFIG_RESET_ON_FATAL_ERROR=n


CONFIG_LOG=y
CONFIG_LOG_BUFFER_SIZE=32768
CONFIG_CBPRINTF_FP_SUPPORT=y


# Stack Analyzer
CONFIG_THREAD_ANALYZER=y
CONFIG_THREAD_STACK_INFO=y
CONFIG_THREAD_NAME=y
CONFIG_THREAD_ANALYZER_USE_PRINTK=y
# Stack initialization for watermarking
CONFIG_INIT_STACKS=y


# Stack protection
CONFIG_STACK_SENTINEL=y
CONFIG_HW_STACK_PROTECTION=y


# WDT
CONFIG_WATCHDOG=y
CONFIG_WDT_DISABLE_AT_BOOT=n
CONFIG_WDT_NRFX=y


# Input event handler
CONFIG_INPUT=y
CONFIG_INPUT_THREAD_STACK_SIZE=1536
# Input event logs
# CONFIG_INPUT_EVENT_DUMP=y


# Enable MCUMGR
CONFIG_MCUMGR=y

# Enable MCUMGR management for both OS and Images
CONFIG_MCUMGR_GRP_OS=y
CONFIG_MCUMGR_GRP_IMG=y

# Configure MCUMGR transport to UART
CONFIG_MCUMGR_TRANSPORT_UART=y

# Configure dependencies for CONFIG_MCUMGR
CONFIG_NET_BUF=y
CONFIG_ZCBOR=y
CONFIG_CRC=y

# Configure dependencies for CONFIG_MCUMGR_GRP_IMG
CONFIG_FLASH=y
CONFIG_IMG_MANAGER=y

# Configure dependencies for CONFIG_IMG_MANAGER
CONFIG_STREAM_FLASH=y
CONFIG_FLASH_MAP=y



# Configure dependencies for CONFIG_MCUMGR_TRANSPORT_UART
# NOTE: application works working if this is enabled
# CONFIG_BASE64=y 



CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y

# Shell features
CONFIG_SHELL_HISTORY=y
CONFIG_SHELL_HISTORY_BUFFER=512
CONFIG_SHELL_TAB=y
CONFIG_SHELL_TAB_AUTOCOMPLETION=y

# Shell configurations
CONFIG_SHELL=y
CONFIG_SHELL_WILDCARD=n
CONFIG_SHELL_PROMPT_UART="test > "
CONFIG_SHELL_ARGC_MAX=40
# -h and --help options are handled in Modem Shell
CONFIG_SHELL_HELP_OPT_PARSE=n
# Command line buffer is set this large to enable writing of certificates and injecting A-GNSS data on command line.
CONFIG_SHELL_CMD_BUFF_SIZE=3584
# Shell stack has impact for modem shell application, not CONFIG_MAIN_STACK_SIZE
CONFIG_SHELL_STACK_SIZE=9216
# Shell RX buffer needs to be increased to avoid problems with test automation
CONFIG_SHELL_BACKEND_SERIAL_RX_RING_BUFFER_SIZE=512
# Use interrupt driven shell UART, otherwise we won't be able to suspend the UART
CONFIG_SHELL_BACKEND_SERIAL_API_INTERRUPT_DRIVEN=y
#CONFIG_SERIAL_SUPPORT_INTERRUPT=y

# Shell support
CONFIG_SHELL=y
CONFIG_SHELL_BACKEND_SERIAL=y
CONFIG_SHELL_HISTORY=y
CONFIG_SHELL_HISTORY_BUFFER=512
CONFIG_SHELL_TAB=y
CONFIG_SHELL_TAB_AUTOCOMPLETION=y

# Console and logging
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_LOG=y
CONFIG_PRINTK=y

#include <zephyr/kernel.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/drivers/uart.h>
#include <zephyr/logging/log.h>

LOG_MODULE_REGISTER(main, LOG_LEVEL_DBG);

#define GPIO_NODE DT_NODELABEL(gpio0)
static const struct device* gpio = DEVICE_DT_GET(GPIO_NODE);

#define GREEN_PIN 9
#define RED_PIN   8

int main(void)
{
    gpio_pin_configure(gpio, GREEN_PIN, GPIO_OUTPUT_ACTIVE);
    gpio_pin_configure(gpio, RED_PIN, GPIO_OUTPUT_INACTIVE);

    LOG_INF("init");
    while (1) {
        gpio_pin_toggle(gpio, GREEN_PIN);
        gpio_pin_toggle(gpio, RED_PIN);
        k_sleep(K_MSEC(500));
    }
}

#include <zephyr/kernel.h>
#include <zephyr/shell/shell.h>

static int reboot_shell(const struct shell* sh, size_t argc, char** argv)
{
    shell_print(sh, "Rebooting device...");
    return 0;
}


SHELL_CMD_ARG_REGISTER(reboot, NULL, "Reboot the device.", reboot_shell, 1, 0);

Why does enabling CONFIG_BASE64 cause the application to not function as expected? Will disabling the option prevent remote firmware updates from being possible?

Thanks



Edit:

Just realized this was specifically what depended on Base64, "CONFIG_MCUMGR_TRANSPORT_UART".

Is the issue simply that UART shell and UART MCUMGR cannot coexist?

Related