Bugfix for write size. The write size for encryption have to be rounded to 16 bytes.

A wl_config structure size now ounded to 16.
Flash Emulator updated to work with defined minimum size.
Tests are updated.
This commit is contained in:
Dmitry
2018-03-06 10:26:21 +03:00
parent 17e8d49f26
commit 7b287c25b1
6 changed files with 37 additions and 12 deletions
+2 -2
View File
@@ -318,13 +318,13 @@ esp_err_t WL_Flash::updateWL()
uint32_t byte_pos = this->state.pos * this->cfg.wr_size;
this->used_bits = 0;
// write state to mem. We updating only affected bits
result |= this->flash_drv->write(this->addr_state1 + sizeof(wl_state_t) + byte_pos, &this->used_bits, 1);
result |= this->flash_drv->write(this->addr_state1 + sizeof(wl_state_t) + byte_pos, &this->used_bits, this->cfg.wr_size);
if (result != ESP_OK) {
ESP_LOGE(TAG, "%s - update position 1 result=%08x", __func__, result);
this->state.access_count = this->state.max_count - 1; // we will update next time
return result;
}
result |= this->flash_drv->write(this->addr_state2 + sizeof(wl_state_t) + byte_pos, &this->used_bits, 1);
result |= this->flash_drv->write(this->addr_state2 + sizeof(wl_state_t) + byte_pos, &this->used_bits, this->cfg.wr_size);
if (result != ESP_OK) {
ESP_LOGE(TAG, "%s - update position 2 result=%08x", __func__, result);
this->state.access_count = this->state.max_count - 1; // we will update next time