📄 start12.lst
字号:
166: #if defined(__ELF_OBJECT_FILE_FORMAT__)
167: #if defined( __BANKED__) || defined(__LARGE__)
168: LDY _startupData.nofInitBodies; load number of cpp.
169: BEQ done ; if cppcount == 0, goto done
170: LDX _startupData.initBodies ; load address of first module to initialize
171: nextInit:
172: LEAX 3,X ; increment to next init
173: PSHX ; save address of next function to initialize
174: PSHY ; save cpp counter
175: CALL [-3,X] ; use double indirect call to load the page register also
176: PULY ; restore cpp counter
177: PULX ; restore actual address
178: DEY ; decrement cpp counter
179: BNE nextInit
180: #else /* defined( __BANKED__) || defined(__LARGE__) */
181:
182: LDD _startupData.nofInitBodies; load number of cpp.
183: BEQ done ; if cppcount == 0, goto done
184: LDX _startupData.initBodies ; load address of first module to initialize
185: nextInit:
186: LDY 2,X+ ; load address of first module to initialize
187: PSHD
188: PSHX ; save actual address
189: JSR 0,Y ; call initialization function
190: PULX ; restore actual address
191: PULD ; restore cpp counter
192: DBNE D, nextInit
193: #endif /* defined( __BANKED__) || defined(__LARGE__) */
194: #else /* __ELF_OBJECT_FILE_FORMAT__ */
195: LDX _startupData.mInits ; load address of first module to initialize
196: #if defined( __BANKED__) || defined(__LARGE__)
197: nextInit: LDY 3,X+ ; load address of initialization function
198: BEQ done ; stop when address == 0
199: ; in common environments the offset of a function is never 0, so this test could be avoided
200: #ifdef __InitFunctionsMayHaveOffset0__
201: BRCLR -1,X, done, 0xff ; stop when address == 0
202: #endif /* __InitFunctionsMayHaveOffset0__ */
203: PSHX ; save address of next function to initialize
204: CALL [-3,X] ; use double indirect call to load the page register also
205: #else /* defined( __BANKED__) || defined(__LARGE__) */
206: nextInit:
207: LDY 2,X+ ; load address of first module to initialize
208: BEQ done ; stop when address of function == 0
209: PSHX ; save actual address
210: JSR 0,Y ; call initialization function
211: #endif /* defined( __BANKED__) || defined(__LARGE__) */
212: PULX ; restore actual address
213: BRA nextInit
214: #endif /* __ELF_OBJECT_FILE_FORMAT__ */
215: done:
216: #endif /* __cplusplus */
217: }
218: }
0028 0a RTC
219:
220: #if defined( __ELF_OBJECT_FILE_FORMAT__) && defined(__cplusplus )
221:
222: #if !defined(FAR_DATA) && (defined( __BANKED__) || defined(__LARGE__))
223: static void __far Fini(void)
224: #else
225: static void Fini(void)
226: #endif
227: {
228: /* purpose: 1) call global destructors in C++ */
229: __asm {
230: #if defined( __BANKED__) || defined(__LARGE__)
231:
232: LDY _startupData.nofFiniBodies; load number of cpp.
233: BEQ done ; if cppcount == 0, goto done
234: LDX _startupData.finiBodies ; load address of first module to finalize
235: nextInit2:
236: LEAX 3,X ; increment to next init
237: PSHX ; save address of next function to finalize
238: PSHY ; save cpp counter
239: CALL [-3,X] ; use double indirect call to load the page register also
240: PULY ; restore cpp counter
241: PULX ; restore actual address
242: DEY ; decrement cpp counter
243: BNE nextInit2
244: #else /* defined( __BANKED__) || defined(__LARGE__) */
245:
246: LDD _startupData.nofFiniBodies; load number of cpp.
247: BEQ done ; if cppcount == 0, goto done
248: LDX _startupData.finiBodies ; load address of first module to finalize
249: nextInit2:
250: LDY 2,X+ ; load address of first module to finalize
251: PSHD
252: PSHX ; save actual address
253: JSR 0,Y ; call finalize function
254: PULX ; restore actual address
255: PULD ; restore cpp counter
256: DBNE D, nextInit2
257: #endif /* defined( __BANKED__) || defined(__LARGE__) */
258: done:;
259: }
260: }
261: #endif
262:
263:
264: #include "non_bank.sgm"
265:
266: #pragma MESSAGE DISABLE C12053 /* Stack-pointer change not in debugging-information */
267: #pragma NO_FRAME
268: #pragma NO_ENTRY
269: #pragma NO_EXIT
270:
271: #ifdef __cplusplus
272: extern "C"
273: #endif
274:
275: /* The function _Startup must be called in order to initialize global variables and to call main */
276: /* You can adapt this function or call it from your startup code to implement a different startup */
277: /* functionality. */
278:
279: /* You should also setup the needed IO registers as WINDEF (HC12A4 only) or the COP registers to run */
280: /* on hardware */
281:
282: /* to set the reset vector several ways are possible : */
283: /* 1. define the function with "interrupt 0" as done below in the first case */
284: /* 2. add the following line to your prm file : VECTOR ADDRESS 0xfffe _Startup */
285: /* of course, even more posibilities exists */
286: /* the reset vector must be set so that the application has a defined entry point */
287:
288: #define STARTUP_FLAGS_NOT_INIT_SP (1<<1)
289:
290: #if defined(__SET_RESET_VECTOR__)
291: void __interrupt 0 _Startup(void) {
292: #else
293: void _Startup(void) {
Function: _Startup
Source : D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\Sources\Start12.c
Options : -Env"GENPATH=D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256;D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\bin;D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\prm;D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\cmd;D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\Sources;D:\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\lib;D:\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\src;D:\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\include" -Env"LIBPATH=D:\Metrowerks\CodeWarrior CW12_V3.1\lib\HC12c\include" -Env"OBJPATH=D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\bin" -Env"TEXTPATH=D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\bin" -Lasm=%n.lst -Mb -ObjN="D:\RTAC\Willy Note\HCS12 MSCAN\MSCAN12_DP256\MSCAN12_DP256\MSCAN12_DP256_Data\P&E_ICD\ObjectCode\Start12.c.o" -WmsgSd12053
294: #endif
295: /* purpose: 1) initialize the stack
296: 2) initialize the RAM, copy down init data etc (Init)
297: 3) call main;
298: parameters: NONE
299: called from: _PRESTART-code generated by the Linker
300: or directly referenced by the reset vector */
301: for(;;) { /* forever: initialize the program; call the root-procedure */
302: if (!(_startupData.flags&STARTUP_FLAGS_NOT_INIT_SP)) {
0000 1e00000203 BRSET _startupData,#2,*+8 ;abs = 0008
303: /* initialize the stack pointer */
304: INIT_SP_FROM_STARTUP_DESC(); /*lint !e522 asm code */ /* HLI macro definition in hidef.h */
0005 ff0000 LDS _startupData:4
305: }
306:
307: #ifdef _HCS12_SERIALMON
308: /* for Monitor based software remap the RAM & EEPROM to adhere
309: to EB386. Edit RAM and EEPROM sections in PRM file to match these. */
310: ___INITRG = 0x00; /* lock registers block to 0x0000 */
311: ___INITRM = 0x39; /* lock Ram to end at 0x3FFF */
312: ___INITEE = 0x09; /* lock EEPROM block to end at 0x0fff */
313: #endif
314:
315: /* Here user defined code could be inserted, the stack could be used */
316: #if defined(_DO_DISABLE_COP_)
317: _DISABLE_COP();
318: #endif
319:
320: /* Example : Set up WinDef Register to allow Paging */
321: #ifdef HC812A4 /* HC12 A4 derivative needs WINDEF to configure which pages are available */
322: #if (__ENABLE_EPAGE__ != 0 || __ENABLE_DPAGE__ != 0 || __ENABLE_PPAGE__ != 0)
323: WINDEF= __ENABLE_EPAGE__ | __ENABLE_DPAGE__ | __ENABLE_PPAGE__;
324: #endif
325: #endif
326: Init(); /* zero out, copy down, call constructors */
0008 4a000000 CALL Init,PAGE(Init)
327: /* Here user defined code could be inserted, all global variables are initilized */
328: #if defined(_DO_ENABLE_COP_)
329: _ENABLE_COP(1);
330: #endif
331:
332: /* call main() */
333: (*_startupData.main)();
000c 4bfb0000 CALL [_startupData:1,PCR]
0010 20ee BRA *-16 ;abs = 0000
334:
335: /* call destructors. Only done when this file is compiled as C++ and for the ELF object file format */
336: /* the HIWARE object file format does not support this */
337: #if defined( __ELF_OBJECT_FILE_FORMAT__) && defined(__cplusplus )
338: Fini();
339: #endif
340:
341: } /* end loop forever */
342: }
343:
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -