Arm Community
Site
Search
User
Site
Search
User
Groups
Arm Research
DesignStart
Education Hub
Graphics and Gaming
High Performance Computing
Innovation
Multimedia
Open Source Software and Platforms
Physical
Processors
Security
System
Software Tools
TrustZone for Armv8-M
中文社区
Blog
Announcements
Artificial Intelligence
Automotive
Healthcare
HPC
Infrastructure
Innovation
Internet of Things
Machine Learning
Mobile
Smart Homes
Wearables
Forums
All developer forums
IP Product forums
Tool & Software forums
Support
Open a support case
Documentation
Downloads
Training
Arm Approved program
Arm Design Reviews
Community Help
More
Cancel
Developer Community
Tools and Software
Software Tools
Jump...
Cancel
Software Tools
Arm Development Studio forum
ARM assembler register read
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
Replies
5 replies
Subscribers
126 subscribers
Views
4104 views
Users
0 members are here
Related
ARM assembler register read
Offline
Dennis Gabler
over 7 years ago
Note: This was originally posted on 11th September 2010 at http://forums.arm.com
Hello All,
I need a quick example of how to place a value from a hardware register (0x70001234 for example) into a register such as R0
then compare it to a constant such as 0xE0680003 and do a branch based on equality.
So far I have had no luck getting something this simple to work.
Thanks,
Dennis
Parents
Offline
MARIO VISPERAS
over 7 years ago
Note: This was originally posted on 11th September 2010 at
http://forums.arm.com
[font="Courier New"]load_compare_RAM
; ldr r0, = 0xE0680003 ; constant to be compared with
ldr r0, [pc, #0x14] ; get the constant at [pc + 20d] = 0xE0680003
; ldr r1, = 0x70001234 ; RAM addr
ldr r1, [pc, #0x14] ; get the constant at [pc + 20d] = 0x70001234. This is the RAM addr
ldr r2, [r1, #0] ; offsset = 0. Read RAM
CMP r0, r2 ;
BEQ eq_cmp ; jump to next block if Z
neq_cmp
B next_block1
eq_cmp
B next_block2
DCD 0xE0680003 ; DCD = .word
DCD 0x70001234 ; DCD = .word
next_block1
; next block1 of codes here
next_block2
; next block2 of codes here[/font]
; #############################
; the 2 commented lines are the pseudo instructions. If you enable them, you do not
; need the line below each of them. In this case, you would also not need the 2 DCD lines.
;
; The active codes above are a manual way of creating a literal pool (of constants). If you use
; the pseudo-instr, you let the assembler do all the work for you.
;
; This web page removes all my nice spaces in the assembly codes and compresses them.
Cancel
Up
0
Down
Reply
Cancel
Reply
Offline
MARIO VISPERAS
over 7 years ago
Note: This was originally posted on 11th September 2010 at
http://forums.arm.com
[font="Courier New"]load_compare_RAM
; ldr r0, = 0xE0680003 ; constant to be compared with
ldr r0, [pc, #0x14] ; get the constant at [pc + 20d] = 0xE0680003
; ldr r1, = 0x70001234 ; RAM addr
ldr r1, [pc, #0x14] ; get the constant at [pc + 20d] = 0x70001234. This is the RAM addr
ldr r2, [r1, #0] ; offsset = 0. Read RAM
CMP r0, r2 ;
BEQ eq_cmp ; jump to next block if Z
neq_cmp
B next_block1
eq_cmp
B next_block2
DCD 0xE0680003 ; DCD = .word
DCD 0x70001234 ; DCD = .word
next_block1
; next block1 of codes here
next_block2
; next block2 of codes here[/font]
; #############################
; the 2 commented lines are the pseudo instructions. If you enable them, you do not
; need the line below each of them. In this case, you would also not need the 2 DCD lines.
;
; The active codes above are a manual way of creating a literal pool (of constants). If you use
; the pseudo-instr, you let the assembler do all the work for you.
;
; This web page removes all my nice spaces in the assembly codes and compresses them.
Cancel
Up
0
Down
Reply
Cancel
Children
No data
More questions in this forum
By title
By date
By reply count
By view count
By most asked
By votes
By quality
Descending
Ascending
All recent questions
Unread questions
Questions you've participated in
Questions you've asked
Unanswered questions
Answered questions
Questions with suggested answers
Questions with no replies
Answered
Problem with arm_cmplx_mag_f32()
+1
2359
views
2
replies
Latest
1 month ago
by
Vishal_Patel
Answered
Can anyone please help me on how evalution development studio 2020.1 work s and which compiler is needed and how it can be setup?
+1
2147
views
3
replies
Latest
1 month ago
by
Ronan Synnott
Answered
Can anyone tell me the difference between DSTREAM and DSTREAM-ST?
+1
2320
views
2
replies
Latest
1 month ago
by
Xiang
Not Answered
Would you be interested in a VScode extension to handle ARM toolchain?
0
2028
views
0
replies
Started
1 month ago
by
vix
Answered
How to view SFRs in DS during debugging?
+1
2717
views
1
reply
Latest
2 months ago
by
Ronan Synnott
<
>
View all questions in Arm Development Studio forum