I am trying to compile a zephyr sample. It’s failing to find files that are in “framework-zephyr-tinycbor”. How do I include additional frameworks in the build?
tinycbor
is in the default zephyr modules installed by PlatformIO. As you can see in its CMakeLists.txt
:
$ cat ~/.platformio/packages/framework-zephyr-tinycbor/CMakeLists.txt
if(CONFIG_TINYCBOR)
zephyr_interface_library_named(TINYCBOR)
# This line is for compatibility and should be removed at some point of
# time. It is supposed to allow building sources that still reference cbor
# headers without tinycbor subrirectory.
target_include_directories(TINYCBOR INTERFACE include/tinycbor)
target_include_directories(TINYCBOR INTERFACE include)
zephyr_library()
zephyr_library_sources(
src/cbor_buf_reader.c
src/cbor_buf_writer.c
src/cborencoder.c
src/cborerrorstrings.c
src/cborparser.c
)
zephyr_library_sources_ifdef(CONFIG_NEWLIB_LIBC src/cborparser_dup_string.c)
zephyr_library_sources_ifdef(CONFIG_CBOR_PRETTY_PRINTING src/cborpretty.c)
zephyr_library_link_libraries(TINYCBOR)
target_link_libraries(TINYCBOR INTERFACE zephyr_interface)
endif()
and in e.g. this example:
You have to adapt the prj.conf
of your project accordingly. In your case, adding
CONFIG_TINYCBOR=y
is mandatory. You can also define the optional CONFIG_CBOR_PRETTY_PRINTING
option.
Thanks for your reply. I saw the framework after I posted.
Hi,
Also trying to use tinycbor in platformio with zephyr…
CONFIG_TINYCBOR=y
CONFIG_CBOR_PRETTY_PRINTING=y
and I can see the framework-zephyr-tinycbor have been added to the .platformio\packages directory…
But I am not able to #include <cbor.h> etc to get it to compile…
Found this, but not sure it needed anymore… (tested, but did not help)
cbor - Building tinycbor module with Zephyr - Stack Overflow
Newbie here…
Any suggestions?
Cheers
-Anders