-
Notifications
You must be signed in to change notification settings - Fork 422
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
New examples/zephyr directory that contains a sample coap-client. Building the coap-client assumes that the zephyrproject has already been installed and set up (default directory ~/zephyrproject).
- Loading branch information
Showing
15 changed files
with
462 additions
and
16 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,2 @@ | ||
# never objects, and not the resulting binary | ||
coap-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
ZEPHYR_PROJECT?=~/zephyrproject | ||
|
||
all: coap-client | ||
|
||
coap-client: client-src/src/main.c client-src/* | ||
LIBCOAP_DIR=`pwd`/../.. ;\ | ||
(. $(ZEPHYR_PROJECT)/.venv/bin/activate ;\ | ||
cd $(ZEPHYR_PROJECT)/zephyr ;\ | ||
west build -p always -b native_sim \ | ||
$${LIBCOAP_DIR}/examples/zephyr/client-src -- \ | ||
-DCONF_FILE=prj.conf \ | ||
-DEXTRA_ZEPHYR_MODULES=$${LIBCOAP_DIR} \ | ||
-DEXTRA_CONF_FILE=$${LIBCOAP_DIR}/zephyr/libcoap-mbedtls.conf \ | ||
--fresh ;\ | ||
deactivate) ;\ | ||
cp -f $(ZEPHYR_PROJECT)/zephyr/build/zephyr/zephyr.exe coap-client |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,12 @@ | ||
Example of libcoap running in Zephyr | ||
==================================== | ||
|
||
The Zephyr project environment needs to be pre-installed. By default, the | ||
libcoap Makefile assumes that this is located at ~/zephyrproject . | ||
|
||
To build the coap-client example, do | ||
|
||
$ make | ||
|
||
The executable gets built in ~/zephyrproject/zephyr/build/zephyr/zephyr.exe | ||
which is then copied to coap-client . |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,9 @@ | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
cmake_minimum_required(VERSION 3.20.0) | ||
find_package(Zephyr REQUIRED HINTS $ENV{ZEPHYR_BASE}) | ||
project(coap_client) | ||
|
||
target_sources(app PRIVATE src/main.c) | ||
|
||
include(${ZEPHYR_BASE}/samples/net/common/common.cmake) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,33 @@ | ||
# Private config options for coap-client sample app | ||
|
||
# Copyright (c) 2020 Intel Corporation | ||
# SPDX-License-Identifier: Apache-2.0 | ||
|
||
mainmenu "Networking coap-client sample application" | ||
|
||
config LIBCOAP_TARGET_DOMAIN_URI | ||
string "Target Uri" | ||
default "coaps://libcoap.net" | ||
help | ||
Target uri for the example to use. Use coaps:// prefix for encrypted traffic | ||
using Pre-Shared Key (PSK) or Public Key Infrastructure (PKI). | ||
|
||
if MBEDTLS | ||
config LIBCOAP_PSK_KEY | ||
string "Preshared Key (PSK) to used in the connection to the CoAP server" | ||
default "secretPSK" | ||
help | ||
The Preshared Key to use to encrypt the communicatons. The same key must be | ||
used at both ends of the CoAP connection, and the CoaP client must request | ||
an URI prefixed with coaps:// instead of coap:// for DTLS to be used. | ||
|
||
config LIBCOAP_PSK_IDENTITY | ||
string "PSK Client identity (username)" | ||
default "user" | ||
help | ||
The identity (or username) to use to identify to the CoAP server which | ||
PSK key to use. | ||
|
||
endif # MBEDTLS | ||
|
||
source "Kconfig.zephyr" |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,44 @@ | ||
CONFIG_NETWORKING=y | ||
CONFIG_NET_UDP=y | ||
CONFIG_NET_TCP=y | ||
CONFIG_NET_IPV6=y | ||
CONFIG_NET_IPV4=y | ||
#CONFIG_NET_DHCPV4=y | ||
|
||
CONFIG_ENTROPY_GENERATOR=y | ||
CONFIG_TEST_RANDOM_GENERATOR=y | ||
CONFIG_INIT_STACKS=y | ||
|
||
CONFIG_NET_LOG=y | ||
CONFIG_LOG=y | ||
|
||
CONFIG_NET_STATISTICS=y | ||
|
||
CONFIG_NET_PKT_RX_COUNT=32 | ||
CONFIG_NET_PKT_TX_COUNT=32 | ||
CONFIG_NET_BUF_RX_COUNT=32 | ||
CONFIG_NET_BUF_TX_COUNT=32 | ||
|
||
CONFIG_NET_IF_UNICAST_IPV6_ADDR_COUNT=3 | ||
CONFIG_NET_IF_MCAST_IPV6_ADDR_COUNT=4 | ||
CONFIG_NET_MAX_CONTEXTS=10 | ||
|
||
CONFIG_NET_SHELL=y | ||
|
||
CONFIG_NET_CONFIG_SETTINGS=y | ||
CONFIG_NET_CONFIG_NEED_IPV6=y | ||
CONFIG_NET_CONFIG_NEED_IPV4=y | ||
CONFIG_NET_CONFIG_MY_IPV6_ADDR="2001:db8::1" | ||
CONFIG_NET_CONFIG_PEER_IPV6_ADDR="2001:db8::2" | ||
CONFIG_NET_CONFIG_MY_IPV4_ADDR="192.0.2.1" | ||
CONFIG_NET_CONFIG_PEER_IPV4_ADDR="192.0.2.2" | ||
|
||
CONFIG_NET_L2_ETHERNET=y | ||
|
||
CONFIG_ETH_NATIVE_POSIX=y | ||
CONFIG_ETH_NATIVE_POSIX_RANDOM_MAC=y | ||
#CONFIG_ETH_NATIVE_POSIX_MAC_ADDR="00:00:5e:00:53:2a" | ||
|
||
CONFIG_LIBCOAP=y | ||
|
||
CONFIG_HEAP_MEM_POOL_SIZE=16384 |
Oops, something went wrong.