?? chipcon_cexit.s51
字號:
/******************************************************************************
* *
* ********** *
* ************ *
* *** *** *
* *** ++ *** *
* *** + + *** CHIPCON *
* *** + *
* *** + + *** *
* *** ++ *** *
* *** *** *
* ************ *
* ********** *
* *
*******************************************************************************
Filename: chipcon_cexit.s51
Target: cc2430
Author: KJA
Revised: 16/12-2005
Revision: 1.0
Description:
System termination code for the 8051 IAR Systems C/EC++ Compiler.
For CLIB there is no option to set to get rid of the last system break point.
When the compiler build the application with debug information the debug
variant of the "cexit" module will be included.
To get around this you have to exclude the debug label "?C_EXIT" from the
application. You can do this by including this file in your project.
The "?exit" module will replace the one in your library.
Include this file in the project and add $TOOLKIT_DIR$\SRC\LIB\ to
the assembler include path.
Copyright 2004-2005 IAR Systems. All rights reserved.
******************************************************************************/
;
; Naming covention of labels in this file:
;
; ?xxx - External labels only accessed from assembler.
; __xxx - External labels accessed from or defined in C.
; xxx - Labels local to one module (note: this file contains
; several modules).
; main - The starting point of the user program.
;
#define XRSEGCSTART RSEG CSTART:CODE:NOROOT
#include "iar_common.h"
EXTERNS_FOR_ALL_DPTR_SYMBOLS()
#if (defined(__DLIB_BUILD__) )
//------------------------------------------------------------------------
//
// DLIB exit sequence
//
// ---------------------------------------------------------
// The exit system
//
// The default exit function, written in C, calls _exit provided
// below. This function performs system cleanup and calls __exit that
// halts the system.
//
// -----------------------------------------------
// _exit -- Perform system cleanup and jump to __exit.
//
// The module below contains a number of segment parts that is
// included in the final application only if they are needed.
//
XRSEGCSTART
MODULE ?cexit
PUBLIC _exit
FUNCTION _exit,0203H
EXTERN __exit
REQUIRE __exit
REQUIRE ?exit_br_xxexit
_exit:
// -------------------------------------
// Segment part included if the argument to exit must be saved and
// later restored.
XRSEGCSTART
REQUIRE ?exit_restore
?exit_save:
MOV A,R2
MOV R6,A
MOV A,R3
MOV R7,A
// -------------------------------------
// Segment part included if destructors must be called.
XRSEGCSTART
PUBLIC __cstart_call_dtors
EXTERN __call_dtors
REQUIRE ?exit_save
// This label is required by "__record_needed_destruction".
__cstart_call_dtors:
#if (__CODE_MODEL__ == __CM_BANKED__)
EXTERN ?BCALL
MOV DPL,#low(__call_dtors)
MOV DPH,#high(__call_dtors)
#ifdef __EXTENDED_DPTR__
MOV ?DPX,#0
#endif
MOV A,#BYTE3(__call_dtors)
LCALL ?BCALL
#else
LCALL __call_dtors
#endif
// -------------------------------------
// Segment part included if DLib standard IO is used.
XRSEGCSTART
PUBLIC __cstart_closeall
REQUIRE ?exit_save
// This label is required by DLib.
__cstart_closeall:
EXTERN _Close_all
#if (__CODE_MODEL__ == __CM_BANKED__)
EXTERN ?BCALL
MOV DPL,#low(_Close_all)
MOV DPH,#high(_Close_all)
#ifdef __EXTENDED_DPTR__
MOV ?DPX,#0
#endif
MOV A,#BYTE3(_Close_all)
LCALL ?BCALL
#else
LCALL _Close_all
#endif
// -------------------------------------
// Restore the argument previously stored by the "save" section above.
XRSEGCSTART
?exit_restore:
MOV A,R6
MOV R2,A
MOV A,R7
MOV R3,A
XRSEGCSTART
// Jump to __exit.
?exit_br_xxexit:
#if (__CODE_MODEL__ == __CM_BANKED__)
EXTERN ?BCALL
MOV DPL,#low(__exit)
MOV DPH,#high(__exit)
#ifdef __EXTENDED_DPTR__
MOV ?DPX,#0
#endif
MOV A,#BYTE3(__exit)
LCALL ?BCALL
#else
LJMP __exit // __exit will not return
#endif
ENDMOD
END
#else // __CLIB_BUILD__
//------------------------------------------------------------------------
//
// CLIB exit(int code)
//
//------------------------------------------------------------------------
MODULE ?cexit
PUBLIC exit
// PUBLIC ?C_EXIT
XRSEGCSTART
FUNCTION exit,0203H
exit:
// ?C_EXIT:
PUBLIC ?ROM_MONITOR_NOPS
?ROM_MONITOR_NOPS:
NOP ; Three NOPs for ROM-Monitor breaks.
NOP
NOP
SJMP exit
ENDMOD
END
#endif
?? 快捷鍵說明
復制代碼
Ctrl + C
搜索代碼
Ctrl + F
全屏模式
F11
切換主題
Ctrl + Shift + D
顯示快捷鍵
?
增大字號
Ctrl + =
減小字號
Ctrl + -