How to debug undefined reference to __device_dts_ord_XX errors?

Hi!

Currently, I'm trying to create a new board. I have a source code for the Thingy52 board and the code just compiles. With my own board I get __device_dts_ord_10 linker errors. And I don't know, why. I have no idea how to debug such errors since the errors are completely useless.

It says, the error is in some line

if (btn_prs) {

where btn_prs is just a boolean variable and why the linker error should be there? It doesn't make sense.

However, I somewhat found out where the problematic code segments are. They are as follows:

static const struct gpio_dt_spec led = GPIO_DT_SPEC_GET(DT_ALIAS(led0), gpios);
static const struct gpio_dt_spec button = GPIO_DT_SPEC_GET(DT_ALIAS(sw0), gpios);
If I remove some parts like this
static const struct gpio_dt_spec led
the code compiles.
And now I don't see where the problem with this is. Why it works with the Thingy52 board but not with mine? The led0 alias is defined and the led also like this
aliases {
led0 = &led0;
sw0 = &button0;
};

leds {
compatible = "gpio-leds";
led0: led_0 {
gpios = <&gpio0 7 GPIO_ACTIVE_LOW>;
label = "Red LED";
};
};

buttons {
compatible = "gpio-keys";
button0: button_0 {
gpios = <&gpio0 11 (GPIO_PULL_UP | GPIO_ACTIVE_LOW)>;
label = "Button";
};
};
 
Maybe, you can help me or give me a hint where to search for such errors.
In another project I cannot upgrade the NRF Connect SDK since such errors appear with newer versions. There is nothing documented!
  • Hi

    Do you build your project for this "shockburst probe" board?

    I'd be interested to see the generated devicetree in your build directory (build/zephyr/zephyr.dts), I think it could help a lot in figuring out what's going wrong, as this is definitely related to your devicetree setup.

    See this case where someone had a similar issue caused by missing devicetree definitions:

    https://devzone.nordicsemi.com/f/nordic-q-a/85485/how-to-use-nrf-led-matrix-sample-and-library-from-zephyr-with-nrf-connect-sdk-1-9-1-and-ses-for-use-in-an-app-on-micro-bit-v2

    -Einar

  • Here is the zephyr.dts of the build directory

    /dts-v1/;
    
    / {
    	#address-cells = < 0x1 >;
    	#size-cells = < 0x1 >;
    	model = "ShockBurst_Probe";
    	compatible = "jan,shockburst-probe";
    	chosen {
    		zephyr,entropy = &rng;
    		zephyr,flash-controller = &flash_controller;
    		zephyr,sram = &sram0;
    		zephyr,flash = &flash0;
    		zephyr,code-partition = &slot0_partition;
    	};
    	aliases {
    		led0 = &led0;
    		sw0 = &button0;
    	};
    	soc {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x1 >;
    		compatible = "nordic,nRF52810-QFAA", "nordic,nRF52810", "nordic,nRF52", "simple-bus";
    		interrupt-parent = < &nvic >;
    		ranges;
    		nvic: interrupt-controller@e000e100 {
    			#address-cells = < 0x1 >;
    			compatible = "arm,v7m-nvic";
    			reg = < 0xe000e100 0xc00 >;
    			interrupt-controller;
    			#interrupt-cells = < 0x2 >;
    			arm,num-irq-priority-bits = < 0x3 >;
    			phandle = < 0x1 >;
    		};
    		systick: timer@e000e010 {
    			compatible = "arm,armv7m-systick";
    			reg = < 0xe000e010 0x10 >;
    			status = "disabled";
    		};
    		ficr: ficr@10000000 {
    			compatible = "nordic,nrf-ficr";
    			reg = < 0x10000000 0x1000 >;
    			status = "okay";
    		};
    		uicr: uicr@10001000 {
    			compatible = "nordic,nrf-uicr";
    			reg = < 0x10001000 0x1000 >;
    			status = "okay";
    		};
    		sram0: memory@20000000 {
    			compatible = "mmio-sram";
    			reg = < 0x20000000 0x6000 >;
    		};
    		clock: clock@40000000 {
    			compatible = "nordic,nrf-clock";
    			reg = < 0x40000000 0x1000 >;
    			interrupts = < 0x0 0x1 >;
    			status = "okay";
    			label = "CLOCK";
    		};
    		power: power@40000000 {
    			compatible = "nordic,nrf-power";
    			reg = < 0x40000000 0x1000 >;
    			interrupts = < 0x0 0x1 >;
    			status = "okay";
    		};
    		bprot: bprot@40000000 {
    			compatible = "nordic,nrf-bprot";
    			reg = < 0x40000000 0x1000 >;
    			status = "okay";
    		};
    		radio: radio@40001000 {
    			compatible = "nordic,nrf-radio";
    			reg = < 0x40001000 0x1000 >;
    			interrupts = < 0x1 0x1 >;
    			status = "okay";
    			ble-2mbps-supported;
    		};
    		uart0: uart@40002000 {
    			compatible = "nordic,nrf-uarte";
    			reg = < 0x40002000 0x1000 >;
    			interrupts = < 0x2 0x1 >;
    			status = "disabled";
    			label = "UART_0";
    		};
    		i2c0: i2c@40003000 {
    			compatible = "nordic,nrf-twim";
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x0 >;
    			reg = < 0x40003000 0x1000 >;
    			clock-frequency = < 0x186a0 >;
    			interrupts = < 0x3 0x1 >;
    			status = "disabled";
    			label = "I2C_0";
    		};
    		spi0: spi@40004000 {
    			compatible = "nordic,nrf-spim";
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x0 >;
    			reg = < 0x40004000 0x1000 >;
    			interrupts = < 0x4 0x1 >;
    			status = "disabled";
    			label = "SPI_0";
    		};
    		gpiote: gpiote@40006000 {
    			compatible = "nordic,nrf-gpiote";
    			reg = < 0x40006000 0x1000 >;
    			interrupts = < 0x6 0x5 >;
    			status = "okay";
    			label = "GPIOTE_0";
    		};
    		adc: adc@40007000 {
    			compatible = "nordic,nrf-saadc";
    			reg = < 0x40007000 0x1000 >;
    			interrupts = < 0x7 0x1 >;
    			status = "disabled";
    			label = "ADC_0";
    			#io-channel-cells = < 0x1 >;
    		};
    		timer0: timer@40008000 {
    			compatible = "nordic,nrf-timer";
    			status = "okay";
    			reg = < 0x40008000 0x1000 >;
    			cc-num = < 0x4 >;
    			interrupts = < 0x8 0x1 >;
    			prescaler = < 0x0 >;
    			label = "TIMER_0";
    		};
    		timer1: timer@40009000 {
    			compatible = "nordic,nrf-timer";
    			status = "okay";
    			reg = < 0x40009000 0x1000 >;
    			cc-num = < 0x4 >;
    			interrupts = < 0x9 0x1 >;
    			prescaler = < 0x0 >;
    			label = "TIMER_1";
    		};
    		timer2: timer@4000a000 {
    			compatible = "nordic,nrf-timer";
    			status = "okay";
    			reg = < 0x4000a000 0x1000 >;
    			cc-num = < 0x4 >;
    			interrupts = < 0xa 0x1 >;
    			prescaler = < 0x0 >;
    			label = "TIMER_2";
    			phandle = < 0x2 >;
    		};
    		rtc0: rtc@4000b000 {
    			compatible = "nordic,nrf-rtc";
    			reg = < 0x4000b000 0x1000 >;
    			cc-num = < 0x3 >;
    			interrupts = < 0xb 0x1 >;
    			status = "okay";
    			clock-frequency = < 0x8000 >;
    			prescaler = < 0x1 >;
    			label = "RTC_0";
    		};
    		temp: temp@4000c000 {
    			compatible = "nordic,nrf-temp";
    			reg = < 0x4000c000 0x1000 >;
    			interrupts = < 0xc 0x1 >;
    			status = "okay";
    			label = "TEMP_0";
    		};
    		rng: random@4000d000 {
    			compatible = "nordic,nrf-rng";
    			reg = < 0x4000d000 0x1000 >;
    			interrupts = < 0xd 0x1 >;
    			status = "okay";
    			label = "RNG";
    		};
    		ecb: ecb@4000e000 {
    			compatible = "nordic,nrf-ecb";
    			reg = < 0x4000e000 0x1000 >;
    			interrupts = < 0xe 0x1 >;
    			status = "okay";
    			label = "ECB";
    		};
    		ccm: ccm@4000f000 {
    			compatible = "nordic,nrf-ccm";
    			reg = < 0x4000f000 0x1000 >;
    			interrupts = < 0xf 0x1 >;
    			length-field-length-8-bits;
    			status = "okay";
    		};
    		wdt: wdt0: watchdog@40010000 {
    			compatible = "nordic,nrf-wdt";
    			reg = < 0x40010000 0x1000 >;
    			interrupts = < 0x10 0x1 >;
    			status = "okay";
    			label = "WDT";
    		};
    		rtc1: rtc@40011000 {
    			compatible = "nordic,nrf-rtc";
    			reg = < 0x40011000 0x1000 >;
    			cc-num = < 0x4 >;
    			interrupts = < 0x11 0x1 >;
    			status = "okay";
    			clock-frequency = < 0x8000 >;
    			prescaler = < 0x1 >;
    			label = "RTC_1";
    		};
    		qdec: qdec0: qdec@40012000 {
    			compatible = "nordic,nrf-qdec";
    			reg = < 0x40012000 0x1000 >;
    			interrupts = < 0x12 0x1 >;
    			status = "disabled";
    			label = "QDEC";
    		};
    		comp: comparator@40013000 {
    			compatible = "nordic,nrf-comp";
    			reg = < 0x40013000 0x1000 >;
    			interrupts = < 0x13 0x1 >;
    			status = "disabled";
    			#io-channel-cells = < 0x1 >;
    		};
    		egu0: swi0: egu@40014000 {
    			compatible = "nordic,nrf-egu", "nordic,nrf-swi";
    			reg = < 0x40014000 0x1000 >;
    			interrupts = < 0x14 0x1 >;
    			status = "okay";
    		};
    		egu1: swi1: egu@40015000 {
    			compatible = "nordic,nrf-egu", "nordic,nrf-swi";
    			reg = < 0x40015000 0x1000 >;
    			interrupts = < 0x15 0x1 >;
    			status = "okay";
    		};
    		swi2: swi@40016000 {
    			compatible = "nordic,nrf-swi";
    			reg = < 0x40016000 0x1000 >;
    			interrupts = < 0x16 0x1 >;
    			status = "okay";
    		};
    		swi3: swi@40017000 {
    			compatible = "nordic,nrf-swi";
    			reg = < 0x40017000 0x1000 >;
    			interrupts = < 0x17 0x1 >;
    			status = "okay";
    		};
    		swi4: swi@40018000 {
    			compatible = "nordic,nrf-swi";
    			reg = < 0x40018000 0x1000 >;
    			interrupts = < 0x18 0x1 >;
    			status = "okay";
    		};
    		swi5: swi@40019000 {
    			compatible = "nordic,nrf-swi";
    			reg = < 0x40019000 0x1000 >;
    			interrupts = < 0x19 0x1 >;
    			status = "okay";
    		};
    		pwm0: pwm@4001c000 {
    			compatible = "nordic,nrf-pwm";
    			reg = < 0x4001c000 0x1000 >;
    			interrupts = < 0x1c 0x1 >;
    			status = "disabled";
    			label = "PWM_0";
    			#pwm-cells = < 0x3 >;
    		};
    		pdm0: pdm@4001d000 {
    			compatible = "nordic,nrf-pdm";
    			reg = < 0x4001d000 0x1000 >;
    			interrupts = < 0x1d 0x1 >;
    			status = "disabled";
    			label = "PDM_0";
    		};
    		flash_controller: flash-controller@4001e000 {
    			compatible = "nordic,nrf52-flash-controller";
    			reg = < 0x4001e000 0x1000 >;
    			partial-erase;
    			#address-cells = < 0x1 >;
    			#size-cells = < 0x1 >;
    			label = "NRF_FLASH_DRV_NAME";
    			flash0: flash@0 {
    				compatible = "soc-nv-flash";
    				label = "NRF_FLASH";
    				erase-block-size = < 0x1000 >;
    				write-block-size = < 0x4 >;
    				reg = < 0x0 0x30000 >;
    				partitions {
    					compatible = "fixed-partitions";
    					#address-cells = < 0x1 >;
    					#size-cells = < 0x1 >;
    					boot_partition: partition@0 {
    						label = "mcuboot";
    						reg = < 0x0 0xc000 >;
    					};
    					slot0_partition: partition@c000 {
    						label = "image-0";
    						reg = < 0xc000 0xa000 >;
    					};
    					slot1_partition: partition@16000 {
    						label = "image-1";
    						reg = < 0x16000 0xa000 >;
    					};
    					scratch_partition: partition@20000 {
    						label = "image-scratch";
    						reg = < 0x20000 0xa000 >;
    					};
    					storage_partition: partition@2a000 {
    						label = "storage";
    						reg = < 0x2a000 0x6000 >;
    					};
    				};
    			};
    		};
    		ppi: ppi@4001f000 {
    			compatible = "nordic,nrf-ppi";
    			reg = < 0x4001f000 0x1000 >;
    			status = "okay";
    		};
    		gpio0: gpio@50000000 {
    			compatible = "nordic,nrf-gpio";
    			gpio-controller;
    			reg = < 0x50000000 0x1000 >;
    			#gpio-cells = < 0x2 >;
    			label = "GPIO_0";
    			status = "okay";
    			port = < 0x0 >;
    			phandle = < 0x3 >;
    		};
    	};
    	pinctrl: pin-controller {
    		compatible = "nordic,nrf-pinctrl";
    	};
    	rng_hci: entropy_bt_hci {
    		compatible = "zephyr,bt-hci-entropy";
    		label = "bt_hci_entropy";
    		status = "okay";
    	};
    	cpus {
    		#address-cells = < 0x1 >;
    		#size-cells = < 0x0 >;
    		cpu@0 {
    			device_type = "cpu";
    			compatible = "arm,cortex-m4";
    			reg = < 0x0 >;
    			swo-ref-frequency = < 0x1e84800 >;
    		};
    	};
    	sw_pwm: sw-pwm {
    		compatible = "nordic,nrf-sw-pwm";
    		status = "disabled";
    		label = "SW_PWM";
    		generator = < &timer2 >;
    		clock-prescaler = < 0x0 >;
    		#pwm-cells = < 0x3 >;
    	};
    	leds {
    		compatible = "gpio-leds";
    		led0: led_0 {
    			gpios = < &gpio0 0x7 0x1 >;
    			label = "Status LED";
    		};
    	};
    	buttons {
    		compatible = "gpio-keys";
    		button0: button_0 {
    			gpios = < &gpio0 0xb 0x11 >;
    			label = "Button";
    		};
    	};
    };
    

  • Hi

    I can't immediately see anything wrong with this devicetree.

    Are you still having this issue? have you made any progress?

    Did the thread with the similar issue give you any leads?

    -Einar

Related