Цитата(редактор @ Jun 19 2018, 23:59)

склоняюсь к версии "дикого" указателя (неверное значение адреса или размера блока для копирования). Уж больно симптомы к этому располагают - ОЗУ зачищается (частично), а код не перезапускается (нет начального тестирования по словам ТС -значит сработал не RESET - и WDT с питанием скорее всего ни при чем). Возможно, неверный указатель на функцию забрасывает исполнение в случайное место.
Есть полезная функция в Кейле
http://www.keil.com/support/man/docs/armcc...59124940593.htm7.136 --protect_stack, --no_protect_stack
Inserts a guard variable onto the stack frame for each vulnerable function.
The guard variable is inserted between any buffers and the return address entry.
A function is considered vulnerable if it contains a vulnerable array. A vulnerable array is one that has:
Automatic storage duration.
A character type (char or wchar_t).
In addition to inserting the guard variable and check, the compiler also moves vulnerable arrays to the top of the stack, immediately preceding the guard variable. The compiler stores a copy of the guard variable's value at another location, and uses the copy to check that the guard has not been overwritten, indicating a buffer overflow.
Код
/*******************************************************************************
* Функции проверки переполнения стека
Parameter: none
Return:
КЛЮЧ КОМПИЛЯТОРА
--protect_stack
*******************************************************************************/
void * __stack_chk_guard = (void *)(0xDEADBEEF); // initialize guard variable
// Called by stack checking code if guard variable is corrupted
void __stack_chk_fail(void)
{
// переполнение стека
}
// тестер
void teststack(void)
{
char buf[4];
strcpy(buf, "123456"); // больше размера буфера
}