Summary
The bacnet-stack is packaged as a Zephyr module, but there is no corresponding ports/zephyr/ datalink implementation for BACnet/IP. The existing ports (ports/linux/bip-init.c, ports/bsd/bip-init.c) pull in Linux/BSD-specific headers (asm/types.h, ifaddrs.h) that do not exist in the Zephyr build environment, causing a compile failure.
Current behaviour
When including bacnet-stack as a Zephyr west module and attempting to use BACnet/IP, the build fails:
fatal error: ifaddrs.h: No such file or directory
Expected behaviour
BACnet/IP should build and run on Zephyr using its native networking APIs.
What I did
I implemented a bip-init.c for Zephyr using its BSD socket compatibility layer (zsock_socket, zsock_bind, zsock_setsockopt) and net_if_get_default() to obtain the assigned IP address.
This has been tested on an NXP i.MX RT1020 with CONFIG_NET_SOCKETS=y, and successfully initializes the BACnet/IP datalink.
Contribution
I can open a PR adding a ports/zephyr/ implementation if this aligns with the project direction.
Environment
- Zephyr version: main (commit 79ce80e73c30)
- Board: NXP i.MX RT1020
- bacnet-stack-zephyr commit: c1f1c1e
- bacnet-stack core version: 1.5.0 (bacnet-stack-1.5.0-25-g5d73544a)
Summary
The bacnet-stack is packaged as a Zephyr module, but there is no corresponding
ports/zephyr/datalink implementation for BACnet/IP. The existing ports (ports/linux/bip-init.c,ports/bsd/bip-init.c) pull in Linux/BSD-specific headers (asm/types.h,ifaddrs.h) that do not exist in the Zephyr build environment, causing a compile failure.Current behaviour
When including bacnet-stack as a Zephyr west module and attempting to use BACnet/IP, the build fails:
Expected behaviour
BACnet/IP should build and run on Zephyr using its native networking APIs.
What I did
I implemented a bip-init.c for Zephyr using its BSD socket compatibility layer (zsock_socket, zsock_bind, zsock_setsockopt) and net_if_get_default() to obtain the assigned IP address.
This has been tested on an NXP i.MX RT1020 with CONFIG_NET_SOCKETS=y, and successfully initializes the BACnet/IP datalink.
Contribution
I can open a PR adding a ports/zephyr/ implementation if this aligns with the project direction.
Environment