Commit 9f9b323f authored by Johny Mattsson's avatar Johny Mattsson
Browse files

Ensure flash write bounce buffer is used if source is also flash.

When using the flash write API, the flash is unmapped/uncached, and as
such it's not possible to source data directly from flash (e.g. string
literals).
parent 1259f8d7
...@@ -471,7 +471,8 @@ uint32_t platform_s_flash_write( const void *from, uint32_t toaddr, uint32_t siz ...@@ -471,7 +471,8 @@ uint32_t platform_s_flash_write( const void *from, uint32_t toaddr, uint32_t siz
SpiFlashOpResult r; SpiFlashOpResult r;
const uint32_t blkmask = INTERNAL_FLASH_WRITE_UNIT_SIZE - 1; const uint32_t blkmask = INTERNAL_FLASH_WRITE_UNIT_SIZE - 1;
uint32_t *apbuf = NULL; uint32_t *apbuf = NULL;
if( ((uint32_t)from) & blkmask ){ uint32_t fromaddr = (uint32_t)from;
if( (fromaddr & blkmask ) || (fromaddr >= INTERNAL_FLASH_START_ADDRESS)) {
apbuf = (uint32_t *)c_malloc(size); apbuf = (uint32_t *)c_malloc(size);
if(!apbuf) if(!apbuf)
return 0; return 0;
......
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment