ESP8266 Developer Zone The Official ESP8266 Forum 2016-07-27T16:28:36+08:00 https://bbs.espressif.com:443/feed.php?f=7&t=2477 2016-07-27T16:28:36+08:00 2016-07-27T16:28:36+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2477&p=8146#p8146 <![CDATA[Re: spi_flash_write at address 0 (zero)]]>

Code:

uint32 *data = os_malloc(sizeof(BOOT_DATA));
os_memcpy(data, &BOOT_DATA, sizeof(BOOT_DATA));

/* copy current boot header code */

spi_flash_erase_sector(0);
spi_flash_write(0, data, sizeof(BOOT_DATA));

os_free(data);


Now boot is updating and work as expected.

Statistics: Posted by DarkSide — Wed Jul 27, 2016 4:28 pm


]]>
2016-07-27T12:20:57+08:00 2016-07-27T12:20:57+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2477&p=8144#p8144 <![CDATA[Re: spi_flash_write at address 0 (zero)]]>
DarkSide wrote:
Hello,
Is it possible to write flash at address 0?
I want to update boot from my code, I using next code:

Code:

static const uint8_t BOOT_DATA[] ICACHE_RODATA_ATTR STORE_ATTR = { ... };
spi_flash_erase_sector(0);
spi_flash_write(0, (uint32*)&BOOT_DATA, sizeof(BOOT_DATA));


but looks like spi_flash_write does not writing. Instead of correct data I have all zeroes (dumping flash content to file to check).
Any suggestions?

Try

Code:

spi_flash_write(0, (uint32*)BOOT_DATA, sizeof(BOOT_DATA));

Statistics: Posted by tobewinner — Wed Jul 27, 2016 12:20 pm


]]>
2016-07-27T05:16:24+08:00 2016-07-27T05:16:24+08:00 https://bbs.espressif.com:443/viewtopic.php?t=2477&p=8142#p8142 <![CDATA[spi_flash_write at address 0 (zero)]]> Is it possible to write flash at address 0?
I want to update boot from my code, I using next code:

Code:

static const uint8_t BOOT_DATA[] ICACHE_RODATA_ATTR STORE_ATTR = { ... };
spi_flash_erase_sector(0);
spi_flash_write(0, (uint32*)&BOOT_DATA, sizeof(BOOT_DATA));


but looks like spi_flash_write does not writing. Instead of correct data I have all zeroes (dumping flash content to file to check).
Any suggestions?

Statistics: Posted by DarkSide — Wed Jul 27, 2016 5:16 am


]]>