mirror of
https://github.com/logicog/RTLPlayground.git
synced 2026-08-30 14:52:51 +08:00
Fix reading configuration over flash block boundaries
This commit is contained in:
+7
-4
@@ -1165,6 +1165,7 @@ void execute_config(void) __banked
|
||||
strtox(passwd, PASSWORD);
|
||||
save_cmd = 0;
|
||||
|
||||
uint8_t cmd_idx = 0;
|
||||
do {
|
||||
flash_region.addr = pos;
|
||||
flash_region.len = FLASH_READ_BURST_SIZE;
|
||||
@@ -1172,8 +1173,7 @@ void execute_config(void) __banked
|
||||
|
||||
__xdata uint8_t cfg_idx = 0;
|
||||
uint8_t c = 0;
|
||||
do {
|
||||
for (uint8_t cmd_idx = 0; cmd_idx < (CMD_BUF_SIZE - 1); cmd_idx++) {
|
||||
while (cmd_idx < (CMD_BUF_SIZE - 1)) {
|
||||
c = flash_buf[cfg_idx++];
|
||||
if (c == 0 || c == '\n') {
|
||||
cmd_buffer[cmd_idx] = '\0';
|
||||
@@ -1181,12 +1181,15 @@ void execute_config(void) __banked
|
||||
cmd_parser();
|
||||
if (c == 0)
|
||||
goto config_done;
|
||||
break;
|
||||
cmd_idx = 0;
|
||||
continue;
|
||||
}
|
||||
|
||||
cmd_buffer[cmd_idx] = c;
|
||||
cmd_idx++;
|
||||
if (!cfg_idx)
|
||||
break;
|
||||
}
|
||||
} while(cfg_idx);
|
||||
|
||||
len_left -= FLASH_READ_BURST_SIZE;
|
||||
pos += FLASH_READ_BURST_SIZE;
|
||||
|
||||
Reference in New Issue
Block a user