fix(spi_flash): Dump data when data addr is not aligned by 4-byte

This commit is contained in:
Zhang Jun Hao
2018-06-23 18:28:07 +08:00
parent 2bfe5da486
commit eca1eeb678

View File

@ -472,7 +472,7 @@ esp_err_t IRAM_ATTR spi_flash_write(size_t dest_addr, const void *src, size_t si
size = (size / 4 + 1) * 4; size = (size / 4 + 1) * 4;
} }
if (IS_FLASH(src)) { if (IS_FLASH(src) || ((size_t)src) & 0x3) {
tmp = wifi_malloc(size, OSI_MALLOC_CAP_32BIT); tmp = wifi_malloc(size, OSI_MALLOC_CAP_32BIT);
if (!tmp) { if (!tmp) {
return ESP_ERR_NO_MEM; return ESP_ERR_NO_MEM;
@ -499,7 +499,7 @@ esp_err_t IRAM_ATTR spi_flash_write(size_t dest_addr, const void *src, size_t si
FLASH_INTR_UNLOCK(c_tmp); FLASH_INTR_UNLOCK(c_tmp);
if (IS_FLASH(src)) if (IS_FLASH(src) || ((size_t)src) & 0x3)
wifi_free(tmp); wifi_free(tmp);
spi_debug("%d\n", system_get_time()); spi_debug("%d\n", system_get_time());