-
Notifications
You must be signed in to change notification settings - Fork 2k
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
pkg/libcoap: Add in libcoap CoAP library support
libcoap version 4.3.4. Includes a CoAP client and CoAP server example. tests/pkg/libcoap: Simple CoAP over DTLS loopback test.
- Loading branch information
Showing
31 changed files
with
2,012 additions
and
0 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
if USEMODULE_LIBCOAP | ||
config LIBCOAP_CLIENT_URI | ||
string "CoAP URI to connect to" | ||
default "coap://[fe80::405:5aff:fe15:9b7f]/.well-known/core" | ||
config LIBCOAP_USE_PSK | ||
string "Secret to use for PSK communications" | ||
default "secretPSK" | ||
depends on USEMODULE_TINYDTLS | ||
config LIBCOAP_USE_PSK_ID | ||
string "User ID to use for PSK communications" | ||
default "user_abc" | ||
depends on USEMODULE_TINYDTLS | ||
endif # USEMODULE_LIBCOAP |
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,67 @@ | ||
# name of your application | ||
APPLICATION = libcoap-client | ||
|
||
# If no BOARD is found in the environment, use this default: | ||
BOARD ?= native | ||
|
||
# This has to be the absolute path to the RIOT base directory: | ||
RIOTBASE ?= $(CURDIR)/../.. | ||
|
||
# Include packages that pull up and auto-init the link layer. | ||
# NOTE: 6LoWPAN will be included if IEEE802.15.4 devices are present | ||
USEMODULE += netdev_default | ||
USEMODULE += auto_init_gnrc_netif | ||
|
||
# Activate ICMPv6 error messages | ||
USEMODULE += gnrc_icmpv6_error | ||
|
||
# Specify the mandatory networking module for a IPv6 routing node | ||
USEMODULE += gnrc_ipv6_router_default | ||
|
||
# Add a routing protocol | ||
USEMODULE += gnrc_rpl | ||
USEMODULE += auto_init_gnrc_rpl | ||
|
||
# Additional networking modules that can be dropped if not needed | ||
USEMODULE += gnrc_icmpv6_echo | ||
|
||
# Specify the mandatory networking modules for IPv6 and UDP | ||
USEMODULE += gnrc_ipv6_default | ||
USEMODULE += memarray | ||
USEMODULE += ipv4_addr | ||
|
||
# a cryptographically secure implementation of PRNG is needed for tinydtls | ||
# Uncomment the following 3 lines for tinydtls support | ||
CFLAGS += -DWITH_RIOT_SOCK | ||
USEPKG += tinydtls | ||
USEMODULE += prng_sha1prng | ||
|
||
# libcoap support | ||
USEPKG += libcoap | ||
|
||
# Configure if DNS is required | ||
# USEMODULE += sock_dns | ||
|
||
# Support 64 bit ticks | ||
USEMODULE += ztimer64_xtimer_compat | ||
|
||
# Add also the shell, some shell commands | ||
USEMODULE += shell | ||
USEMODULE += shell_cmds_default | ||
USEMODULE += ps | ||
USEMODULE += netstats_l2 | ||
USEMODULE += netstats_ipv6 | ||
USEMODULE += netstats_rpl | ||
|
||
# libcoap needs some space | ||
CFLAGS += -DTHREAD_STACKSIZE_MAIN=\(3*THREAD_STACKSIZE_DEFAULT\) | ||
|
||
# Comment this out to disable code in RIOT that does safety checking | ||
# which is not needed in a production environment but helps in the | ||
# development process: | ||
DEVELHELP ?= 1 | ||
|
||
# Change this to 0 show compiler invocation lines by default: | ||
# QUIET ?= 1 | ||
|
||
include $(RIOTBASE)/Makefile.include |
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,70 @@ | ||
BOARD_INSUFFICIENT_MEMORY := \ | ||
airfy-beacon \ | ||
arduino-duemilanove \ | ||
arduino-leonardo \ | ||
arduino-mega2560 \ | ||
arduino-nano \ | ||
arduino-uno \ | ||
atmega256rfr2-xpro \ | ||
atmega328p \ | ||
atmega328p-xplained-mini \ | ||
atmega8 \ | ||
atxmega-a3bu-xplained \ | ||
b-l072z-lrwan1 \ | ||
blackpill-stm32f103c8 \ | ||
blackpill-stm32f103cb \ | ||
bluepill-stm32f030c8 \ | ||
bluepill-stm32f103c8 \ | ||
bluepill-stm32f103cb \ | ||
calliope-mini \ | ||
cc2650-launchpad \ | ||
cc2650stk \ | ||
derfmega128 \ | ||
hifive1 \ | ||
hifive1b \ | ||
i-nucleo-lrwan1 \ | ||
im880b \ | ||
lsn50 \ | ||
maple-mini \ | ||
microbit \ | ||
microduino-corerf \ | ||
msb-430 \ | ||
msb-430h \ | ||
nrf51dk \ | ||
nrf51dongle \ | ||
nrf6310 \ | ||
nucleo-f030r8 \ | ||
nucleo-f031k6 \ | ||
nucleo-f042k6 \ | ||
nucleo-f070rb \ | ||
nucleo-f072rb \ | ||
nucleo-f103rb \ | ||
nucleo-f302r8 \ | ||
nucleo-f303k8 \ | ||
nucleo-f334r8 \ | ||
nucleo-l011k4 \ | ||
nucleo-l031k6 \ | ||
nucleo-l053r8 \ | ||
nucleo-l073rz \ | ||
olimex-msp430-h1611 \ | ||
olimex-msp430-h2618 \ | ||
opencm904 \ | ||
samd10-xmini \ | ||
saml10-xpro \ | ||
saml11-xpro \ | ||
samr21-xpro \ | ||
slstk3400a \ | ||
spark-core \ | ||
stk3200 \ | ||
stm32f030f4-demo \ | ||
stm32f0discovery \ | ||
stm32f7508-dk \ | ||
stm32g0316-disco \ | ||
stm32l0538-disco \ | ||
stm32mp157c-dk2 \ | ||
telosb \ | ||
waspmote-pro \ | ||
yunjia-nrf51822 \ | ||
z1 \ | ||
zigduino \ | ||
# |
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,24 @@ | ||
# libcoap client example | ||
|
||
This example shows how to configure a client to use libcoap | ||
|
||
## Fast configuration (Between RIOT instances): | ||
|
||
Preparing the logical interfaces: | ||
|
||
sudo ./../../dist/tools/tapsetup/tapsetup --create 2 | ||
|
||
## Client invocation | ||
For the client: | ||
|
||
PORT=tap0 make term | ||
coapc coap://[ip6-address]/some/path | ||
|
||
The IP address to connect to needs to be that as returned by libcoap_server, | ||
or that of the tap0 interface, etc. | ||
|
||
## Handling the static memory allocation | ||
|
||
libcoap for RIOT is using the `sys/memarray` module and therefore there | ||
are certain limits. Said resources are defined in `libcoap/src/coap_mem.c`, | ||
but can be overwritten at compile time. |
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,10 @@ | ||
CONFIG_LIBCOAP_CLIENT_SUPPORT=y | ||
CONFIG_LIBCOAP_CLIENT_URI="coap://[fe80::405:5aff:fe15:9b7f]/.well-known/core" | ||
|
||
CONFIG_LIBCOAP_USE_PSK="secretPSK" | ||
CONFIG_LIBCOAP_USE_PSK_ID="user_abc" | ||
|
||
CONFIG_KCONFIG_USEPKG_LIBCOAP=y | ||
# Logging levels are defined in pkg/libcoap using Kconfig | ||
|
||
CONFIG_KCONFIG_USEPKG_TINYDTLS=y |
Oops, something went wrong.