diff --git a/tests/riotboot_flashwrite/Makefile b/tests/riotboot_flashwrite/Makefile index 739f759942b4..9c2b9f4ba52b 100644 --- a/tests/riotboot_flashwrite/Makefile +++ b/tests/riotboot_flashwrite/Makefile @@ -13,6 +13,7 @@ USEMODULE += gnrc_icmpv6_echo # Required for nanocoap server USEMODULE += nanocoap_sock +USEMODULE += nanocoap_resources # include this for printing IP addresses USEMODULE += shell_cmds_default diff --git a/tests/riotboot_flashwrite/coap_handler.c b/tests/riotboot_flashwrite/coap_handler.c index 4a892e10c703..12a09de83916 100644 --- a/tests/riotboot_flashwrite/coap_handler.c +++ b/tests/riotboot_flashwrite/coap_handler.c @@ -78,10 +78,9 @@ ssize_t _flashwrite_handler(coap_pkt_t* pkt, uint8_t *buf, size_t len, coap_requ return pkt_pos - (uint8_t*)pkt->hdr; } -/* must be sorted by path (ASCII order) */ -const coap_resource_t coap_resources[] = { - COAP_WELL_KNOWN_CORE_DEFAULT_HANDLER, - { "/flashwrite", COAP_POST, _flashwrite_handler, &_writer }, +NANOCOAP_RESOURCE(flashwrite) { + .path = "/flashwrite", + .methods = COAP_POST, + .handler = _flashwrite_handler, + .context = &_writer }; - -const unsigned coap_resources_numof = ARRAY_SIZE(coap_resources);