Skip to content

Commit f72bc60

Browse files
committed
feed watchdog during OTA header verification
1 parent 727df3d commit f72bc60

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/decompress/utility.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -137,6 +137,8 @@ int Arduino_Portenta_OTA::decompress()
137137
uint32_t crc32, bytes_read;
138138
uint8_t crc_buf[128];
139139

140+
feedWatchdog();
141+
140142
/* Read the OTA header ... */
141143
fread(ota_header.buf, 1, sizeof(ota_header.buf), update_file);
142144

@@ -147,6 +149,8 @@ int Arduino_Portenta_OTA::decompress()
147149
return static_cast<int>(Error::OtaHeaderLength);
148150
}
149151

152+
feedWatchdog();
153+
150154
/* ... and the CRC second ... rewind to start of CRC verified header ... */
151155
fseek(update_file, sizeof(ota_header.header.len) + sizeof(ota_header.header.crc32), SEEK_SET);
152156
/* ... initialize CRC ... */
@@ -161,6 +165,9 @@ int Arduino_Portenta_OTA::decompress()
161165
}
162166
fread(crc_buf, 1, ota_header.header.len - bytes_read, update_file);
163167
crc32 = crc_update(crc32, crc_buf, ota_header.header.len - bytes_read);
168+
169+
feedWatchdog();
170+
164171
/* ... then finalise ... */
165172
crc32 ^= 0xFFFFFFFF;
166173
/* ... and compare. */
@@ -170,6 +177,8 @@ int Arduino_Portenta_OTA::decompress()
170177
return static_cast<int>(Error::OtaHeaderCrc);
171178
}
172179

180+
feedWatchdog();
181+
173182
if (ota_header.header.magic_number != 0x2341025b) /* 0x2341:025b = VID/PID Portenta H7 */
174183
{
175184
fclose(update_file);

0 commit comments

Comments
 (0)