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

Inline assembly disassembly shows different instructions during debugging!! msp432 uvision

Hello everybody!

If you please could help with this problem. I am writing a timer32 interrupt handler and try to use inline assembly.

I wrote the simplest code, which triggers a port pin high and then low at the minimal possible time interval. One instruction turns it on, the next one - off. The code is very simple.

The problem is when I used a debugger (msp432 launchpad), I saw that the compiler actually had changed my code!!! I saw that it stored the values to registers, different from what I wrote AND the worst thing was, the compiler thought that writing #1 to the port ( STRB r1, [r0] ) was totally redundant, since the next instruction writes a zero there, so the compiler simply dumped that instruction. So it changes my assembly code! Could please anyone tell me how to force the compiler to stop playing a smart ass and to implement my inline assembly code exactly the way it is written and do all the instructions I write? Thank you!!!

void T32_INT1_IRQHandler(void){
	__asm{
			MOV R0, #0x40004c03  //DIO port address
			MOV r1, #1
			MOV r2, #0
			STRB r1, [r0]       //Port pin High
			STRB r2, [r0]       //Port pin Low
		}
	}

Parents
  • Yeah. I guess it is true. I thought just sprinkling two-three instructions into a C source would be easy enough, which turns out not to be the case. So I will write the whole thing in asm... After all, it will give me a nice stimulus to keep the interrupt routine as short as possible :)

    Thanks!

Reply
  • Yeah. I guess it is true. I thought just sprinkling two-three instructions into a C source would be easy enough, which turns out not to be the case. So I will write the whole thing in asm... After all, it will give me a nice stimulus to keep the interrupt routine as short as possible :)

    Thanks!

Children
No data