This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

MCUboot - disabling uart console print log

Hi,
At power on lots of MUCBoot prints pop out of the UART:

*** Booting Zephyr OS build v2.3.0-rc1-ncs1 ***
<inf> mcuboot: Starting bootloader
<inf> mcuboot: Primary image: magic=good, swap_type=0x3, copy_done=0x1, image_ok=0x1
<inf> mcuboot: Boot source: none
<inf> mcuboot: Swap type: none
<inf> mcuboot: Bootloader chainload address offset: 0x10000
<inf> mcuboot: Jumping to the first image slot
*** Booting Zephyr OS build v2.3.0-rc1-ncs1 ***

At power off the same story:

*** Booting Zephyr OS build v2.3.0-rÿ*** Booting Zephyr OS buildà*** Booting Zephyr OS â

How to disable them ?

This is my app configuration


CONFIG_SERIAL=y
CONFIG_UART_0_NRF_FLOW_CONTROL=y
CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_LOG=n
CONFIG_CONSOLE=y
CONFIG_HEAP_MEM_POOL_SIZE=2048
CONFIG_SYSTEM_WORKQUEUE_STACK_SIZE=2048
CONFIG_REBOOT=y
CONFIG_DEBUG=y
CONFIG_NET_BUF=y
CONFIG_BOOTLOADER_MCUBOOT=y

# MCU manager and SMP server
CONFIG_MCUMGR=y
CONFIG_MCUMGR_SMP_UART=y

CONFIG_THREAD_MONITOR=y
CONFIG_STATS=y
CONFIG_STATS_NAMES=y

CONFIG_MCUMGR_CMD_IMG_MGMT=y
CONFIG_MCUMGR_CMD_OS_MGMT=y
CONFIG_MCUMGR_CMD_STAT_MGMT=y

  • Hi!

    To disable the logging from MCUboot, just add "CONFIG_SERIAL=n" to the MCUboot configuration file. 

    So, make a file called <your_mcuboot_config_file>.conf and add the configuration there. 

    And then in the CMakeLists.txt file of your application, add 

    set(mcuboot_CONF_FILE 
        prj.conf 
        ${CMAKE_CURRENT_LIST_DIR}/<your_mcuboot_config_file>.conf
        )

    at the beginning of the file, right after the cmake_minimum_required) line.

    This should disable the output from MCUboot only.

    Best regards,

    Heidi

  • Hello Heidi,
    thank you for your reply.

    Suppose we start from a clean memory.
    Usually I execute four operations in succession

    1) rebuild mcuboot
        $ west build -b <myboard> -d build_mcuboot/ bootloader/mcuboot/boot/zephyr/
    2) flash mcuboot
        $ west flash -d build_mcuboot
    3) rebuild app
        $ west build -b <myboard> -d build_app/ <myapp>
    4) flash app
        $ west flash --bin-file build_app/zephyr/app_update.bin

    Exactly when the <your_mcuboot_config_file>.conf is used in the command series above ?

    Coul you explain the relationship between "CONFIG_SERIAL=y" in <myapp>/prj.conf
    and "CONFIG_SERIAL=n" in <myapp>/<your_mcuboot_config_file>.conf

  • Hi!

    Okay, I see. I was assuming that you built the application as one, by enabling CONFIG_BOOTLOADER_MCUBOOT in your application. 

    If you are building and flashing the bootloader separately, you can add the config I mentioned in this file: https://github.com/nrfconnect/sdk-mcuboot/blob/master/boot/zephyr/prj.conf, which is the configuration file for MCUBoot. 

     

    Gabriele said:
    Exactly when the <your_mcuboot_config_file>.conf is used in the command series above ?

     The file I mentioned will not be used in your build sequence, because you build and flash the bootloader first and then the application.

    However, the configurations for MCUBoot including disabling the serial driver are used in step 1 when building the bootloader.

     

    Gabriele said:
    Coul you explain the relationship between "CONFIG_SERIAL=y" in <myapp>/prj.conf
    and "CONFIG_SERIAL=n" in <myapp>/<your_mcuboot_config_file>.conf

    This just enables the serial driver in your application, so that you can get debug information out. And then disables the serial driver specifically in the bootloader, so you won't see any logging from that module. 

    And then the addition to the CMakeLists.txt file that I described earlier is how we add the <your_mcuboot_config_file>.conf file to the rest of the MCUboot configurations. 

    What may be confusing is that the reference to prj.conf in the code below is not a reference to the prj.conf in your application. It's the MCUboot prj.conf file found here here: /bootloader/mcuboot/boot/zephyr/pjr.conf

    set(mcuboot_CONF_FILE
    prj.conf
    ${CMAKE_CURRENT_LIST_DIR}/<your_mcuboot_config_file>.conf
    )

    Best regards,

    Heidi

Related