Hi,
I built an experimental program based the “simpleserial-base”, and now I meet a problem that I can get the right return value after every reset, and later, the target won’t reponse after I send an instruction to it.
Here is my code,
uint8_t get_pt(uint8_t* pt, uint8_t len)
#endif
{
trigger_high();
static uint8_t sk[KYBER_INDCPA_SECRETKEYBYTES], pk[KYBER_INDCPA_PUBLICKEYBYTES];
PQCLEAN_KYBER512_CLEAN_indcpa_keypair(sk, pk, pt);
trigger_low();
simpleserial_put('r', 16, pk);
return 0x00;
}
int main(void)
{
platform_init();
init_uart();
trigger_setup();
/* Uncomment this to get a HELLO message for debug */
putch('h');
putch('e');
putch('l');
putch('l');
putch('o');
putch('\n');
simpleserial_init();
simpleserial_addcmd('p', 32, get_pt);
#if SS_VER != SS_VER_2_0
simpleserial_addcmd('k', 16, get_key);
simpleserial_addcmd('x', 0, reset);
#endif
while(1)
simpleserial_get();
}
I used a ST-link to debug it just now, and I found, the program will run correctly during the first “simpleserial_get()”, and when it exit from this method, it won’t run next “simpleserial_get()” as the “while(1)” loop, it went to
hardware/victims/firmware/hal/stm32f3/stm32f3_hal_lowlevel.c:1044
and stuck at the method “UART_WaitOnFlagUntilTimeout” like
I don’t understand how this happens, can you help me?
Thanks a lot!