This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Zephyr nRF52840 EEPROM Sample code compilation error

Hello,

I am a beginner in nRF. I want to implement EEPROM. So I am trying to execute Zephyr/sample/driver/EEPROM code but I am getting compilation error the below error message for board nrf52840dk_nrf52840.

In function 'get_eeprom_device':
/home/neeraj/Applications/Nordic/zephyr/include/device.h:81:39: error: '__device_dts_ord_DT_N_ALIAS_eeprom_0_ORD' undeclared (first use in this function)
   81 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                                       ^~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/toolchain/common.h:124:26: note: in definition of macro '_DO_CONCAT'
  124 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/neeraj/Applications/Nordic/zephyr/include/device.h:81:31: note: in expansion of macro '_CONCAT'
   81 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                               ^~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/device.h:233:37: note: in expansion of macro 'DEVICE_NAME_GET'
  233 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_NAME(node_id))
      |                                     ^~~~~~~~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/device.h:247:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  247 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/samples/drivers/eeprom/src/main.c:25:29: note: in expansion of macro 'DEVICE_DT_GET'
   25 |  const struct device *dev = DEVICE_DT_GET(DT_ALIAS(eeprom_0));
      |                             ^~~~~~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/device.h:81:39: note: each undeclared identifier is reported only once for each function it appears in
   81 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                                       ^~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/toolchain/common.h:124:26: note: in definition of macro '_DO_CONCAT'
  124 | #define _DO_CONCAT(x, y) x ## y
      |                          ^
/home/neeraj/Applications/Nordic/zephyr/include/device.h:81:31: note: in expansion of macro '_CONCAT'
   81 | #define DEVICE_NAME_GET(name) _CONCAT(__device_, name)
      |                               ^~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/device.h:233:37: note: in expansion of macro 'DEVICE_NAME_GET'
  233 | #define DEVICE_DT_NAME_GET(node_id) DEVICE_NAME_GET(Z_DEVICE_DT_DEV_NAME(node_id))
      |                                     ^~~~~~~~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/include/device.h:247:34: note: in expansion of macro 'DEVICE_DT_NAME_GET'
  247 | #define DEVICE_DT_GET(node_id) (&DEVICE_DT_NAME_GET(node_id))
      |                                  ^~~~~~~~~~~~~~~~~~
/home/neeraj/Applications/Nordic/zephyr/samples/drivers/eeprom/src/main.c:25:29: note: in expansion of macro 'DEVICE_DT_GET'
   25 |  const struct device *dev = DEVICE_DT_GET(DT_ALIAS(eeprom_0));
      |                             ^~~~~~~~~~~~~

I believe this error is because there is no eeprom_0 declaration in <board>.dts file. If this error is due to the same then what shall I declare in my nrf52840dk_nrf52840.overlay file?

Thanks in advance.

Regards,

Neeraj Dhekale

Parents
  • Hello All,

    I have added below EEPROM in the nrf52840dk_nrf52840.overlay file.

    eeprom0: eeprom0 {
    status = "okay";
    compatible = "zephyr,sim-eeprom";
    label = "EEPROM_0";
    size = <DT_SIZE_K(4)>;
    };

    But getting below error message:

    /home/neeraj/gnuarmemb/bin/../lib/gcc/arm-none-eabi/10.3.1/../../../../arm-none-eabi/bin/ld.bfd: app/libapp.a(main.c.obj): in function `z_impl_eeprom_write':
    /home/neeraj/Applications/Nordic/zephyr/include/drivers/eeprom.h:90: undefined reference to `__device_dts_ord_5'.

    Please help.

    Thanks and regards,

    Neeraj Dhekale

  • Hi,

    How does you project config file look like?

    regards

    Jared 

Reply Children
Related