Annoying random compilation issues with no deterministic solution (VScode + NRF Connect SDK)

Good morning,

I am working on a firmware for a custom board featuring an NRF52833 + an NRF21540 FEM; I am creating both a peripheral and a central device.

The problem I ran into several times now, is that at a given point, without any evident reason, my code stops compiling and I get a bunch of

errors that are difficult to understand and which are reported below.

In file included from /opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/toolchain/gcc.h:89,
                 from /opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/toolchain.h:50,
                 from /opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/init.h:13,
                 from /opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/device.h:13,
                 from /Users/lbe/workspace/Projects/e-brain/zephyr_code/Security_And_LongRange/ebrain_peripheral_uart/src/uart_async_adapter.h:22,
                 from /Users/lbe/workspace/Projects/e-brain/zephyr_code/Security_And_LongRange/ebrain_peripheral_uart/src/main.c:32:
/opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/device.h:83:41: error: '__device_dts_ord_60' undeclared here (not in a function); did you mean '__device_dts_ord_10'?
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                         ^~~~~~~~~
/opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/toolchain/common.h:132:26: note: in definition of macro '_DO_CONCAT'
  132 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/device.h:83:33: note: in expansion of macro '_CONCAT'
   83 | #define DEVICE_NAME_GET(dev_id) _CONCAT(__device_, dev_id)
      |                                 ^~~~~~~
/opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/device.h:209:37: note: in expansion of macro 'DEVICE_NAME_GET'
  209 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_ID(node_id))
      |                                     ^~~~~~~~~~~~~~~
/opt/nordic/ncs/v2.3.0/zephyr/include/zephyr/device.h:226:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  226 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/Users/lbe/workspace/Projects/e-brain/zephyr_code/Security_And_LongRange/ebrain_peripheral_uart/src/main.c:96:36: note: in expansion of macro 'DEVICE_DT_GET'
   96 | static const struct device *uart = DEVICE_DT_GET(DT_CHOSEN(ebrain_uart));
      |                                    ^~~~~~~~~~~~~
../src/main.c: In function 'uart_test_async_api':
/Users/lbe/workspace/Projects/e-brain/zephyr_code/Security_And_LongRange/ebrain_peripheral_uart/src/main.c:302:20: error: 'const struct uart_driver_api' has no member named 'callback_set'
  302 |         return (api->callback_set != NULL);
      |                    ^~
ninja: build stopped: subcommand failed.
FATAL ERROR: command exited with status 1: /opt/nordic/ncs/toolchains/v2.3.0/bin/cmake --build /Users/lbe/workspace/Projects/e-brain/zephyr_code/Security_And_LongRange/ebrain_peripheral_uart/build

The issue appears on code that worked perfectly fine; in the case above I just added 1 line of code, and the error arose.

Of course, I tried removing the newly added line of code, but got the same error.

As I already did in the past, I removed the project and got a fresh copy from the git repository storing functional code; still the same error.
I tried reboot of the computer, still error.

Every time I ran into this problem, I spend a ridiculous amount of time trying random things, until in the end, for an unknown reason, the

code compiles again.

Is anyone able to understand what happens here, and what is the solution to fix the problem?

Thanks in advance,


Lorenzo

Parents
  • Hello,

    Thank you for contacting DevZone at NordicSemi.

    As this is a custom board, I might need your help to reproduce it on the DK.

    Nonetheless, from the error, it looks like something is missing (or in error) in the Device-Tree.


    How are your overlay files looking? Have you enabled uart in your project configuration?

    From the line number 26 of the output you have shared:
    it says that there is error in main.c at 320:20, and that error is related to uart_driver_api; what is this line in your code?

    Either uart is not enabled, or some issue with uart configuration. What project configurations you are using?

    The issue appears on code that worked perfectly fine; in the case above I just added 1 line of code, and the error arose.

    Of course, I tried removing the newly added line of code, but got the same error.

    This is something bothering me. So the code was working perfectly, and you added a single line of code, and it broke, and then after removing that line, you are getting the same error? Have you tried pristine build (after removing that line)? I don't have any idea other than this. But you may make sure that nothing else has changed (including configs, includes, board etc).

    Regards,

    Naeem

Reply
  • Hello,

    Thank you for contacting DevZone at NordicSemi.

    As this is a custom board, I might need your help to reproduce it on the DK.

    Nonetheless, from the error, it looks like something is missing (or in error) in the Device-Tree.


    How are your overlay files looking? Have you enabled uart in your project configuration?

    From the line number 26 of the output you have shared:
    it says that there is error in main.c at 320:20, and that error is related to uart_driver_api; what is this line in your code?

    Either uart is not enabled, or some issue with uart configuration. What project configurations you are using?

    The issue appears on code that worked perfectly fine; in the case above I just added 1 line of code, and the error arose.

    Of course, I tried removing the newly added line of code, but got the same error.

    This is something bothering me. So the code was working perfectly, and you added a single line of code, and it broke, and then after removing that line, you are getting the same error? Have you tried pristine build (after removing that line)? I don't have any idea other than this. But you may make sure that nothing else has changed (including configs, includes, board etc).

    Regards,

    Naeem

Children
No Data
Related