Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update iotivity-lite port for Zephyr 3.0.0 #235

Draft
wants to merge 30 commits into
base: master
Choose a base branch
from

Conversation

Oxymoron79
Copy link
Collaborator

@Oxymoron79 Oxymoron79 commented Apr 5, 2022

Update the port of iotivity-lite for the latest Zephyr RTOS (3.0.0) using the ST STM32H747I Discovery board.

  • Build with CMake
  • Update TinyCBOR to version 0.6 to be able to disable floating point support with Zephyr's minimal libc
  • Implement iotivity-lite storage using Zephyr's Filesystem module.
  • Implement IPv4/6 multicast handler
  • Port UDP handler using the Posix socket library (similar to the other iotivity-lite ports)
  • Implement network monitor
  • Add atomic implementation for #if defined(ZEPHYR) to util/oc_atomic.h
  • Implement client funtionality by implementing oc_send_discovery_request
  • IPv4 DHCP client works only with the Zephyr network auto configuration (initializes the network interfaces before calling main()). Running the DHCP client in the application seems to lead to a deadlock. Further investigation is needed.
  • With security enabled, the ownership transfer did not work. Further investigation is needed.

The CMake variable TARGET_SUPPORTS_SHARED_LIBS provides this information.
E.g. Zephyr does not support dynamic libraries.
TinyCBor queries compile definitions in its header files for overrides
that may needed for a target platform (e.g. Zephyr).
The Zephyr SDK generates some platform header files in a CMake target,
which has to be completed before the compilation of iotivity-lite
can start.
Defining dependencies for our targets delays the targets until the
dependent targets have finished.
If iotivity-lite is used as a CMake subproject in a Zephyr application,
detect the Zephyr SDK with the ZEPHYR_BASE variable and setup the build
for the Zephyr port:
* Set the Zephyr CMake task zephyr_interface as target dependency.
* Set the Zephyr include directories globally.
* Add the Zephyr compile definitions and options.
TinyCBOR 0.6.0 allows to disable floating point support with a
compile definition CBOR_NO_FLOATING_POINT.
It seems that floating point support is only needed in src/cborpretty.c
to use functions from the math.h header, which are not available in Zephyr.
…yCBOR

The Zephyr minimal libc doesn't provide a strtod function implementation.
Those functions use the sscanf function, which is not implemented in the
minimal libc of Zephyr.
* Replace netlink sockets with Zephyr network manager
* Replace shutdown_pipe pipe with a Zephyr socketpair
* Use Zephyr functions for multicast address and group management
@Oxymoron79
Copy link
Collaborator Author

~format

@WAvdBeek
Copy link
Contributor

WAvdBeek commented Apr 5, 2022

Update TinyCBOR to version 0.6 to be able to disable floating point support with Zephyr's minimal libc

can we do this in a seperate pull request, e.g. to check if anything breaks?

@Oxymoron79
Copy link
Collaborator Author

can we do this in a seperate pull request, e.g. to check if anything breaks?

@WAvdBeek: Yes, sure. See #238

@jkralik
Copy link
Member

jkralik commented Jun 17, 2022

@Oxymoron79 Please, could you add example server + README which uses zephyr ?

@Oxymoron79
Copy link
Collaborator Author

@Oxymoron79 Please, could you add example server + README which uses zephyr ?

@jkralik I have now added a README for the Zephyr port and how I used it. Sorry that it took so long - I didn't find the time to write it...

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants