mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Erase flash before writing upload image
This commit is contained in:
@@ -332,6 +332,10 @@ uint8_t stream_upload(uint16_t bptr)
|
||||
if (write_len >= FLASHMEM_PAGE_SIZE) {
|
||||
dbg_string("len: "); dbg_short(write_len); dbg_char(' ');
|
||||
dbg_string("CRC16: "); dbg_short(crc_value); dbg_char('\n');
|
||||
if (uptr % FLASH_SECTOR_SIZE == 0) {
|
||||
flash_region.addr = uptr;
|
||||
flash_sector_erase();
|
||||
}
|
||||
flash_region.addr = uptr;
|
||||
flash_region.len = FLASHMEM_PAGE_SIZE;
|
||||
flash_write_bytes(flash_buf);
|
||||
|
||||
@@ -1,6 +1,8 @@
|
||||
#ifndef _RTL837X_FLASH_H_
|
||||
#define _RTL837X_FLASH_H_
|
||||
|
||||
#define FLASH_SECTOR_SIZE 0x1000
|
||||
|
||||
void flash_init(uint8_t enable_dio);
|
||||
void flash_read_uid(void);
|
||||
void flash_write_enable(void);
|
||||
|
||||
Reference in New Issue
Block a user