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

📄 start12.lst

📁 ucos-ii 在m68hc12上的移植
💻 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) HIWARE AG, 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:  #if defined(__PROCESSOR_X4__) || defined(__HC12S__)    /* In some early version DBNE/... did not work. */
   18:  #define DO_NOT_USE_TEST_BRANCHES 1 /* Do not use DBNE/TBEQ,.... */
   19:  #else
   20:  #define DO_NOT_USE_TEST_BRANCHES 0 /* Do use DBNE/TBEQ,.... */
   21:  #endif
   22:  
   23:  #if defined(__HC12S__) && (defined(FAR_DATA) || defined(__BANKED__))
   24:  #error /* no banked support */
   25:  #endif
   26:  
   27:  #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 */
   28:  struct _tagStartup _startupData;  //   read-only:
   29:                                    //   _startupData is allocated in ROM and
   30:                                    //   initialized by the linker
   31:  #pragma DATA_SEG DEFAULT
   32:  #if defined(FAR_DATA)
   33:  #include "non_bank.sgm"
   34:  // the init function must be in non banked memory if banked variables are used
   35:  // because _SET_PAGE is called, which may change any page register.
   36:  
   37:  #ifdef __cplusplus
   38:    extern "C"
   39:  #endif
   40:  void _SET_PAGE(void);             // the inline assembler needs a prototype
   41:                                    // this is a runtime routine with a special
   42:                                    // calling convention, dont use it in c code!
   43:  static void Init(void);
   44:  static void Fini(void);
   45:  #else
   46:  #include "default.sgm"
   47:  #if defined( __BANKED__) || defined(__LARGE__)
   48:  static void __far Init(void);
   49:  static void __far Fini(void);
   50:  #endif // defined( __BANKED__) || defined(__LARGE__)
   51:  #endif // FAR_DATA
   52:  
   53:  /* define value and bits for Windef Register */
   54:  
   55:  #define WINDEF (*(volatile unsigned char*) 0x37)
   56:  #if defined( __BANKED__) || defined(__LARGE__) || defined(__PPAGE__)
   57:  #define __ENABLE_PPAGE__ 0x40
   58:  #else
   59:  #define __ENABLE_PPAGE__ 0x0
   60:  #endif
   61:  
   62:  #if defined(__DPAGE__)
   63:  #define __ENABLE_DPAGE__ 0x80
   64:  #else
   65:  #define __ENABLE_DPAGE__ 0x0
   66:  #endif
   67:  
   68:  #if defined(__EPAGE__)
   69:  #define __ENABLE_EPAGE__ 0x20
   70:  #else
   71:  #define __ENABLE_EPAGE__ 0x0
   72:  #endif
   73:  
   74:  
   75:  #if !defined(FAR_DATA) && (defined( __BANKED__) || defined(__LARGE__))
   76:  static void __far Init(void)
   77:  #else
   78:  static void Init(void)
   79:  #endif
   80:   {

Function: Init
Source  : C:\Users\www\Desktop\m68hc12-mw\sources\Start12.c
Options : -Cf -EnvGENPATH=C:\Users\www\Desktop\m68hc12-mw;C:\Users\www\Desktop\m68hc12-mw\bin;C:\Users\www\Desktop\m68hc12-mw\cmd;C:\Users\www\Desktop\m68hc12-mw\prm;C:\Users\www\Desktop\m68hc12-mw\sources;D:\Installed\CodeWarrior\lib\HC12c\LIB;D:\Installed\CodeWarrior\lib\HC12c\SRC;D:\Installed\CodeWarrior\lib\HC12c\INCLUDE -EnvLIBPATH=D:\Installed\CodeWarrior\lib\HC12c\INCLUDE -EnvOBJPATH=C:\Users\www\Desktop\m68hc12-mw\bin -EnvTEXTPATH=C:\Users\www\Desktop\m68hc12-mw\bin -Lasm=%n.lst -Ms -ObjN=C:\Users\www\Desktop\m68hc12-mw\RTOS_Data\Generic\ObjectCode\Start12.c.o -TD4LD4LLD4

   81:  // purpose:     1) zero out RAM-areas where data is allocated
   82:  //              2) copy initialization data from ROM to RAM
   83:  //              3) call global constructors in C++
   84:  //   called from: _Startup, LibInits
   85:     __asm {
   86:  ZeroOut:
   87:  #if defined(__HIWARE_OBJECT_FILE_FORMAT__) && defined(__LARGE__)
   88:               LDX   _startupData.pZeroOut:1  ; in the large memory model in the HIWARE format, pZeroOut is a 24 bit pointer
   89:  #else
   90:               LDX   _startupData.pZeroOut    ; *pZeroOut
  0000 fe0000       [3]     LDX   _startupData:7
   91:  #endif
   92:               LDY   _startupData.nofZeroOuts ; nofZeroOuts
  0003 fd0000       [3]     LDY   _startupData:5
   93:               BEQ   CopyDown                 ; if nothing to zero out
  0006 270e         [3/1]   BEQ   *+16 ;abs = 0016
   94:  
   95:  NextZeroOut: PSHY                           ; save nofZeroOuts
  0008 35           [2]     PSHY  
   96:  #ifdef __HC12S__
   97:               LDY   0,X                      ; start address and advance *pZeroOut (X = X+4)
   98:               LDD   2,X                      ; byte count
   99:               LEAX  4,X
  100:  NextWord:    CLR   0,Y                      ; clear memory byte
  101:               INY
  102:  #else  /* __HC12S__ */
  103:  #ifdef FAR_DATA
  104:               LDAB  1,X+                     ; load page of destination address
  105:               LDY   2,X+                     ; load offset of destination address
  106:               __PIC_JSR(_SET_PAGE)                ; sets the page in the correct page register
  107:  #else   /* FAR_DATA */
  108:               LDY   2,X+                     ; start address and advance *pZeroOut (X = X+4)
  0009 ed31         [3]     LDY   2,X+
  109:  #endif  /* FAR_DATA */
  110:               LDD   2,X+                     ; byte count
  000b ec31         [3]     LDD   2,X+
  111:  NextWord:    CLR   1,Y+                     ; clear memory byte
  000d 6970         [2]     CLR   1,Y+
  112:  #endif /* __HC12S__ */
  113:  #if DO_NOT_USE_TEST_BRANCHES
  114:               SUBD  #1                       ; for processor version which does not support DBNE
  115:               BNE NextWord
  116:  #else
  117:               DBNE  D, NextWord              ; dec byte count
  000f 0434fb       [3]     DBNE  D,*-2 ;abs = 000d
  118:  #endif
  119:               PULY                           ; restore nofZeroOuts
  0012 31           [3]     PULY  
  120:               DEY                            ; dec nofZeroOuts
  0013 03           [1]     DEY   
  121:               BNE  NextZeroOut
  0014 26f2         [3/1]   BNE   *-12 ;abs = 0008
  122:  CopyDown:
  123:  #ifdef __ELF_OBJECT_FILE_FORMAT__
  124:               LDX   _startupData.toCopyDownBeg ; load address of copy down desc.
  0016 fe0000       [3]     LDX   _startupData:9
  125:  #else
  126:               LDX   _startupData.toCopyDownBeg:2 ; load address of copy down desc.
  127:  #endif
  128:  NextBlock:
  129:  #ifdef __HC12S__
  130:               LDD   0,X                      ; size of init-data -> D
  131:               BEQ   funcInits                ; end of copy down desc.
  132:               LDY   2,X                      ; load destination address
  133:               LEAX  4,X                      ; increment pointer
  134:  #else /* __HC12S__ */
  135:               LDD   2,X+                     ; size of init-data -> D
  0019 ec31         [3]     LDD   2,X+
  136:               BEQ   funcInits                ; end of copy down desc.
  001b 270b         [3/1]   BEQ   *+13 ;abs = 0028
  137:  #ifdef FAR_DATA
  138:               PSHD                           ; save counter
  139:               LDAB  1,X+                     ; load destination page
  140:               LDY   2,X+                     ; destination address
  141:               __PIC_JSR(_SET_PAGE)           ; sets the destinations page register
  142:               PULD                           ; restore counter
  143:  #else  /* FAR_DATA */
  144:               LDY   2,X+                     ; load destination address
  001d ed31         [3]     LDY   2,X+
  145:  #endif /* FAR_DATA */
  146:  #endif /* __HC12S__ */
  147:  Copy:
  148:  #ifdef __HC12S__
  149:               PSHA                          ; move a byte from ROM to the data area
  150:               LDAA  0,X
  151:               STAA  0,Y
  152:               PULA
  153:               INX
  154:               INY
  155:  #else  /* __HC12S__ */
  156:               MOVB  1,X+,1,Y+                ; move a byte from ROM to the data area
  001f 180a3070     [5]     MOVB  1,X+,1,Y+
  157:  #endif /* __HC12S__ */
  158:  #if DO_NOT_USE_TEST_BRANCHES
  159:               SUBD  #1                       ; for processor version which does not support DBNE
  160:               BNE    Copy
  161:  #else
  162:               DBNE  D,Copy                   ; copy-byte loop
  0023 0434f9       [3]     DBNE  D,*-4 ;abs = 001f
  163:  #endif
  164:               BRA   NextBlock
  0026 20f1         [3]     BRA   *-13 ;abs = 0019
  165:  funcInits:                                  ; call of global construtors is only in c++ necessary
  166:  #if defined(__cplusplus)
  167:  #if defined(__ELF_OBJECT_FILE_FORMAT__)
  168:  #if defined( __BANKED__) || defined(__LARGE__)
  169:  
  170:               LDY   _startupData.nofInitBodies; load number of cpp.
  171:               BEQ   done                     ; if cppcount == 0, goto done

⌨️ 快捷键说明

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