[
Date Prev][
Date Next][
Thread Prev][
Thread Next][
Date Index][
Thread Index]
[
List Home]
[tinydtls-dev] Feedback trying to use tinyDTLS with Contiki 2.7
|
Hello,
for a research project, I need to make coap+dtls work on our hardware.
We already have a working Contiki port and I start by integrating
tinyDTLS and validate as much as possible.
I started from a direct clone of the repository, added a shell app in my
contiki repo to allow running test commands.
My first goal was to run the unit tests provided in tinydtls/sha2 and
tinydtls/ecc with every tests packaged in the same firmware.
The first issues I encountered were:
* 'Makefile.tinydtls' still references 'debug.c' instead of 'dtls_debug.c'
* Contiki 2.7 has different path for 'uip.h' and 'uip_debug.h' so I
added a custom CONTIKI_2_7 define to know which one to use.
* Name conflicts in 'testecc.c' and 'testfield.c'
* A boggus name: 'testfiled' instead of 'testfield'
* Some compilation warning
I fixed all of them here for the moment:
https://github.com/iot-lab/armour-tinydtls/compare/0016138fe3998552eee3987a1c09da43a23c9fb5...master
These were really easily fixed.
I will contribute that back to the main repository, but wanted to get
some feedback here before going to gerrit.
Now two other problems that occured:
Testing takes time on slow hardware
-----------------------------------
I execute the tests from testecc in another C file, (just call the test
functions from another app).
It crashed in edcsaTest, adding some prints showed it never crashed at
the same time.
After a lot of debugging I found that the watchdog was triggered and was
rebooting the node.
It could be a good idea to add some `watchdog_periodic();` calls between
each test.
It's not in my clone as I am calling the function from another file.
After that, all tests are ok and working.
Include mess
------------
There is a bigger problem I have not written a solution to, I just fell
on it right now.
I'm now at the level of trying to run a client and a server. I took the
example files from here:
https://github.com/spark/tinydtls/tree/master/examples/contiki
The client was crashing because it accesses invalid addresses when using
"dtls_security_params(peer)".
I tried to print, its value was changing between 'dtls_new_peer' and
just after returning its value to 'dtls_connect'.
Using gdb I saw that in these two functions, the definition of a peer
was different. One was built with UTASH support and not the other.
And in fact, not every header is including "dtls_config.h" and so
"platform-specific/platform.h"
This led to a type being defined differently in two C files from the
library.
I quickly tried try removing the define NOHASH in
"platform-specific/platform.h"
-#define DTLS_PEERS_NOHASH 1
+//#define DTLS_PEERS_NOHASH 1
Then I got the following compilation warning:
In file included from ../../../../apps/tinydtls/dtls_debug.h:24:0,
from ../../../../apps/tinydtls/dtls.c:39:
../../../../apps/tinydtls/global.h:139:0: warning: "uthash_fatal"
redefined
#define uthash_fatal(msg) return(-1) /* fatal error in uthash */
^
In file included from ../../../../apps/tinydtls/dtls.c:36:0:
../../../../apps/tinydtls/uthash.h:70:0: note: this is the location
of the previous definition
#define uthash_fatal(msg) exit(-1) /* fatal error (out of
memory,etc) */
So it requires even more cleaning.
But at least the client is not crashing on the same problem.
(Currently it's rebooting because of the watchdog too, but I did not
investigate.)
What would be the idea to fix this include problem?
Also, currently both "tinydtls.h" and "dtls_config.h" are defining
DTLS_ECC, DTLS_PSK and WITH_CONTIKI.
I will keep working on this and give feedback.
Regards,
Gaëtan