[FL-2836] Fast flash programming mode (#1782)

* updater: lowered logging level for resources unpacking; hal: implemented fast flash write mode
* hal: reworked fast flash programming; clearing most error flags on flash init; changed some flash functions return type from bool to void; scripts: fixed malformed CRC values in update bundles in certain cases;
* hal: flash: larger critical section
* hal: flash: enabling fast write inside critical section
* api_symbols: bump minor version
This commit is contained in:
hedger
2022-09-26 15:03:21 +04:00
committed by GitHub
parent a6b98ccbbe
commit efb09380bd
7 changed files with 110 additions and 83 deletions

View File

@@ -109,10 +109,7 @@ static int storage_int_device_prog(
int ret = 0;
while(size > 0) {
if(!furi_hal_flash_write_dword(address, *(uint64_t*)buffer)) {
ret = -1;
break;
}
furi_hal_flash_write_dword(address, *(uint64_t*)buffer);
address += c->prog_size;
buffer += c->prog_size;
size -= c->prog_size;
@@ -127,16 +124,13 @@ static int storage_int_device_erase(const struct lfs_config* c, lfs_block_t bloc
FURI_LOG_D(TAG, "Device erase: page %d, translated page: %x", block, page);
if(furi_hal_flash_erase(page)) {
return 0;
} else {
return -1;
}
furi_hal_flash_erase(page);
return 0;
}
static int storage_int_device_sync(const struct lfs_config* c) {
UNUSED(c);
FURI_LOG_D(TAG, "Device sync: skipping, cause ");
FURI_LOG_D(TAG, "Device sync: skipping");
return 0;
}

View File

@@ -52,11 +52,19 @@ static bool check_address_boundaries(const size_t address) {
return ((address >= min_allowed_address) && (address < max_allowed_address));
}
static bool update_task_flash_program_page(
const uint8_t i_page,
const uint8_t* update_block,
uint16_t update_block_len) {
furi_hal_flash_program_page(i_page, update_block, update_block_len);
return true;
}
static bool update_task_write_dfu(UpdateTask* update_task) {
DfuUpdateTask page_task = {
.address_cb = &check_address_boundaries,
.progress_cb = &update_task_file_progress,
.task_cb = &furi_hal_flash_program_page,
.task_cb = &update_task_flash_program_page,
.context = update_task,
};
@@ -117,7 +125,7 @@ static bool update_task_write_stack_data(UpdateTask* update_task) {
furi_hal_flash_get_page_number(update_task->manifest->radio_address + element_offs);
CHECK_RESULT(i_page >= 0);
CHECK_RESULT(furi_hal_flash_program_page(i_page, fw_block, bytes_read));
furi_hal_flash_program_page(i_page, fw_block, bytes_read);
element_offs += bytes_read;
update_task_set_progress(