Не знаю как в последних иарах, а раньше всегда был cstartup.s90
Долой империалистический интернационал!
;----------------------------------------------------------------------------
;
; This module contains the AVR C and EC++ startup
; routine and must usually be tailored to suit
; customer's hardware.
;
; File version: $Revision: 1.8 $
;
;----------------------------------------------------------------------------
#include "macros.m90"
;----------------------------------------------------------------------------
; Set up the INTVEC segment with a reset vector
;----------------------------------------------------------------------------
NAME ?RESET
COMMON INTVEC:CODE:ROOT(1) ; Align at an even address
EXTERN ?C_STARTUP
ORG $0
XJMP ?C_STARTUP
ENDMOD
;----------------------------------------------------------------------------
; Forward declarations of segments used in initialization
;----------------------------------------------------------------------------
RSEG CSTACK:DATA:NOROOT(0)
RSEG RSTACK:DATA:NOROOT(0)
;----------------------------------------------------------------------------
; Perform C initialization
;----------------------------------------------------------------------------
MODULE ?C_STARTUP
EXTERN __low_level_init
EXTERN __segment_init
#ifdef _ECLIB
EXTERN __call_ctors
#endif /* _ECLIB */
EXTERN main
EXTERN exit
EXTERN _exit
;----------------------------------------------------------------------------
; If the return address stack is located in external SRAM, make sure that
; you have uncommented the correct code in __low_level_init!!!
;----------------------------------------------------------------------------
RSEG CODE:CODE:NOROOT(1)
PUBLIC ?C_STARTUP
PUBLIC __RESTART
__RESTART:
?C_STARTUP:
REQUIRE ?SETUP_STACK
RSEG CODE:CODE:NOROOT(1)
PUBLIC __RSTACK_in_external_ram
__RSTACK_in_external_ram:
LDI R16,0xC0
OUT 0x35,R16 ;Enable the external SRAM with a wait state
;----------------------------------------------------------------------------
; Set up the CSTACK and RSTACK pointers.
;----------------------------------------------------------------------------
RSEG CODE:CODE:NOROOT(1)
?SETUP_STACK:
;; Return address stack (RSTACK)
LDI R16,LOW(SFE(RSTACK)-1)
OUT 0x3D,R16
#if A90_POINTER_REG_SIZE > 1
LDI R16,HIGH(SFE(RSTACK)-1)
OUT 0x3E,R16
#endif
;; Data stack (CSTACK)
LDI Y0,LOW(SFE(CSTACK))
#if A90_POINTER_REG_SIZE > 1
#if MEMORY_MODEL == TINY_MEMORY_MODEL
LDI Y1,0
#else
LDI Y1,HIGH(SFE(CSTACK))
#endif
#if A90_POINTER_REG_SIZE > 2
LDI Z0,HWRD(SFB(CSTACK))
OUT RAMPY,Z0
#endif
#endif
#if A90_POINTER_REG_SIZE > 2
PUBLIC ?zero_reg_initialization
?zero_reg_initialization:
CLR R15
OUT RAMPD,R15
#else
REQUIRE ?call_low_level_init
;----------------------------------------------------------------------------
; Clear R15 so that it can be used as zero register by the code generator.
; The compiler will emit a "REQUIRE ?zero_reg_initialization" statement if
; this optimization has been enabled.
;----------------------------------------------------------------------------
RSEG CODE:CODE:NOROOT(1)
PUBLIC ?zero_reg_initialization
?zero_reg_initialization:
CLR R15
;----------------------------------------------------------------------------
; Call __low_level_init to do low level initializatons. Modify the supplied
; __low_level_init module to add your own initialization code or to
; remove segment initialization (by returning 0).
;----------------------------------------------------------------------------
RSEG CODE:CODE:NOROOT(1)
#endif
PUBLIC ?call_low_level_init
?call_low_level_init:
XCALL __low_level_init
REQUIRE ?cstartup_call_main
;----------------------------------------------------------------------------
; Call __segment_init to initialize segments.
;----------------------------------------------------------------------------
RSEG CODE:CODE:NOROOT(1)
PUBLIC ?need_segment_init
?need_segment_init:
TST P0
BREQ ?skip_segment_init
XCALL __segment_init
?skip_segment_init:
;----------------------------------------------------------------------------
; Call the constructors of all global objects. This code will only
; be used if any EC++ modules defines global objects that need to
; have its constructor called before main.
;----------------------------------------------------------------------------
#ifdef _ECLIB
RSEG DIFUNCT:CODE:NOROOT(0)
RSEG CODE:CODE:NOROOT(1)
PUBLIC ?call_ctors
?call_ctors:
#ifdef __HAS_ELPM__
LDI P0,LOW(SFB(DIFUNCT))
LDI P1,LOW(SFB(DIFUNCT) >> 8)
LDI P2,SFB(DIFUNCT) >> 16
LDI Q0,LOW(SFE(DIFUNCT))
LDI Q1,LOW(SFE(DIFUNCT) >> 8)
LDI Q2,SFE(DIFUNCT) >> 16
#else
LDI P0,LOW(SFB(DIFUNCT))
LDI P1,SFB(DIFUNCT) >> 8
LDI P2,LOW(SFE(DIFUNCT))
LDI P3,SFE(DIFUNCT) >> 8
#endif
XCALL __call_ctors
#endif /* _ECLIB */
;----------------------------------------------------------------------------
; Call main
;----------------------------------------------------------------------------
RSEG CODE:CODE:NOROOT(1)
PUBLIC ?cstartup_call_main
?cstartup_call_main:
XCALL main
XCALL exit
XJMP _exit
END
;----------------------------------------------------------------------------
; $Log: cstartup.s90 $
; Revision 1.8 2003/11/07 16:34:04Z IPEO
; Revision 1.7 2003/09/04 13:48:25Z IPEO
; Revision 1.6 2003/08/22 14:09:09Z IPEO
; Revision 1.5 2003/08/22 08:54:09Z IPEO
; Revision 1.4 2003/08/20 08:38:55Z IPEO
-
- А эти N можно самому прописать в .xcl файле какие нравятся. - Codavr(25.01.2012 13:45)