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

how to add a ncs/nrf library to my project

For example, I'd like to add library at_cmd_parser to my project. (It's under /ncs/nrf/lib/at_cmd_parser.)

My project is out-of-tree in its own directory. I tried in CMakeLists to use: add_subdirectory(), include(), or add_library(). None of these works.

What is the right way to do it? Other than directly copy those C files into my project?

Thanks!

Parents Reply Children
  • I don't see CONFIG_AT_CMD_PARSER  in the .config file.

    The test project builds fine. I compare the CMakeLists file with mine. It has this line at the top of the file:

    find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE})

    while mine has this line:

    include($ENV{ZEPHYR_BASE}/cmake/app/boilerplate.cmake NO_POLICY_SCOPE)

    So I try to add the find_package() to my CMakeLists. But that generated more errors.

    I think the build system can't find where ncs/nrf is located.

  • I'm not sure why Cmake finds the Zephyr package when you build the test sample, but seemingly not when you build your sample out-of-three. Maybe you should try to delete the build folder and try again.

    What version of nRF connect SDK are you using, and how did you install it (i.e., via nRF connect toolchain manager or a manual installation)? Also, with your original CmakeList.txt, did you check if there were any warnings in the build log regarding the AT_CMD_PARSER setting?

  • Now you mentioned it, I did find such warning about AT_CMD_PARSER. I didn't pay attention to it before. So I added CONFIG_NEWLIB_LIBC=y to prj.conf. That seems to solve the problem. Is this the right solution for it?

    I'm using NCS1.6 and installed manually.

    Also I can't find any doc about CONFIG_AT_CMD_PARSER on Zephyr's web. A search always result in nothing found.

    -------------------------------

    warning: AT_CMD_PARSER (defined at C:/work/ncs/nrf\lib\at_cmd_parser/Kconfig:7) was assigned the
    value 'y' but got the value 'n'. Check these unsatisfied dependencies: (NEWLIB_LIBC ||
    EXTERNAL_LIBC) (=n). See
    docs.zephyrproject.org/.../CONFIG_AT_CMD_PARSER.html and/or look up
    AT_CMD_PARSER in the menuconfig/guiconfig interface. The Application Development Primer, Setting
    Configuration Values, and Kconfig - Tips and Best Practices sections of the manual might be helpful
    too.

  • Yes, that explains it - the library depends on Newlib.The reason you don't find anything about this kconfig symbol in the Zephyr documentation is that the AT command parser library is part of nrf repository and not Zephyr.

    I see the url given in the warning is wrong, it should have directed you to this page where the nRF symbols are included: https://developer.nordicsemi.com/nRF_Connect_SDK/doc/1.6.0/kconfig/index.html 

Related