From 9f9b323fb5a83387931703ab91529e2c30c526ce Mon Sep 17 00:00:00 2001 From: Johny Mattsson Date: Tue, 4 Aug 2015 16:20:25 +1000 Subject: [PATCH] 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). --- app/platform/platform.c | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/app/platform/platform.c b/app/platform/platform.c index 6ed88d18..b31d55e7 100644 --- a/app/platform/platform.c +++ b/app/platform/platform.c @@ -471,7 +471,8 @@ uint32_t platform_s_flash_write( const void *from, uint32_t toaddr, uint32_t siz SpiFlashOpResult r; const uint32_t blkmask = INTERNAL_FLASH_WRITE_UNIT_SIZE - 1; 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); if(!apbuf) return 0;