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

Using a configuration file with mcuboot

SDK Environment: nRF Connect SDK v1.8.0
Target: Decawave DWM1001-DEV. This uses the nRF52832

I used \ncs\v1.8.0\bootloader\mcuboot\samples\zephyr\hello-world as a starting point and used ideas from here and here

I added

set(mcuboot_CONF_FILE
  prj.conf               
  ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf  
)   

Just after cmake_minimum_required(VERSION 3.8)

And created the file mcuboot.conf

# MCUboot single slot with serial recovery

#CONFIG_BOOT_SIGNATURE_TYPE_ECDSA_P256=y
#CONFIG_BOOT_SIGNATURE_KEY_FILE="test-key.pem"

CONFIG_MCUBOOT_SERIAL=y

# Setup boot detect pin
CONFIG_BOOT_SERIAL_DETECT_PORT="GPIO_0"
CONFIG_BOOT_SERIAL_DETECT_PIN=2
CONFIG_BOOT_SERIAL_DETECT_PIN_VAL=0

# Enable serial recovery
CONFIG_BOOT_SERIAL_UART=y
CONFIG_UART_CONSOLE=n
CONFIG_CONSOLE=n
CONFIG_CONSOLE_HANDLER=n

# Enable single slot mode
CONFIG_SINGLE_APPLICATION_SLOT=y

When compiled I get the error:

CMake Error at C:/ncs/v1.8.0/nrf/modules/mcuboot/CMakeLists.txt:238 (file):
file STRINGS file "C:/ncs/v1.8.0/nrf/modules/mcuboot/prj.conf" cannot be
read.

prj.conf can be found at /ncs/v1.8.0/bootloader/mcuboot/boot/zephyr/prj.conf

If I instead add

set(mcuboot_CONF_FILE
  /ncs/v1.8.0/bootloader/mcuboot/boot/zephyr/prj.conf               
  ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf  
) 

Just after cmake_minimum_required(VERSION 3.8), the program compiles ok.

I would rather not have an absolute path to the file here, as this will catch me out when I update the ncs to a newer version.

I tried adding the following instead

set(mcuboot_CONF_FILE                   
  ${ZEPHYR_BASE}/bootloader/mcuboot/boot/zephyr/prj.conf                        
  ${CMAKE_CURRENT_LIST_DIR}/mcuboot.conf  
)       

This does not work as ZEPHYR_BASE is not set yet. If I move this to after find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}), the configuration in mcuboot.conf appears to have no effect.

Is there a better way to handle this?

I have attached the complete project:

6864.hello-world.zip

Built using

west build -b decawave_dwm1001_dev2 --pristine -d build2 /ncs/myapps/bootloader/hello-world -- -DBOARD_ROOT=/ncs/myapps/bootloader/hello-world

Programmed to the device using

west flash --runner nrfjprog --bin-file build/zephyr/app_update.bin -d build2

Firmware updates via the serial port using

mcumgr.exe --conntype=serial --connstring=COM8 image upload build2\zephyr\app_update.bin

Parents
  • Hi David, 
    I found what worked for me the smoothest is putting a mcu_boot.conf into the child_image folder in the project root folder to have an overlay over the original proj.conf
    Doing that I don't need to define the path to the file. 

Reply
  • Hi David, 
    I found what worked for me the smoothest is putting a mcu_boot.conf into the child_image folder in the project root folder to have an overlay over the original proj.conf
    Doing that I don't need to define the path to the file. 

Children
No Data
Related