📄 start.s
字号:
########################################################################
# #
# Copyright (c) 2000 by National Semiconductor Corporation. #
# All rights reserved. #
# #
# Start.s, #
# start routine for CR16B programs, to be used with Tmonlib #
# comment out svc108 call for "load-and-go" mode #
# #
########################################################################
.text
.align 2
.globl _c_reset
.code_label _c_reset
#----------------------------------------------------------------------
# Set bit 0 of MCFG (0xff10) and MCFGSH (0xfbfe) - enables the use of
# BIU I/O Zone (SELIO) for the interface with off-chip logic.
#---------------------------------------------------------------------- #
start::
#ifdef SEV_SEG
loadb 0x069F:m,r0
storb r0,0xF986:m
loadb 0xff10:m,r0
orb $0x1,r0
storb r0,0xff10:m
storb r0,0xfbfe:m
#endif
#----------------------------------------------------------------------
# Initialize the stacks pointers. The constants __STACK_START,
# __ISTACK_START and __STATIC_BASE_START should be defined in the
# linker definition file. __STATIC_BASE_START is needed only when
# using 'sbrel' optimization.
#----------------------------------------------------------------------
movw $0, r0
lpr r0, psr
movw $__ISTACK_START, r0
lpr r0, isp
movw $__STACK_START, sp
movw $__STATIC_BASE_START, r13
#----------------------------------------------------------------------
# Initialize sections according to the linker init table. You can
# choose different functions to initialize a different set of sections.
# The functions available in this library are:
# 1. init_bss()
# 2. init_data()
# 3. init_bss_data()
# 4. init_bss_data_code()
#----------------------------------------------------------------------
bal ra, _init_bss_data
#----------------------------------------------------------------------
# Calling Tmonlib initalization routine TmonLibStart with the pointer
# to the dispatch_table. Tmonlib sets the entries for the debug handlers.
#----------------------------------------------------------------------
#ifdef SEV_SEG
storw $0x3,0xFE52
#endif
movw $__dispatch_table, r1 # Initialize intbase.
#ifdef TMON
movw $0x101, r0
excp svc
#endif
lpr r1,intbase
#ifdef DEBUG
bal ra,_TmonLibStart
#endif
#----------------------------------------------------------------------
# Svc108 is the entery point for TmonLib main-loop. It should be
# commented out for "load-and-go" operation mode.
#----------------------------------------------------------------------
#ifdef SEV_SEG
storw $0x3,0xFE52
#endif
#ifdef DEBUG
movw $0x108, r0
excp svc
#endif
#ifdef SEV_SEG
storw $0x7,0xFE52
#endif
#----------------------------------------------------------------------
# Jump to the "c_reset" apllication.
#----------------------------------------------------------------------
__start::
bal ra, _c_reset # C program entry point.
#----------------------------------------------------------------------
# When returnig from the c_reset function (if it wasn't an infinit loop)
# jump to the exit function to exit. The exit function is located in
# "libc".
#----------------------------------------------------------------------
movw r0, r2 # c_reset's return value is a parameter for exit.
#----------------------------------------------------------------------
# Define the eop (End Of Program) function. This function will be
# called by the exit function. It will return control to the debugger.
#----------------------------------------------------------------------
__eop::
movw $0x410, r0
excp svc
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -