HomeACcessoryKid / life-cycle-manager

Initial install, WiFi settings and over the air firmware upgrades for any esp-open-rtos repository on GitHub
Apache License 2.0
60 stars 11 forks source link

Firmware size 666k #11

Closed kiralikbeyin closed 5 years ago

kiralikbeyin commented 5 years ago

My firmware size is 666k

erasing@0x8a000>070000...762540 cc7725...79d425 f7dee8...5e0e86 b32a3e...fd9dc3  so far collected 561152 bytes
send request......OK
erasing@0x8b000>1e8d3e...2d8569 662107...ab888d 72b9f8...864886 f70d02...797074  so far collected 565248 bytes
send request......OK
erasing@0x8c000>696f6e...040b00 69642d...000000 605c28...204b45 592d2d...3e3e20  so far collected 569344 bytes
send request......OK

download stops at 569344

maccoylton commented 5 years ago

Your firmware is too large for OTA, depending on the size of your sysparams area, then the maximum is somewhere around 512k. In my setup I believe its specifically 565248 bytes.

What type of device are you trying to build?

kiralikbeyin commented 5 years ago

@maccoylton it is a dynamic service and using some custom libs.

I think lcm is not good for me because of size.

Do you have any experince with http_client_ota? https://github.com/SuperHouse/esp-open-rtos/issues/726

maccoylton commented 5 years ago

@maccoylton it is a dynamic service and using some custom libs. ...

@kiralikbeyin sorry no, never used http_client_ota. We have been able to fit all accessories inside 512k so far even including some custom libs. For example I have a thermostat that used a screen, and fonts, but that is still within the limit. I’m curious as to what accessory you are creating and what custom libs?

Sent with GitHawk

kiralikbeyin commented 5 years ago

When flashing with usb i see

Configuring flash size...
Flash params set to 0x0320
Compressed 3072 bytes to 2183...
Wrote 3072 bytes (2183 compressed) at 0x00000000 in 0.2 seconds (effective 125.1 kbit/s)...
Hash of data verified.
Compressed 2048 bytes to 23...
Wrote 2048 bytes (23 compressed) at 0x00001000 in 0.0 seconds (effective 2470.9 kbit/s)...
Hash of data verified.
Compressed 665540 bytes to 462839...
Wrote 665540 bytes (462839 compressed) at 0x00002000 in 40.8 seconds (effective 130.5 kbit/s)...

Wrote 665540 bytes (462839 compressed) at 0x00002000 in 40.8 seconds (effective 130.5 kbit/s)...

Is it possible to use compressed bin file?

I tried to use "make image" https://github.com/espressif/esptool/wiki/Advanced-Commands#make_image but didnt give compressed file..

How to make a compressed bin file.. any tool maybe?

Accessories are switches. Custom libs like mbedtls, http server etc..

kiralikbeyin commented 5 years ago

https://github.com/espressif/esptool/issues/451#issuecomment-518456916 no way to make a compressed bin file

@HomeACcessoryKid Please can you write max size for binary file?

HomeACcessoryKid commented 5 years ago

The maximum user space with the current setup is 0x2000 - 0x8d000 or 569344 since that is where the OTA firmware itself starts. What happens is that once you overwrite that it is broken.

I created LCM specifically for a 1Mbytes flash and because the crypto I cannot make the OTA firmware any smaller.

What you could do if you feel you are up to it, is adapting the concept a little by using a flash of 2Mbytes or bigger, and adjusting the rboot settings and defined values to use two partitions of 1Mbyte each. Make your own repo and create your own secret key. It is a tricky puzzle, but doesn't require inventing new stuff.
Due to time constraints I will not do this

Another option is to find out if you can reduce your code to under 569k. Wolfssl is a nice library for crypto as well

I will close the subject now BR, HacK