Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Two-stage firmware? #20

Open
pvvx opened this issue Oct 23, 2023 · 3 comments
Open

Two-stage firmware? #20

pvvx opened this issue Oct 23, 2023 · 3 comments

Comments

@pvvx
Copy link

pvvx commented Oct 23, 2023

If the size of the fw bin file is less than 128 kilobytes, then two-stage firmware from the original (MiHome) is not required. It is necessary to enter the code in the cold start to move the fw to the required area of flash memory. There is an example in the firmware for MJWSD05MMC.
TelinkMiFlasher and some custom firmware already support advanced OTA for writing files larger than 128 kilobytes to the 0x40000 area.
Zigbee also has the ability to restore the original (original from MiHome) firmware via OTA.

Если размер файла fw bin меньше 128 килобайт, то двухэтапная прошивка из оригинала (MiHome) не требуется. Необходимо вписать код в холодный запуск для перемещения fw в требуемую область флэш-памяти. В прошивке для MJWSD05MMC есть пример.
TelinkMiFlasher и некоторые пользовательские прошивки уже поддерживают расширенный OTA для записи файлов размером более 128 килобайт в область 0x40000.
Zigbee также имеет возможность восстановить исходную (оригинал от MiHome) прошивку через OTA.

@devbis
Copy link
Owner

devbis commented Oct 25, 2023

The size for the firmware is almost 128kb that makes impossible to flash it with you flashing tool after adding more features and spilling over 129kb (due to restrictions in the web UI). In this case bluetooth firmware should be able to write a firmware to 0x40000 address, what is intermediate firmware does.

ota_40000 is literally doing what you've said (it's your code modified). It looks for the boot flag in 0x20000, moves itself to 0x40000, and changes its segments to let next zigbee firmware be written to 0 or 0x40000.

@pvvx
Copy link
Author

pvvx commented Oct 25, 2023

For double flashing, you need to use a random MAC.
Otherwise, there will be problems described in this issue

Для двойной перепрошивки требуется использовать случайный MAC.
Иначе будут проблемы, описанные в этом issue

@pvvx
Copy link
Author

pvvx commented Nov 12, 2023

Starting from firmware version v4.6, all thermometers in TelinkMiFlasher.html (v6.9) support BigOTA.

BigOTA is enabled if the OTA file is larger than 128 kilobytes.
BigOTA download occurs at address 0x40000.
BigOTA size limit is 221184 bytes. The MAC of the device is written at address 0x76000.

If the battery is low, the connection may be interrupted. Then you will need to download again.
For example, MiHome does not allow OTA when the battery charge is less than 50%.


Начиная с версии прошивки v4.6, все термометры в TelinkMiFlasher.html (v6.9) поддерживают BigOTA.

BigOTA включается, если файл OTA более 128 килобайт.
Загрузка BigOTA происходит по адресу 0x40000.
Ограничение размера BigOTA в 221184 байт. По адресу 0x76000 записан MAC устройства.

При слабой батарее возможен разрыв связи. Тогда потребуется повторить загрузку.
Например, MiHome не разрешает ОТА при заряде батареи менее 50%.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants