dheeptuck / esp8266-ota

An ota example for esp8266 using non-os SDK and rboot
MIT License
6 stars 5 forks source link

what is OTA_FILE ? #1

Open dipendra77 opened 4 years ago

dipendra77 commented 4 years ago

what is file.bin in rboot_ota.h ?what is its significance and how do you generate it ?Why are you loading it at 0xff address. Please explain.

dheeptuck commented 4 years ago

OTA_FILE is used to specify an arbitrary file(not the firmware binary) that needs to be loaded into the flash. See rboot-ota.c comments for more info. If you are looking for doing a Firmware OTA, then it doesn't matter whatever name you define for OTA_FILE. In case you are looking to transfer and arbitrary file, then the necessary the OTA_FILE needs to be updated with the files name you want to transfer.

dipendra77 commented 4 years ago

I have ported the directly to non is sdk? I am using esp bootloader not rboot ? I am able to download the binary but while writing to flash it fails. Rboot_get_config() should return the current rom address I suppose. I am not very clear how that part is working and how do.you get the partition you need to write the OTA binary to? I am using 2048kb esp8266 version and my OTA partitions are at address 0x1000 (ota1) and 0x81000 (ota2).

dheeptuck commented 4 years ago

See here on how the partition onto which the newer image needs to be copied is figured out. Since the flash sizes you are using is different from the one used in this example, you would need to edit the linker command files here. Also, I would strongly recommend you to use the example project directly first without changing the flash sizes because the your flash size is higher(hence the project can work without modification). If it works you could edit the linker command files(rom0.ld and rom1.ld) for your flash size.

dipendra77 commented 4 years ago

Hi Sudeep, Thank you for your valuable suggestion. I tried it with 2048 KB ROM by writing the binary file to 0x81000 address by hard coding it to the next rom slot address. following is the code snippet inside rboot_ota_start(): ....................... bootconf = rboot_get_config(); slot = bootconf.current_rom; if (slot == 0) slot = 1; else slot = 0; upgrade->rom_slot = slot; if(upgrade->rom_slot == 0) {
bootconf.roms[upgrade->rom_slot] = 0x81000; } else if(upgrade->rom_slot == 1) { bootconf.roms[upgrade->rom_slot] = 0x1000; } upgrade->write_status = rboot_write_init(bootconf.roms[upgrade->rom_slot]); ........................ I am able to do an upgrade. But on boot it fails to fetch the right address it should boot to and goes into fatal exception. I tried hardcoding the address as per the rom_slot variable returned by the rboot_get_config() . How do I avoid hard coding this and which linker script shall i modify and to what , so it becomes compatible with 2048KB flash chip ? Please find attached the linker scripts generated after compilation in text format.

eagle.app.v6.new.1024.app1.ld.txt eagle.app.v6.new.1024.app2.ld.txt

Note: My OTA address are 0x1000 and 0x81000 as per the espressif documentation here, ref. section 4.2.1. https://www.espressif.com/sites/default/files/2a-esp8266-sdk_getting_started_guide_en_0.pdf

Thank you in advance.

dheeptuck commented 4 years ago

Which is the bootloader you are trying to use: expressif or rboot ?