I2c configuration In MCUboot

I'm working on a custom board based on the nRF5340. On this board, the UART output (connected to an RS232 transceiver) is gated through an I/O expander which is controlled via I2C. This means the RS232 driver is only enabled after the application configures the I/O expander to turn it on now I want to turn it on in mcuboot and tried modifying the mcuboot application as bellow.

I tried configuring the i2c in mcuboot.conf 

#mcuboot.conf
CONFIG_LOG=y
CONFIG_MCUBOOT_LOG_LEVEL_INF=y
# CONFIG_MCUBOOT_SERIAL=y
# CONFIG_BOOT_SERIAL_UART=y
CONFIG_UART_CONSOLE=n
CONFIG_MCUBOOT_INDICATION_LED=y
CONFIG_FW_INFO_FIRMWARE_VERSION=3
CONFIG_MCUBOOT_LOG_LEVEL_INF=y
#CONFIG_SERIAL=n
CONFIG_GPIO=y
CONFIG_I2C=y


I also enabled the i2c in mcuboot overlay file 

//mcuboot.overlay
&i2c1 {
    status = "okay";
};

&i2c1_default {
	group1 {
		psels = <NRF_PSEL(TWIM_SDA, 1, 2)>, <NRF_PSEL(TWIM_SCL, 1, 3)>;
	};
};

&i2c1_sleep {
	group1 {
		psels = <NRF_PSEL(TWIM_SDA, 1, 2)>, <NRF_PSEL(TWIM_SCL, 1, 3)>;
	};
};


and define i2c_dev in main.c as 
const struct device *i2c_dev = DEVICE_DT_GET(DT_NODELABEL(i2c1));

but I am getting error 

C:/ncs/v2.9.0/bootloader/mcuboot/boot/zephyr/main.c:31: undefined reference to `__device_dts_ord_105'
collect2.exe: error: ld returned 1 exit status


how to resolve this

Parents
  • Hello,

    The error 'undefined reference to '__device_dts_ord_105' shows that either I2C is not enabled in the final devicetree for MCUboot or the required I2C driver is not enabled in the MCUboot build. Can you please check here in the zephyr.dts file (build/mcuboot/zephyr/zephyr.dts) is the i2c1 has 'status = "okay" '?

    If not, the overlay may not be applied correctly. Make sure the overlay file is in the correct location and named properly.

    • For nRF5340 custom board, use child_image/mcuboot/boards/<your_board>.overlay (multi-image), for generic child_image/mcuboot.overlay or sysbuild/mcuboot/boards/<your_board>.overlay (Sysbuild), for generic sysbuild/mcuboot.overlay

    In the mcuboot.conf, you have CONFIG_I2C=y, you can try to add the CONFIG_NRFX_TWIM=y or CONFIG_NRFX_TWI for enabling the correct driver.

  • Hello,
    I tried it with 


    and tried to build the project I got error 

    CMake Error at C:/ncs/v2.9.0/zephyr/cmake/modules/extensions.cmake:2923 (message):
      No prj.conf file(s) was found in the C:/gnodeBoot/sysbuild/mcuboot
      folder(s), please read the Zephyr documentation on application development.
    Call Stack (most recent call first):
      C:/ncs/v2.9.0/zephyr/cmake/modules/configuration_files.cmake:40 (zephyr_file)
      C:/ncs/v2.9.0/zephyr/cmake/modules/zephyr_default.cmake:133 (include)
      C:/ncs/v2.9.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.9.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:12 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
      CMake configure failed for Zephyr project: mcuboot
    


    also when I used normal mcuboot.overlay i2c1 is present in zyphyr.dts

Reply
  • Hello,
    I tried it with 


    and tried to build the project I got error 

    CMake Error at C:/ncs/v2.9.0/zephyr/cmake/modules/extensions.cmake:2923 (message):
      No prj.conf file(s) was found in the C:/gnodeBoot/sysbuild/mcuboot
      folder(s), please read the Zephyr documentation on application development.
    Call Stack (most recent call first):
      C:/ncs/v2.9.0/zephyr/cmake/modules/configuration_files.cmake:40 (zephyr_file)
      C:/ncs/v2.9.0/zephyr/cmake/modules/zephyr_default.cmake:133 (include)
      C:/ncs/v2.9.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
      C:/ncs/v2.9.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
      CMakeLists.txt:12 (find_package)
    
    
    -- Configuring incomplete, errors occurred!
    CMake Error at cmake/modules/sysbuild_extensions.cmake:514 (message):
      CMake configure failed for Zephyr project: mcuboot
    


    also when I used normal mcuboot.overlay i2c1 is present in zyphyr.dts

Children
No Data
Related