How to remove unused UART pin configuration from nrf5340_cpuapp_common-pinctrl.dtsi?

I don't use UART of nRF5340. But west build failed if I remove unused UART pin configuration from nrf5340_cpuapp_common-pinctrl.dtsi.

/*
	uart0_default: uart0_default {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 20)>,
				<NRF_PSEL(UART_RTS, 0, 19)>;
		};
		group2 {
			psels = <NRF_PSEL(UART_RX, 0, 22)>,
				<NRF_PSEL(UART_CTS, 0, 21)>;
			bias-pull-up;
		};
	};

	uart0_sleep: uart0_sleep {
		group1 {
			psels = <NRF_PSEL(UART_TX, 0, 20)>,
				<NRF_PSEL(UART_RX, 0, 22)>,
				<NRF_PSEL(UART_RTS, 0, 19)>,
				<NRF_PSEL(UART_CTS, 0, 21)>;
			low-power-enable;
		};
	};
*/

C:\ncs\v2.4.0\nrf\samples\minimal_log>west build -b nrf5340dk_nrf5340_cpuapp
-- west build: generating a build system
Loading Zephyr default modules (Zephyr base).
-- Application: C:/ncs/v2.4.0/nrf/samples/minimal_log
-- CMake version: 3.20.5
-- Using NCS Toolchain 2.4.0 for building. (C:/ncs/toolchains/31f4403e35/cmake)
-- Found Python3: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe (found suitable exact version "3.8.2") found components: Interpreter
-- Cache files will be written to: C:/ncs/v2.4.0/zephyr/.cache
-- Zephyr version: 3.3.99 (C:/ncs/v2.4.0/zephyr)
-- Found west (found suitable version "1.0.0", minimum required is "0.7.1")
-- Board: nrf5340dk_nrf5340_cpuapp
-- Found host-tools: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found toolchain: zephyr 0.16.0 (C:/ncs/toolchains/31f4403e35/opt/zephyr-sdk)
-- Found Dtc: C:/ncs/toolchains/31f4403e35/opt/bin/dtc.exe (found suitable version "1.4.7", minimum required is "1.4.6")
-- Found BOARD.dts: C:/ncs/v2.4.0/zephyr/boards/arm/nrf5340dk_nrf5340/nrf5340dk_nrf5340_cpuapp.dts
devicetree error: /soc/peripheral@50000000/uart@8000: undefined node label 'uart0_default'
-- In: C:/ncs/v2.4.0/nrf/samples/minimal_log/build/zephyr, command: C:/ncs/toolchains/31f4403e35/opt/bin/python.exe;C:/ncs/v2.4.0/zephyr/scripts/dts/gen_defines.py;--dts;C:/ncs/v2.4.0/nrf/samples/minimal_log/build/zephyr/zephyr.dts.pre;--dtc-flags;'-Wno-unique_unit_address_if_enabled';--bindings-dirs;C:/ncs/v2.4.0/nrf/dts/bindings;C:/ncs/v2.4.0/zephyr/dts/bindings;--header-out;C:/ncs/v2.4.0/nrf/samples/minimal_log/build/zephyr/include/generated/devicetree_generated.h.new;--dts-out;C:/ncs/v2.4.0/nrf/samples/minimal_log/build/zephyr/zephyr.dts.new;--edt-pickle-out;C:/ncs/v2.4.0/nrf/samples/minimal_log/build/zephyr/edt.pickle;--vendor-prefixes;C:/ncs/v2.4.0/nrf/dts/bindings/vendor-prefixes.txt;--vendor-prefixes;C:/ncs/v2.4.0/zephyr/dts/bindings/vendor-prefixes.txt
CMake Error at C:/ncs/v2.4.0/zephyr/cmake/modules/dts.cmake:276 (message):
  gen_defines.py failed with return code: 1
Call Stack (most recent call first):
  C:/ncs/v2.4.0/zephyr/cmake/modules/zephyr_default.cmake:115 (include)
  C:/ncs/v2.4.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:66 (include)
  C:/ncs/v2.4.0/zephyr/share/zephyr-package/cmake/ZephyrConfig.cmake:92 (include_boilerplate)
  CMakeLists.txt:5 (find_package)


-- Configuring incomplete, errors occurred!
FATAL ERROR: command exited with status 1: 'C:\ncs\toolchains\31f4403e35\opt\bin\cmake.EXE' '-DWEST_PYTHON=C:\ncs\toolchains\31f    f4403e35\opt\bin\python.exe' '-BC:\ncs\v2.4.0\nrf\samples\minimal_log\build' -GNinja -DBOARD=nrf5340dk_nrf5340_cpuapp '-SC:\ncs\v2.4.0\nrf\samples\minimal_log'

Parents
  • Hello,

    It is not a good practice to change or delete items from the provided board files (like nrf5340_cpuapp_common-pinctrl.dtsi) unless it is a custom board where you know what and why you are doing so.

    The recommended way to change the hardware configuration is using board files along with the overlay files.

    Also, it is recommended that if you are not using some peripheral then you disable it in the overlay.

    For example, the uart0 can be disabled by having following in the overlay:

    &uart0{
    status = "disabled";
    };

    Also, please note that the name of the overlay should be correct and matching the board that is being used for building the project.

    I would also recommend checking and confirming in the compiled DTS (./build/zephyr/zephyr.dts)

    BR, Naeem

Reply
  • Hello,

    It is not a good practice to change or delete items from the provided board files (like nrf5340_cpuapp_common-pinctrl.dtsi) unless it is a custom board where you know what and why you are doing so.

    The recommended way to change the hardware configuration is using board files along with the overlay files.

    Also, it is recommended that if you are not using some peripheral then you disable it in the overlay.

    For example, the uart0 can be disabled by having following in the overlay:

    &uart0{
    status = "disabled";
    };

    Also, please note that the name of the overlay should be correct and matching the board that is being used for building the project.

    I would also recommend checking and confirming in the compiled DTS (./build/zephyr/zephyr.dts)

    BR, Naeem

Children
Related