Skip to main content
Visitor II
February 11, 2025
Question

Enable Counter Driver on zephyr

  • February 11, 2025
  • 1 reply
  • 667 views

Hi Everyone

I face other problem of Counter driver on zephyr for STM32MP157 DK2 kit

Here is dts:

&timers5 {
status = "okay";

counter {
compatible = "st,stm32-counter";
status = "okay";
};
};

and prj config:

CONFIG_COUNTER=y

I face problem:

zephyr-sdk-0.17.0/arm-zephyr-eabi/bin/../lib/gcc/arm-zephyr-eabi/12.2.0/../../../../arm-zephyr-eabi/bin/ld.bfd: app/libapp.a(main.c.obj): in function z_impl_counter_get_frequency': /home/dotaituan/Documents/2nd_LEAPS/03_git/134-zephyr/zephyr/include/zephyr/drivers/counter.h:301: undefined reference to __device_dts_ord_66' collect2: error: ld returned 1 exit status ninja: build stopped: subcommand failed.


Anyone could help?

Thank you so much!

1 reply

ST Employee
February 11, 2025

Hello @dotaituan

This is a linker error, check this troubleshooting devicetree: Troubleshooting devicetree — Zephyr Project Documentation.

To fix it, you need to make sure that:

  1. The node is enabled: the node must have status = "okay"; (Recall that a missing status property means the same thing as status = "okay")

  2. A device driver responsible for allocating the struct device is enabled. That is, the Kconfig option which makes the build system compile the driver sources into your application needs to be set to y.