Failing to configure USB console and SW update

I'm trying to enable USB for console and SW update over USB but failing miserably.

I'm getting errors:
zephyr/drivers/console/libdrivers__console.a(uart_console.c.obj): in function `uart_console_init': v2.4.2\zephyr\drivers\console\uart_console.c:613: undefined reference to `__device_dts_ord_124'

and

zephyr/drivers/console/libdrivers__console.a(uart_console.c.obj): in function `console_out': zephyr\drivers\console\uart_console.c:110: undefined reference to `__device_dts_ord_124'

My related .dts definitions are as follows:

/ {
	chosen {
		zephyr,console = &cdc_acm_uart0;
		zephyr,shell-uart = &cdc_acm_uart0;
		zephyr,uart-mcumgr = &cdc_acm_uart0;
		zephyr,bt-mon-uart = &cdc_acm_uart0;
		zephyr,bt-c2h-uart = &cdc_acm_uart0;
		zephyr,bt-hci-rpmsg-ipc = &ipc0;
		// nordic,802154-spinel-ipc = &ipc0;
		// zephyr,ieee802154 = &ieee802154;
	};
};

zephyr_udc0: &usbd {
	compatible = "nordic,nrf-usbd";
	status = "okay";

	cdc_acm_uart0: cdc_acm_uart0 {
		compatible = "zephyr,cdc-acm-uart";
		status = "okay";
	};
};

The flags that trigger the error are:
CONFIG_CONSOLE=y
CONFIG_UART_CONSOLE=y
CONFIG_MCUMGR_TRANSPORT_UART=y
CONFIG_UART_CONSOLE_MCUMGR=y
CONFIG_RTT_CONSOLE=y

When looking the driver code, it should pick zephyr,console definition but for some reason, it is not included in the build...

Parents
  • Hi,

    Could you locate the file below in your build folder and tell me which peripheral matches the ord number. They are listed at the start of the file.

        build\zephyr\include\generated\devicetree_generated.h

    If you rebuild, check if the number in the __device_dts_ord_124 part of the error message changes from 124 to something else.

    I assume that USB configs are enabled? For example CONFIG_USB_CDC_ACM=y
    And that uart0 is enabled?

  • I'm not seeing anything starting with "__device_dts" in the devicetree_generated.h. 

    Chosen nodes have been converted into:

    #define DT_CHOSEN_zephyr_console                          DT_N_S_soc_S_peripheral_50000000_S_usbd_36000_S_cdc_acm_uart0
    #define DT_CHOSEN_zephyr_console_EXISTS                   1
    #define DT_CHOSEN_zephyr_shell_uart                       DT_N_S_soc_S_peripheral_50000000_S_usbd_36000_S_cdc_acm_uart0
    #define DT_CHOSEN_zephyr_shell_uart_EXISTS                1
    #define DT_CHOSEN_zephyr_uart_mcumgr                      DT_N_S_soc_S_peripheral_50000000_S_usbd_36000_S_cdc_acm_uart0
    #define DT_CHOSEN_zephyr_uart_mcumgr_EXISTS               1
    


    I've CONFIG_USB_CDC_ACM=y as well as CONFIG_SERIAL=y (I'm using other UARTs in the solution).

    UART0 is enabled through dts file as follows (do I need to have it there even though I'm using USB UART emulation):
    &uart0 {
    	compatible = "nordic,nrf-uarte";
    	status = "okay";
    	current-speed = <115200>;
    	pinctrl-0 = <&uart1_default>;
    	pinctrl-1 = <&uart1_sleep>;
    	pinctrl-names = "default", "sleep";
    };
    

  • Could you zip and attach your project? Or reproduce it in a sample and attach that?

  • Thanks for taking the time to look into this. I attached carved out version that still produces the error.
    hw25firmware_stub.zip

Reply Children
Related