You can chat about native SDK questions and issues here.

User avatar
By berkutta
#60746 @gjump
Now it seems to kind of work. The routine starts (first printf for erasing sector 16 get's printed) but after that nothing happens. It goes into the wdt. But after that it can't boot anymore. So it seems to cleared some parts of sector 16. Any ideas why it can't complete the erase of sector 16? (Programm like on screenshot above). Don't know how the ld linker thing exactly works. I attached mine of NONOS 2.
You do not have the required permissions to view the files attached to this post.
User avatar
By gjump
#60788 @Berkuta, maybe the area that you are trying to erase is write protected? Did you checked the following docs:
99A-ESP8266__Flash_RW_Operation__EN_v0.2.pdf
https://github.com/esp8266/esp8266-wiki/wiki/Memory-Map
I did a fast reading, and it seams that only the last 4 sectors are available to user RW.
Try the sector 0x3C.

keep me updated!
User avatar
By berkutta
#60789 @gjump I think the PDF is about how you can make your user data safe to power loss etc. But I don't want/need to store user data. On Sector 16 the program (irom0) itself begins. And that is what I want to rewrite. That's the reason why this routine must be in RAM :)
User avatar
By gjump
#60791 @berkutta
Ohhh, you want to self update you own app. OK, now we are on the same page.
First you should check this doc:
99C-ESP8266__OTA_Upgrade__EN_v1.5.pdf

But those are the steps you should follow
1- Be sure that your are using the bootloader version, otherwise isn't possible to perform self update, afaik.
2- Call the function system_upgrade_userbin_check to check if you need to flash userbin1 or userbin2, each one is stored in one half of your memory.
3- Erase/program the userbin area not used
4- Call system_upgrade_flag_set to update the userbin flag, the let the bootloader know that on next reboot it should call the updated userbin
5- Call system_upgrade_reboot to finish the update and reboot.

Obs: Remember that the bin files for userbin1 and userbin2 are diferent because each one are stored in different memory addresses, you have to compile both, and during the update you check which one will be programmed.

:D