This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Shell not working when using SMP Serial Recovery

Dear community,

After a lot of though and fighting with our hardware we decided to use a dual slot bootloader config with an external flash.

We based our testing on the following repo plus the provided example in the SDK shell/shell_module

When we run the booloader with a simple hello world it works without an issue.

When we run the shell example runs without any issue.

When we combine the two then there's no shell after boot and the example does nothing.

We are trying to make this simple example work since our custom software is dependent on shell functionality and we need to make something work with it.

We are also providing our code in case someone has some insights.

SDK: 1.7.0 or 1.9.1 using Visual Code

  • Hi

    I am not able to build the sample you uploaded.
    I built for nrf5340dk_nrf5340_cpuapp in v1.9.1.

    Here are the error codes:

    /home/REDACTED/Downloads/shell_module_ref/src/qsort.c:88:6: error: redefinition of 'qsort'
       88 | void qsort(void *a, size_t n, size_t es, cmp_t *cmp)
          |      ^~~~~
    In file included from /home/REDACTED/Downloads/shell_module_ref/src/qsort.c:36:
    /home/REDACTED/ncs/zephyr/lib/libc/minimal/include/stdlib.h:66:20: note: previous definition of 'qsort' was here
       66 | static inline void qsort(void *base, size_t nmemb, size_t size,
          |                    ^~~~~
    [45/329] Building C object CMakeFiles/app.dir/src/uart_reinit.c.obj
    FAILED: CMakeFiles/app.dir/src/uart_reinit.c.obj 
    ccache /home/REDACTED/gnuarmemb/bin/arm-none-eabi-gcc -DBUILD_VERSION=v2.7.99-ncs1-1 -DKERNEL -DNRF5340_XXAA_APPLICATION -DNRF_SKIP_FICR_NS_COPY_TO_RAM -DUSE_PARTITION_MANAGER=1 -            D_FORTIFY_SOURCE=2 -D__PROGRAM_START -D__ZEPHYR__=1 -I/home/REDACTED/ncs/zephyr/include -I/home/REDACTED/Downloads/shell_module_ref/build/zephyr/include/generated -I/home/REDACTED/ncs/zephyr/soc/arm/nordic_nrf/nrf53 -I/home/REDACTED/ncs/zephyr/lib/util/fnmatch/. -I/home/REDACTED/ncs/zephyr/soc/arm/nordic_nrf/common/. -I/home/REDACTED/ncs/zephyr/subsys/bluetooth -I/home/REDACTED/ ncs/nrf/include -I/home/REDACTED/ncs/modules/hal/cmsis/CMSIS/Core/Include -I/home/REDACTED/ncs/modules/hal/nordic/nrfx -I/home/REDACTED/ncs/modules/hal/nordic/nrfx/drivers/include -I/home/   REDACTED/ncs/modules/hal/nordic/nrfx/mdk -I/home/REDACTED/ncs/zephyr/modules/hal_nordic/nrfx/. -I/home/REDACTED/Downloads/shell_module_ref/build/modules/libmetal/libmetal/lib/include -I/home/REDACTED/ncs/modules/lib/open-amp/open-amp/lib/include -I/home/REDACTED/ncs/modules/lib/tinycbor/zephyr/../include -I/home/REDACTED/ncs/modules/crypto/tinycrypt/lib/include -I/home/REDACTED/ ncs/nrfxlib/softdevice_controller/include -I/home/REDACTED/ncs/zephyr/subsys/mgmt/mcumgr/lib/mgmt/include -I/home/REDACTED/ncs/zephyr/subsys/mgmt/mcumgr/lib/cborattr/include -I/home/REDACTED/ncs/zephyr/subsys/mgmt/mcumgr/lib/util/include -I/home/REDACTED/ncs/zephyr/subsys/mgmt/mcumgr/lib/smp/include -I/home/REDACTED/ncs/zephyr/subsys/mgmt/mcumgr/lib/cmd/img_mgmt/include -        isystem /home/REDACTED/ncs/zephyr/lib/libc/minimal/include -isystem /home/REDACTED/gnuarmemb/bin/../lib/gcc/arm-none-eabi/9.2.1/include -isystem /home/REDACTED/gnuarmemb/bin/../lib/gcc/arm-  none-eabi/9.2.1/include-fixed -isystem /home/REDACTED/ncs/nrfxlib/crypto/nrf_cc312_platform/include -Os -imacros /home/REDACTED/Downloads/shell_module_ref/build/zephyr/include/generated/     autoconf.h -ffreestanding -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m33 -mthumb -mabi=aapcs -mfp16-format=ieee -imacros /home/REDACTED/ncs/zephyr/include/toolchain/    zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wno-main -Wno-pointer-sign -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -Werror=implicit-int -fno-asynchronous-unwind-tables -fno-pie -fno-pic -fno-strict-overflow -fno-reorder-functions -fno-defer-pop -fmacro-prefix-map=/home/REDACTED/Downloads/shell_module_ref=CMAKE_SOURCE_DIR -    fmacro-prefix-map=/home/REDACTED/ncs/zephyr=ZEPHYR_BASE -fmacro-prefix-map=/home/REDACTED/ncs=WEST_TOPDIR -ffunction-sections -fdata-sections -std=c99 -nostdinc -MD -MT CMakeFiles/app.dir/   src/uart_reinit.c.obj -MF CMakeFiles/app.dir/src/uart_reinit.c.obj.d -o CMakeFiles/app.dir/src/uart_reinit.c.obj -c /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c
    /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c: In function 'shell_init_from_work':
    /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c:14:23: error: 'CONFIG_UART_SHELL_ON_DEV_NAME' undeclared (first use in this function)
       14 |    device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
          |                       ^~~~~~~~~~~~~~~~~~~~~~~~~~~~~
    /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c:14:23: note: each undeclared identifier is reported only once for each function it appears in
    /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c:20:48: error: incompatible type for argument 3 of 'shell_init'
       20 |  shell_init(shell_backend_uart_get_ptr(), dev, true, log_backend, level);
          |                                                ^~~~
          |                                                |
          |                                                int
    In file included from /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c:6:
    /home/REDACTED/ncs/zephyr/include/shell/shell.h:838:43: note: expected 'struct shell_backend_config_flags' but argument is of type 'int'
      838 |         struct shell_backend_config_flags cfg_flags,
          |         ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^~~~~~~~~
    /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c: In function 'shell_uninit_cb':
    /home/REDACTED/Downloads/shell_module_ref/src/uart_reinit.c:90:23: error: 'CONFIG_UART_SHELL_ON_DEV_NAME' undeclared (first use in this function)
       90 |    device_get_binding(CONFIG_UART_SHELL_ON_DEV_NAME);
    

    Could include instuctions on how to run this sample?

    Regards,
    Sigurd Hellesvik

  • Hi Hellesvik,

    First of all thanx for the repo you've put up regarding the bootloader.

    I don't know why it's not compiling really.

    It's just a sample from sdk plus your example from your repo :)

    I just put them together and it compiles fine for me.

  • Ohwell, in that case I will try to add shell config to my repo and see where it gets me.

    I hope to be able to return with this by end of Tuesday.

    Regards,
    Sigurd Hellesvik

  • Thanks Sigurd!

    Greatly appreciated!

  • Hi

    Figured it out!

    Even though my sample is for serial recovery DFU, I had not removed the SMP Server functionality from it.
    Therefore, the SMP server is using the uart line, and it is not able to share it with the shell.

    Just disable the SMP Server by removing the MCUMGR configs in prj.conf and the img_mgmt from src/main.c, and it should be fine.

    I will update my sample on git with these changes shortly.

    Regards,
    Sigurd Hellesvik

Related