This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

Cortex-M3:Little endian

Hi All,

The cortex M3 in STM32F100xx devices stores in little endian format. Does this mean that even the memory locations which I see in KEIL window are in the little endian format? For eg: 0x20000AFF is actually 0x2000FFA0?

Its getting a bit confusing here.

Assistance requested.

Thanks!!

BR,

\Kashif

  • The addresses are just byte address; I suspect the issue you are having is that you have the window in "Int" mode, at which point the address 0x20000AFF is unaligned, meaning that it is not divisible by four bytes, and thus the debugger constructing the 32-bit value by concatenating the 4 bytes from 0x20000AFF, 0x20000B00, 0x20000B01 and 0x20000B02 with the byte from 0x20000AFF being the least-significant byte, and the one from 0x20000B02 being the most-significant byte. To view the aligned word value including the byte at address 0x20000AFF, then you should be looking at 0x20000AFC.

    As an example, if the content of each byte is the least significant bits of its address, then in "Char" mode, you would see:

    0x20000AFC: FC FD FE FF 00 01 02 03 04 05 06 ..
    

    In "Int" mode for both the aligned and unaligned addresses, you would see:

    0x20000AFC: FFFEFDFC 03020100 ...
    

    or

    0x20000AFF: 020100FF 06050403 ...
    

    hth

    Simon.