Help wanted for yaota8266 project...

All ESP8266 boards running MicroPython.
Official boards are the Adafruit Huzzah and Feather boards.
Target audience: MicroPython users with an ESP8266 board.
Post Reply
jedie
Posts: 247
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Help wanted for yaota8266 project...

Post by jedie » Sun Jan 05, 2020 3:04 pm

I need some help for yaota8266, because i have no experience with the C programming :oops:



I refactored the OTA client. Now you don't have to specify the IP address of the device anymore.
A UDP broadcast will be sent and if the first device reports something back, future packets will only be sent to this IP.

Here is a problem: The device sends nothing back on errors: So the OTA client didn't recognized the device and send the first packed, again and again to 255.255.255.255 UDP broadcast address.

Think it's better to send something back in case of a error. But how to do this?
Existing issued for this: https://github.com/jedie/yaota8266/issues/4



Another problem: The device prints the error: "Invalid digest size in signature". This happens on first packet. So the update stuck in a "first packed" loop. I have no idea what's the real problem is.
Existing issued for this: https://github.com/jedie/yaota8266/issues/3



Some background information:

I already merged all needed open pull requests from https://github.com/pfalcon/yaota8266/pulls a few are needed bugfixes without it not work.

I created a own fork here: https://github.com/jedie/yaota8266 because Paul Sokolovsky seems to have no interests to bring this project a step further, see: https://github.com/pfalcon/yaota8266/pull/27

jedie
Posts: 247
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Help wanted for yaota8266 project...

Post by jedie » Sun Jan 05, 2020 5:31 pm

Oh. OTA hat now be worked for the first time...

On the device it's ends with:

Code: Select all

...
UDP incoming from: 49b2a8c0:49412, data=0x3ffebbc2
Pkt id: c51
offset: 806912 len: 256
Proc1 time: 3567
Full time: 3818
UDP incoming from: 49b2a8c0:49412, data=0x3ffed4d2
Pkt id: c52
offset: 807168 len: 18
Proc1 time: 3212
Full time: 3434
UDP incoming from: 49b2a8c0:49412, data=0x3ffedb16
Pkt id: c53
offset: 0 len: 0
Writing 274 bytes of buf to 101000
OTA finished, rexmits: 5
Rebooting
The Python OTA client output looks like this:

Code: Select all

yaota8266/cli.py ota micropython-sonoff-webswitch/build/firmware-ota.bin.ota
Validate micropython-sonoff-webswitch/build/firmware-ota.bin.ota
File is valid, ok.
wait for response...........received from: ('192.168.178.30', 8266)
1.0% Sending #33 (9.2 KBytes/s)
3.5% Sending #111 (14.6 KBytes/s)
...
94.2% Sending #2970 (15.5 KBytes/s)
95.8% Sending #3020 (15.4 KBytes/s)
98.0% Sending #3089 (15.4 KBytes/s)
Send OTA end...Done, rexmits: 2
Send 807186 Bytes in 51.2sec (15.4 KBytes/s)

kevinkk525
Posts: 745
Joined: Sat Feb 03, 2018 7:02 pm

Re: Help wanted for yaota8266 project...

Post by kevinkk525 » Sun Jan 05, 2020 6:57 pm

Awesome! Did it also update the firmware correctly now? That would be a huge step forward for the esp8266
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

jedie
Posts: 247
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Help wanted for yaota8266 project...

Post by jedie » Sun Jan 05, 2020 7:27 pm

Seems so. But needs more tests.

Just test it an report your experience... Hopefully we can make it more stable...

I have tried to make it more "dumb user fit" and add some checks. The idea is that it is easy to verify that the builded and flashed bootloader is created with the existing RSA private key...

Check the yaota8266.bin is easy and looks like this:

Code: Select all

/docker-yaota8266$ make verify 
make -C yaota8266 verify
make[1]: Verzeichnis „/home/jens/repos/micropython-sonoff-webswitch/docker-yaota8266/yaota8266“ wird betreten
python3 cli.py verify
config.h exists, ok.
config.h check, ok.
yaota8266.bin exists, ok.
yaota8266.bin SHA256: ca02469c99fda6af957d373181770462e0e124f4cc8fe7399ab276f8ece9c8e2
RSA modulus found at 0x80e0
yaota8266.bin was created with the current RSA priv.key, ok.
make[1]: Verzeichnis „/home/jens/repos/micropython-sonoff-webswitch/docker-yaota8266/yaota8266“ wird verlassen
I also tried to check if the device contains the code with the right RSA Key... So i made this: https://github.com/jedie/yaota8266/blob ... _device.py but this currently not work, see: https://github.com/jedie/yaota8266/blob ... _device.py


I also create/enhance Makefile and CLI, e.g.:

Code: Select all

.../yaota8266$ make
make targets:
  help              This help page
  print-rsa-modulus Print the RSA modulus line for copy&paste into config.h
  rsa-keys          Generate RSA keys and print the RSA modulus line for copy&paste into config.h
  verify            Check RSA key, config.h and compiled "yaota8266.bin"
  build             Build boot8266 and ota-server and combine it to: "yaota8266.bin" and verfiy it
  clean             clean builded files

Code: Select all

.../yaota8266$ ./cli.py -h
usage: cli.py [-h]
              {generate_rsa_keys,print_rsa_modulus,sign,ota,canned_ota,verify}
              ...

yaota8266 (yet another esp8266 OTA) client

optional arguments:
  -h, --help            show this help message and exit

subcommands:
  {generate_rsa_keys,print_rsa_modulus,sign,ota,canned_ota,verify}
    generate_rsa_keys   Generate RSA keys in '.../yaota8266/ota_client/' if
                        not already exists
    print_rsa_modulus   Print the RSA modulus line for copy&paste into
                        config.h
    sign                Sign firmware file for OTA
    ota                 Do the OTA update for a device
    canned_ota          Do the 'canned' OTA update for a device
    verify              Check RSA key, config.h and compiled 'yaota8266.bin'

jedie
Posts: 247
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Help wanted for yaota8266 project...

Post by jedie » Mon Jan 06, 2020 8:28 am

Seems that there is also a problem if the device can't access the WiFi. Seems that it then hangs in a boot loop.
But i don't know if it's a general problem of ESP8266?!?

I see this output:

Code: Select all

...
no FooBarSSID found, reconnect after 1s
reconnect
no FooBarSSID found, reconnect after 1s
reconnect
no FooBarSSID found, reconnect after 1s
reconnect
no FooBarSSID found, reconnect after 1s
reconnect
...
See also: viewtopic.php?f=16&t=5995

jedie
Posts: 247
Joined: Fri Jan 29, 2016 12:32 pm
Contact:

Re: Help wanted for yaota8266 project...

Post by jedie » Thu Jan 16, 2020 7:01 am

kevinkk525 wrote:
Sun Jan 05, 2020 6:57 pm
Awesome! Did it also update the firmware correctly now? That would be a huge step forward for the esp8266
Have you try it?

kevinkk525
Posts: 745
Joined: Sat Feb 03, 2018 7:02 pm

Re: Help wanted for yaota8266 project...

Post by kevinkk525 » Thu Jan 16, 2020 7:34 am

No I didn't try it yet.
Kevin Köck
Micropython Smarthome Firmware (with Home-Assistant integration): https://github.com/kevinkk525/pysmartnode

Post Reply