📄 start.asm
字号:
;====================================================================
; THIS SAMPLE CODE IS PROVIDED AS IS AND IS SUBJECT TO ALTERATIONS.
; FUJITSU MICROELECTRONICS ACCEPTS NO RESPONSIBILITY OR LIABILITY
; FOR ANY ERRORS OR ELIGIBILITY FOR ANY PURPOSES.
;
; Startup file for memory and basic controller initialisation
;
; MB90500/MB90300/MB90400/MB90800/MB90600 Series C Compiler,
; (compatible but untested for MB90700/MB90700H/MB90200)
;
; (C) FUJITSU MICROELECTRONICS EUROPE 1998-2003
;====================================================================
.PROGRAM STARTUP
.TITLE "STARTUP FILE FOR MEMORY INITIALISATION"
;====================================================================
; 1 Contents
;====================================================================
; 1 Contents
; 2 Disclaimer
; 3 History
;
; 4 SETTINGS (USER INTERFACE)
; 4.1 Controller Family
; 4.2 Memory model
; 4.3 Constant Data Handling
; 4.4 Stack Type and Stack Size
; 4.5 General Register Bank
; 4.6 Low-Level Library Interface
; 4.7 Clock Selection
; 4.8 External Bus Interface
; 4.9 Reset Vector
; 4.10 Enable RAMCODE Copying
;
; 5 Section and Data Declaration
; 5.1 Several fixed addresses (fixed for MB90xxx controllers)
; 5.2 Declaration of __near addressed data sections
; 5.3 Declaration of RAMCODE section and labels
; 5.4 Declaration of sections containing other sections description
; 5.5 Stack area and stack top definition
; 5.6 Direct page register dummy label definition
;
; 6 Start-Up Code
; 6.1 Import external symbols
; 6.2 "NOT RESET YET" WARNING
; 6.3 Program start (the reset vector should point here)
; 6.4 Set clock ratio
; 6.5 Set external bus configuaration
; 6.6 Copy initial values to data areas.
; 6.7 Clear uninitialised data areas to zero
; 6.8 Prepare stacks and set the active stack type
; 6.9 Set Data Bank Register (DTB) and Direct Page Register (DPR)
; 6.10 Wait for PLL to stabilise
; 6.11 Initialise Low-Level Library Interface
; 6.12 Call C-language main function
; 6.13 Shut down library
; 6.14 Program end loop
; 6.15 Debug address specification
;
;====================================================================
; 2 Disclaimer
;====================================================================
; FUJITSU MICROELECTRONICS EUROPE GMBH
; Am Siebenstein 6-10, 63303 Dreieich
; Tel.:++49 6103 690-0, Fax -122
;
; The following software is for demonstration purposes only.
; It is not fully tested, nor validated in order to fulfil
; its task under all circumstances. Therefore, this software
; or any part of it must only be used in an evaluation
; laboratory environment.
; This software is subject to the rules of our standard
; DISCLAIMER, that is delivered with our SW-tools on the CD
; "Microcontrollers - Documentation & Software" (V3.4) or
; see our Internet Page -
; http://www.fme.fujitsu.com/products/micro/disclaimer.html
;
;====================================================================
; 3 History
;====================================================================
;
; Version 1.00 25 Aug 98 HLo
; - original version
; Version 1.01 31 Aug 98 HLo
; - bug: conditional for reset vector was missing
; Version 1.02 16 Oct 98 HLo
; - memory model AUTO introduced (use far calls only and repair
; stack, if necessary
; - colons removed from EQU labels
; - stream_init call added
; - RAMCONST set as default (also for ROMCONST systems)
; Version 1.03 19 Oct 98 HLo
; - bug: SEGCOPY macro: used size changed from sizeof(src) to
; sizeof(dest). It was conflicting with RAMCONST, if compiler
; is set to ROMCONST.
; Version 1.04 21 Oct 98 HLo
; - ROM mirror option added
; - _exit call added
; - bug: EQU ON/OFF move to upper lines
; Version 1.05 28 Oct 98 HLo
; - CALL/CALLP _exit was not differed
; Version 1.06 18 Feb 99 HLo
; - default external bus configuration: WR signal enabled
; - ROMMIRROR macro processing simplified (less warnings>
; Version 1.07 01 April 99 HLo
; - Version string had wrong number (1.05 instead of 1.06)
; - Copyright slightly changed
; Version 1.08 16 April 99 JRo
; - Version placed in separate section (caused problems with fixed
; reset vector)
; Version 1.09 12 May 99 HLo
; - MB90400 family added
; - several coments changed
; - INTROM_EXTBUS macro was wrong
; - BUSWIDTH macro removed, now resolved from bus signal
; - disclaimer added
; - disabling interrupts added
; Version 1.10 17 May 99 HLo
; - change in 1.09 (MODEBYTE) related to BUSWIDTH was not complete
; Version 1.11 1 June 99 HLo
; - confusing old line with comment removed, was refering to unused
; old BUSWIDTH
; Version 1.12 23 June 99 HLo
; - CLIBINIT is using ON/OFF instead of extra macro now
; Version 2.00 23 July 99 HLo
; - decriptors of __near sections now in DCLEAR/DTRANS
; - code for __near section init removed, now initialised by DCLEAR
; and DTRANS processing
; - RAMCODE option added
; - table of contents added
; - memory model AUTO renamed to AUTOMODEL
; - CONSTDATA mode AUTOCONST introduced to make it clearer
; Version 2.01 11 Oct 99 HLo
; - unused macros WIDTH_8 and WIDTH_16 removed
; Branch 2.02b 16 Nov 99 MSt
; - insert wait loop to check if PLL has stopped
; Version 2.02 20 Aug 2001 NPo
; - MB90300 family added
; Version 2.03 06 Feb 2002 HLo
; - company name/link updated
; - CONST2/CINIT2 section added to support split CONST area
; Version 3.00 30 Jan 2003 HLo
; - branch 2.02b merged to 3.00: added NOP after clock disable
; - new: additional PLL factors for MB90340/350/480
; - new: option to preset stack with pattern
; - new: symbols to access stack in C
; - new: option to skip reservation of stack area
; - new: LX-family MB90800 added
;
;====================================================================
.SECTION VERSIONS, CONST
.SDATA "Start 3.00\n" ; comment this line to remove
;====================================================================
; 4 Settings
;====================================================================
;
; CHECK ALL OPTIONS WHETHER THEY FIT TO THE APPLICATION;
;
; Configure this startup file in the "Settings" section. Search for
; comments with leading "; <<<". This points to the items to be set.
;====================================================================
#set OFF 0
#set ON 1
;====================================================================
; 4.1 Controller Family
;====================================================================
#set MB90700 0 ; FFMC-16
#set MB90200 1 ; FFMC-16F
#set MB90600 2 ; FFMC-16L
#set MB90500 3 ; FFMC-16LX
#set MB90400 4 ; FFMC-16LX
#set MB90300 5 ; FFMC-16LX
#set MB90800 6 ; FFMC-16LX
#set FAMILY MB90300 ; <<< select family
; NOTE: This startup file is not suitable for MB90610 series. Use
; start610.asm instead.
;====================================================================
; 4.2 Memory model
;====================================================================
; data code
#set SMALL 0 ; 16 Bit 16 Bit
#set MEDIUM 1 ; 16 Bit 24 Bit
#set COMPACT 2 ; 24 Bit 16 Bit
#set LARGE 3 ; 24 Bit 24 Bit
#set AUTOMODEL 4 ; works always, might waste 2 bytes
#set MEMMODEL AUTOMODEL ; <<< C-memory model
; The selected memory model should be set in order to fit to the
; model selected for the compiler.
; Note, in this startup version AUTOMODEL will work for all
; C-models. However, if the compiler is configured for SMALL or
; COMPACT, two bytes on stack will be lost. If this is not
; acceptable, the above setting should be set to the correct model.
;====================================================================
; 4.3 Constant Data Handling
;====================================================================
#set ROMCONST 0 ; works only with compiler ROMCONST
#set RAMCONST 1 ; works with BOTH compiler settings
#set AUTOCONST RAMCONST ; works with BOTH compiler settings
#set CONSTDATA AUTOCONST ; <<< set RAM/ROM/AUTOCONST
; - AUTOCONST (default) is a the same as RAMCONST
; - RAMCONST/AUTOCONST should always work, even if compiler is set to
; ROMCONST. If compiler is set to ROMCONST and this startup file is
; set to RAMCONST or AUTOCONST, this startup file will only generate
; an empty section CINIT. The code, which copies from CONST to CINIT
; will not have any effect then.
; - It is highly recommended to set the compiler to ROMCONST for
; single-chip mode or internal ROM+ext bus. The start-up file
; should be set to AUTOCONST.
; - ROMCONST setting on systems with full external bus requires exter-
; nal address mapping.
; Single-chip can be emulated by the emulator debugger.
; ROM mirror can also be used with simulator.
;
; see also MIRROR options of external bus settings
;====================================================================
; 4.4 Stack Type and Stack Size
;====================================================================
#set USRSTACK 0 ; user stack: for main program
#set SYSSTACK 1 ; system stack: for main progrm and interrupts
#set STACKUSE SYSSTACK ; <<< set active stack
#set STACK_RESERVE ON ; <<< reserve stack area in this module
#set STACK_SYS_SIZE 768 ; <<< byte size of System stack
#set STACK_USR_SIZE 2 ; <<< byte size of User stack
#set STACK_FILL OFF ; <<< fills the stack area with pattern
#set STACK_PATTERN 0x55AA ; <<< the pattern to write to stack
; - If the active stack is set to SYSSTACK, it is used for main program
; and interrupts. In this case, the user stack could be set to a dummy
; size.
; If the active stack is set to user stack, it is used for the main
; program but the system stack s automatically activated, if an inter-
; rupt is serviced. Both stack areas must have a reasonable size.
; - If STACK_RESERVE is ON, the sections USTACK and SSTACK are reserved
; in this module. Otherwise, they have to be reserved in other modules.
; If STACK_RESERVE is OFF, the size definitions STACK_SYS_SIZE and
; STACK_USR_SIZE have no meaning.
; - Even if they are reverved in other modules, they are still initialised
; in this start-up file.
; - Filling the stack with pattern allows to dynamically check the stack
; area, which had already been used.
;
; - If only system stack is used and SSB is linked to a different bank
; than USB, make sure that all C-modules (which generate far pointers
; to stack data) have "#pragma SSB". Applies only to exclusive confi-
; gurations.
; - Note, several library functions require quite a big stack (due to
; ANSI). Check the stack information files (*.stk) in the LIB\907
; directory.
;====================================================================
; 4.5 General Register Bank
;====================================================================
#set REGBANK 0 ; <<< set default register bank
; set the General Register Bank that is to be used after startup.
; Usually, this is bank 0, which applies to address H'180..H'18F. Set
; in the range from 0 to 31.
; Note: All used register banks have to be reserved (linker options).
#if REGBANK > 31 || REGBANK < 0
# error REGBANK setting out of range
#endif
;====================================================================
; 4.6 Low-Level Library Interface
;====================================================================
#set CLIBINIT OFF ; <<< select extended libray usage
; This option has only to be set, if stream-IO/standard-IO function of
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -