This thread has been locked.

If you have a related question, please click the "Ask a related question" button in the top right corner. The newly created question will be automatically linked to this question.

Compiler v6.2.0: extra code shown in disassembly window.

Guru 19935 points

Hello,

The code shown below is producing the assembly code shown below it.  Why is the  GpioCtrlRegs.GPAMUX1.... appearing in the assembly code?

Also, when I step through the code I noticed the bits are not set (as viewed in either the memory or expression's window.  Why?

Stephen

Update: I forgot to mention that I am using the F283x CPU Cycle Accurate Simulator.

	EALLOW;

	GpioDataRegs.GPASET.bit.GPIO0 = 1;
	GpioDataRegs.GPASET.bit.GPIO1 = 1;
	GpioDataRegs.GPASET.bit.GPIO2 = 1;
	GpioDataRegs.GPASET.bit.GPIO3 = 1;
	GpioDataRegs.GPASET.bit.GPIO4 = 1;
	GpioDataRegs.GPASET.bit.GPIO5 = 1;
	GpioDataRegs.GPASET.bit.GPIO6 = 1;
	GpioDataRegs.GPASET.bit.GPIO7 = 1;

	GpioDataRegs.GPASET.bit.GPIO10 = 1;
	GpioDataRegs.GPASET.bit.GPIO11 = 1;
	GpioDataRegs.GPASET.bit.GPIO12 = 1;
	GpioDataRegs.GPASET.bit.GPIO13 = 1;
	GpioDataRegs.GPASET.bit.GPIO14 = 1;

0099a5:   7622        EALLOW       
0099a6:   761F01BF    MOVW         DP, #0x1bf
39      	GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
0099a8:   8F006F80    MOVL         XAR4, #0x006f80
16      	GpioDataRegs.GPASET.bit.GPIO0 = 1;
0099aa:   1A020001    OR           @0x2, #0x0001
39      	GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
0099ac:   83A4        MOVL         XAR5, @XAR4
17      	GpioDataRegs.GPASET.bit.GPIO1 = 1;
0099ad:   1A020002    OR           @0x2, #0x0002
18      	GpioDataRegs.GPASET.bit.GPIO2 = 1;
0099af:   1A020004    OR           @0x2, #0x0004
19      	GpioDataRegs.GPASET.bit.GPIO3 = 1;
0099b1:   1A020008    OR           @0x2, #0x0008
39      	GpioCtrlRegs.GPAMUX1.bit.GPIO0 = 0;
0099b3:   DD06        ADDB         XAR5, #6
20      	GpioDataRegs.GPASET.bit.GPIO4 = 1;
0099b4:   1A020010    OR           @0x2, #0x0010
21      	GpioDataRegs.GPASET.bit.GPIO5 = 1;
0099b6:   1A020020    OR           @0x2, #0x0020
22      	GpioDataRegs.GPASET.bit.GPIO6 = 1;
0099b8:   1A020040    OR           @0x2, #0x0040
23      	GpioDataRegs.GPASET.bit.GPIO7 = 1;
0099ba:   1A020080    OR           @0x2, #0x0080
26      	GpioDataRegs.GPASET.bit.GPIO10 = 1;
0099bc:   1A020400    OR           @0x2, #0x0400
27      	GpioDataRegs.GPASET.bit.GPIO11 = 1;
0099be:   1A020800    OR           @0x2, #0x0800
28      	GpioDataRegs.GPASET.bit.GPIO12 = 1;
0099c0:   1A021000    OR           @0x2, #0x1000
29      	GpioDataRegs.GPASET.bit.GPIO13 = 1;
0099c2:   1A022000    OR           @0x2, #0x2000
30      	GpioDataRegs.GPASET.bit.GPIO14 = 1;
0099c4:   1A024000    OR           @0x2, #0x4000



  • The compiler is reordering the statements. The statements involving GPAMUX1 are apparently coming from line 39 in your C code. You probably need to declare GpioDataRegs and GpioCtrlRegs volatile.
    I don't know why the updates are not showing up.
  • Ok, I did a search of my code for GPIO_CTRL_REGS GpioCtrlRegs. All of the search results were either volatile struct GPIO_CTRL_REGS GpioCtrlRegs; or extern volatile struct GPIO_CTRL_REGS GpioCtrlRegs;.

    This might be an issue with v6.2.0 since v6.2.11 doesn't reorder the statements. Actually, I am using 6.2.11 and CCSv6.1 for my production code. v6.2.0 is the version that is used with the CCSv5.5 that I have installed on my computer.

    I had been using the F283x CPU Cycle Accurate Simulator with CCSv6.1 and v6.2.11 and the GPIO data bits were not getting set, so I tried CCSv5.5 with the F283x CPU Cycle Accurate Simulator to see if it would give the same results.

    Stephen