feat: add local-staging FULLOTA2 flow
This commit is contained in:
@@ -20,6 +20,10 @@ KERNEL_FLAGS = ROOT / "ql-kernel/threadx/config/common/default_dflags_1602.mk"
|
||||
FOTA_HEADER = ROOT / "ql-application/threadx/common/include/ql_fota.h"
|
||||
BASELINE_HEADER = ROOT / "ql-application/threadx/interface/custom_app/inc/ota_baseline.h"
|
||||
BUILD_MACRO = ROOT / "ql-application/threadx/interface/custom_app/lib/hal/build_macro.h"
|
||||
APP_MAKEFILE = ROOT / "ql-application/threadx/interface/custom_app/Makefile"
|
||||
MQTT_SOURCE = ROOT / "ql-application/threadx/interface/custom_app/mqtt.c"
|
||||
FULLOTA2_SOURCE = ROOT / "ql-application/threadx/interface/custom_app/ota_fullfota2.c"
|
||||
LEGACY_HTTP_SOURCE = ROOT / "ql-application/threadx/interface/custom_app/http_aofei.c"
|
||||
|
||||
FLASH_SIZE = 0x400000
|
||||
EXPECTED = {
|
||||
@@ -139,6 +143,33 @@ def verify_fota_contract() -> None:
|
||||
if '#define CUSTOM_APP_OTA_BUILD_PROFILE "ota_ready_fs640"' not in generated:
|
||||
fail("generated build macro has the wrong OTA build profile")
|
||||
|
||||
makefile = APP_MAKEFILE.read_text(encoding="utf-8", errors="replace")
|
||||
if "ota_fullfota2.c" not in makefile:
|
||||
fail("minimal FULLOTA2 implementation is not part of the application build")
|
||||
mqtt = MQTT_SOURCE.read_text(encoding="utf-8", errors="replace")
|
||||
if "banban_fullfota2_start" not in mqtt:
|
||||
fail("MQTT OTA command does not start the local-staging FULLOTA2 path")
|
||||
if "ql_fullfota_app_start(cmd->params.ota.url)" in mqtt:
|
||||
fail("MQTT OTA command still invokes the legacy FULLOTA1 path")
|
||||
legacy_http = LEGACY_HTTP_SOURCE.read_text(encoding="utf-8", errors="replace")
|
||||
if "return ql_fullfota_app_start(url)" in legacy_http:
|
||||
fail("legacy HTTP polling path can still invoke FULLOTA1")
|
||||
implementation = FULLOTA2_SOURCE.read_text(encoding="utf-8", errors="replace")
|
||||
required_steps = (
|
||||
"ql_fs_free_size('U')",
|
||||
"ql_fota_fixed_internal_flash_upgrade(1)",
|
||||
"ql_fota_set_package_path",
|
||||
"ql_fota_init",
|
||||
"ql_fota_image_write",
|
||||
"ql_fota_image_flush",
|
||||
"ql_stat",
|
||||
"ql_fota_image_verify",
|
||||
"ql_power_reset",
|
||||
)
|
||||
positions = [implementation.find(step) for step in required_steps]
|
||||
if any(position < 0 for position in positions) or positions != sorted(positions):
|
||||
fail("minimal FULLOTA2 prepare/verify/activate sequence is incomplete or reordered")
|
||||
|
||||
|
||||
def verify_app(path: Path) -> None:
|
||||
if not path.is_file():
|
||||
|
||||
Reference in New Issue
Block a user