Hello Georg,

Is this behaviour true for all 16 bit SFR's? Or is it different for every
other SFR? If it's always the same then maybe SDCC could take this into
account.

Maarten

> hi all,
>
> it might be common knowledge in the community, but it sure was new to me
> (and took me some time to debug)…
>
> As you know the STM8 is and 8-bit uC, so reading from or writing to 16b
> peripheral registers (SFR) takes place in 2 steps. And I found that the
> sequence of access matters for 16b peripheral registers (SFR), and is
> different for read and write:
> write: byteH+byteL is ok, but byteL+byteH (or word write in C) fails
> read: byteL+byteH (and word read in C) is ok, but byteH+byteL fails
>
> I observed this behavior for SDCC v3.4 RC2, and also for Cosmic C-compiler
> 4.3.7. Hope this note helps avoiding bugs, and saving debugging time.
>
> Have a nice day,  :-)
> Georg


------------------------------------------------------------------------------
Learn Graph Databases - Download FREE O'Reilly Book
"Graph Databases" is the definitive new guide to graph databases and their
applications. Written by three acclaimed leaders in the field,
this first edition is now available. Download your free book today!
http://p.sf.net/sfu/NeoTech
_______________________________________________
Sdcc-user mailing list
Sdcc-user@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/sdcc-user

Reply via email to