⭐ 欢迎来到虫虫下载站! | 📦 资源下载 📁 资源专辑 ℹ️ 关于我们
⭐ 虫虫下载站

📄 eb63_execute.s

📁 ARM入门的好帮手.包含了从简单到相对较复杂的程序.
💻 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          : eb63_execute.s
;- Object               : AT91M63200 Execution code to allow consumption 
;-						  measurement
;-
;- Exported Resources   : ExecuteTest
;- Imported Resources   : None
;-
;- 1.0 99/01/08 JLV   	: Creation
;- 1.1 00/00/00 JCZ   	: Clean up
;------------------------------------------------------------------------------

                AREA        TEST, CODE, READONLY, INTERWORK

;-------------------------- List of Included Files ---------------------------

                INCLUDE     periph/pio/pio.inc
                INCLUDE     targets/eb63/eb63.inc

;------------------------ List of constants and types ------------------------
; None

;------------------------ List of Imported resources -------------------------
; None

;------------------------ List of Internal resources -------------------------
; None

;------------------------ List of Exported resources -------------------------
;------------------------------------------------------------------------------
;- Function             : ExecuteTest
;- Treatments           :
;- Input Parameters     :
;-      r0 = address where to run the test function from
;-      r1 = 0 indicates to run the test in ARM, else in Thumb
;- Output Parameters    : None
;- Registers lost       : None
;- Called Functions     : None
;- Called Macros        : None
;------------------------------------------------------------------------------
            EXPORT      ExecuteTest
ExecuteTest
            stmdb       r13!, {r4, r14}
            mov         r4, r0

            movs        r2, r1
            ldreq       r2, =ExecuteArmTest
            ldrne       r2, =ExecuteThumbTest
            bic         r2, r2, #3

            ldr         r3, =Execute_end

CopyTest_loop
            ldr         r12, [r2], #4
            str         r12, [r0], #4
            cmp         r2, r3
            blo         CopyTest_loop

;- Test Arm or Thumb Call requested
            movs        r2, r1
            beq         ArmCall
;- Thumb Call
            add         r4, r4, #1
            mov         lr, pc
            bx          r4

;- Exit
            b           Exit

;- Arm Call
ArmCall
            mov         lr, pc
            mov         pc, r4

;- Exit
Exit
            ldr         r0, PtPIOBBase
            mov         r1, #BP_S1
            mov         r3, #0

;- Wait push buuton released
ExitLoop
            ldr         r2, [r0, #PIO_PDSR]
            ands        r2, r2, r1
            bne         Exit
            add         r3, r3, #1
            cmp         r3, #0x1000
            blo         ExitLoop

            ldmia       r13!, {r4, r14}
            bx          r14

;------------------------------------------------------------------------------
;- Function             : ExecuteArmTest
;- Treatments           : AT91 Thumb execution function
;------------------------------------------------------------------------------

            EXPORT      ExecuteArmTest
ExecuteArmTest
            ldr         r0, PtPIOBBase
            ldr         r2, [r0, #PIO_PDSR]

            mov         r1, #BP_S1
            ands        r3, r2, r1
            beq         EndArmExecute

            b           ExecuteArmTest

EndArmExecute
            bx          lr

;------------------------------------------------------------------------------
;- Function             : ExecuteThumbTest
;- Treatments           : AT91 Thumb execution function
;------------------------------------------------------------------------------
            CODE16
            EXPORT      ExecuteThumbTest

ExecuteThumbTest
            ldr         r0, PtPIOBBase
            ldr         r2, [r0, #PIO_PDSR]
            mov         r3, r2

            ldr         r1, MaskS1
            and         r2, r1
            beq         EndThumbExecute

            b           ExecuteThumbTest

EndThumbExecute
            bx      lr

            CODE32
            ALIGN
PtPIOBBase
            DCD     PIOB_BASE
MaskS1
            DCD     BP_S1

Execute_end

            END

⌨️ 快捷键说明

复制代码 Ctrl + C
搜索代码 Ctrl + F
全屏模式 F11
切换主题 Ctrl + Shift + D
显示快捷键 ?
增大字号 Ctrl + =
减小字号 Ctrl + -