cancel
Showing results for 
Search instead for 
Did you mean: 

STM8 is little endian - right?

Joe.H
Associate III

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

2 REPLIES 2
Philipp Krause
Senior II

No. STM8 is big endian.

S.Ma
Principal

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.