Compilation/configuration problem in prj.conf using CONFIG_BOOTLOADER_MCUBOOT and CONFIG_IMG_MANAGER options while using I2C

We got a project that is using custom boards and custom libraries that is able to compile for one board and that output strange errors for an other.
Following is the prj.conf


CONFIG_SERIAL=y
# CONFIG_UART_INTERRUPT_DRIVEN=y
CONFIG_UART_ASYNC_API=y

# choose RTT console
CONFIG_UART_CONSOLE=n
CONFIG_USE_SEGGER_RTT=y
CONFIG_RTT_CONSOLE=y
# General config
CONFIG_LOG=y
CONFIG_LOG_DEFAULT_LEVEL=4

# Stacks and heaps
# The app crash if we set command too big without this option (like the command to set a certificate)
CONFIG_MAIN_STACK_SIZE=16384
CONFIG_HEAP_MEM_POOL_SIZE=4096

CONFIG_NEWLIB_LIBC_FLOAT_SCANF=y
CONFIG_NEWLIB_LIBC=y
CONFIG_NEWLIB_LIBC_FLOAT_PRINTF=y

##################################
# Conf to allow OTA on the device
##################################

# DFU Target
CONFIG_DFU_TARGET=y

# Image manager
CONFIG_FLASH=y
CONFIG_IMG_ERASE_PROGRESSIVELY=y
CONFIG_DFU_TARGET_MCUBOOT=y

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y

# To reboot the device after a firmware update
CONFIG_REBOOT=y

#################################
# Conf Flash
#################################

CONFIG_STDOUT_CONSOLE=y
# CONFIG_SPI=y
# CONFIG_SPI_NOR=n
# CONFIG_NORDIC_QSPI_NOR=y
# CONFIG_NORDIC_QSPI_NOR_FLASH_LAYOUT_PAGE_SIZE=4096

CONFIG_FLASH=y

#--- any file system
CONFIG_FILE_SYSTEM=y
CONFIG_FLASH_MAP=y
CONFIG_FLASH_PAGE_LAYOUT=y

#----little file system
CONFIG_FILE_SYSTEM_LITTLEFS=y

CONFIG_LOG_STRDUP_BUF_COUNT=16
CONFIG_LOG_BACKEND_RTT_OUTPUT_BUFFER_SIZE=64
CONFIG_LOG_BACKEND_RTT_MODE_BLOCK=y



# Allow events
CONFIG_EVENTS=y

# JSON library
CONFIG_JSON_LIBRARY=y

# Enable nordic security backend and PSA APIs
CONFIG_NRF_SECURITY=y
CONFIG_MBEDTLS_PSA_CRYPTO_C=y



# Config to use the high level API
CONFIG_SLM_AT_COMMANDS=y
CONFIG_HANDLE_CERTS=y
CONFIG_UART_HANDLER=y
CONFIG_FILE_SYSTEM_HANDLE=y

When we compile it, we got warning messages 

warning: BOARD_CAMEL_PWR_CTRL_INIT_PRIORITY (defined at /media/manu/manuLinux/code/sources.yguel/str
aTagGem/stratg/tech4gaia/zephyr_camel_toolbox/src/flipper-
devicetree/boards/arm/stg_camel/Kconfig:12) was assigned the value '85' but got the value ''. Check
these unsatisfied dependencies: GPIO_PCA953X (=n). See http://docs.zephyrproject.org/latest/referenc
e/kconfig/CONFIG_BOARD_CAMEL_PWR_CTRL_INIT_PRIORITY.html and/or look up
BOARD_CAMEL_PWR_CTRL_INIT_PRIORITY 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.


warning: CAMEL_FAKE_DEVICE_DELAY_BEFORE_I2C_INIT_PRIORITY (defined at /media/manu/manuLinux/code/sou
rces.yguel/straTagGem/stratg/tech4gaia/zephyr_camel_toolbox/src/flipper-
devicetree/boards/arm/stg_camel/Kconfig:75) was assigned the value '75' but got the value ''. Check
these unsatisfied dependencies: I2C (=n). See http://docs.zephyrproject.org/latest/referenctg/tech4gaia/zephyr_camel_toolbox/src/zephyr-camel-examples/mqtt/build/mcuboot/zephyr/include/generated/autoconf.h'
e/kconfig
/CONFIG_CAMEL_FAKE_DEVICE_DELAY_BEFORE_I2C_INIT_PRIORITY.html and/or look up
CAMEL_FAKE_DEVICE_DELAY_BEFORE_I2C_INIT_PRIORITY 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.


warning: GPIO_PCA953X (defined at drivers/gpio/Kconfig.pca953x:10) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: I2C (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_GPIO_PCA953X.html and/or look up
GPIO_PCA953X 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.


warning: GPIO_PCA953X_INIT_PRIORITY (defined at drivers/gpio/Kconfig.pca953x:19) was assigned the
value '84' but got the value ''. Check these unsatisfied dependencies: GPIO_PCA953X (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_GPIO_PCA953X_INIT_PRIORITY.html and/or
look up GPIO_PCA953X_INIT_PRIORITY 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.


warning: I2C_TCA954X (defined at drivers/i2c/Kconfig.tca954x:4) was assigned the value 'y' but got
the value 'n'. Check these unsatisfied dependencies: I2C (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_I2C_TCA954X.html and/or look up
I2C_TCA954X 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.


warning: I2C_TCA954X_ROOT_INIT_PRIO (defined at drivers/i2c/Kconfig.tca954x:11) was assigned the
value '82' but got the value ''. Check these unsatisfied dependencies: I2C_TCA954X (=n), I2C (=n).
See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_I2C_TCA954X_ROOT_INIT_PRIO.html
and/or look up I2C_TCA954X_ROOT_INIT_PRIO 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.


warning: I2C_TCA954X_CHANNEL_INIT_PRIO (defined at drivers/i2c/Kconfig.tca954x:15) was assigned the
value '83' but got the value ''. Check these unsatisfied dependencies: I2C_TCA954X (=n), I2C (=n).
See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_I2C_TCA954X_CHANNEL_INIT_PRIO.html
and/or look up I2C_TCA954X_CHANNEL_INIT_PRIO 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.


warning: I2C_INIT_PRIORITY (defined at drivers/i2c/Kconfig:54) was assigned the value '80' but got
the value ''. Check these unsatisfied dependencies: I2C (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_I2C_INIT_PRIORITY.html and/or look up
I2C_INIT_PRIORITY 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.

then an error message related to the warnings:

error: #error CONFIG_REGULATOR_FIXED_INIT_PRIORITY must be lower than CONFIG_I2C_INIT_PRIORITY
   55 | #error CONFIG_REGULATOR_FIXED_INIT_PRIORITY must be lower than \
      |  ^~~~~
/media/manu/manuLinux/code/sources.yguel/straTagGem/stratg/tech4gaia/zephyr_camel_toolbox/src/flipper-devicetree/boards/arm/stg_camel/camel_power_init.c:57:10: note: '#pragma message: CONFIG_I2C_INIT_PRIORITY'
   57 |  #pragma message(STRING(CONFIG_I2C_INIT_PRIORITY))
      |          ^~~~~~~
/media/manu/manuLinux/code/sources.yguel/straTagGem/stratg/tech4gaia/zephyr_camel_toolbox/src/flipper-devicetree/boards/arm/stg_camel/camel_power_init.c:58:10: note: '#pragma message: 70'
   58 |  #pragma message(STRING(CONFIG_REGULATOR_FIXED_INIT_PRIORITY))
      |          ^~~~~~~
/media/manu/manuLinux/code/sources.yguel/straTagGem/stratg/tech4gaia/zephyr_camel_toolbox/src/flipper-devicetree/boards/arm/stg_camel/camel_power_init.c:62:2: error: #error CONFIG_I2C_INIT_PRIORITY must be lower than BOARD_CCS_VDD_PWR_CTRL_INIT_PRIORITY
   62 | #error CONFIG_I2C_INIT_PRIORITY must be lower than BOARD_CCS_VDD_PWR_CTRL_INIT_PRIORITY
      |  ^~~~~
/media/manu/manuLinux/code/sources.yguel/straTagGem/stratg/tech4gaia/zephyr_camel_toolbox/src/flipper-devicetree/boards/arm/stg_camel/camel_power_init.c:66:2: error: #error CONFIG_GPIO_PCA953X_INIT_PRIORITY must be lower than CONFIG_BOARD_CAMEL_PWR_CTRL_INIT_PRIORITY
   66 | #error CONFIG_GPIO_PCA953X_INIT_PRIORITY must be lower than CONFIG_BOARD_CAMEL_PWR_CTRL_INIT_PRIORITY


Here is the complete output of the failed compilation:

compile_output.txt

We have looked at merged prj.conf files that tell us things about I2C and we have found in the file nrf_connect_sdk/bootloader/mcuboot/boot/zephyr/prj.conf
the following lines

### Various Zephyr boards enable features that we don't want.
# CONFIG_BT is not set
# CONFIG_BT_CTLR is not set
# CONFIG_I2C is not set

Thus in our prj.conf we have been experimenting with the config options involving mcuboot / DFU and OTA and wif we comment the 2 following options in our prj.conf:

CONFIG_BOOTLOADER_MCUBOOT=y
CONFIG_IMG_MANAGER=y

the project compiles, however we see warnings that tell us that probably FOTA will not work:

warning: DFU_TARGET_MCUBOOT (defined at /media/manu/manuLinux/system/nordic/nRF_connect/nrf_connect_
sdk/nrf/subsys/dfu/dfu_target/Kconfig:14) was assigned the value 'y' but got the value 'n'. Check
these unsatisfied dependencies: IMG_MANAGER (=n), BOOTLOADER_MCUBOOT (=n). See
http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_DFU_TARGET_MCUBOOT.html and/or look up
DFU_TARGET_MCUBOOT 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.


warning: IMG_ERASE_PROGRESSIVELY (defined at subsys/dfu/Kconfig:63) was assigned the value 'y' but
got the value 'n'. Check these unsatisfied dependencies: MCUBOOT_IMG_MANAGER (=n), IMG_MANAGER (=n).
See http://docs.zephyrproject.org/latest/reference/kconfig/CONFIG_IMG_ERASE_PROGRESSIVELY.html
and/or look up IMG_ERASE_PROGRESSIVELY in the menuconfig/guiconfig interface. The Application
Development Primer, Setting Configuration Valuolbox/src/zephyr-camel-examples/mqtt/build/zephyr/include/generated/autoconf.h'
es, and Kconfig - Tips and Best Practices sections of
the manual might be helpful too.


Following is the complete output of the compilation that succeeded:
compile_output_almost_ok.txt

What are we doing wrong ? And how could we have a project that uses both FOTA capabilities and I2C config options in the same prj.conf ?
Furthermore, we have an other board for which the project compiles fine, but the I2C configuration is defined through an overlay.
Is there a thing that forces to use an overlay while wanting to use FOTA and I2C ?

  • For the I2C issue make sure that you are defining the CONFIG_* that are needed for the TCA driver and that your board is defined so the device tree has the necessary TCA parameters as well.

    Look in the zephyr tree at the TCA test to see how it is setup: zephyr\tests\drivers\i2c\i2c_tca954x

  • Hi,

     

    Try disabling the specific functionality for mcuboot specifically, as I assume that you do not need to communicate with your i2c sensors in mcuboot.

    This is done by creating the folder (and file):

    my_project/child_image/mcuboot/boards/$MY_BOARD.overlay

     

    If we use nrf52840dk_nrf52840 as the board here, it will be:

    my_project/child_image/mcuboot/boards/nrf52840dk_nrf52840.overlay

     

    Which should hold the i2c instance that you want to disable:

    &i2cX {
        status = "disabled";
    };

     

    Now re-generate the build folder (ie. delete the current build-folder and generate the build again) and it should not add the i2c instance (and the sensors that hangs on that instance).

     

    Kind regards,

    Håkon

Related