Re: #LWM2M #Leshan #FirmwareUpdate #lwm2m #leshan #firmwareupdate

Lubos, Robert

Hi Thomas,


I’m not sure if the firmware update is even achievable on qemu_x86 platform (same goes with reboot). The lwm2m_client sample does not implement the actual FW update procedure, just provide stubs to get the communication going.


I’ve included some more replies inline below.





From: devel@... <devel@...> On Behalf Of Thomas LE ROUX via
Sent: poniedziałek, 2 listopada 2020 17:14
To: devel@...
Subject: [Zephyr-devel] #LWM2M #Leshan #FirmwareUpdate


Hi everybody !

I'm trying to build a projet using Zephyr & LWM2M (& Leshan).

TL;DR before I start explaining more precisely my issue :

Having issue making a Firmware Update on a QEMU_x86 instance.

Has anyone been able to successfully achieve a Firmware Upgrade ? How ?


For now, I'm prototyping through QEMU.

I have made my small application to test things out, creating objects and ressources ; defining new .xml files … There's one last thing that I need to succeed before going deeper into my project : Firmware Update. I am unable to make a firmware update on my QEMU instance.

I am actually using a Leshan localhost as my LWM2M server.

I’ve tried several things :

  • Pushing using 5/0/0 :
    • File above 200ko can’t be pushed without an issue occuring (packets stop downloading and 5/0/3 remain at the value 1 (meaning « downloading ») afterwards.

Try increasing the “Response Timeout” parameter in the Leshan web UI. The Leshan will cease to transmit further updates if it does not finish the operation before “Response timeout”.

    • The .elf generated for samples/basic/hello_world is around 400ko which causes an issue here.
    • The .bin generated, however, weight around 100ko which is fine.
      • The file uploads (result can be seen on my terminal).
        • [00:00:28.040,000] <inf> net_lwm2m_client_app: FIRMWARE: BLOCK RECEIVED: len:37 last_block:1
      • The 5/0/3 State value goes to 2 (« downloaded »).
      • When I execute 5/0/2 (Update) : 5/0/5 (Update Result) goes to 1 (meaning Firmware updated successfully).
      • However, nothing happens, and my QEMU continue to respond to requests, no flash occurs.

Nothing else can be expected from the sample at this point (as I said I’m not sure if it’s possible to do the actual firmware update of the qemu_x86 image). From the LwM2M point of view, the FW update procedure is complete as the entire image was delivered to the device. You can check how does it work with an actual device for instance here:

  • Pulling using 5/0/1 :
    • I've run a local server in order to make a firmware update through 5/0/1 by giving the http address of .bin and .elf.
    • When I try to Update (for .elf or .bin, i have the following Update Result : 9 (meaning « Unsupported protocol » )

This is happening because http is not implemented as a FW delivery method in the LwM2M library. For now, only CoAP block transfer is supported.

The problem might be related to the fact that some functions are not yet implemented in Zephyr (e.g : Device reboot on 3/0/4 leads to a callback doing « /* Change the battery voltage for testing */ » and no reboot, same for Factory Default ) …

My problem is pretty much described, if needed, I can send some logs.


Thank you for your help !

Best regards,



Join to automatically receive all group messages.