Other Parts Discussed in Thread: TMS320F28335
Hello
Using CCS 5.2.1, Compiler 6.1.0, processor TMS320F28335.
We are doing a compiler source to object code analysis and I have the following issue which puzzles me.
Building the very simple program:
void main(void) {
int a=0, b=0, c=0;
int d;
a = 1;
b = 2;
c = 3;
d = a+b+c;
for(;;);
}
Built with
"C:/ti/ccsv5/tools/compiler/c2000_6.1.0/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -Ooff -g --diag_error=225 --display_error_number --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
The assembly listing is:
main:
33804d: FE04 ADDB SP, #4
3 int a=0, b=0, c=0;
33804e: 2B41 MOV *-SP[1], #0
33804f: 2B42 MOV *-SP[2], #0
338050: 2B43 MOV *-SP[3], #0
6 a = 1;
338051: 56BF0141 MOVB *-SP[1], #0x01, UNC
7 b = 2;
338053: 56BF0242 MOVB *-SP[2], #0x02, UNC
8 c = 3;
338055: 56BF0343 MOVB *-SP[3], #0x03, UNC
10 d = a+b+c;
338057: 9242 MOV AL, *-SP[2]
338058: 9441 ADD AL, *-SP[1]
338059: 9443 ADD AL, *-SP[3]
33805a: 9644 MOV *-SP[4], AL
12 for(;;);
C$DW$L$_main$2$B, C$L1:
33805b: 6F00 SB C$L1, UNC
Built with:
"C:/ti/ccsv5/tools/compiler/c2000_6.1.0/bin/cl2000" -v28 -ml -mt --float_support=fpu32 -Ooff --symdebug:none --diag_error=225 --display_error_number --preproc_with_compile --preproc_dependency="main.pp" "../main.c"
The assembly listing is:
main:
33804d: FE04 ADDB SP, #4
33804e: 2B42 MOV *-SP[2], #0
33804f: 2B41 MOV *-SP[1], #0
338050: 2B43 MOV *-SP[3], #0
338051: 56BF0242 MOVB *-SP[2], #0x02, UNC
338053: 56BF0141 MOVB *-SP[1], #0x01, UNC
338055: 56BF0343 MOVB *-SP[3], #0x03, UNC
338057: 9242 MOV AL, *-SP[2]
338058: 9441 ADD AL, *-SP[1]
338059: 9443 ADD AL, *-SP[3]
33805a: 9644 MOV *-SP[4], AL
33805b: 6F00 SB 0, UNC
Both are build with optimization=off, but without debug there is a re-ordering of the assembly lines.
(1) Is there anywhere that describes what is going on here? I’ve not been able to find anything in the various PDFs.
(2) Is there a switch to stop this re-ordering? I would have expected the same assembler in both cases given that optimization=off.
(3) We are trying to determine if using debug (-g) adds anything to the final code loaded into flash, by comparing outputs from hex2000. But with this re-ordering, a straight compare shows lots of differences.
Regards,
Giles Robinson