Understanding output of code

#if SS_VER == SS_VER_2_1
uint8_t glitch_loop(uint8_t cmd, uint8_t scmd, uint8_t len, uint8_t* in)
uint8_t glitch_loop(uint8_t* in, uint8_t len)
    volatile uint16_t i, j;
    volatile uint32_t cnt;
    cnt = 0;
    for(i=0; i<50; i++){
        for(j=0; j<50; j++){
    simpleserial_put('r', 4, (uint8_t*)&cnt);
#if SS_VER == SS_VER_2_1
    return (cnt != 2500) ? 0x10 : 0x00;
    return (cnt != 2500);

i am getting result from the code


but but the cnt value should be 2500 then why am i getting this value can you explain.

09C4 is 2500 in hexadecimal

Why it is in reverse order :sweat_smile:

Because Arm processors are little endian.

Hello Alex,

In this case, when I have to give an input to chipwhisperer via python script,
for example, inp = “\x00\x01x\x0a\xFF” , do I need to switch the input as “\xFFx\0a\x01\x00” since the controller is storing in little-endian format?

You only need to worry about byte order if you’re converting from multiple single bytes to multi byte numbers. In the above example, the number is being converted from a 4 byte array into a 32-bit integer.

1 Like