Skip to content

Commit d989ce5

Browse files
committed
Do not check for valid image and OTA magic. Valid image is checked by MCUboot and magic is checked in getOTAData
1 parent 483561b commit d989ce5

File tree

1 file changed

+10
-6
lines changed

1 file changed

+10
-6
lines changed

envie/target_init.cpp

Lines changed: 10 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -168,20 +168,24 @@ int target_init(void) {
168168
/* Test if user code is programmed starting from USBD_DFU_APP_DEFAULT_ADD
169169
* address. TODO check MCUBoot header instead.
170170
*/
171-
int app_valid = (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x20000000)
172-
|| (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x24000000)
173-
|| (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x30000000)
174-
|| (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x38000000);
171+
//int app_valid = (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x20000000)
172+
// || (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x24000000)
173+
// || (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x30000000)
174+
// || (((*(__IO uint32_t *) 0x08040000) & 0xFF000000) == 0x38000000);
175175

176-
if (app_valid && magic != 0xDF59 && magic != 0x07AA && boot_sel==0) {
176+
if (/*app_valid &&*/ magic != 0xDF59 /*&& magic != 0x07AA*/ && boot_sel==0) {
177177
RTCSetBKPRegister(RTC_BKP_DR0, 0);
178178
HAL_FLASH_Lock();
179179
BOOT_LOG_DBG("Envie app magic 0x%x", RTCGetBKPRegister(RTC_BKP_DR0));
180180
return 0;
181181

182182
} else {
183183
BOOT_LOG_DBG("Envie loop magic 0x%x", RTCGetBKPRegister(RTC_BKP_DR0));
184-
return 1;
184+
if(boot_sel) {
185+
return 1;
186+
} else {
187+
return 2;
188+
}
185189
}
186190
}
187191

0 commit comments

Comments
 (0)