@@ -80,15 +80,22 @@ void sample_data_init() {
80
80
}
81
81
#else // Platforms other than linux cuurenlty do not support image read/write to disk function,
82
82
// run-slot will be initialized with default values during boot-up
83
+
84
+ ret = osal_read_slothdr (RUN_IMAGE , & g_slothdr [RUN_IMAGE ]);
85
+ if (ret < 0 ){
86
+ memcpy (& g_slothdr [RUN_IMAGE ],& default_run_slot_image , sizeof (Csmp_Slothdr ));
87
+ (void ) osal_write_slothdr (RUN_IMAGE , & g_slothdr [RUN_IMAGE ]);
88
+ DPRINTF ("sample_data_init: Run slot not found!\n" );
89
+ }
83
90
ret = osal_read_slothdr (UPLOAD_IMAGE , & g_slothdr [UPLOAD_IMAGE ]);
84
91
if (ret < 0 ){
85
- memset (& g_slothdr [UPLOAD_IMAGE ], 0 , sizeof (Csmp_Slothdr ));
92
+ memcpy (& g_slothdr [UPLOAD_IMAGE ],& default_run_slot_image , sizeof (Csmp_Slothdr ));
86
93
(void ) osal_write_slothdr (UPLOAD_IMAGE , & g_slothdr [UPLOAD_IMAGE ]);
87
94
DPRINTF ("sample_data_init: Upload slot not found!\n" );
88
95
}
89
96
ret = osal_read_slothdr (BACKUP_IMAGE , & g_slothdr [BACKUP_IMAGE ]);
90
97
if (ret < 0 ){
91
- memset (& g_slothdr [BACKUP_IMAGE ], 0 , sizeof (Csmp_Slothdr ));
98
+ memcpy (& g_slothdr [BACKUP_IMAGE ],& default_run_slot_image , sizeof (Csmp_Slothdr ));
92
99
(void ) osal_write_slothdr (BACKUP_IMAGE , & g_slothdr [BACKUP_IMAGE ]);
93
100
DPRINTF ("sample_data_init: Backup slot not found!\n" );
94
101
}
0 commit comments