|
@@ -44,7 +44,7 @@ static enum rym_code ymodem_on_begin(struct rym_ctx *ctx, rt_uint8_t *buf, rt_si
|
|
|
file_name = (char *)&buf[0];
|
|
file_name = (char *)&buf[0];
|
|
|
file_size = (char *)&buf[rt_strlen(file_name) + 1];
|
|
file_size = (char *)&buf[rt_strlen(file_name) + 1];
|
|
|
update_file_total_size = atol(file_size);
|
|
update_file_total_size = atol(file_size);
|
|
|
- //rt_kprintf("Ymodem file_size:%d\n", update_file_total_size);
|
|
|
|
|
|
|
+ rt_kprintf("Ymodem file_size:%d\n", update_file_total_size);
|
|
|
|
|
|
|
|
update_file_cur_size = 0;
|
|
update_file_cur_size = 0;
|
|
|
|
|
|
|
@@ -61,7 +61,7 @@ static enum rym_code ymodem_on_begin(struct rym_ctx *ctx, rt_uint8_t *buf, rt_si
|
|
|
return RYM_CODE_CAN;
|
|
return RYM_CODE_CAN;
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
- //LOG_I("Start erase. Size (%d)", update_file_total_size);
|
|
|
|
|
|
|
+ LOG_I("Start erase. Size (%d)", update_file_total_size);
|
|
|
|
|
|
|
|
/* erase DL section */
|
|
/* erase DL section */
|
|
|
if (fal_partition_erase(dl_part, 0, update_file_total_size) < 0)
|
|
if (fal_partition_erase(dl_part, 0, update_file_total_size) < 0)
|
|
@@ -105,7 +105,7 @@ void ymodem_ota(uint8_t argc, char **argv)
|
|
|
return;
|
|
return;
|
|
|
} else {
|
|
} else {
|
|
|
/* change default partition to save firmware */
|
|
/* change default partition to save firmware */
|
|
|
- recv_partition = argv[2];
|
|
|
|
|
|
|
+ recv_partition = argv[2];
|
|
|
}
|
|
}
|
|
|
}else{
|
|
}else{
|
|
|
rt_kprintf("Usage: ymodem_ota -p <partiton name>.\n");
|
|
rt_kprintf("Usage: ymodem_ota -p <partiton name>.\n");
|
|
@@ -132,12 +132,18 @@ void ymodem_ota(uint8_t argc, char **argv)
|
|
|
}
|
|
}
|
|
|
else
|
|
else
|
|
|
{
|
|
{
|
|
|
|
|
+ /* wait some time for terminal response finish */
|
|
|
|
|
+ rt_thread_delay(RT_TICK_PER_SECOND);
|
|
|
rt_console_set_device("uart1");
|
|
rt_console_set_device("uart1");
|
|
|
rt_kprintf("Update firmware fail.\n");
|
|
rt_kprintf("Update firmware fail.\n");
|
|
|
-// /* wait some time for terminal response finish */
|
|
|
|
|
-// rt_thread_delay(rt_tick_from_millisecond(1000));
|
|
|
|
|
-// extern void rt_hw_cpu_reset(void);
|
|
|
|
|
-// rt_hw_cpu_reset();
|
|
|
|
|
|
|
+ /* wait some time for terminal response finish */
|
|
|
|
|
+ rt_thread_delay(rt_tick_from_millisecond(200));
|
|
|
|
|
+
|
|
|
|
|
+ /* Reset the device, Start old firmware */
|
|
|
|
|
+ extern void rt_hw_cpu_reset(void);
|
|
|
|
|
+ rt_hw_cpu_reset();
|
|
|
|
|
+ /* wait some time for terminal response finish */
|
|
|
|
|
+ rt_thread_delay(rt_tick_from_millisecond(200));
|
|
|
}
|
|
}
|
|
|
|
|
|
|
|
return;
|
|
return;
|