📄 sys_params.lst
字号:
ANSI-C/cC++ Compiler for HC12 V-5.0.30 Build 6157, Jun 7 2006
1: #include "s12x_peripherals.h"
2: #include "s12xe_flash.h"
3: #include "sys_params.h"
4: #include "main.h"
5: #include "far_ptr.h"
6:
7: __SEG_SIZE_DEF(SYSTEM_DATA); // size of system parameter variables
8:
9: #pragma DATA_SEG SYSTEM_DATA /* linked into the buffer RAM at 0x0C00 */
10:
11: int PARAM_1;
12: int PARAM_2;
13: char PARAM_3;
14: int PARAM_4;
15: int PARAM_5;
16: tU16 PARAM_6;
17: tU16 PARAM_7;
18: tU16 PARAM_8;
19: char PARAM_9;
20: tU16 PARAM_10;
21: tU16 PARAM_11;
22: tU16 PARAM_12;
23: tU16 PARAM_13;
24: tU08 PARAM_14;
25: tU16 PARAM_15; //27 bytes
26:
27: #pragma CONST_SEG DEFAULT
28:
29: /* these represent static parameters programmed by the application or boot */
30: /* loader into the user D-Flash during production (for example). */
31: /* In this example these are created as constants in the code that are then */
32: /* programmed once into the D-Flash (global address 0x100000'G). */
33: /* Their order and type should be the same as the variable list in the */
34: /* SYSTEM_DATA segment above. */
35:
36: const int PARAM_1_NVM = 0x1111;
37: const int PARAM_2_NVM = 0x2222;
38: const char PARAM_3_NVM = 0x33;
39: const int PARAM_4_NVM = 0x4444;
40: const int PARAM_5_NVM = 0x5555;
41: const tU16 PARAM_6_NVM = 0x6666;
42: const tU16 PARAM_7_NVM = 0x7777;
43: const tU16 PARAM_8_NVM = 0x8888;
44: const char PARAM_9_NVM = 0x99;
45: const tU16 PARAM_10_NVM = 0xAAAA;
46: const tU16 PARAM_11_NVM = 0xBBBB;
47: const tU16 PARAM_12_NVM = 0xCCCC;
48: const tU16 PARAM_13_NVM = 0xDDDD;
49: const tU08 PARAM_14_NVM = 0xEE;
50: const tU16 PARAM_15_NVM = 0x1234; //27 bytes
51:
52: #pragma CODE_SEG DEFAULT
53:
54: void InitSysParams(void){
Function: InitSysParams
Source : D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources\sys_params.c
Options : -CPUHCS12XE -D__FAR_DATA -D__NO_FLOAT__ -Env"GENPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\prm;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\cmd;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\lib;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\src;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\lib;*C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\src;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources\Configuration;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\defs_XEx100_M22E;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\include;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\include" -Env"LIBPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\prm;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\cmd;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\lib;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\src;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\lib;*C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\src;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Sources\Configuration;D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\defs_XEx100_M22E;C:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\include;C:\Program Files\Freescale\CW for HC12 V4.5\lib\xgatec\include" -Env"OBJPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin" -Env"TEXTPATH=D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\bin" -Lasm=%n.lst -Mb -ObjN="D:\Profiles\b06321\My Documents\S12X\S12XE - Sailfish\Training\Training REV0\Solutions\Example 9\Example_9_Data\Flash_P&E_target\ObjectCode\sys_params.c.o" -WmsgSd1106
0000 1bf1ed [2] LEAS -19,SP
55: tU16 *__far src_ptr_f16;
56: tU16 *__far dst_ptr_f16 = (tU16 *__far)SYS_PARAM_DFLASH_START;
0003 18698a [3] CLRW 10,SP
0006 c610 [1] LDAB #16
0008 6b89 [2] STAB 9,SP
57: tU08 ftmStat;
58: tU16 data[4];
59: int i;
60: int remainder;
61:
62: /* Program default parameters into D-flash if not already loaded */
63: if(*dst_ptr_f16 == 0xFFFF){
000a ee8a [3] LDX 10,SP
000c 5b10 [2] STAB /*GPAGE*/16
000e 18ed00 [4] GLDY 0,X
0011 04a6f2 [3] IBNE Y,*+245 ;abs = 0106
64: FTM.fclkdiv.byte = FCLK_DIV; /* write the flash clock divider */
0014 8604 [1] LDAA #4
0016 7a0000 [3] STAA FTM
65: /* before launching first FTM command */
66: /* but after CCIF flag has set */
67: src_ptr_f16 = (tU16 *__far)&PARAM_1_NVM;
0019 ce0000 [2] LDX #GLOBAL(PARAM_1_NVM)
001c c600 [1] LDAB #GLOBAL_PAGE(PARAM_1_NVM)
001e 6e8d [2] STX 13,SP
0020 6b8c [2] STAB 12,SP
68: /* program them into D-flash */
69: /* write 4 words at a time - would be cleaner to write a dedicated function to take a pointer */
70: for(i = (SIZEOF_SYSTEM_DATA / 8); i>0; i--) {
0022 160000 [4] JSR InitSysParams:0x0119
0025 6e8f [2] STX 15,SP
0027 205e [3] BRA *+96 ;abs = 0087
71: data[0] = *src_ptr_f16++;
0029 ee8d [3] LDX 13,SP
002b 160000 [4] JSR InitSysParams:0x010a
002e 6c81 [2] STD 1,SP
72: data[1] = *src_ptr_f16++;
0030 160000 [4] JSR InitSysParams:0x0116
0033 6c83 [2] STD 3,SP
73: data[2] = *src_ptr_f16++;
0035 160000 [4] JSR InitSysParams:0x010a
0038 6c85 [2] STD 5,SP
74: data[3] = *src_ptr_f16++;
003a 160000 [4] JSR InitSysParams:0x0116
003d 6c87 [2] STD 7,SP
75: ftmStat = LaunchFlashCommand(6 ,PROGRAM_D_FLASH, WP_PAGE(dst_ptr_f16), WP_ADDR(dst_ptr_f16), data[0], data[1], data[2], data[3]);
003f cc1106 [2] LDD #4358
0042 37 [2] PSHB
0043 36 [2] PSHA
0044 e68b [3] LDAB 11,SP
0046 37 [2] PSHB
0047 ec8d [3] LDD 13,SP
0049 3b [2] PSHD
004a ec86 [3] LDD 6,SP
004c 3b [2] PSHD
004d ec8a [3] LDD 10,SP
004f 3b [2] PSHD
0050 ec8e [3] LDD 14,SP
0052 3b [2] PSHD
0053 ecf012 [3] LDD 18,SP
0056 4a000000 [7] CALL LaunchFlashCommand,PAGE(LaunchFlashCommand)
005a 1b8b [2] LEAS 11,SP
76: if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
005c 6b80 [2] STAB 0,SP
005e c433 [1] ANDB #51
0060 2706 [3/1] BEQ *+8 ;abs = 0068
77: Error(ftmStat);
0062 e680 [3] LDAB 0,SP
0064 4a000000 [7] CALL Error,PAGE(Error)
78: FP_ADD(dst_ptr_f16, 8);
0068 e689 [3] LDAB 9,SP
006a 87 [1] CLRA
006b b705 [1] SEX A,X
006d b756 [1] TFR X,Y
006f 18ea8a [4] ORY 10,SP
0072 18cb0008 [3] ADDY #8
0076 c900 [1] ADCB #0
0078 8900 [1] ADCA #0
007a 1887 [2] CLRX
007c 6b89 [2] STAB 9,SP
007e ed8a [3] LDY 10,SP
0080 1948 [2] LEAY 8,Y
0082 6d8a [2] STY 10,SP
0084 18638f [4] DECW 15,SP
0087 ec8f [3] LDD 15,SP
0089 2e9e [3/1] BGT *-96 ;abs = 0029
79: }
80: /* write any remaining data */
81: remainder = ((SIZEOF_SYSTEM_DATA % 8) /2);
008b 160000 [4] JSR InitSysParams:0x0119
008e ce0002 [2] LDX #2
0091 1815 [12] IDIVS
0093 6ef011 [3] STX 17,SP
82: for(i = 0; i < remainder; i++ )
0096 18698f [3] CLRW 15,SP
0099 2010 [3] BRA *+18 ;abs = 00ab
83: data[i] = *src_ptr_f16++;
009b 59 [1] LSLD
009c 1a81 [2] LEAX 1,SP
009e 1ae6 [2] LEAX D,X
00a0 ed8d [3] LDY 13,SP
00a2 34 [2] PSHX
00a3 077d [4] BSR *+127 ;abs = 0122
00a5 30 [3] PULX
00a6 6c00 [2] STD 0,X
00a8 18628f [4] INCW 15,SP
00ab ec8f [3] LDD 15,SP
00ad acf011 [3] CPD 17,SP
00b0 2de9 [3/1] BLT *-21 ;abs = 009b
84: if(SIZEOF_SYSTEM_DATA % 2){
00b2 cc0000 [2] LDD #__SEG_SIZE_SYSTEM_DATA
00b5 ce0002 [2] LDX #2
00b8 1815 [12] IDIVS
00ba 04441c [3] TBEQ D,*+31 ;abs = 00d9
85: data[i] = *src_ptr_f16|0x00FF;
00bd ec8f [3] LDD 15,SP
00bf 59 [1] LSLD
00c0 1a81 [2] LEAX 1,SP
00c2 1ae6 [2] LEAX D,X
00c4 ed8d [3] LDY 13,SP
00c6 e68c [3] LDAB 12,SP
00c8 5b10 [2] STAB /*GPAGE*/16
00ca 34 [2] PSHX
00cb 18ee40 [4] GLDX 0,Y
00ce 188a00ff [3] ORX #255
00d2 31 [3] PULY
00d3 6e40 [2] STX 0,Y
86: remainder++;
00d5 1862f011 [5] INCW 17,SP
87: }
88: ftmStat = LaunchFlashCommand(remainder + 2 ,PROGRAM_D_FLASH, WP_PAGE(dst_ptr_f16), WP_ADDR(dst_ptr_f16), data[0], data[1], data[2], data[3]);
00d9 e6f012 [3] LDAB 18,SP
00dc cb02 [1] ADDB #2
00de 37 [2] PSHB
00df c611 [1] LDAB #17
00e1 37 [2] PSHB
00e2 a68b [3] LDAA 11,SP
00e4 36 [2] PSHA
00e5 ec8d [3] LDD 13,SP
00e7 3b [2] PSHD
00e8 ec86 [3] LDD 6,SP
00ea 3b [2] PSHD
00eb ec8a [3] LDD 10,SP
00ed 3b [2] PSHD
00ee ec8e [3] LDD 14,SP
00f0 3b [2] PSHD
00f1 ecf012 [3] LDD 18,SP
00f4 4a000000 [7] CALL LaunchFlashCommand,PAGE(LaunchFlashCommand)
00f8 1b8b [2] LEAS 11,SP
89: if ((ftmStat & (ACCERR|FPVIOL|MGSTAT1|MGSTAT0)))
00fa 6b80 [2] STAB 0,SP
00fc c433 [1] ANDB #51
00fe 2706 [3/1] BEQ *+8 ;abs = 0106
90: Error(ftmStat);
0100 e680 [3] LDAB 0,SP
0102 4a000000 [7] CALL Error,PAGE(Error)
91: }
92: }
0106 1bf013 [2] LEAS 19,SP
0109 0a [7] RTC
010a 1902 [2] LEAY 2,X
010c 6d8f [2] STY 15,SP
010e e68e [3] LDAB 14,SP
0110 5b10 [2] STAB /*GPAGE*/16
0112 18ec00 [4] GLDD 0,X
0115 3d [5] RTS
0116 070a [4] BSR *+12 ;abs = 0122
0118 3d [5] RTS
0119 cc0000 [2] LDD #__SEG_SIZE_SYSTEM_DATA
011c ce0008 [2] LDX #8
011f 1815 [12] IDIVS
0121 3d [5] RTS
0122 1a42 [2] LEAX 2,Y
0124 6ef011 [3] STX 17,SP
0127 e6f010 [3] LDAB 16,SP
012a 5b10 [2] STAB /*GPAGE*/16
012c 18ec40 [4] GLDD 0,Y
012f 3d [5] RTS
93:
94:
95:
96:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -