I am using the KEIL MDK-5.25, assembly. The project compiles without some problems, but when i see the disassembly the assembler change the inmediate value.
Assembler replace the immediate for another.
ASM code:
SBCS R2,R1 ;R2=0xFFFFFFC7 SUBS R2,#0xC7 ;R2=0xFFFFFF00 LSLS R2,#20 ;R2=0xF0000000
Disassembly code:
517: SBCS R2,R1 ;R2=0xFFFFFFC7 0x000006BA 418A SBCS r2,r2,r1 518: SUBS R2,#0xC7 ;R2=0xFFFFFF00 0x000006BC 3A00 SUBS r2,r2,#0x00 519: LSLS R2,#20 ;R2=0xF0000000 0x000006BE 0512 LSLS r2,r2,#20 520: MOVS R4,#28 <\pre> The value #0xC7 replaced to #0x00. And this brings a wrong result. This only comes when i make the debugger with the microcontroller. When i use the simulator comes right!!
517: SBCS R2,R1 ;R2=0xFFFFFFC7 0x000006BA 418A SBCS r2,r2,r1 518: SUBS R2,#0xC7 ;R2=0xFFFFFF00 0x000006BC 3AC7 SUBS r2,r2,#0xC7 519: LSLS R2,#20 ;R2=0xF0000000 0x000006BE 0512 LSLS r2,r2,#20 <\pre> Somebody saw something simlar?
Thankyou Rostohar.
Exately, also I thinked that was a problem with the target. But I made the tests with another chip, other programmer, also load the codde with Atmel Studio and hapens the same problem. There is a interesant thing, when i load the .HEX the code is correct! When I make the debbug. the KEIL loads the .axf, and the ploblem hapens. but the .axf i can not read.
.HEX:
:1006A0000A4612BA0A4352BAD2BA91422ED105234F :1006B000DA4140BF0120024052428A41C73A120546 :1006C0001C24E2411146464B1970197809030909A7
Bestregards.
Cabral