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
Pelion IoT Platform
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 Vs GCC assembler
Tools, Software and IDEs blog
Forums
Videos & Files
Help
Jump...
Cancel
New
Replies
13 replies
Subscribers
127 subscribers
Views
6612 views
Users
0 members are here
Related
ARM Vs GCC assembler
Offline
Gerald Murphy
over 7 years ago
Note: This was originally posted on 25th January 2013 at http://forums.arm.com
Hi,
I have a question regarding the ARM and GCC assemblers i.e. ARMASM and GAS.
MOV.W R4,#0x87C0 is translated to F248_74C0 by ARMASM.
However, GAS throws up the error "invalid constant (87c0) after fixup" for the same instruction. Why does GAS give an error for this?
I realise the operand is 16-bit but I'm using the '.syntax unified'. I thought GAS supports .W and .N suffixes. Even without the .W suffix, GAS gives the same error whereas ARMASM quietly expands the 16-bit instruction to 32-bit.
I'm using 'GCC version 4.7.2 (Sourcety CodeBench Lite 2012.09-63).
Any insight as to why GAS is giving an error is appreciated. The workaround is to use two instructions. The following 2 instructions compile OK.
MOVW R4 ,#0xC0
MOVT R4 ,#0x87
Thanks and regards,
Ger
Parents
Offline
Gerald Murphy
over 7 years ago
Note: This was originally posted on 11th February 2013 at
http://forums.arm.com
Thanks for the explanation, it helped a lot. I now understand that the first 4 encodings (i:imm3a: = 0000x,0001x, 0010x,0011x) are special encodings for various 8-bit repeat combinations. The remaining i:iim3:a encodings are used for shift operations (assuming MSB=1, 5-bit shift + 7-bit immediate).
Unfortunately, I'm not familiar with the classic ARM ISA. The ARM Cortex-M3 (ARMV7) is my first introduction to ARM processors - so I'm learning as I go!
Another feature I'm getting to grips with is the thumb-2 instruction set concept. While I realise that the thumb-2 instruction set is a combination of 16-bit (thumb) and 32-bit (ARM) instructions, I'm still a little unsure as to how the architecture handles thumb-2 instructions. The unified assembly langauge instruction set means that the same syntax is used for both 16-bit and 32-bit instructions. Here is my understanding (basic level) - feel free to correct any errors.
Q1) I'm assuming the assembler will try to use the 16-bit instruction encoding whenever possible. Depending on the registers used, immediate value size, if .W is specified etc, the assember will use a 32-bit instruction encoding.
Q2) Are all instructions decoded as 32-bit by the processor logic? If the first 5-bits [15:11] of the instruction half-word are 0b11101, 0c11110 or 0b11111, the instruction is 32-bits. The 16-bit instructions are used to improve code density and are converted to 32-bit for execution.
Q3) For the ARM V7 architecture with a 3-stage pipeline, the program counter value = (address of current instruction being executed + 4). Does this still hold true even if an instruction is 32-bits? I assume it does but I'm unsure as to why it isn't = (address of current instruction + 6).
Regards,
Ger
Cancel
Up
0
Down
Reply
Cancel
Reply
Offline
Gerald Murphy
over 7 years ago
Note: This was originally posted on 11th February 2013 at
http://forums.arm.com
Thanks for the explanation, it helped a lot. I now understand that the first 4 encodings (i:imm3a: = 0000x,0001x, 0010x,0011x) are special encodings for various 8-bit repeat combinations. The remaining i:iim3:a encodings are used for shift operations (assuming MSB=1, 5-bit shift + 7-bit immediate).
Unfortunately, I'm not familiar with the classic ARM ISA. The ARM Cortex-M3 (ARMV7) is my first introduction to ARM processors - so I'm learning as I go!
Another feature I'm getting to grips with is the thumb-2 instruction set concept. While I realise that the thumb-2 instruction set is a combination of 16-bit (thumb) and 32-bit (ARM) instructions, I'm still a little unsure as to how the architecture handles thumb-2 instructions. The unified assembly langauge instruction set means that the same syntax is used for both 16-bit and 32-bit instructions. Here is my understanding (basic level) - feel free to correct any errors.
Q1) I'm assuming the assembler will try to use the 16-bit instruction encoding whenever possible. Depending on the registers used, immediate value size, if .W is specified etc, the assember will use a 32-bit instruction encoding.
Q2) Are all instructions decoded as 32-bit by the processor logic? If the first 5-bits [15:11] of the instruction half-word are 0b11101, 0c11110 or 0b11111, the instruction is 32-bits. The 16-bit instructions are used to improve code density and are converted to 32-bit for execution.
Q3) For the ARM V7 architecture with a 3-stage pipeline, the program counter value = (address of current instruction being executed + 4). Does this still hold true even if an instruction is 32-bits? I assume it does but I'm unsure as to why it isn't = (address of current instruction + 6).
Regards,
Ger
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
Suggested Answer
Debugging kernel: OS support not working for Linux 5.4
0
Kernel Developers
External Hardware Debug
Debugger
7082
views
5
replies
Latest
2 months ago
by
sgoldschmidt
Suggested Answer
DS-5 bare metal wait error after run "debug"
0
DS-5 Development Studio
Debugging
Arm Compiler 5
Memory
29190
views
14
replies
Latest
2 months ago
by
prasadghole
Suggested Answer
ARM development studio with ARM Juno r2 board
0
Juno Arm Development Platform
Arm Development Studio
Products
Arm Support
6576
views
2
replies
Latest
2 months ago
by
Ronan Synnott
Answered
"Unable to execute remote query (response code 503) " issue
0
6301
views
1
reply
Latest
2 months ago
by
Ronan Synnott
Not Answered
Where can I download DS-5 hardware firmware??
0
5821
views
1
reply
Latest
2 months ago
by
Ronan Synnott
<
>
View all questions in Arm Development Studio forum