undefined reference to `__device_dts_ord_23'

Complete error:

C:\ncs\v2.2.0\zephyr\include\zephyr\drivers\gpio.h:1090: undefined reference to `__device_dts_ord_23'

I am an absolute newbie to device tree, so I was trying to play around to understand the API.

I took the "hello_world" zephyr example as template, and changed the main.c to the code below. No changes to the nrf52dk_nrf52832.dts, and no overlays.

I tried to add CONFIG_PWM=y as suggested in other thread on this - didn't help, still have the linking problem. The explanation on this in the API reference for DEVICE_DT_GET doesn't tell me anything.

/*
 * Copyright (c) 2012-2014 Wind River Systems, Inc.
 *
 * SPDX-License-Identifier: Apache-2.0
 */

#include <zephyr/kernel.h>
#include <zephyr/device.h>
#include <zephyr/drivers/gpio.h>
#include <zephyr/logging/log.h>

#define MY_LED_NODE DT_ALIAS(led3)
#define LED_GPIO    DT_GPIO_LABEL(MY_LED_NODE, gpios)
#define LED_PIN     DT_GPIO_PIN(MY_LED_NODE, gpios)
#define LED_FLAGS   DT_GPIO_FLAGS(MY_LED_NODE, gpios)

void led_thread( void *, void *, void * );
const k_tid_t led_thread_id;

K_THREAD_DEFINE( led_thread_id, 500, led_thread, NULL, NULL, NULL, 5, K_USER, 0);

void led_thread( void *, void *, void * )
{
    const struct device *dev = DEVICE_DT_GET(MY_LED_NODE);
    gpio_pin_configure( dev, LED_PIN, LED_FLAGS );

    uint8_t val = 0;

    while( true )
    {
        printk( "#" );
        gpio_pin_set( dev, LED_PIN, val );
        val ^= 1;
        k_msleep( 1000 );
    }

}


void main(void)
{
    printk("Hello World! %s\n", CONFIG_BOARD);
}
prj.conf just contains:
CONFIG_PWM=y
CONFIG_GPIO=y
Parents Reply Children
No Data
Related