📄 w_32.asm
字号:
;******************************************************************************
; TEXAS INSTRUMENTS INCORPORATED PROPRIETARY INFORMATION
;
; Property of Texas Instruments
; For Unrestricted Internal Use Only
; Unauthorized reproduction and/or distribution is strictly prohibited.
; This product is protected under copyright law and trade secret law
; as an unpublished work.
;
; Created 1999, (C) Copyright 1999 Texas Instruments. All rights reserved.
;
;
; Filename : w_32.asm
;
; Description : Test of memory access in 32 bits mode
; (write and read back 2 values )
;
; Project : ARM925ST
;
; Author : Francis Huguenin fhugueni@tif.ti.com
;
;*******************************************************************************
.state16 ; thumb mode
.ref edata ;defined by armas
.global $w_32
.ref etext
OK .equ 0x0001
BAD .equ 0x0002
NOT_TESTED .equ 0x0
THE_END .equ 0xffff ;That's the end of the test(s)
$w_32:
;
; - write 2 words (32 bits)
; - read them back
; - and check that the value is correct
;
; The 2 words are written to the address of the memory
; space given in argument.
;
; Input : R0 = address to test,
;
; Output : R0 = result (1 for OK, 2 for bad)
;
push {r4,lr}
;Load into R2 address of data to be written
ldr r2,data_addr ; R2 = data_addr
;; -------------------------------------------------------------------------
;; TEST WRITE 32 bits (at address contain in R0) --
;; -------------------------------------------------------------------------
ldr r4,[r2,#0] ;Load first word
str r4,[r0,#0] ;Store the first word into the address
ldr r4,[r2,#4] ;Load 2nd word
str r4,[r0,#4] ;Store it into address+1
bl read_back ;Unconditionally branch to 'read_back'
cmp r3,#OK ;Compare Result R3 to OK
bne its_bad ;IF Result Not OK THEN BRANCH to 'its_bad'
its_ok:
mov r0,#OK ;test is ok
b the_end ;Unconditionally branch to 'the_end'
its_bad:
mov r0,#BAD ;test is bad
the_end:
pop {r4,pc} ; Return to caller
end: b end ;infinite loop to terminate execution
loop: b loop ; loop to prevent bad execution of data
; read back the 2 written words
read_back:
ldr r4,[r2,#0] ;Load first word
ldr r3,[r0,#0] ;load the first written word
cmp r3,r4 ;compare
bne one_bad ;If NotEqual
ldr r4,[r2,#4] ;Load second word
ldr r3,[r0,#4] ;load the second written word
cmp r3,r4 ;compare
bne one_bad ;If NotEqual
;Branch to 'one_bad'
one_ok:
mov r3,#OK ;test is ok
b one_end ;Unconditionally branch to 'one_end'
one_bad:
mov r3,#BAD ;test is bad
one_end:
mov pc,lr
.align 4
; select 32 bit instructions assembling mode
.state32
;;**********************************************************************
;; V A R I A B L E S **
;;**********************************************************************
data_addr .word data
data .word 0AA55FF00h,055AA00FFh
.end ; Terminate assembly
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -