connectivity-ip
npx machina-cli add skill beriberikix/zephyr-agent-skills/connectivity-ip --openclawZephyr Connectivity: IP Networking
Build memory-efficient, cloud-connected applications using Zephyr's modular IP stack and industry-standard IoT protocols.
Core Workflows
1. Protocol Selection
Choose the right protocol (LwM2M, CoAP, MQTT) based on your device's power and management needs.
- Reference: protocol_selection.md
- Key Tools:
CONFIG_COAP,CONFIG_LWM2M,CONFIG_MQTT_LIB.
2. IP Stack Configuration
Tune the networking stack to save Flash and RAM while ensuring reliable communication.
- Reference: ip_stack_config.md
- Key Tools:
CONFIG_NET_IPV4,CONFIG_NET_BUF_RX_COUNT, DNS resolver.
3. SDK & Module Integration
Integrate external cloud SDKs and libraries as first-class Zephyr modules.
- Reference: sdk_module_integration.md
- Key Tools:
west.yml,zephyr/module.yml,name-allowlist.
Quick Start (Kconfig for CoAP)
# Minimal stack for CoAP over UDP
CONFIG_NETWORKING=y
CONFIG_NET_UDP=y
CONFIG_NET_IPV4=y
CONFIG_COAP=y
CONFIG_DNS_RESOLVER=y
Professional Patterns (Cloud Connectivity)
- Extreme Trimming: Disable TCP and IPv6 if not strictly required to reclaim 10KB+ of RAM.
- Manifest Control: Use an
allow-listin yourwest.ymlto prevent cloning hundreds of megabytes of unused vendor modules. - Async DNS: Use the asynchronous DNS resolver to prevent blocking the main application thread during host lookup.
Resources
- References:
protocol_selection.md: LwM2M vs CoAP vs MQTT.ip_stack_config.md: Optimizing buffers and disabling unused protocols.sdk_module_integration.md: West manifest management and SDK modules.
Source
git clone https://github.com/beriberikix/zephyr-agent-skills/blob/main/skills/connectivity-ip/SKILL.mdView on GitHub Overview
This skill guides configuring Zephyr’s modular IP stack and selecting IoT protocols (LwM2M, CoAP, MQTT) for cloud-connected devices. It also covers trimming network memory usage and integrating external cloud SDKs as Zephyr modules via West manifests to keep builds lean.
How This Skill Works
Technically, you pick the protocol via CONFIG flags (CONFIG_COAP, CONFIG_LWM2M, CONFIG_MQTT_LIB) and tailor the IP stack with options like CONFIG_NET_IPV4 and UDP/TCP settings. External cloud SDKs are added as Zephyr modules using West manifests (west.yml and module.yml with a name allowlist), enabling modular builds and safe dependency pruning.
When to Use It
- Building a cloud-connected device that uses CoAP, MQTT, or LwM2M
- Optimizing memory usage by trimming unused protocols like TCP or IPv6
- Integrating an external cloud SDK as a Zephyr module via West manifest
- Choosing a protocol based on power, latency, and management needs
- Preparing a deployment where DNS resolution should be asynchronous to avoid blocking
Quick Start
- Step 1: Enable the needed networking features for your protocol (e.g., CONFIG_NETWORKING=y, CONFIG_NET_UDP=y, CONFIG_NET_IPV4=y, CONFIG_COAP=y, CONFIG_DNS_RESOLVER=y)
- Step 2: Add and constrain cloud SDK modules with a West manifest using a name-allowlist (west.yml) and module.yml
- Step 3: Tune the IP stack by trimming unused protocols and buffers (e.g., disable TCP/IPv6 if not needed; adjust CONFIG_NET_BUF_RX_COUNT)
Best Practices
- Use only the protocols your device truly needs (e.g., CoAP for constrained devices, MQTT for pub/sub)
- Enable async DNS resolution to avoid blocking the main application thread
- Use an allow-list in west.yml to prune vendor modules and reduce build size
- Tune NET buffers and disable unused features (e.g., TCP, IPv6) to reclaim memory
- Balance IPv4/IPv6 and UDP/TCP to meet reliability and power goals
Example Use Cases
- CoAP-based environmental sensor sending telemetry to a CoAP server with DNS resolver enabled
- MQTT client publishing telemetry to a cloud broker (e.g., AWS IoT) with IPv4/UDP configured
- LwM2M-enabled device management for remote provisioning and updates
- Industrial gateway integrating an external cloud SDK via a West manifest
- An edge device that trims TCP/IPv6 to reclaim memory and meet tight RAM budgets