yaota8266 icon indicating copy to clipboard operation
yaota8266 copied to clipboard

Allow user app to signal need to enter an OTA bootloader

Open pfalcon opened this issue 8 years ago • 6 comments

Allow user app to call some function which cause a reboot with unconditional start of ota-server part. (E.g., to implement MicroPython's pyb.bootloader()).

pfalcon avatar Jan 10 '17 07:01 pfalcon

This is actually soft-blocked on https://github.com/micropython/micropython/issues/2779

pfalcon avatar Jan 29 '17 16:01 pfalcon

Isn't it possible to write a magic word with machine.RTC().memory(magicword) into the RTC-memory and check for this from boot8266.c?

I can set and re-read (after reset) the memory successfully from the RTC-mem in micropython, however I am kind of pulling my hair, how to get the user-memory contents from boot8266.c. I have printed all the memory (512 bytes) starting from BASE_RTCMEM=0x60001000, but can't find anything defined before in micropython in the output - after entering micropython again, I can see the memory in machine.RTC().memory().

http://www.esp8266.com/viewtopic.php?f=8&t=3505 mentions to use system_rtc_mem_read but I assume that his should map anyways back to the aforementioned memory address.

Any idea or advice, how I can get the RTC-memory-content and any suggestions for magic words ("YAOTAOTA","MPOTAOTA")? Then I will happily fork and patch.

ulno avatar Jul 24 '17 23:07 ulno

Ah, just saw that the memory start seems to be 0x60001200 and I found the contents there too.

ulno avatar Jul 24 '17 23:07 ulno

Working and implemented in https://github.com/ulno/yaota8266/commit/566a292bb2269747c3475b835d3a84ebc0c3061f

You can now trigger the OTA mode via the following:

import machine
machine.RTC().memory("yaotaota")
machine.reset()

After such a reset, the memory will show zaotaota:

import machine
machine.RTC().memory()
machine.RTC().memory()
b'zaotaota'

ulno avatar Jul 25 '17 20:07 ulno

Hi @ all, is a better way available as this to start the ota server via remote? My IOT device are build in (wall, housings, ...) and i will make update over the air without press a button. Is this way to write a magic word in the flash the best solution? Thx Hexxter

hexxter avatar Apr 22 '18 15:04 hexxter

What I described, works pretty well, and is just a small patch to yaota - just check out my fork.

Though recently I have trouble compiling it against head (compare #19) - does the normal yaota still compile against micropython head?

ulno avatar Apr 22 '18 15:04 ulno