Forum : ST7/STM8
Original Post
Post Information | Post |
---|---|
May 3, 2011 - 1:41pm
|
Hi, I have some flags in my code and the processor uses them very frequently. I want to improve the performance of the processor. I saw that converting some page0 flags into bit flags causes code size to be bigger. My code is like below: ... I have enough RAM area so from the performance point of view, which keyword should I use to define variables? "page0" or "bit"? Thanks&Regards |
Hi Volkan,
You are right: The STM8 is not very efficient concerning bit handling. A BSET/BRES instruction is 4 bytes long, although a CLR/INC/DEC on a page0 byte variable is only 2 bytes.
I would suggest to keep using "page0 unsigned char" as your default bit type, as the code will probably be more efficient.
Note that on ST7, the bit handling is much better (as bit-addressable memory is limited to 256 bytes) than on STM8.
Best Regards,