Skip to content

Commit 7be7949

Browse files
RM 2235. Support WDT on SmartFusion.
Signed-off-by: Reinhard Mötzel <[email protected]> Signed-off-by: Sergei Poselenov <[email protected]>
1 parent d980efe commit 7be7949

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

common/image.c

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -451,12 +451,22 @@ phys_size_t getenv_bootm_size(void)
451451
void memmove_wd (void *to, void *from, size_t len, ulong chunksz)
452452
{
453453
#if defined(CONFIG_HW_WATCHDOG) || defined(CONFIG_WATCHDOG)
454+
if (to > from) {
455+
from += len;
456+
to += len;
457+
}
454458
while (len > 0) {
455459
size_t tail = (len > chunksz) ? chunksz : len;
456460
WATCHDOG_RESET ();
461+
if (to > from) {
462+
to -= tail;
463+
from -= tail;
464+
}
457465
memmove (to, from, tail);
458-
to += tail;
459-
from += tail;
466+
if (to < from) {
467+
to += tail;
468+
from += tail;
469+
}
460470
len -= tail;
461471
}
462472
#else /* !(CONFIG_HW_WATCHDOG || CONFIG_WATCHDOG) */

0 commit comments

Comments
 (0)