OTA upload error

#1

1. My goal is:
Perform OTA update with curl
2. My actions are:
`

curl -F file=fw.zip https://mdash.net/api/v2/devices/device3/ota?access_token=API_TOKEN

`
3. The result I see is:

  "code": -1,
  "message": "-1 Image too big"

4. My expectation & question is:
OTA to be performed. Am I doing something wrong here?

Thanks.

#2

Which platform are you building for?
What is the size of fw.zip?
Can you flash it successfully?

Do you build a custom firmware or one of the demos?

BTW, the syntax of your curl line is incorrect.
Should be curl -F file=@path_to_the_file. Notice the @.
Ref: Using REST API

#3

1.Which platform are you building for?
ESP8266
2.What is the size of fw.zip ?
933KB
3.Can you flash it successfully?
Yes.
4.Do you build a custom firmware or one of the demos?
Smartlight demo
5.BTW, the syntax of your curl line is incorrect.
Should be curl -F file=@path_to_the_file . Notice the @
I will check in terminal if I have the @ when sending the curl command. I hope that is a typo mistake in the post and not that is the problem.

Thanks.

#4

I suppose you are talking about mongoose-os-smart-light.
OTA with curl or the mdash.net interface works for me for both ESP32 and ESP8266.

#5

I get the same error on mdash.net and curl.
To check if I did something wrong I download again the example from your link, build it with mos build, flash it to a different esp8266(flash is successfully) and try to send it again via OTA.

{
  "code": -1,
  "message": "-1 Image too big"
}

Same message appears.

This is what I get into console:

[Jan 28 20:48:36.847] mg_rpc.c:293            OTA.Begin via WSS_out 148.251.54.236:443
[Jan 28 20:48:36.854] mgos_ota_core.c:253     Starting, timeout 600, commit timeout 600, mem 39064
[Jan 28 20:48:37.212] mg_rpc.c:293            OTA.Write via WSS_out 148.251.54.236:443
[Jan 28 20:48:37.270] mg_rpc.c:293            OTA.Write via WSS_out 148.251.54.236:443
[Jan 28 20:48:37.282] mgos_ota_core.c:489     FW: smartlight esp8266 1.0 20200128-181300
[Jan 28 20:48:37.295] esp_ota_backend.c:152   Slot 1, FW: smartlight.bin -> 0x200000, FS fs.bin -> 0x48000
[Jan 28 20:48:37.307] mgos_ota_core.c:506     0.15% total, esp_init_data_default_v08.bin 128 of 128
[Jan 28 20:48:37.326] esp_ota_backend.c:231   Cannot write fs.bin (262144) @ 0x48000: max size 131072
[Jan 28 20:48:37.334] mgos_ota_core.c:811     Update finished, result -1 (Image too big)
[Jan 28 20:48:37.715] mg_rpc.c:293            OTA.Write via WSS_out 148.251.54.236:443
[Jan 28 20:48:37.970] mg_rpc.c:293            OTA.Write via WSS_out 148.251.54.236:443
[Jan 28 20:48:38.214] mg_rpc.c:293            OTA.End via WSS_out 148.251.54.236:443

Is it possible to send me your fw.zip to see if that works?

#6

Ahhh! Does your ESP8266 have at least 2MB of flash?
If not, OTA is not available…

#7

Should be ok, right?


But I build it with
> mos build --platform esp8266 --build-var BOARD=esp8266-2M
Could this be the problem?

#8

262144 is the size of the filesystem in the new firmware. The existing one has only 131072.
That means it was built with --build-var BOARD=esp8266-2M and included the boards library.

mongoose-os-smart-light does not include it and it’s built with the default 4M layout.
To build it with 2M layout, either add boards in its mos.yml or use --build-var FLASH_SIZE=2097152.