Uart Device from zephyr get eroor

Hi,

In the NCS V2.3.0 version, I successfully obtained the serial device through the following code and compiled it
But when I get the serial device in the same way in NCS V2.6.1, there is an error and I want to know what causes this?

static const struct device *const uart0_dev = DEVICE_DT_GET(DT_NODELABEL(uart0));
static const struct device *const uart1_dev = DEVICE_DT_GET(DT_NODELABEL(uart1));

nrf52840dk_nrf52840.overlay

/*
 * Copyright (c) 2021-2022 Nordic Semiconductor ASA
 *
 * SPDX-License-Identifier: LicenseRef-Nordic-5-Clause
 */

/ {
	chosen {
		nordic,pm-ext-flash = &mx25r64;
		zephyr,console = &uart0;
	};

	/*
	* In some default configurations within the nRF Connect SDK,
	* e.g. on nRF52840, the chosen zephyr,entropy node is &cryptocell.
	* This devicetree overlay ensures that default is overridden wherever it
	* is set, as this application uses the RNG node for entropy exclusively.
	*/

	chosen {
		zephyr,entropy = &rng;
	};

	/*
	* By default, PWM module is only configured for led0 (LED1 on the board).
	* The light bulb app, however, uses LED2 to show the state of the lighting,
	* including its brightness level.
	*/
	aliases {
		pwm-led1 = &pwm_led1;
	};

	pwmleds {
		compatible = "pwm-leds";
		pwm_led1: pwm_led_1 {
			pwms = <&pwm0 1 PWM_MSEC(2) PWM_POLARITY_INVERTED>;
		};
	};

};

&pwm0 {
	pinctrl-0 = <&pwm0_default_alt>;
	pinctrl-1 = <&pwm0_sleep_alt>;
	pinctrl-names = "default", "sleep";
};

&pinctrl {
	pwm0_default_alt: pwm0_default_alt {
		group1 {
			psels = <NRF_PSEL(PWM_OUT1, 0, 14)>;
			nordic,invert;
		};
	};

	pwm0_sleep_alt: pwm0_sleep_alt {
		group1 {
			psels = <NRF_PSEL(PWM_OUT1, 0, 14)>;
			low-power-enable;
		};
	};

};

&pinctrl {
vcom0_default: vcom0_default {
	group1 {
		psels = <NRF_PSEL(UART_TX, 1, 1)>;
	};
	group2 {
		psels = <NRF_PSEL(UART_RX, 1, 0)>;
		bias-pull-up;
	};
};

vcom0_sleep: vcom0_sleep {
	group1 {
		psels = <NRF_PSEL(UART_TX, 1, 1)>,
			<NRF_PSEL(UART_RX, 1, 0)>;
		low-power-enable;
	};
};

uart1_default: uart1_default {
	group1 {
		psels = <NRF_PSEL(UART_TX, 1, 13)>;
	};
	group2 {
		psels = <NRF_PSEL(UART_RX, 0, 29)>;
		bias-pull-up;
	};

};

uart1_sleep: uart1_sleep {
	group1 {
		psels = <NRF_PSEL(UART_TX, 1, 13)>,
			<NRF_PSEL(UART_RX, 0, 29)>;
		low-power-enable;
	};
};
};

&uart0 {
	status = "okay";
	current-speed = <115200>;
	pinctrl-0 = <&vcom0_default>;
	pinctrl-1 = <&vcom0_sleep>;
	pinctrl-names = "default", "sleep";
};

// Give the pins to UART1, and enable it
&uart1 {
	status = "okay";
	current-speed = <9600>;
	pinctrl-0 = <&uart1_default>;
	pinctrl-1 = <&uart1_sleep>;
	pinctrl-names = "default", "sleep";
};


/* Disable unused peripherals to reduce power consumption */
&adc {
	status = "disabled";
};
&uart1 {
	status = "disabled";
};
&i2c0 {
	status = "disabled";
};
&spi1 {
	status = "disabled";
};
&spi3 {
	status = "disabled";
};
&usbd {
	status = "disabled";
};

build error

FAILED: CMakeFiles/app.dir/src/app_task.cpp.obj 
E:\ncs\toolchains\cf2149caf2\opt\zephyr-sdk\arm-zephyr-eabi\bin\arm-zephyr-eabi-g++.exe -DCHIP_BYPASS_IDL -DCHIP_HAVE_CONFIG_H -DKERNEL -DMBEDTLS_CONFIG_FILE=\"nrf-config.h\" -DMBEDTLS_PSA_CRYPTO_CONFIG_FILE=\"nrf-psa-crypto-want-config.h\" -DMBEDTLS_PSA_CRYPTO_USER_CONFIG_FILE=\"nrf-psa-crypto-config.h\" -DNRF52840_XXAA -DNRF_802154_ACK_TIMEOUT_ENABLED=1 -DNRF_802154_CARRIER_FUNCTIONS_ENABLED=0 -DNRF_802154_CCA_CORR_LIMIT_DEFAULT=2 -DNRF_802154_CCA_CORR_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_ED_THRESHOLD_DEFAULT=45 -DNRF_802154_CCA_MODE_DEFAULT=NRF_RADIO_CCA_MODE_ED -DNRF_802154_ECB_PRIORITY=-1 -DNRF_802154_ENCRYPTION_ENABLED=1 -DNRF_802154_ENERGY_DETECTED_VERSION=1 -DNRF_802154_IE_WRITER_ENABLED=1 -DNRF_802154_INTERNAL_RADIO_IRQ_HANDLING=0 -DNRF_802154_PENDING_EXTENDED_ADDRESSES=16 -DNRF_802154_PENDING_SHORT_ADDRESSES=16 -DNRF_802154_PLATFORM_ASSERT_INCLUDE=\"nrf_802154_assert_zephyr.h\" -DNRF_802154_RX_BUFFERS=16 -DNRF_802154_SECURITY_KEY_STORAGE_SIZE=3 -DNRF_802154_SECURITY_WRITER_ENABLED=1 -DNRF_802154_SERIALIZATION_HOST=0 -DNRF_802154_SWI_PRIORITY=1 -DNRF_802154_TX_STARTED_NOTIFY_ENABLED=1 -DNRF_802154_USE_RAW_API=1 -DUSE_PARTITION_MANAGER=1 -DZCBOR_ASSERTS -D_ANSI_SOURCE -D_FORTIFY_SOURCE=1 -D_POSIX_C_SOURCE=200809 -D__LINUX_ERRNO_EXTENSIONS__ -D__PROGRAM_START -D__ZEPHYR__=1 -IE:/ncs/v2.6.1/nrf/samples/matter/common/src -IE:/my_prj/v2.6.1/light_bulb1/src -IE:/my_prj/v2.6.1/light_bulb1/src/zap-generated -IE:/ncs/v2.6.1/nrf/drivers/mpsl/clock_control -IE:/ncs/v2.6.1/zephyr/include -IE:/my_prj/v2.6.1/light_bulb1/build_52840/zephyr/include/generated -IE:/ncs/v2.6.1/zephyr/soc/arm/nordic_nrf/nrf52 -IE:/ncs/v2.6.1/zephyr/lib/libc/newlib/include -IE:/ncs/v2.6.1/zephyr/soc/common/nordic_nrf/. -IE:/ncs/v2.6.1/zephyr/soc/arm/nordic_nrf/common/. -IE:/ncs/v2.6.1/zephyr/subsys/mgmt/mcumgr/util/include -IE:/ncs/v2.6.1/zephyr/subsys/mgmt/mcumgr/transport/include -IE:/ncs/v2.6.1/zephyr/subsys/bluetooth -IE:/ncs/v2.6.1/zephyr/subsys/settings/include -IE:/ncs/v2.6.1/nrf/include -IE:/ncs/v2.6.1/nrf/lib/multithreading_lock/. -IE:/ncs/v2.6.1/nrf/subsys/bluetooth/controller/. -IE:/ncs/v2.6.1/nrf/subsys/trusted_storage/include -IE:/ncs/v2.6.1/zephyr/drivers/flash -IE:/ncs/v2.6.1/nrf/tests/include -IE:/ncs/v2.6.1/zephyr/modules/openthread/platform/. -IE:/ncs/v2.6.1/modules/hal/cmsis/CMSIS/Core/Include -IE:/ncs/v2.6.1/zephyr/modules/cmsis/. -IE:/ncs/v2.6.1/modules/hal/nordic/nrfx -IE:/ncs/v2.6.1/modules/hal/nordic/nrfx/drivers/include -IE:/ncs/v2.6.1/modules/hal/nordic/nrfx/mdk -IE:/ncs/v2.6.1/zephyr/modules/hal_nordic/nrfx/. -IE:/ncs/v2.6.1/modules/debug/segger/SEGGER -IE:/ncs/v2.6.1/modules/debug/segger/Config -IE:/ncs/v2.6.1/modules/lib/zcbor/include -IE:/ncs/v2.6.1/nrfxlib/nfc/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/fem/common/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/fem/nrf21540_gpio/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/fem/nrf21540_gpio_spi/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/fem/simple_gpio/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/fem/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/fem/include/protocol -IE:/ncs/v2.6.1/nrfxlib/mpsl/include -IE:/ncs/v2.6.1/nrfxlib/mpsl/include/protocol -IE:/ncs/v2.6.1/nrfxlib/openthread/include -IE:/ncs/v2.6.1/nrfxlib/crypto/nrf_oberon/include/mbedtls -IE:/ncs/v2.6.1/nrfxlib/crypto/nrf_oberon/include -IE:/my_prj/v2.6.1/light_bulb1/build_52840/modules/nrf/subsys/nrf_security/src/include/generated -IE:/ncs/v2.6.1/nrf/subsys/nrf_security/include -IE:/ncs/v2.6.1/nrf/ext/oberon/psa/core/include -IE:/ncs/v2.6.1/nrf/ext/oberon/psa/core/library -IE:/ncs/v2.6.1/modules/crypto/mbedtls/include -IE:/ncs/v2.6.1/modules/crypto/mbedtls/library -IE:/ncs/v2.6.1/nrf/ext/oberon/psa/drivers -IE:/ncs/v2.6.1/nrfxlib/nrf_802154/driver/include -IE:/ncs/v2.6.1/nrfxlib/nrf_802154/sl/include -IE:/ncs/v2.6.1/nrfxlib/nrf_802154/common/include -IE:/ncs/v2.6.1/zephyr/modules/hal_nordic/nrf_802154/include -IE:/ncs/v2.6.1/nrfxlib/softdevice_controller/include -IE:/ncs/v2.6.1/modules/lib/matter/src -IE:/ncs/v2.6.1/modules/lib/matter/src/include -IE:/ncs/v2.6.1/modules/lib/matter/third_party/nlassert/repo/include -IE:/ncs/v2.6.1/modules/lib/matter/third_party/nlio/repo/include -IE:/ncs/v2.6.1/modules/lib/matter/zzz_generated/app-common -IE:/my_prj/v2.6.1/light_bulb1/build_52840/modules/connectedhomeip/gen/include -IE:/ncs/v2.6.1/modules/lib/matter/examples/providers -IE:/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/zephyr/.. -IE:/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/zephyr/../include -IE:/ncs/v2.6.1/bootloader/mcuboot/boot/bootutil/zephyr/../../zephyr/include -isystem E:/ncs/v2.6.1/zephyr/lib/libc/common/include -isystem E:/ncs/v2.6.1/nrfxlib/crypto/nrf_cc310_platform/include "-DCHIP_ADDRESS_RESOLVE_IMPL_INCLUDE_HEADER=<lib/address_resolve/AddressResolve_DefaultImpl.h>" -fno-strict-aliasing -O2 -fcheck-new -std=c++17 -Wno-register -fno-exceptions -fno-rtti -imacros E:/my_prj/v2.6.1/light_bulb1/build_52840/zephyr/include/generated/autoconf.h -fno-common -g -gdwarf-4 -fdiagnostics-color=always -mcpu=cortex-m4 -mthumb -mabi=aapcs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mfp16-format=ieee --sysroot=E:/ncs/toolchains/cf2149caf2/opt/zephyr-sdk/arm-zephyr-eabi/arm-zephyr-eabi -imacros E:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/zephyr_stdint.h -Wall -Wformat -Wformat-security -Wno-format-zero-length -Wpointer-arith -Wexpansion-to-defined -Wno-unused-but-set-variable -fno-pic -fno-pie -fno-asynchronous-unwind-tables -fno-reorder-functions --param=min-pagesize=0 -fno-defer-pop -fmacro-prefix-map=E:/my_prj/v2.6.1/light_bulb1=CMAKE_SOURCE_DIR -fmacro-prefix-map=E:/ncs/v2.6.1/zephyr=ZEPHYR_BASE -fmacro-prefix-map=E:/ncs/v2.6.1=WEST_TOPDIR -ffunction-sections -fdata-sections -specs=nano.specs -D_POSIX_THREADS -std=gnu++17 -D_SYS__PTHREADTYPES_H_ -MD -MT CMakeFiles/app.dir/src/app_task.cpp.obj -MF CMakeFiles\app.dir\src\app_task.cpp.obj.d -o CMakeFiles/app.dir/src/app_task.cpp.obj -c E:/my_prj/v2.6.1/light_bulb1/src/app_task.cpp
In file included from E:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/gcc.h:98,
                 from E:/ncs/v2.6.1/zephyr/include/zephyr/toolchain.h:50,
                 from E:/ncs/v2.6.1/zephyr/include/zephyr/sys/util.h:18,
                 from E:/ncs/v2.6.1/zephyr/include/zephyr/devicetree.h:26,
                 from E:/ncs/v2.6.1/nrf/samples/matter/common/src/board/board_config.h:9,
                 from E:/ncs/v2.6.1/nrf/samples/matter/common/src/board/board.h:9,
                 from E:/my_prj/v2.6.1/light_bulb1/src/app_task.h:9,
                 from E:/my_prj/v2.6.1/light_bulb1/src/app_task.cpp:7:
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: error: '__device_dts_ord_124' was not declared in this scope; did you mean '__device_dts_ord_24'?
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
  216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
E:/my_prj/v2.6.1/light_bulb1/src/app_task.cpp:69:47: note: in expansion of macro 'DEVICE_DT_GET'
   69 | static const struct device *const uart1_dev = DEVICE_DT_GET(DT_NODELABEL(uart1));
      |                                               ^~~~~~~~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:41: note: maximum limit of 1000 namespaces searched for '__device_dts_ord_124'
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/toolchain/common.h:137:26: note: in definition of macro '_DO_CONCAT'
  137 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:89:33: note: in expansion of macro '_CONCAT'
   89 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:216:37: note: in expansion of macro 'DEVICE_NAME_GET'
  216 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
E:/ncs/v2.6.1/zephyr/include/zephyr/device.h:233:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  233 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
E:/my_prj/v2.6.1/light_bulb1/src/app_task.cpp:69:47: note: in expansion of macro 'DEVICE_DT_GET'
   69 | static const struct device *const uart1_dev = DEVICE_DT_GET(DT_NODELABEL(uart1));
      |                                               ^~~~~~~~~~~~~
[514/531] Building CXX object CMakeFiles/app.dir/E_/ncs/v2.6.1/modules/lib/matter/zzz_generated/app-common/app-common/zap-generated/cluster-objects.cpp.obj
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: 'E:\ncs\toolchains\cf2149caf2\opt\bin\cmake.EXE' --build 'e:\my_prj\v2.6.1\light_bulb1\build_52840'

Related