[FL-2269] Core2 OTA (#1144)

* C2OTA: wip
* Update Cube to 1.13.3
* Fixed prio
* Functional Core2 updater
* Removed hardware CRC usage; code cleanup & linter fixes
* Moved hardcoded stack params to copro.mk
* Fixing CI bundling of core2 fw
* Removed last traces of hardcoded radio stack
* OB processing draft
* Python scripts cleanup
* Support for comments in ob data
* Sacrificed SD card icon in favor of faster update. Waiting for Storage fix
* Additional handling for OB mismatched values
* Description for new furi_hal apis; spelling fixes
* Rework of OB write, WIP
* Properly restarting OB verification loop
* Split update_task_workers.c
* Checking OBs after enabling post-update mode
* Moved OB verification before flashing
* Removed ob.data for custom stacks
* Fixed progress calculation for OB
* Removed unnecessary OB mask cast

Co-authored-by: Aleksandr Kutuzov <alleteam@gmail.com>
This commit is contained in:
hedger
2022-04-27 18:53:48 +03:00
committed by GitHub
parent 81aeda86db
commit 7ce305fca3
41 changed files with 1622 additions and 295 deletions

View File

@@ -15,13 +15,18 @@ static const char* update_task_stage_descr[] = {
[UpdateTaskStageValidateDFUImage] = "Checking DFU file",
[UpdateTaskStageFlashWrite] = "Writing flash",
[UpdateTaskStageFlashValidate] = "Validating",
[UpdateTaskStageRadioImageValidate] = "Checking radio image",
[UpdateTaskStageRadioErase] = "Removing radio stack",
[UpdateTaskStageRadioWrite] = "Writing radio stack",
[UpdateTaskStageRadioCommit] = "Applying radio stack",
[UpdateTaskStageRadioInstall] = "Installing radio stack",
[UpdateTaskStageRadioBusy] = "Core2 is updating",
[UpdateTaskStageOBValidation] = "Validating opt. bytes",
[UpdateTaskStageLfsBackup] = "Backing up LFS",
[UpdateTaskStageLfsRestore] = "Restoring LFS",
[UpdateTaskStageResourcesUpdate] = "Updating resources",
[UpdateTaskStageCompleted] = "Completed!",
[UpdateTaskStageError] = "Error",
[UpdateTaskStageOBError] = "OB error, pls report",
};
static void update_task_set_status(UpdateTask* update_task, const char* status) {
@@ -37,7 +42,10 @@ static void update_task_set_status(UpdateTask* update_task, const char* status)
void update_task_set_progress(UpdateTask* update_task, UpdateTaskStage stage, uint8_t progress) {
if(stage != UpdateTaskStageProgress) {
update_task->state.stage = stage;
// do not override more specific error states
if((update_task->state.stage < UpdateTaskStageError) || (stage < UpdateTaskStageError)) {
update_task->state.stage = stage;
}
update_task->state.current_stage_idx++;
update_task_set_status(update_task, NULL);
}
@@ -53,7 +61,7 @@ void update_task_set_progress(UpdateTask* update_task, UpdateTaskStage stage, ui
progress,
update_task->state.current_stage_idx,
update_task->state.total_stages,
update_task->state.stage == UpdateTaskStageError,
update_task->state.stage >= UpdateTaskStageError,
update_task->status_change_cb_state);
}
}
@@ -116,6 +124,7 @@ UpdateTask* update_task_alloc() {
update_task->storage = furi_record_open("storage");
update_task->file = storage_file_alloc(update_task->storage);
update_task->status_change_cb = NULL;
string_init(update_task->update_path);
FuriThread* thread = update_task->thread = furi_thread_alloc();
@@ -152,12 +161,6 @@ void update_task_free(UpdateTask* update_task) {
free(update_task);
}
bool update_task_init(UpdateTask* update_task) {
furi_assert(update_task);
string_init(update_task->update_path);
return true;
}
bool update_task_parse_manifest(UpdateTask* update_task) {
furi_assert(update_task);
update_task_set_progress(update_task, UpdateTaskStageReadManifest, 0);
@@ -224,4 +227,4 @@ UpdateTaskState const* update_task_get_state(UpdateTask* update_task) {
UpdateManifest const* update_task_get_manifest(UpdateTask* update_task) {
furi_assert(update_task);
return update_task->manifest;
}
}