Skip to main content
Visitor II
October 1, 2019
Question

STM8 is little endian - right?

  • October 1, 2019
  • 2 replies
  • 1106 views

I have started writing some STM8 code in assembler and happened upon a memory assignment issue I can't explain.

Globally I have

segment 'ram0'

Test_Word ds.w

in code:

ldw X, #$48

ldw Test_Word , X

The two bytes of memory at location Test_Word is 00 $48

This appears to be Big Endian memory assignment

if in code ...

ld A, #5

ld Test_Word , A

The two bytes of memory at location Test_Word is 05 $48

To me this is very strange.

Can someone explain why the instructions

 ldw X, #$48

ldw Test_Word , X

Did not populate memory as $48 00

Thanks in advance for any insight.

Joe

    This topic has been closed for replies.

    2 replies

    Visitor II
    October 6, 2019

    No. STM8 is big endian.

    Visitor II
    October 6, 2019

    if you want to make sure, make a program with a 16 bit global variable, store a value and check the 2 bytes in debug watch or memory window.

    Works for any core, and might give the answer faster than reading a programming manual.