|
|
View previous topic :: View next topic |
Author |
Message |
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
From 5066 to 5094. |
Posted: Tue Jul 07, 2020 11:05 pm |
|
|
Chip is a 12F1840
Long time on my 5.066, yesterday i made a update to 5.094 and i don't understand this.
What is going on here?
5094
Code: | .................... control.Delay=2900+(state*130L); //2900,130,15 2900,100,20 2500,90,20 3000,80,25
0114: CLRF @7A
0115: MOVF state,W
0116: MOVWF @@38
0117: MOVF @7A,W
0118: MOVWF @@39
0119: MOVF @@39,W
011A: MOVWF ??65535+1
011B: MOVF @@38,W
011C: MOVWF ??65535
011D: CLRF @MULS1616.P1+1
011E: MOVLW 82
011F: MOVWF @MULS1616.P1
*
014D: MOVF @79,W
014E: MOVWF @7A
014F: MOVF @78,W
0150: ADDLW 54
0151: MOVWF @78
0152: MOVLW 0B
0153: ADDWFC @7A,F
0154: MOVF @78,W
0155: MOVWF Control+2
0156: MOVF @7A,W
0157: MOVWF Control+3 |
5066
Code: | .................... control.Delay=2900+(state*130L); //2900,130,15 2900,100,20 2500,90,20 3000,80,25
0115: CLRF ??65535+1
0116: MOVF state,W
0117: MOVWF ??65535
0118: CLRF @MUL1616.P1+1
0119: MOVLW 82
011A: MOVWF @MUL1616.P1
*
012F: MOVF @78,W
0130: ADDLW 54
0131: MOVWF Control+2
0132: MOVLW 0B
0133: ADDWFC @79,W
0134: MOVWF Control+3 |
Complicated to read, i must find out in the .sym file what the location was. List file in configuration is set to Symbolic.
The following is the init code for all static assignment. Why have CCS changed the logic name to addresses?
5066
Code: | MOVLW FF
0194: MOVLB 00
0195: MOVWF stateold
0196: CLRF count
0197: MOVLW 04
0198: MOVWF ms50 |
5094
Code: | MOVLW FF
01BC: MOVLB 00
01BD: MOVWF 32
01BE: CLRF 33
01BF: MOVLW 04
01C0: MOVWF 34 |
|
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19524
|
|
Posted: Wed Jul 08, 2020 12:03 am |
|
|
The 'default' for all the compilers, is to use addresses, not symbolic names.
On your previous compiler, you must have changed the setting to use
symbolic. This setting has not been upgraded, so you need to make it
again.
Options
Project
Output Files
List file. Symbolic.
The default is 'CCS Basic'. |
|
|
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Wed Jul 08, 2020 1:22 am |
|
|
No it is set, all other in the .lst it is right but not in the section for static assign.
Just after the main() in the .lst file. |
|
|
Ttelmah
Joined: 11 Mar 2010 Posts: 19524
|
|
Posted: Wed Jul 08, 2020 2:32 am |
|
|
OK. There is no sign at all that this is a 'static assignment'. C as such does
not have a distinct 'static assignment'. All that happens is that static
variables if they have values assigned at declaration, have these initilalised
before the start of the main code, instead of in the sub-routines where they
are declared.
Now what you show looks like a post-declaration assignment to a possibly
'static' variable, but cannot be a 'static assignment' in the normal meaning
of this phrase (since in C assignments to static's done at declaration, can
only use constants). This looks like a post declaration initialisation.
A 'static assignment' in C , would be a declaration like:
Code: |
static struct {
int32 val;
int16 another;
} a_structure = {0x11223344,0x1122};
|
Now, why the compiler has changed what you are seeing, would need
study with some complete code, to actually see what it is doing. It looks
as if it is using one extra scratch level in passing data to the mul function.
Scratch variables never use symbolic notation.
Tracking back compiler versions to see when this actually happened, and
then what 'remarks' were made about what this compiler version 'fixed',
might well give a clue. |
|
|
hmmpic
Joined: 09 Mar 2010 Posts: 314 Location: Denmark
|
|
Posted: Sun Jul 12, 2020 6:34 am |
|
|
I have set List file in configuration to use Symbolic, and it is some time but not always.
I try one more example:
Code: | #include <18f26k22.h>
#use delay(clock=8M,int)
void Test1(){
int8 t1=0x10;
static int8 t2=0x20;
t1=0x11;
t2=0x21;
}
void main(void){
Test1();
} |
Compile... Now look at the .lst file.
This look ok.
Code: | .................... void Test1(){
00004: MOVLW 10
00006: MOVWF t1
.................... int8 t1=0x10;
.................... static int8 t2=0x20;
....................
.................... t1=0x11;
00008: MOVLW 11
0000A: MOVWF t1
.................... t2=0x21;
0000C: MOVLW 21
0000E: MOVWF t2
00010: GOTO 0036 (RETURN) |
Here CCS initializing the static int8 t2, you see the static int8 t2 is used as it's ddress and not with the name as in 5066.
Code: | .................... void main(void){
00014: CLRF TBLPTRU
00016: BCF RCON.IPEN
00018: MOVLW 60
0001A: MOVWF OSCCON
0001C: BCF OSCTUNE.PLLEN
0001E: BCF OSCTUNE.INTSRC
00020: MOVLB F
00022: CLRF x38
00024: CLRF x39
00026: CLRF x3A
00028: CLRF CM2CON1
0002A: CLRF CM2CON0
0002C: CLRF CM1CON0
0002E: MOVLW 20
00030: MOVWF 04 -> This is the static int8 t2 location fount in the .sym file |
From the .sym file
Code: | 004 Test1.t2 ->Location for my static int8 t2
005 Test1.t1 |
|
|
|
|
|
You cannot post new topics in this forum You cannot reply to topics in this forum You cannot edit your posts in this forum You cannot delete your posts in this forum You cannot vote in polls in this forum
|
Powered by phpBB © 2001, 2005 phpBB Group
|