This discussion has been locked.
You can no longer post new replies to this discussion. If you have a question you can start a new discussion

error when using Conditional instruction - STM32f103

Hi every body !

I have a problem when using inline assembler instruct in C function.

T'm using Keil MDK V7.52 with STM32f103 family. I know that cortex M3 supports conditional instruction such as ANDEQ,ORREQ... But when i use it in "__asm{...}" block all conditional instructions generate error #2830 : cannot do desired conditional execution

I don't know how to solve it. Some one can help me ?

Thank you !

Parents
  • __forceinline __asm void UpdateMathFlag(uint8_t* status)
    { PUSH {r1} LDR r1,[r0]

    IT EQ ORREQ r1,#0x01 ; zero flag

    IT VS ORRVS r1,#0x02 ; Overflow Flag

    IT MI ORRMI r1,#0x04 ; negative flag

    STRB r1,[r0] POP {R1} BX LR
    }

    __inline void UpdateMathFlag2(uint8_t* status)
    { uint32_t temp;
    __asm { LDRB temp,[status] BIC temp,#0x07 IT EQ ORREQ temp,#1 IT VS ORRVS temp,#2 IT MI ORRMI temp,#4 STRB temp,[status] }
    }

Reply
  • __forceinline __asm void UpdateMathFlag(uint8_t* status)
    { PUSH {r1} LDR r1,[r0]

    IT EQ ORREQ r1,#0x01 ; zero flag

    IT VS ORRVS r1,#0x02 ; Overflow Flag

    IT MI ORRMI r1,#0x04 ; negative flag

    STRB r1,[r0] POP {R1} BX LR
    }

    __inline void UpdateMathFlag2(uint8_t* status)
    { uint32_t temp;
    __asm { LDRB temp,[status] BIC temp,#0x07 IT EQ ORREQ temp,#1 IT VS ORRVS temp,#2 IT MI ORRMI temp,#4 STRB temp,[status] }
    }

Children
No data