⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 start12.lst

📁 CAN通信程序,在汽车电子开发中 十分有用
💻 LST
📖 第 1 页 / 共 2 页
字号:
ANSI-C/cC++ Compiler for HC12 V-5.0.30 Build 6037, Feb  7 2006

    1:  /*****************************************************
    2:        start12.c - standard startup code
    3:     The startup code may be optimized to special user requests
    4:   ----------------------------------------------------
    5:     Copyright (c) Metrowerks, Basel, Switzerland
    6:                 All rights reserved
    7:                    Do not modify!
    8:  
    9:  Note: ROM libraries are not implemented in this startup code
   10:  Note: C++ destructors of global objects are NOT yet supported in the HIWARE Object File Format.
   11:        To use this feature, please build your application with the ELF object file format.
   12:   *****************************************************/
   13:  
   14:  #include "hidef.h"
   15:  #include "start12.h"
   16:  
   17:  /* Macros to control how the startup code handles the COP: */
   18:  /* #define _DO_FEED_COP_  : do feed the COP  */
   19:  /* #define _DO_ENABLE_COP_: do enable the COP  */
   20:  /* #define _DO_DISABLE_COP_: disable the COP */
   21:  /* Without defining any of these, the startup code does NOT handle the COP */
   22:  
   23:  #pragma DATA_SEG __NEAR_SEG STARTUP_DATA /* _startupData can be accessed using 16 bit accesses. This is needed because it contains the stack top, and without stack, far data cannot be accessed */
   24:  struct _tagStartup _startupData;  /*   read-only: */
   25:                                    /*   _startupData is allocated in ROM and */
   26:                                    /*   initialized by the linker */
   27:  #pragma DATA_SEG DEFAULT
   28:  #if defined(FAR_DATA)
   29:  #include "non_bank.sgm"
   30:  /* the init function must be in non banked memory if banked variables are used */
   31:  /* because _SET_PAGE is called, which may change any page register. */
   32:  
   33:  #ifdef __cplusplus
   34:    extern "C"
   35:  #endif
   36:  void _SET_PAGE(void);             /* the inline assembler needs a prototype */
   37:                                    /* this is a runtime routine with a special */
   38:                                    /* calling convention, dont use it in c code! */
   39:  static void Init(void);
   40:  static void Fini(void);
   41:  #else
   42:  #include "default.sgm"
   43:  #if defined( __BANKED__) || defined(__LARGE__)
   44:  static void __far Init(void);
   45:  static void __far Fini(void);
   46:  #endif /* defined( __BANKED__) || defined(__LARGE__) */
   47:  #endif /* FAR_DATA */
   48:  
   49:  
   50:  /* define value and bits for Windef Register */
   51:  #ifdef HC812A4
   52:  #define WINDEF (*(volatile unsigned char*) 0x37)
   53:  #if defined( __BANKED__) || defined(__LARGE__) || defined(__PPAGE__)
   54:  #define __ENABLE_PPAGE__ 0x40
   55:  #else
   56:  #define __ENABLE_PPAGE__ 0x0
   57:  #endif
   58:  #if defined(__DPAGE__)
   59:  #define __ENABLE_DPAGE__ 0x80
   60:  #else
   61:  #define __ENABLE_DPAGE__ 0x0
   62:  #endif
   63:  #if defined(__EPAGE__)
   64:  #define __ENABLE_EPAGE__ 0x20
   65:  #else
   66:  #define __ENABLE_EPAGE__ 0x0
   67:  #endif
   68:  #endif  /* HC812A4 */
   69:  
   70:  #ifdef _HCS12_SERIALMON
   71:        /* for Monitor based software remap the RAM & EEPROM to adhere
   72:           to EB386. Edit RAM and EEPROM sections in PRM file to match these. */
   73:  #define ___INITRM      (*(volatile unsigned char *) 0x0010)
   74:  #define ___INITRG      (*(volatile unsigned char *) 0x0011)
   75:  #define ___INITEE      (*(volatile unsigned char *) 0x0012)
   76:  #endif
   77:  
   78:  #if defined(_DO_FEED_COP_)
   79:  #define __FEED_COP_IN_HLI()  } __asm movb #0x55, _COP_RST_ADR; __asm movb #0xAA, _COP_RST_ADR; __asm {
   80:  #else
   81:  #define __FEED_COP_IN_HLI() /* do nothing */
   82:  #endif
   83:  
   84:  #if !defined(FAR_DATA) && (defined( __BANKED__) || defined(__LARGE__))
   85:  static void __far Init(void)
   86:  #else
   87:  static void Init(void)
   88:  #endif
   89:   {

Function: Init
Source  : E:\Freescale\code\MSCAN12_DP256\Sources\Start12.c
Options : -Env"GENPATH=E:\Freescale\code\MSCAN12_DP256;E:\Freescale\code\MSCAN12_DP256\bin;E:\Freescale\code\MSCAN12_DP256\prm;E:\Freescale\code\MSCAN12_DP256\cmd;E:\Freescale\code\MSCAN12_DP256\Sources;D:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\lib;D:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\src;D:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\include" -Env"LIBPATH=D:\Program Files\Freescale\CW for HC12 V4.5\lib\HC12c\include" -EnvOBJPATH=E:\Freescale\code\MSCAN12_DP256\bin -EnvTEXTPATH=E:\Freescale\code\MSCAN12_DP256\bin -Lasm=%n.lst -Mb -ObjN=E:\Freescale\code\MSCAN12_DP256\MSCAN12_DP256_Data\P&E_ICD\ObjectCode\Start12.c.o

   90:  /* purpose:     1) zero out RAM-areas where data is allocated   */
   91:  /*              2) copy initialization data from ROM to RAM     */
   92:  /*              3) call global constructors in C++              */
   93:  /*   called from: _Startup, LibInits                            */
   94:     __asm {
   95:  ZeroOut:
   96:  #if defined(__HIWARE_OBJECT_FILE_FORMAT__) && defined(__LARGE__)
   97:               LDX   _startupData.pZeroOut:1  ; in the large memory model in the HIWARE format, pZeroOut is a 24 bit pointer
   98:  #else
   99:               LDX   _startupData.pZeroOut    ; *pZeroOut
  0000 fe0000       [3]     LDX   _startupData:8
  100:  #endif
  101:               LDY   _startupData.nofZeroOuts ; nofZeroOuts
  0003 fd0000       [3]     LDY   _startupData:6
  102:               BEQ   CopyDown                 ; if nothing to zero out
  0006 270e         [3/1]   BEQ   *+16 ;abs = 0016
  103:  
  104:  NextZeroOut: PSHY                           ; save nofZeroOuts
  0008 35           [2]     PSHY  
  105:  #ifdef FAR_DATA
  106:               LDAB  1,X+                     ; load page of destination address
  107:               LDY   2,X+                     ; load offset of destination address
  108:               __PIC_JSR(_SET_PAGE)           ; sets the page in the correct page register
  109:  #else   /* FAR_DATA */
  110:               LDY   2,X+                     ; start address and advance *pZeroOut (X = X+4)
  0009 ed31         [3]     LDY   2,X+
  111:  #endif  /* FAR_DATA */
  112:               LDD   2,X+                     ; byte count
  000b ec31         [3]     LDD   2,X+
  113:  #ifdef  __OPTIMIZE_FOR_SIZE__               /* -os, default */
  114:  NextWord:    CLR   1,Y+                     ; clear memory byte
  000d 6970         [2]     CLR   1,Y+
  115:               __FEED_COP_IN_HLI()            ; feed the COP if necessary /*lint !e505 !e522 asm code */
  116:               DBNE  D, NextWord              ; dec byte count
  000f 0434fb       [3]     DBNE  D,*-2 ;abs = 000d
  117:  #else
  118:               LSRD                           ; /2 and save bit 0 in the carry
  119:               PSHX
  120:               LDX   #0
  121:  LoopClrW:    STX   2,Y+                     ; Word-Clear
  122:               __FEED_COP_IN_HLI()            ; feed the COP if necessary /*lint !e505 !e522 asm code */
  123:               DBNE  D, LoopClrW
  124:               PULX
  125:               BCC   LastClr                  ; handle last byte
  126:               CLR   1,Y+
  127:  LastClr:
  128:  #endif
  129:               PULY                           ; restore nofZeroOuts
  0012 31           [3]     PULY  
  130:               DEY                            ; dec nofZeroOuts
  0013 03           [1]     DEY   
  131:               BNE  NextZeroOut
  0014 26f2         [3/1]   BNE   *-12 ;abs = 0008
  132:  CopyDown:
  133:  #ifdef __ELF_OBJECT_FILE_FORMAT__
  134:               LDX   _startupData.toCopyDownBeg ; load address of copy down desc.
  0016 fe0000       [3]     LDX   _startupData:10
  135:  #else
  136:               LDX   _startupData.toCopyDownBeg:2 ; load address of copy down desc.
  137:  #endif
  138:  NextBlock:
  139:               LDD   2,X+                     ; size of init-data -> D
  0019 ec31         [3]     LDD   2,X+
  140:               BEQ   funcInits                ; end of copy down desc.
  001b 270b         [3/1]   BEQ   *+13 ;abs = 0028
  141:  #ifdef FAR_DATA
  142:               PSHD                           ; save counter
  143:               LDAB  1,X+                     ; load destination page
  144:               LDY   2,X+                     ; destination address
  145:               __PIC_JSR(_SET_PAGE)           ; sets the destinations page register
  146:               PULD                           ; restore counter
  147:  #else  /* FAR_DATA */
  148:               LDY   2,X+                     ; load destination address
  001d ed31         [3]     LDY   2,X+
  149:  #endif /* FAR_DATA */
  150:  
  151:  #ifdef  __OPTIMIZE_FOR_SIZE__               /* -os, default */
  152:  Copy:        MOVB  1,X+,1,Y+                ; move a byte from ROM to the data area
  001f 180a3070     [5]     MOVB  1,X+,1,Y+
  153:               __FEED_COP_IN_HLI()            ; feed the COP if necessary /*lint !e505 !e522 asm code */
  154:               DBNE  D,Copy                   ; copy-byte loop
  0023 0434f9       [3]     DBNE  D,*-4 ;abs = 001f
  155:  #else
  156:               LSRD                           ; /2 and save bit 0 in the carry
  157:  Copy:        MOVW  2,X+,2,Y+                ; move a word from ROM to the data area
  158:               __FEED_COP_IN_HLI()            ; feed the COP if necessary /*lint !e505 !e522 asm code */
  159:               DBNE  D,Copy                   ; copy-word loop
  160:               BCC   NextBlock                ; handle last byte?
  161:               MOVB  1,X+,1,Y+                ; copy the last byte
  162:  #endif
  163:               BRA   NextBlock
  0026 20f1         [3]     BRA   *-13 ;abs = 0019
  164:  funcInits:                                  ; call of global construtors is only in c++ necessary
  165:  #if defined(__cplusplus)

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -