Re: DeviceTree binding problem #dts #customboard


Kumar Gala
 

On Mar 25, 2021, at 10:57 AM, wbasser@gmail.com wrote:

I created some local GPIO pins in a custom device tree for the project. It build correctly and I can see the entries in both the "build/zephyr.dts" and "build/includes/generated/devicetree_unfixed.h".
A snippet below shows the entries in the DTS file for the board
/* These aliases are provided for compatibility with samples */
aliases {
led0 = &led0;
pwm-led0 = &pwm_led0;
sw0 = &user_button;
i2c-0 = &sercom2;
test1 = &test1;
test2 = &test2;
};

outputs {
compatible = "gpio";
test1: test1_0 {
gpios = <&porta 16 0>;
label = "TEST1";
};
test2: test2_0 {
gpios = <&porta 17 0>;
label = "TEST2";
};
};



In main:
#include <zephyr.h>
#include <sys/printk.h>
#include <devicetree.h>
#include <drivers/gpio.h>

#define TEST1_ALIAS DT_ALIAS( test1 )

void main(void)
{
uint32_t uPin;

uPin = DT_GPIO_PIN( TEST1_ALIAS, gpios );

printk("Hello World! %s\n", CONFIG_ARCH);
}
I get an error on the pin assignment
ephyr/include/generated/devicetree_unfixed.h:905:30: error: 'DT_N_S_outputs_S_test1_0_P_gpios_IDX_0_VAL_pin' undeclared (first use in this function); did you mean 'DT_N_S_buttons_S_button_0_P_gpios_IDX_0_VAL_pin'? 905 | #define DT_N_ALIAS_test1 DT_N_S_outputs_S_test1_0 | ^~~~~~~~~~~~~~~~~~~~~~~~ /

Do you have a dts binding for compatible = “gpio”.

- k

Join users@lists.zephyrproject.org to automatically receive all group messages.