I've got some C code that looks like:
if( minuteCount > 0x3) { i = 0xAA; // debug }
For some reason, it jumps into this code (setting i to 0xAA) even when minuteCount is set to 0. I set the view in Code Composer Studio to "Mixed Source/ASM" and I'm seeing:
if( minuteCount > 0x3)00B72F 761F MOVW DP,#0x02FA00B731 9203 MOV AL,@300B732 5203 CMPB AL,#3 { i = 0xAA; // debug00B733 56B2 MOVB *-SP[3],#0x08,GT
}
I'm not an assembly expert, but shouldn't there be some kind of conditional jump made after the CMPB test of AL, when comparing it to #3?
I'm running Code Composer Studio 3.3.59.4
Code Generation Tools v5.0.0B2
Compiler settings:
-g -q -pdr -fr"$(Proj_dir)\Debug" -fs"$(Proj_dir)\Debug" -i"..\..\DSP2833x_headers\include" -i"..\..\DSP2833x_common\include" -i"C:\tidcs\c28\C28x_FPU_Lib\beta1\include" -d"_DEBUG" -d"LARGE_MODEL" -ml -mt -v28 --float_support=fpu32
Any ideas?
Thanks,
Eric
Are you sure minuteCount is defined as int?
Then, to view complete asm code for your instructions, you should read more lines, because the assembly code you read is not in 1 to 1 sequentially correspondent to your C code. Try to read few lines forward and you'll see the branch instruction.
Regards,
Raffaele
Hi Raffaele,
Here's a simplified version that shows the compiler output:
int minuteCount = 0;int i;
main(){ if( minuteCount > 0x3) {000040 __text, .text, main:000040 761F MOVW DP,#0x0000000042 9200 MOV AL,@0000043 5203 CMPB AL,#3 i = 0x55;000044 56B2 MOVB @1,#0x55,GT }000046 9A00 MOVB AL,#0}000047 0006 LRETR
I still don't seem to see any conditional branching.
Hi Eric
The instuction at address 0x0044 MOVB @1,0x55,GT is a conditional move (move if GT (greater))
Hope this clears things up
Regards, Mitja
Mitja,
Yes, that clears things up!
I apologize for my assembly language ignorance, I've been doing most of my development in "C".
Oops, didn't see the GT... sorry :P