Hello! Everybody!
Please help me. I would like to use named register. R6 for example. After a subroutine, which modify this register, the compiler doesnt recognize it, and place a nop where I want to rewrite this register. Here is my simple example:
register unsigned int akku __asm("r6");
unsigned char test1() { akku=1; return 12; }
unsigned char test(void) { unsigned char x,y; akku=10; //it is ok x=test1(); //this subroutine modify the akku(R6) register to 1 akku=10; //here is the problem if (x==12) { y=akku; } return y; } After the subroutine y=1. But the correct value is 10.
Here you can see the dissasembly window. The problem is the 0x8000CE6. Why it is NOP???
41: { 42: unsigned char x,y; 0x08000CDC B500 PUSH {lr} 43: akku=10; 0x08000CDE 260A MOVS r6,#0x0A 44: x=test1(); 0x08000CE0 F000F807 BL.W test1 (0x08000CF2) 0x08000CE4 4602 MOV r2,r0 45: akku=10; 0x08000CE6 BF00 NOP 46: if (x==12) 47: { 0x08000CE8 2A0C CMP r2,#0x0C 0x08000CEA D100 BNE 0x08000CEE 48: y=akku; 49: } 0x08000CEC B2F1 UXTB r1,r6 50: return y; 0x08000CEE 4608 MOV r0,r1 51: }
Thank you.