|
|
@@ -3,7 +3,7 @@
|
|
|
#include "app/nv_storage.h"
|
|
|
#include "bsp/fmc_flash.h"
|
|
|
#include "bsp/shark_rtc.h"
|
|
|
-
|
|
|
+#include "libs/logger.h"
|
|
|
static int iap_write_image(uint8_t *data, int len);
|
|
|
static int iap_check_image(uint8_t *data, int len);
|
|
|
void _reboot_timer_handler(shark_timer_t *t);
|
|
|
@@ -73,8 +73,15 @@ void process_iap_message(can_frame_t *frame, int len){
|
|
|
break;
|
|
|
case CAN_KET_ERASE_NV:
|
|
|
shark_rtc_set_backup(0x3002);
|
|
|
- nv_erase_soc(0);
|
|
|
- nv_erase_soc(1);
|
|
|
+ if (len == 0) {
|
|
|
+ nv_erase_all_soc(1);
|
|
|
+ }else {
|
|
|
+ if (frame->data[0] == 1) {//erase and clear cycle
|
|
|
+ nv_erase_all_soc(0);
|
|
|
+ }else {
|
|
|
+ nv_erase_all_soc(1);
|
|
|
+ }
|
|
|
+ }
|
|
|
shark_timer_post(&_reboot_timer, 100);
|
|
|
protocol_send_ack(frame->head.can_addr, frame->key, 1);
|
|
|
break;
|