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

Cortex-M0 Thumb-2 instruction: Is this instruction valid?

STM     r0!, {}

I have looked at Thumb2 instruction set web but I can't find the behaviour of STM command if the reglist is empty.

Thanks in advance.

Parents
  • Hi hector.bravo,

    it is not valid and any compiler probably cannot deal with the instruction. As Mr. daith says, STMDB/LDMDB register list requires more than one register. However, a compiler can deal with the register list which has one register. In the case, STM would be replaced with STR.

    stmdb r0!,{r1} =>  str.w   r1, [r0, #-4]!

    I guess some disassembler might show "stm r0!,{}" for the code "0xc000".

    Best regards,
    Yasuhiko Koumoto.

Reply
  • Hi hector.bravo,

    it is not valid and any compiler probably cannot deal with the instruction. As Mr. daith says, STMDB/LDMDB register list requires more than one register. However, a compiler can deal with the register list which has one register. In the case, STM would be replaced with STR.

    stmdb r0!,{r1} =>  str.w   r1, [r0, #-4]!

    I guess some disassembler might show "stm r0!,{}" for the code "0xc000".

    Best regards,
    Yasuhiko Koumoto.

Children
No data