📄 lib_mem_a.lst
字号:
ARM Macro Assembler Page 1
1 00000000 ;*******************************************************
*************************************************
2 00000000 ; uC/LIB
3 00000000 ; CUSTOM LIBRARY M
ODULES
4 00000000 ;
5 00000000 ; (c) Copyright 2004-2008; Micr
ium, Inc.; Weston, FL
6 00000000 ;
7 00000000 ; All rights reserved. Protected by inter
national copyright laws.
8 00000000 ;
9 00000000 ; uC/LIB is provided in source form for FR
EE evaluation, for educational
10 00000000 ; use or peaceful research. If you plan o
n using uC/LIB in a commercial
11 00000000 ; product you need to contact Micrium to p
roperly license its use in your
12 00000000 ; product. We provide ALL the source code
for your convenience and to
13 00000000 ; help you experience uC/LIB. The fact th
at the source code is provided
14 00000000 ; does NOT mean that you can use it withou
t paying a licensing fee.
15 00000000 ;
16 00000000 ; Knowledge of the source code may NOT be
used to develop a similar product.
17 00000000 ;
18 00000000 ; Please help us continue to provide the E
mbedded community with the finest
19 00000000 ; software available. Your honesty is gre
atly appreciated.
20 00000000 ;*******************************************************
*************************************************
21 00000000
22 00000000
23 00000000 ;*******************************************************
*************************************************
24 00000000 ;
25 00000000 ; STANDARD MEMORY OP
ERATIONS
26 00000000 ;
27 00000000 ; ARM-Cortex-M
3
28 00000000 ; RealView Developme
nt Suite
29 00000000 ; RealView Microcontroller De
velopment Kit (MDK)
30 00000000 ; ARM Developer Sui
te (ADS)
31 00000000 ; Keil uVision
32 00000000 ;
33 00000000 ; Filename : lib_mem_a.asm
34 00000000 ; Version : V1.25
35 00000000 ; Programmer(s) : JDH
36 00000000 ; BAN
37 00000000 ;*******************************************************
*************************************************
ARM Macro Assembler Page 2
38 00000000 ; Note(s) : (1) NO compiler-supplied standard libr
ary functions are used in library or product software.
39 00000000 ;
40 00000000 ; (a) ALL standard library functions
are implemented in the custom library modules :
41 00000000 ;
42 00000000 ; (1) \<Custom Library Directory
>\lib*.*
43 00000000 ;
44 00000000 ; (2) \<Custom Library Directory
>\Ports\<cpu>\<compiler>\lib*_a.*
45 00000000 ;
46 00000000 ; where
47 00000000 ; <Custom Library
Directory> directory path for custom library softwa
re
48 00000000 ; <cpu>
directory name for specific processor (C
PU)
49 00000000 ; <compiler>
directory name for specific compiler
50 00000000 ;
51 00000000 ; (b) Product-specific library funct
ions are implemented in individual products.
52 00000000 ;
53 00000000 ; (2) Assumes ARM CPU mode configured fo
r Little Endian.
54 00000000 ;*******************************************************
*************************************************
55 00000000
56 00000000
57 00000000 ;*******************************************************
*************************************************
58 00000000 ; PUBLIC FUNCT
IONS
59 00000000 ;*******************************************************
*************************************************
60 00000000
61 00000000 EXPORT Mem_Copy
62 00000000
63 00000000
64 00000000 ;*******************************************************
*************************************************
65 00000000 ; CODE GENERATION D
IRECTIVES
66 00000000 ;*******************************************************
*************************************************
67 00000000
68 00000000 AREA |.text|, CODE, READONLY, ALIGN=
2
69 00000000 THUMB
70 00000000 REQUIRE8
71 00000000 PRESERVE8
72 00000000
73 00000000
74 00000000 ;$PAGE
75 00000000 ;*******************************************************
*************************************************
76 00000000 ; Mem_Copy()
ARM Macro Assembler Page 3
77 00000000 ;
78 00000000 ; Description : Copy data octets from one buffer to anot
her buffer.
79 00000000 ;
80 00000000 ; Argument(s) : pdest Pointer to destination memor
y buffer.
81 00000000 ;
82 00000000 ; psrc Pointer to source memor
y buffer.
83 00000000 ;
84 00000000 ; size Number of data buffer octets
to copy.
85 00000000 ;
86 00000000 ; Return(s) : none.
87 00000000 ;
88 00000000 ; Caller(s) : Application.
89 00000000 ;
90 00000000 ; Note(s) : (1) Null copies allowed (i.e. 0-octet si
ze).
91 00000000 ;
92 00000000 ; (2) Memory buffers NOT checked for overl
apping.
93 00000000 ;
94 00000000 ; (3) Modulo arithmetic is used to determi
ne whether a memory buffer starts on a 'CPU_ALIGN'
95 00000000 ; address boundary.
96 00000000 ;
97 00000000 ; (4) ARM Cortex-M3 processors use a subse
t of the ARM Thumb-2 instruction set which does
98 00000000 ; NOT support 16-bit conditional branc
h instructions but ONLY supports 8-bit conditional
99 00000000 ; branch instructions.
100 00000000 ;
101 00000000 ; Therefore, branches exceeding 8-bit,
signed, relative offsets :
102 00000000 ;
103 00000000 ; (a) CANNOT be implemented with c
onditional branches; but ...
104 00000000 ; (b) MUST be implemented with non-c
onditional branches.
105 00000000 ;*******************************************************
*************************************************
106 00000000
107 00000000 ; void Mem_Copy (void *pdest, ; ==> R0
108 00000000 ; void *psrc, ; ==> R1
109 00000000 ; CPU_SIZE_T size) ; ==> R2
110 00000000
111 00000000 Mem_Copy
112 00000000 2800 CMP R0, #0
113 00000002 D100 BNE Mem_Copy_1
114 00000004 4770 BX LR ; return if pdest =
= NULL
115 00000006
116 00000006 Mem_Copy_1
117 00000006 2900 CMP R1, #0
118 00000008 D100 BNE Mem_Copy_2
119 0000000A 4770 BX LR ; return if psrc =
= NULL
ARM Macro Assembler Page 4
120 0000000C
121 0000000C Mem_Copy_2
122 0000000C 2A00 CMP R2, #0
123 0000000E D100 BNE Mem_Copy_3
124 00000010 4770 BX LR ; return if size =
= 0
125 00000012
126 00000012 Mem_Copy_3
127 00000012 E92D 1FF8 STMFD SP!, {R3-R12} ; save registers
on stack
128 00000016
129 00000016
130 00000016 ;$PAGE
131 00000016 Chk_Align_32 ; check if both des
t & src 32-bit alig
ned
132 00000016 F000 0303 AND R3, R0, #0x03
133 0000001A F001 0403 AND R4, R1, #0x03
134 0000001E 42A3 CMP R3, R4
135 00000020 D111 BNE Chk_Align_16 ; not 32-bit align
ed, check for 16-bi
t alignment
136 00000022
137 00000022 F1C3 0304 RSB R3, R3, #0x04 ; compute 1-2-3 p
re-copy bytes (to a
lign to the next 32
-bit boundary)
138 00000026 F003 0303 AND R3, R3, #0x03
139 0000002A
140 0000002A Pre_Copy_1
141 0000002A 2B01 CMP R3, #1 ; copy 1-2-3 bytes
(to align to the ne
xt 32-bit boundary)
142 0000002C D31D BCC Copy_32_1 ; start real 32-bit
copy
143 0000002E 2A01 CMP R2, #1 ; check if any more
data to copy
144 00000030 D200 BCS Pre_Copy_1_Cont
145 00000032 E0F2 B Mem_Copy_END ; no mor
e data to copy (see
Note #4b)
146 00000034
147 00000034 Pre_Copy_1_Cont
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -