Rocksolid Light

Welcome to novaBBS (click a section below)

mail  files  register  newsreader  groups  login

Message-ID:  

You might have mail.


devel / comp.arch.embedded / Re: LWM2M C Language Implementation for the Small Embedded IoT Devices

SubjectAuthor
* Re: LWM2M C Language Implementation for the Small Embedded IoT DevicesHanah anees
`- Re: LWM2M C Language Implementation for the Small Embedded IoT DevicesVikram Kerkar

1
Re: LWM2M C Language Implementation for the Small Embedded IoT Devices

<0762cf8e-274c-4e17-8753-1e5fcb4adc35n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=857&group=comp.arch.embedded#857

  copy link   Newsgroups: comp.arch.embedded
X-Received: by 2002:ac8:5bcd:0:b0:2e1:c6c4:ca00 with SMTP id b13-20020ac85bcd000000b002e1c6c4ca00mr1585840qtb.528.1650589782986;
Thu, 21 Apr 2022 18:09:42 -0700 (PDT)
X-Received: by 2002:a25:d044:0:b0:644:e507:2ed9 with SMTP id
h65-20020a25d044000000b00644e5072ed9mr2406828ybg.66.1650589782763; Thu, 21
Apr 2022 18:09:42 -0700 (PDT)
Path: i2pn2.org!i2pn.org!weretis.net!feeder6.news.weretis.net!news.misty.com!border2.nntp.dca1.giganews.com!nntp.giganews.com!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch.embedded
Date: Thu, 21 Apr 2022 18:09:42 -0700 (PDT)
In-Reply-To: <c72e8fb3-66e3-4ab1-8774-759d19675ddd@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=100.11.83.12; posting-account=i3pOswoAAADr2Y2XczVDXLe2DvIMnK3P
NNTP-Posting-Host: 100.11.83.12
References: <d7f050be-d630-4c69-940b-864700a5e416@googlegroups.com>
<8a58fa98-5f14-4ad4-867b-e4e8a18c98a6@googlegroups.com> <c72e8fb3-66e3-4ab1-8774-759d19675ddd@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <0762cf8e-274c-4e17-8753-1e5fcb4adc35n@googlegroups.com>
Subject: Re: LWM2M C Language Implementation for the Small Embedded IoT Devices
From: hanahtec...@gmail.com (Hanah anees)
Injection-Date: Fri, 22 Apr 2022 01:09:42 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
Lines: 238
 by: Hanah anees - Fri, 22 Apr 2022 01:09 UTC

On Thursday, July 5, 2018 at 10:33:59 AM UTC-4, kalvi...@gmail.com wrote:
> keskiviikko 30. toukokuuta 2018 22.48.12 UTC+3 sys...@gmail.com kirjoitti:
> > hi Kalvin
> >
> > any updates, sample code, im trying to do the same on an m4 g55 microchip mcu.
> >
> > thanks
> >
> > rp
> >
> >
> > On Thursday, April 27, 2017 at 2:34:38 AM UTC+10, kalvi...@gmail.com wrote:
> > > Hi group!
> > >
> > > As a n00b in the IoT domain I have had trouble finding a suitable open source implementation in C for the LWM2M protocol with DTLS support.
> > >
> > > What I have found so far are following implementations:
> > >
> > > - Contiki lwm2m: https://github.com/sics-iot/lwm2m-contiki
> > > - Wakaama LWM2M: https://github.com/eclipse/wakaama
> > > - Awa LWM2M: https://github.com/FlowM2M/AwaLWM2M
> > > - Anjay: https://github.com/AVSystem/Anjay
> > >
> > > However I am not able to compare pros and cons of the different implementations in terms of code quality, features, maturity, code size etc.
> > >
> > > The target device is built on an ARM Cortex M4 with 256 KB Flash memory, 48 KB of RAM and an Ethernet connection. The network stack might be LwIP supporting IPv4 and IPv6, but if I decide to go for Contiki I probably will use the built-in uIP stack. The device is a OS-less bare-metal system or Contiki.
> > >
> > > I would appreciate very much if someone has experience in those implementations and could give me some feedback or point me to the right direction.
> > >
> > > Best regards,
> > > Kalvin
> Hi rp,
> Sorry this late reply, but I haven't been reading the newsgroups lately. Anyway, here is how I proceeded with the porting effort:
>
> 1. First, I took the Wakaama client source code and the LwIP 2.0.2 source code, and made the Wakaama client running on a PC using the LwIP socket interface. This required tweaking the Wakaama build scripts so that the build process would also build the LwIP and link it with Wakaama.
>
> 2. Modified Wakaama client to use the LwIP raw API running on a PC. The LwIP porting guide is a good place to start:
> http://lwip.wikia.com/wiki/Porting_for_an_OS
>
> This all was pretty straight forward to do as Wakaama has quite simple and thin networking interface using only UDP protocol.
>
> Wireshark proved to be a very valuable too in this process when debugging the DTSL-related stuff for example.
>
> You may need to use the TAP-interface adapter so that the LwIP is able to use the Ethernet interface of your development machine:
> https://backreference.org/2010/03/26/tuntap-interface-tutorial/
>
> Now that I had the Wakaama client running on a PC using LwIP raw interface I had to make it running on my target hardware.
>
> 3. I needed setup a LwIP PPP connection.
>
> 4. Tweaked the LwIP configuration to fit the target hardware.
>
> 5. Tweaked the TinyDTLS build scripts so that it compiles cleanly on the target hardware and ARM C compiler.
>
> 6. My target ARM-system did not provide the malloc and free, so I had to figure out what to do with that. Luckily the LwIP provided also malloc and free, and modified the source code to use these library functions. There were some other minor functions that I needed to implement, like the time functions.
>
> 6. After a clean build and some printf-debugging, I was able to connect my target hardware running Wakaama client to a server over PPP.
>
> That's basically the whole process. Although I hadn't been working with the LwIP nor Wakaama before, it took me less than two weeks (with very little sleep) to get the things up and running and to get the Wakaama LWM2M client DTLS connection working with the Leshan server.
>
> During more comprehensive testing it was found out that DTLS/Wakaama was bleeding some memory. I added some printf's to LwIP malloc/free adapter stubs which were created to mimic the std malloc and free functions. Created a simple Python tool to track the malloc/free memory blocks using the printf-output, and I was able to spot the problematic places and patched the code to release the allocated memory so that the malloc/free was working without any further issues.
>
> Hope this helps you to get started.
>
> Br,
> Kalvin

Hello All,
We are integrating Anjay LWM2M client on Murata Type 1LD (cypress psoc). if mbedTLS is enabled there is an error trying to register. Where as the code works in non -secure mode. Also the same code works fine in mbedTLS mode from linux machine. So this has to be an issue with Anjay LWM2M and WICED integration. Trying to debug and not sure what the following error means, any help is much appreciated

Setting IPv6 link-local address
Obtaining IPv4 address via DHCP
IPv6 Network ready IP: FE80::29D:6BFF:FE62:78AA
IPv4 Network ready IP: 192.168.1.195
Wifi network up success
Wifi network up success

TEST Version 1.0.4

*** mbedtls_ctr_drbg_seed ***

entropy_callback

######################## entropy_callback
Seed_callback out buff : 536930016
Initializing Anjay
RunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunning$$$$$ AVS_NET_DTLS_SOCKET $$$$$$
avs_net_dtls_socket_create
WITH SSL
$$$$$create_ssl_socket
configure_ssl socket 0x2000e3cc, configuration= 0x2000e4e8

*initialize_ssl_socket
AVS_NET_SECURITY_PSK

******** initialize_psk_security ******

******************* mbedtls_ssl_conf_psk ###################
Psk key P4s$w0rd length 8
Identity testboard length 9
$$$$$$$ AVS_OK
************_anjay_server_connection_internal_bring_online

Start SSL
**Could not restore session; performing full handshake
MBEDTLS_SSL_CLI_C end point 0
inside mbedtls_ssl_flush_output
wrap_handshake_result Result 0, security mode 1, dane_ta_certs (null) verify_result 0
handshake success: new session started
**Return AVS_OK

ANJAY_REGISTRATION_ERROR_REJECTED
update rejected for SSID 1 needs re-registration
Attempting to register with LwM2M version 1.0
sending Register
lwm2m version 0
coap_base->last_exchange_id 0
(*exchange_ptr)->id 0
avs_time_monotonic_now() second 0 nanosec 9
Register send
Runningget_dtls_overhead
avs_net_socket_send

send_ssl start

Output Bytes:48 2 B4 66 D 88 34 D0 23 5B 8B 31 B2 72 64 11 28 39 6C 77 6D 32 6D 3D 31 2E 30 C 65 70 3D 74 65 73 74 62 6F 61 72 64 5 6C 74 3D 36 30 FF 3C 2F 31 2F 30 3E
send_ssl socket= 0x20015b18 , buffer= 0x20017014 , buffer_length= 53
Going for mbedtls_ssl_write
Handshake not NULL
Client id (null) client id length 0 Host name try-anjay.avsystem.com psk (null) psk_leng 0
Psk key P4s$w0rd ident testboard
Hand shake not over
MBEDTLS_SSL_CLI_C end point 0
inside mbedtls_ssl_flush_output
inside mbedtls_ssl_flush_output
avs_bio_send
avs_net_socket_send
inside mbedtls_ssl_flush_output
avs_bio_send
avs_net_socket_send
wrap_handshake_result Result 53, security mode 1, dane_ta_certs (null) verify_result 0
Hand shake result : 53
RunningReceive_ssl socket = 0x20015b18, buffer= 0x200141e8 , buffer_length= 2048inside mbedtls_ssl_flush_output
MBEDTLS_SSL_CLI_C end point 0
inside mbedtls_ssl_flush_output
wrap_handshake_result Result -76, security mode 1, dane_ta_certs (null) verify_result 0
receive failed: -76
RunningRunningRunningavs_net_socket_send

send_ssl start

Output Bytes:48 2 B4 66 D 88 34 D0 23 5B 8B 31 B2 72 64 11 28 39 6C 77 6D 32 6D 3D 31 2E 30 C 65 70 3D 74 65 73 74 62 6F 61 72 64 5 6C 74 3D 36 30 FF 3C 2F 31 2F 30 3E
send_ssl socket= 0x20015b18 , buffer= 0x20017014 , buffer_length= 53
Going for mbedtls_ssl_write
Handshake not NULL
Client id (null) client id length 0 Host name try-anjay.avsystem.com psk (null) psk_leng 0
Psk key P4s$w0rd ident testboard
Hand shake not over
MBEDTLS_SSL_CLI_C end point 0
inside mbedtls_ssl_flush_output
inside mbedtls_ssl_flush_output
avs_bio_send
avs_net_socket_send
Handshake return -26880
Going for mbedtls_ssl_write
Handshake not NULL
Client id (null) client id length 0 Host name try-anjay.avsystem.com psk (null) psk_leng 0
Psk key P4s$w0rd ident testboard
Hand shake not over
MBEDTLS_SSL_CLI_C end point 0
inside mbedtls_ssl_flush_output
Handshake return -76
wrap_handshake_result Result -76, security mode 1, dane_ta_certs (null) verify_result 0
Hand shake result : -76
socket bio_error
send failed 0 53 : -76
AVS_COAP_CLIENT_REQUEST_FAIL
failure while receiving Register response: Message too long
mapping CoAP error Message too long to network error
ANJAY_REGISTRATION_ERROR_NETWORK
could not register to server 1

Thanks
Anees

Re: LWM2M C Language Implementation for the Small Embedded IoT Devices

<dfe4b676-1ee6-42c5-b7fb-fcaa90939370n@googlegroups.com>

  copy mid

https://www.novabbs.com/devel/article-flat.php?id=901&group=comp.arch.embedded#901

  copy link   Newsgroups: comp.arch.embedded
X-Received: by 2002:a5d:5382:0:b0:21a:3d9e:d29c with SMTP id d2-20020a5d5382000000b0021a3d9ed29cmr613503wrv.288.1655406468758;
Thu, 16 Jun 2022 12:07:48 -0700 (PDT)
X-Received: by 2002:a81:9f0d:0:b0:2fe:ac51:19b with SMTP id
s13-20020a819f0d000000b002feac51019bmr7352076ywn.164.1655406468139; Thu, 16
Jun 2022 12:07:48 -0700 (PDT)
Path: i2pn2.org!i2pn.org!usenet.goja.nl.eu.org!3.eu.feeder.erje.net!feeder.erje.net!fdn.fr!usenet-fr.net!proxad.net!feeder1-2.proxad.net!209.85.128.87.MISMATCH!news-out.google.com!nntp.google.com!postnews.google.com!google-groups.googlegroups.com!not-for-mail
Newsgroups: comp.arch.embedded
Date: Thu, 16 Jun 2022 12:07:47 -0700 (PDT)
In-Reply-To: <0762cf8e-274c-4e17-8753-1e5fcb4adc35n@googlegroups.com>
Injection-Info: google-groups.googlegroups.com; posting-host=103.105.111.98; posting-account=KlHmqQoAAAD3It76D8pXiHcZd6ubnjHX
NNTP-Posting-Host: 103.105.111.98
References: <d7f050be-d630-4c69-940b-864700a5e416@googlegroups.com>
<8a58fa98-5f14-4ad4-867b-e4e8a18c98a6@googlegroups.com> <c72e8fb3-66e3-4ab1-8774-759d19675ddd@googlegroups.com>
<0762cf8e-274c-4e17-8753-1e5fcb4adc35n@googlegroups.com>
User-Agent: G2/1.0
MIME-Version: 1.0
Message-ID: <dfe4b676-1ee6-42c5-b7fb-fcaa90939370n@googlegroups.com>
Subject: Re: LWM2M C Language Implementation for the Small Embedded IoT Devices
From: vikramke...@gmail.com (Vikram Kerkar)
Injection-Date: Thu, 16 Jun 2022 19:07:48 +0000
Content-Type: text/plain; charset="UTF-8"
Content-Transfer-Encoding: quoted-printable
 by: Vikram Kerkar - Thu, 16 Jun 2022 19:07 UTC

On Friday, 22 April 2022 at 06:39:45 UTC+5:30, Hanah anees wrote:
> On Thursday, July 5, 2018 at 10:33:59 AM UTC-4, kalvi...@gmail.com wrote:
> > keskiviikko 30. toukokuuta 2018 22.48.12 UTC+3 sys...@gmail.com kirjoitti:
> > > hi Kalvin
> > >
> > > any updates, sample code, im trying to do the same on an m4 g55 microchip mcu.
> > >
> > > thanks
> > >
> > > rp
> > >
> > >
> > > On Thursday, April 27, 2017 at 2:34:38 AM UTC+10, kalvi...@gmail.com wrote:
> > > > Hi group!
> > > >
> > > > As a n00b in the IoT domain I have had trouble finding a suitable open source implementation in C for the LWM2M protocol with DTLS support.
> > > >
> > > > What I have found so far are following implementations:
> > > >
> > > > - Contiki lwm2m: https://github.com/sics-iot/lwm2m-contiki
> > > > - Wakaama LWM2M: https://github.com/eclipse/wakaama
> > > > - Awa LWM2M: https://github.com/FlowM2M/AwaLWM2M
> > > > - Anjay: https://github.com/AVSystem/Anjay
> > > >
> > > > However I am not able to compare pros and cons of the different implementations in terms of code quality, features, maturity, code size etc.
> > > >
> > > > The target device is built on an ARM Cortex M4 with 256 KB Flash memory, 48 KB of RAM and an Ethernet connection. The network stack might be LwIP supporting IPv4 and IPv6, but if I decide to go for Contiki I probably will use the built-in uIP stack. The device is a OS-less bare-metal system or Contiki.
> > > >
> > > > I would appreciate very much if someone has experience in those implementations and could give me some feedback or point me to the right direction.
> > > >
> > > > Best regards,
> > > > Kalvin
> > Hi rp,
> > Sorry this late reply, but I haven't been reading the newsgroups lately.. Anyway, here is how I proceeded with the porting effort:
> >
> > 1. First, I took the Wakaama client source code and the LwIP 2.0.2 source code, and made the Wakaama client running on a PC using the LwIP socket interface. This required tweaking the Wakaama build scripts so that the build process would also build the LwIP and link it with Wakaama.
> >
> > 2. Modified Wakaama client to use the LwIP raw API running on a PC. The LwIP porting guide is a good place to start:
> > http://lwip.wikia.com/wiki/Porting_for_an_OS
> >
> > This all was pretty straight forward to do as Wakaama has quite simple and thin networking interface using only UDP protocol.
> >
> > Wireshark proved to be a very valuable too in this process when debugging the DTSL-related stuff for example.
> >
> > You may need to use the TAP-interface adapter so that the LwIP is able to use the Ethernet interface of your development machine:
> > https://backreference.org/2010/03/26/tuntap-interface-tutorial/
> >
> > Now that I had the Wakaama client running on a PC using LwIP raw interface I had to make it running on my target hardware.
> >
> > 3. I needed setup a LwIP PPP connection.
> >
> > 4. Tweaked the LwIP configuration to fit the target hardware.
> >
> > 5. Tweaked the TinyDTLS build scripts so that it compiles cleanly on the target hardware and ARM C compiler.
> >
> > 6. My target ARM-system did not provide the malloc and free, so I had to figure out what to do with that. Luckily the LwIP provided also malloc and free, and modified the source code to use these library functions. There were some other minor functions that I needed to implement, like the time functions.
> >
> > 6. After a clean build and some printf-debugging, I was able to connect my target hardware running Wakaama client to a server over PPP.
> >
> > That's basically the whole process. Although I hadn't been working with the LwIP nor Wakaama before, it took me less than two weeks (with very little sleep) to get the things up and running and to get the Wakaama LWM2M client DTLS connection working with the Leshan server.
> >
> > During more comprehensive testing it was found out that DTLS/Wakaama was bleeding some memory. I added some printf's to LwIP malloc/free adapter stubs which were created to mimic the std malloc and free functions. Created a simple Python tool to track the malloc/free memory blocks using the printf-output, and I was able to spot the problematic places and patched the code to release the allocated memory so that the malloc/free was working without any further issues.
> >
> > Hope this helps you to get started.
> >
> > Br,
> > Kalvin
> Hello All,
> We are integrating Anjay LWM2M client on Murata Type 1LD (cypress psoc). if mbedTLS is enabled there is an error trying to register. Where as the code works in non -secure mode. Also the same code works fine in mbedTLS mode from linux machine. So this has to be an issue with Anjay LWM2M and WICED integration. Trying to debug and not sure what the following error means, any help is much appreciated
>
> Setting IPv6 link-local address
> Obtaining IPv4 address via DHCP
> IPv6 Network ready IP: FE80::29D:6BFF:FE62:78AA
> IPv4 Network ready IP: 192.168.1.195
> Wifi network up success
> Wifi network up success
>
> TEST Version 1.0.4
>
> *** mbedtls_ctr_drbg_seed ***
>
> entropy_callback
>
> ######################## entropy_callback
> Seed_callback out buff : 536930016
> Initializing Anjay
> RunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunningRunning$$$$$ AVS_NET_DTLS_SOCKET $$$$$$
> avs_net_dtls_socket_create
> WITH SSL
> $$$$$create_ssl_socket
> configure_ssl socket 0x2000e3cc, configuration= 0x2000e4e8
>
> *initialize_ssl_socket
> AVS_NET_SECURITY_PSK
>
> ******** initialize_psk_security ******
>
> ******************* mbedtls_ssl_conf_psk ###################
> Psk key P4s$w0rd length 8
> Identity testboard length 9
> $$$$$$$ AVS_OK
> ************_anjay_server_connection_internal_bring_online
>
> Start SSL
> **Could not restore session; performing full handshake
> MBEDTLS_SSL_CLI_C end point 0
> inside mbedtls_ssl_flush_output
> wrap_handshake_result Result 0, security mode 1, dane_ta_certs (null) verify_result 0
> handshake success: new session started
> **Return AVS_OK
>
> ANJAY_REGISTRATION_ERROR_REJECTED
> update rejected for SSID 1 needs re-registration
> Attempting to register with LwM2M version 1.0
> sending Register
> lwm2m version 0
> coap_base->last_exchange_id 0
> (*exchange_ptr)->id 0
> avs_time_monotonic_now() second 0 nanosec 9
> Register send
> Runningget_dtls_overhead
> avs_net_socket_send
>
> send_ssl start
>
> Output Bytes:48 2 B4 66 D 88 34 D0 23 5B 8B 31 B2 72 64 11 28 39 6C 77 6D 32 6D 3D 31 2E 30 C 65 70 3D 74 65 73 74 62 6F 61 72 64 5 6C 74 3D 36 30 FF 3C 2F 31 2F 30 3E
> send_ssl socket= 0x20015b18 , buffer= 0x20017014 , buffer_length= 53
> Going for mbedtls_ssl_write
> Handshake not NULL
> Client id (null) client id length 0 Host name try-anjay.avsystem.com psk (null) psk_leng 0
> Psk key P4s$w0rd ident testboard
> Hand shake not over
> MBEDTLS_SSL_CLI_C end point 0
> inside mbedtls_ssl_flush_output
> inside mbedtls_ssl_flush_output
> avs_bio_send
> avs_net_socket_send
> inside mbedtls_ssl_flush_output
> avs_bio_send
> avs_net_socket_send
> wrap_handshake_result Result 53, security mode 1, dane_ta_certs (null) verify_result 0
> Hand shake result : 53
> RunningReceive_ssl socket = 0x20015b18, buffer= 0x200141e8 , buffer_length= 2048inside mbedtls_ssl_flush_output
> MBEDTLS_SSL_CLI_C end point 0
> inside mbedtls_ssl_flush_output
> wrap_handshake_result Result -76, security mode 1, dane_ta_certs (null) verify_result 0
> receive failed: -76
> RunningRunningRunningavs_net_socket_send
>
> send_ssl start
>
> Output Bytes:48 2 B4 66 D 88 34 D0 23 5B 8B 31 B2 72 64 11 28 39 6C 77 6D 32 6D 3D 31 2E 30 C 65 70 3D 74 65 73 74 62 6F 61 72 64 5 6C 74 3D 36 30 FF 3C 2F 31 2F 30 3E
> send_ssl socket= 0x20015b18 , buffer= 0x20017014 , buffer_length= 53
> Going for mbedtls_ssl_write
> Handshake not NULL
> Client id (null) client id length 0 Host name try-anjay.avsystem.com psk (null) psk_leng 0
> Psk key P4s$w0rd ident testboard
> Hand shake not over
> MBEDTLS_SSL_CLI_C end point 0
> inside mbedtls_ssl_flush_output
> inside mbedtls_ssl_flush_output
> avs_bio_send
> avs_net_socket_send
> Handshake return -26880
> Going for mbedtls_ssl_write
> Handshake not NULL
> Client id (null) client id length 0 Host name try-anjay.avsystem.com psk (null) psk_leng 0
> Psk key P4s$w0rd ident testboard
> Hand shake not over
> MBEDTLS_SSL_CLI_C end point 0
> inside mbedtls_ssl_flush_output
> Handshake return -76
> wrap_handshake_result Result -76, security mode 1, dane_ta_certs (null) verify_result 0
> Hand shake result : -76
> socket bio_error
> send failed 0 53 : -76
> AVS_COAP_CLIENT_REQUEST_FAIL
> failure while receiving Register response: Message too long
> mapping CoAP error Message too long to network error
> ANJAY_REGISTRATION_ERROR_NETWORK
> could not register to server 1
>
> Thanks
> Anees


Click here to read the complete article
1
server_pubkey.txt

rocksolid light 0.9.8
clearnet tor