mcuboot customer config

Hi, 

I want to disable the UART of  MCUBOOT to reduce power consumption. I searched in the DevZone and got the answer as below.

I followed the answer above, and created a test project  based on the sample that zephyr/samples/hello_world.

The modification as below.

prj,conf 

CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
CONFIG_UART_CONSOLE=n
CONFIG_SERIAL=n

CONFIG_BOOTLOADER_MCUBOOT=y

CMakeLists.txt

# SPDX-License-Identifier: Apache-2.0

cmake_minimum_required(VERSION 3.20.0)

set(mcuboot_CONF_FILE prj.conf ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf)
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})
project(hello_world)

target_sources(app PRIVATE src/main.c)

nrf5340dk_nrf5340_cpuapp.overlay

&uart0 {
    status = "disabled";    
};

mcuboot.conf

CONFIG_SERIAL=n
CONFIG_UART_CONSOLE=n

project directory 

But I got a build error. According to the build log, "file STRINGS file "D:/NCS/v1.7.1/nrf/modules/mcuboot/prj.conf" cannot be read."

There is not any  prj.conf file in "NCS/v1.7.1/nrf/modules/mcuboot/" actually.

Am I missing something?

Parents
  • Try the following:

    • Add these lines to <application>/CMakeLists.txt under cmake_minimum_required(..)

    set(mcuboot_OVERLAY_CONFIG
      ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf
    )

    • Then add a file named mcuboot.conf to <application> with the following content:

    CONFIG_SERIAL=n

    You can doublecheck that this has taken effect by searching for CONFIG_SERIAL in <application>/build/mcuboot/zephyr/.config


    Read more about OVERLAY_CONFIG and the other Build System variables here: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/zephyr/application/index.html#important-build-system-variables 

    To get a better understanding of how to propogate a variable from the parent image (e.g. your application) to a child image (e.g. mcuboot), read this secion: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.8.0/nrf/ug_multi_image.html#image-specific-variables 

    Best regards,

    Simon

  • Hi Simon,

    You can doublecheck that this has taken effect by searching for CONFIG_SERIAL in <application>/build/mcuboot/zephyr/.config

    It has taken effect.

    # CONFIG_GPIO_MCUX is not set
    # CONFIG_CPU_HAS_CUSTOM_FIXED_SOC_MPU_REGIONS is not set
    # CONFIG_TINYCRYPT is not set
    # CONFIG_SERIAL is not set
    # CONFIG_SRAM_VECTOR_TABLE is not set

     but I got a build error.  I attached the build log and  highlight the error.

    > Executing task: nRF Connect: Build hello_world/build (active) <

    Building hello_world
    west build --build-dir d:\hello_world\build d:\hello_world --pristine --board nrf5340dk_nrf5340_cpuapp -- -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING="NONE" -DCONF_FILE:STRING="d:/hello_world/prj.conf"

    -- west build: generating a build system
    Including boilerplate (Zephyr base): D:/NCS/v1.7.1/zephyr/cmake/app/boilerplate.cmake
    -- Application: D:/hello_world
    -- Zephyr version: 2.6.99 (D:/NCS/v1.7.1/zephyr), build: v2.6.99-ncs1-1
    -- Found Python3: D:/NCS/v1.7.1/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Cache files will be written to: D:/NCS/v1.7.1/zephyr/.cache
    -- Found dtc: D:/NCS/v1.7.1/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (d:/NCS/v1.7.1/toolchain/opt)
    -- Found BOARD.dts: D:/NCS/v1.7.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Generated zephyr.dts: D:/hello_world/build/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: D:/hello_world/build/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: D:/hello_world/build/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: D:/hello_world/build/zephyr/dts.cmake
    Parsing D:/NCS/v1.7.1/zephyr/Kconfig
    Loaded configuration 'D:/NCS/v1.7.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'd:/hello_world/prj.conf'
    Configuration saved to 'D:/hello_world/build/zephyr/.config'
    Kconfig header saved to 'D:/hello_world/build/zephyr/include/generated/autoconf.h'
    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: D:/NCS/v1.7.1/toolchain/opt/bin/arm-none-eabi-gcc.exe

    === child image mcuboot - begin ===
    Including boilerplate (Zephyr base): D:/NCS/v1.7.1/zephyr/cmake/app/boilerplate.cmake
    -- Application: D:/NCS/v1.7.1/bootloader/mcuboot/boot/zephyr
    -- Zephyr version: 2.6.99 (D:/NCS/v1.7.1/zephyr), build: v2.6.99-ncs1-1
    -- Found Python3: D:/NCS/v1.7.1/toolchain/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
    -- Found west (found suitable version "0.11.1", minimum required is "0.7.1")
    -- Board: nrf5340dk_nrf5340_cpuapp
    -- Cache files will be written to: D:/NCS/v1.7.1/zephyr/.cache
    -- Found dtc: D:/NCS/v1.7.1/toolchain/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
    -- Found toolchain: gnuarmemb (D:/NCS/v1.7.1/toolchain/opt)
    -- Found BOARD.dts: D:/NCS/v1.7.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
    -- Found devicetree overlay: D:/NCS/v1.7.1/bootloader/mcuboot/boot/zephyr/dts.overlay
    -- Generated zephyr.dts: D:/hello_world/build/mcuboot/zephyr/zephyr.dts
    -- Generated devicetree_unfixed.h: D:/hello_world/build/mcuboot/zephyr/include/generated/devicetree_unfixed.h
    -- Generated device_extern.h: D:/hello_world/build/mcuboot/zephyr/include/generated/device_extern.h
    -- Including generated dts.cmake file: D:/hello_world/build/mcuboot/zephyr/dts.cmake

    warning: CONSOLE_HANDLER (defined at d:\hello_world\build\drivers\console\Kconfig:39) was assigned the value 'y' but got
    the value 'n'. Check these unsatisfied dependencies: UART_CONSOLE (=n), SERIAL_SUPPORT_INTERRUPT
    Parsing D:/NCS/v1.7.1/bootloader/mcuboot/boot/zephyr/Kconfig
    Loaded configuration 'D:/NCS/v1.7.1/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp_defconfig'
    Merged configuration 'prj.conf'
    Merged configuration 'D:/hello_world/mcuboot.conf'
    Merged configuration 'D:/NCS/v1.7.1/nrf/subsys/partition_manager/partition_manager_enabled.conf'
    Configuration saved to 'D:/hello_world/build/mcuboot/zephyr/.config'
    Kconfig header saved to 'D:/hello_world/build/mcuboot/zephyr/include/generated/autoconf.h'
    (=n). See docs.zephyrproject.org/.../CONFIG_CONSOLE_HANDLER.html and/or
    look up CONSOLE_HANDLER in the menuconfig/guiconfig interface. The Application Development Primer,
    Setting Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be
    helpful too.

    -- The C compiler identification is GNU 9.2.1
    -- The CXX compiler identification is GNU 9.2.1
    -- The ASM compiler identification is GNU
    -- Found assembler: D:/NCS/v1.7.1/toolchain/opt/bin/arm-none-eabi-gcc.exe
    MCUBoot bootloader key file: D:/NCS/v1.7.1/bootloader/mcuboot/root-rsa-2048.pem
    -- Configuring done
    -- Generating done
    -- Build files have been written to: D:/hello_world/build/mcuboot
    === child image mcuboot - end ===

    CMake Error at D:\NCS\v1.7.1\nrf\modules\mcuboot\CMakeLists.txt:187 (file):
    file STRINGS file "D:/NCS/v1.7.1/nrf/modules/mcuboot/prj.conf" cannot be
    read.


    CMake Warning at D:\NCS\v1.7.1\nrf\modules\mcuboot\CMakeLists.txt:204 (message):

    ---------------------------------------------------------
    --- WARNING: Using default MCUBoot key, it should not ---
    --- be used for production. ---
    ---------------------------------------------------------

    -- Configuring incomplete, errors occurred!
    See also "D:/hello_world/build/CMakeFiles/CMakeOutput.log".
    See also "D:/hello_world/build/CMakeFiles/CMakeError.log".
    FATAL ERROR: command exited with status 1: 'd:\NCS\v1.7.1\toolchain\opt\bin\cmake.EXE' '-DWEST_PYTHON=d:\NCS\v1.7.1\toolchain\opt\bin\python.exe' '-Bd:\hello_world\build' '-Sd:\hello_world' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp -DCMAKE_EXPORT_COMPILE_COMMANDS:BOOL=On -DNCS_TOOLCHAIN_VERSION:STRING=NONE -DCONF_FILE:STRING=d:/hello_world/prj.conf
    The terminal process terminated with exit code: 1.

    Terminal will be reused by tasks, press any key to close it.

  • I understand why you get the warnings, since the mentioned configs depend on CONFIG_SERIAL. However, I'm not sure about the error "file STRINGS file ..."

    Could you upload your sample here as a zipped file and I'll see if I'm able to reproduce it on my end.

Reply Children
Related