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
  • Hello Pete! I have thought about it also, alas, to no avail. The instruction was still missing. But the funny thing was that when I finally wrote the code in pure asm and the instruction was finally implemented, there was no visible difference in pin jerking speed, whether the on and off instructions went in a row, or had a MOV in between! Perhaps the internal guts of the MSP432 are wired in such a way that it can move some number to a register while storing another number somewhere else? Or perhaps my oscilloscope bullsh*ts.

Reply
  • Hello Pete! I have thought about it also, alas, to no avail. The instruction was still missing. But the funny thing was that when I finally wrote the code in pure asm and the instruction was finally implemented, there was no visible difference in pin jerking speed, whether the on and off instructions went in a row, or had a MOV in between! Perhaps the internal guts of the MSP432 are wired in such a way that it can move some number to a register while storing another number somewhere else? Or perhaps my oscilloscope bullsh*ts.

Children
No data