Device tree error for USB CDC on custom board

Hello everyone,

I working on the device tree of a custom board based on nRF5340. My starting point was the Thingy:53 device tree.

When I try to enable USB CDC for console and shell, I got the following building error with zephyr usb console sample:

/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/toolchains/1f9b40e71a/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/console/libdrivers__console.a(uart_console.c.obj): in function `uart_console_init':
/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/v2.4.0/zephyr/drivers/console/uart_console.c:613: undefined reference to `__device_dts_ord_123'
/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/toolchains/1f9b40e71a/opt/zephyr-sdk/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: zephyr/drivers/console/libdrivers__console.a(uart_console.c.obj): in function `console_out':
/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/v2.4.0/zephyr/drivers/console/uart_console.c:110: undefined reference to `__device_dts_ord_123'

Extract of build/zephyr/include/generated/devicetree_generated.h:

 *   122 /soc/peripheral@50000000/usbd@36000
 *   123 /soc/peripheral@50000000/usbd@36000/cdc_acm_uart0
 *   124 /soc/peripheral@50000000/usbd@36000/cdc_acm_uart1
 

My device tree:

erl_nrf5340.zip

The only way to successfully build is to disabled uart0 and uart1 in the device tree, but its not acceptable because they will be used in final application.

Thank you for your help.

Parents
  • Hey Benoit,

    Can you share the zephyr.dts and .config files from your build folder?

    BR,

  • Hmm...

    [73/255] Building C object zephyr/CMakeFiles/zephyr.dir/subsys/usb/device/class/cdc_acm.c.obj
    /home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/v2.4.0/zephyr/subsys/usb/device/class/cdc_acm.c:63:2: warning: #warning "USB_CDC_ACM_LOG_LEVEL forced to LOG_LEVEL_NONE" [-Wcpp]
    63 | #warning "USB_CDC_ACM_LOG_LEVEL forced to LOG_LEVEL_NONE"
    | ^~~~~~~

    We need to find out why 

  • CONFIG_LOG_BACKEND_UART=y
    # CONFIG_LOG_BACKEND_UART_ASYNC is not set
    Try setting this async flag.
  • It's MCUBoot that fails to build : 

    === child image mcuboot -  begin ===
    loading initial cache file /home/bgorostidi/Workspace/Projects/Iot/nrf53_test/console_usb/build_erl/mcuboot/child_image_preload.cmake
    -- Application: /home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/v2.4.0/bootloader/mcuboot/boot/zephyr
    -- CMake version: 3.20.5
    Loading Zephyr default modules (Zephyr base).
    -- Found Python3: /home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/toolchains/1f9b40e71a/usr/local/bin/python3.8 (found suitable exact version "3.8.2") found components: Interpreter 
    -- Cache files will be written to: /home/bgorostidi/.cache/zephyr
    -- Zephyr version: 3.3.99 (/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/v2.4.0/zephyr)
    -- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
    -- Board: erl_nrf5340_cpuapp
    -- Found host-tools: zephyr 0.16.0 (/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/toolchains/1f9b40e71a/opt/zephyr-sdk)
    -- Found toolchain: zephyr 0.16.0 (/home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/toolchains/1f9b40e71a/opt/zephyr-sdk)
    -- Found Dtc: /home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/toolchains/1f9b40e71a/usr/bin/dtc (found suitable version "1.4.7", minimum required is "1.4.6") 
    -- Found BOARD.dts: /home/bgorostidi/Workspace/Projects/Iot/nrf53_test/console_usb/boards/arm/erl_nrf5340/erl_nrf5340_cpuapp.dts
    -- Found devicetree overlay: /home/bgorostidi/Workspace/Toolchains/nrfConnect_SDK/v2.4.0/bootloader/mcuboot/boot/zephyr/app.overlay
    -- Generated zephyr.dts: /home/bgorostidi/Workspace/Projects/Iot/nrf53_test/console_usb/build_erl/mcuboot/zephyr/zephyr.dts

    You need to make sure you set the proper configs for the MCUBoot child image. See bootloader\mcuboot\boot\zephyr\boards\thingy53_nrf5340_cpuapp.conf for an example. 

  • I looked to MCUBoot conf and put recommended conf into child_image/mcuboot.conf without external flash config. I also updated custom dts to add mcuboot Led/Button:

    		mcuboot-button0 = &button0;
    		mcuboot-led0 = &blue_led;

    I'm now getting errors relating to Partition Manager.

    Special question for my knowledge: Why my custom board, used on a sample project without 'CONFIG_BOOTLOADER_MCUBOOT=y' build an mcuboot image?

    0116.files.zip

Reply Children
Related