📄 cstartup_ads.s
字号:
;------------------------------------------------------------------------------
;- ATMEL Microcontroller Software Support - ROUSSET -
;------------------------------------------------------------------------------
; The software is delivered "AS IS" without warranty or condition of any
; kind, either express, implied or statutory. This includes without
; limitation any warranty or condition with respect to merchantability or
; fitness for any particular purpose, or against the infringements of
; intellectual property rights of others.
;-----------------------------------------------------------------------------
;- File source : cstartup_ads.s
;- Object : Generic CStartup
;- Compilation flag : None
;-
;- 1.0 27 Jan 03 FBr : Creation ARM ADS
;------------------------------------------------------------------------------
;[DUI0204E_rvct_assembler_guide.pdf Table 2-2 Condition code suffixes]
;+------+-------------------------+----------------------------------------+
;|Suffix|Flags | Meaning |
;+------+-------------------------+----------------------------------------+
;|EQ |Z set |Equal |
;+------+-------------------------+----------------------------------------+
;|NE |Z clear |Not equal |
;+------+-------------------------+----------------------------------------+
;|CS/HS |C set |Higher or same (unsigned >= ) |
;+------+-------------------------+----------------------------------------+
;|CC/LO |C clear |Lower (unsigned < ) |
;+------+-------------------------+----------------------------------------+
;|MI |N set |Negative |
;+------+-------------------------+----------------------------------------+
;|PL |N clear |Positive or zero |
;+------+-------------------------+----------------------------------------+
;|VS |V set |Overflow |
;+------+-------------------------+----------------------------------------+
;|VC |V clear |No overflow |
;+------+-------------------------+----------------------------------------+
;|HI |C set and Z clear |Higher (unsigned > ) |
;+------+-------------------------+----------------------------------------+
;|LS |C clear or Z set |Lower or same (unsigned <= ) |
;+------+-------------------------+----------------------------------------+
;|GE |N and V the same |Signed >= |
;+------+-------------------------+----------------------------------------+
;|LT |N and V differ |Signed < |
;+------+-------------------------+----------------------------------------+
;|GT |Z clear, N and V the same|Signed > |
;+------+-------------------------+----------------------------------------+
;|LE |Z set, N and V differ |Signed <= |
;+------+-------------------------+----------------------------------------+
;|AL |Any |Always. This suffix is normally omitted.|
;+------+-------------------------+----------------------------------------+
;[DUI0204E_rvct_assembler_guide.pdf Table 3-2 Built-in variables]
;+-----------------+--------------------------------------------------------------+
;|{ARCHITECTURE} | Holds the name of the selected ARM architecture. |
;+-----------------+--------------------------------------------------------------+
;|{AREANAME} | Holds the name of the current AREA. |
;+-----------------+--------------------------------------------------------------+
;|{ARMASM_VERSION} | Holds an integer that increases with each version. See also |
;| | Determining the armasm version at assembly time on page 3-18 |
;+-----------------+--------------------------------------------------------------+
;||ads$version| | Has the same value as {ARMASM_VERSION}, see above. |
;+-----------------+--------------------------------------------------------------+
;|{CODESIZE} | Is a synonym for {CONFIG}. |
;+-----------------+--------------------------------------------------------------+
;|{COMMANDLINE} | Holds the contents of the command line. |
;+-----------------+--------------------------------------------------------------+
;|{CONFIG} | Has the value 32 if the assembler is assembling ARM code, |
;| | or 16 if it is assembling Thumb code. |
;+-----------------+--------------------------------------------------------------+
;|{CPU} | Holds the name of the selected cpu. The default is ARM7TDMI. |
;| | If an architecture was specified in the command line --cpu |
;| | option, {CPU} holds the value "Generic ARM". |
;+-----------------+--------------------------------------------------------------+
;|{ENDIAN} | Has the value big if the assembler is in big-endian mode, or |
;| | little if it is in little-endian mode. |
;+-----------------+--------------------------------------------------------------+
;|{FPIC} | Has the value True if /fpic is set. The default is False. |
;+-----------------+--------------------------------------------------------------+
;|{FPU} | Holds the name of the selected fpu. The default is SoftVFP. |
;+-----------------+--------------------------------------------------------------+
;|{INPUTFILE} | Holds the name of the current source file. |
;+-----------------+--------------------------------------------------------------+
;|{INTER} | Has the value True if /inter is set. The default is False. |
;+-----------------+--------------------------------------------------------------+
;|{LINENUM} | Holds an integer indicating the line number in the current |
;| | source file. |
;+-----------------+--------------------------------------------------------------+
;|{NOSWST} | Has the value True if /noswst is set. The default is False. |
;+-----------------+--------------------------------------------------------------+
;|{OPT} | Value of the currently-set listing option. The OPT directive |
;| | can be used to save the current listing option, force a |
;| | change in it, or restore its original value. |
;+-----------------+--------------------------------------------------------------+
;|{PC} or . | Address of current instruction. |
;+-----------------+--------------------------------------------------------------+
;|{PCSTOREOFFSET} | Is the offset between the address of the STR pc,[...] or |
;| | STM Rb,{..., pc} instruction and the value of pc stored out. |
;| | This varies depending on the CPU or architecture specified. |
;+-----------------+--------------------------------------------------------------+
;|{ROPI} | Has the value True if /ropi is set. The default is False. |
;+-----------------+--------------------------------------------------------------+
;|{RWPI} | Has the value True if /rwpi is set. The default is False. |
;+-----------------+--------------------------------------------------------------+
;|{SWST} | Has the value True if /swst is set. The default is False. |
;+-----------------+--------------------------------------------------------------+
;|{VAR} or @ | Current value of the storage area location counter. |
;+-----------------+--------------------------------------------------------------+
;[DUI0204E_rvct_assembler_guide.pdf 3.3.1 Predeclared register names]
;The following register names are predeclared:
; r0-r15 and R0-R15
; a1-a4 (argument, result, or scratch registers, synonyms for r0 to r3)
; v1-v8 (variable registers, r4 to r11)
; sb and SB (static base, r9)
; sl and SL (stack limit, r10)
; fp and FP (frame pointer, r11)
; ip and IP (intra-procedure-call scratch register, r12)
; sp and SP (stack pointer, r13)
; lr and LR (link register, r14)
; pc and PC (program counter, r15).
INCLUDE AT91RM9200.inc
;--------------------------------
;- ARM Core Mode and Status Bits
;--------------------------------
ARM_MODE_USER EQU 0x10
ARM_MODE_FIQ EQU 0x11
ARM_MODE_IRQ EQU 0x12
ARM_MODE_SVC EQU 0x13
ARM_MODE_ABORT EQU 0x17
ARM_MODE_UNDEF EQU 0x1B
ARM_MODE_SYS EQU 0x1F
I_BIT EQU 0x80
F_BIT EQU 0x40
T_BIT EQU 0x20
;------------------------------------------------------------------------------
;- Stack Area Definition
;-----------------------
;-
;------------------------------------------------------------------------------
IRQ_STACK_SIZE EQU 0x10
FIQ_STACK_SIZE EQU 0x10
ABT_STACK_SIZE EQU 0x10
UND_STACK_SIZE EQU 0x10
SVC_STACK_SIZE EQU 0x10
USER_STACK_SIZE EQU 0x100
AREA |C$$stack|, DATA
;- IRQ stack definition
AT91_IRQ_Stack_End DCD 0x55AA55AA
SPACE (IRQ_STACK_SIZE - 4)
AT91_IRQ_Stack_Begin EQU (AT91_IRQ_Stack_End + (IRQ_STACK_SIZE - 4))
;- FIQ stack definition
AT91_FIQ_Stack_End DCD 0x55AA55AA
SPACE (FIQ_STACK_SIZE - 4)
AT91_FIQ_Stack_Begin EQU (AT91_FIQ_Stack_End + (FIQ_STACK_SIZE - 4))
;- ABORT stack definition
AT91_ABT_Stack_End DCD 0x55AA55AA
SPACE (ABT_STACK_SIZE - 4)
AT91_ABT_Stack_Begin EQU (AT91_ABT_Stack_End + (ABT_STACK_SIZE - 4))
;- UNDEF stack definition
AT91_UND_Stack_End DCD 0x55AA55AA
SPACE (UND_STACK_SIZE - 4)
AT91_UND_Stack_Begin EQU (AT91_UND_Stack_End + (UND_STACK_SIZE - 4))
;- SVC stack definition
AT91_SVC_Stack_End DCD 0x55AA55AA
SPACE (SVC_STACK_SIZE-4)
AT91_SVC_Stack_Begin EQU (AT91_SVC_Stack_End + (SVC_STACK_SIZE-4))
;- USER and SYSTEM stack definition
AT91_USER_Stack_End DCD 0x55AA55AA
SPACE (USER_STACK_SIZE-4)
AT91_USER_Stack_Begin EQU (AT91_USER_Stack_End + (USER_STACK_SIZE-4))
EXPORT AT91_IRQ_Stack_End
EXPORT AT91_IRQ_Stack_Begin
EXPORT AT91_FIQ_Stack_End
EXPORT AT91_FIQ_Stack_Begin
EXPORT AT91_ABT_Stack_End
EXPORT AT91_ABT_Stack_Begin
EXPORT AT91_UND_Stack_End
EXPORT AT91_UND_Stack_Begin
EXPORT AT91_SVC_Stack_End
EXPORT AT91_SVC_Stack_Begin
EXPORT AT91_USER_Stack_End
EXPORT AT91_USER_Stack_Begin
;------------------------------------------------------------------------------
;- Area Definition
;-----------------
;- Must be defined as function to put first in the code as it must be mapped
;- at offset 0 of the flash EBI_CSR0, ie. at address 0 before remap.
;------------------------------------------------------------------------------
AREA reset, CODE, READONLY
; IMPORT __use_no_semihosting_swi
;------------------------------------------------------------------------------
;- Define the entry point
;------------------------
EXPORT __ENTRY
__ENTRY
; *****************
; Exception Vectors
; *****************
; +------------------------------------------------------------+------------------------------------+--------------+------------+
; |复位 Reset | 特权模式(Supervisor,sve) | 0x00000000 | 0xffff0000 |
; |未定义指令 Undefined instructions | 未定义指令中止模式(Undefined,und) | 0x00000004 | 0xffff0004 |
; |软件中断 Software interrupt(SWI) | 特权模式(Supervisor,sve) | 0x00000008 | 0xffff0008 |
; |指令预取中止Prefetch Abort(instruction fetch memory abort) | 数据访问中止(Abort,abt) | 0x0000000c | 0xffff000c |
; |数据访问中止Data Abort(data access memory abort) | 数据访问中止(Abort,abt) | 0x00000010 | 0xffff0010 |
; |保留 | | 0x00000014 | 0xffff0014 |
; |外部中断请求IRQ(interrupt) | 外部中断模式(IRQ,irq) | 0x00000018 | 0xffff0018 |
; |快速中断请求FIQ(fast interrupt) | 快速中断模式(FIQ,fiq) | 0x0000001c | 0xffff001c |
; +------------------------------------------------------------+------------------------------------+--------------+------------+
;------------------------------------------------------------------------------
;- Exception vectors ( before Remap )
;------------------------------------
;- These vectors are read at address 0.
;- They absolutely requires to be in relative addresssing mode in order to
;- guarantee a valid jump. For the moment, all are just looping (what may be
;- dangerous in a final system). If an exception occurs before remap, this
;- would result in an infinite loop.
;------------------------------------------------------------------------------
B InitReset ; reset
undefvec
B undefvec ; Undefined Instruction
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -