Topic : Incorrect inlining of function

Forum : ST7/STM8

Original Post
Post Information Post
July 6, 2011 - 10:59am
Guest

Consider this code

#include

typedef unsigned char uint8_t;

static inline uint8_t disableInterrupts(void)
{
uint8_t status = _getCC_();
_sim_();
return status;
}

int main()
{
uint8_t n;
n = disableInterrupts();
while (1);
return 0;
}

The .lst looks like this

; FUNCTION main (BEGIN)
; SOURCE LINE # 16
0000 88 PUSH A
; SOURCE LINE # 11
0001 88 PUSH A
0002 8A PUSH CC
0003 84 POP A
; SOURCE LINE # 12
0004 6B01 F LD (001H,SP),A ; [ status ]
; SOURCE LINE # 13
0006 84 POP A
0007 ?WHILE_0001:
; SOURCE LINE # 20
0007 20FE JRA ?WHILE_0001
; n unsigned char (size=1). Automatic variable in AUTO

; FUNCTION main (END)

It is clear that the _sim_() intrinsic is not included when inlining the function disableInterrupts(). The _getCC_() call is included ( PUSH CC assembler instruction ). Why is _sim_() missing?

My tools:
STM8 compiler/linker ver 2.32.10.0307
I am compiling for the STM8 family, SCINAME(STM8). Target CPU is STM8S207CB.

Best Regards
Andreas

Replies
Post Information Post
+1
0
-1
July 7, 2011 - 9:42am
Raisonance Support Team

Hi Andreas,

We are looking into this problem. More news later.