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 } }