Login

Important information

This site uses cookies to store information on your computer. By continuing to use our site, you consent to our cookies.

ARM websites use two types of cookie: (1) those that enable the site to function and perform as required; and (2) analytical cookies which anonymously track visitors only while using the site. If you are not happy with this use of these cookies please review our Privacy Policy to learn how they can be disabled. By disabling cookies some features of the site will not work.

ARM Community: Switching from ARM to Thumb mode - ARM Community

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

Switching from ARM to Thumb mode Rate Topic: -----

#1 User is offline   chintan8 

  • Member
  • Pip
  • Group: Members
  • Posts: 8
  • Joined: 01-December 08

Posted 28 September 2011 - 03:41 AM

Hello, I have written simple program to switch from ARM to Thumb mode as below. When "bx" instruction is execute it switch to thumb mode. In disassembly window "mov r0,#0x00" instruction in converted to "0x00000014 0000 LSL R0,R0,#0
0x00000016 E3A0 B 0x0000075A"
So its not comming to next instruction and branch to 0x0000075A location. Is there require any setting to execute thumb instruction? I have enable arm/thumb internetworking.

area AA, code, readonly
export __main
__main
mov r8,#0x80
adr r2,a
add r2,0x01
bx r2
mov r7,#0xff
a mov r0,#0x00
mov r1,#0xff
end


0

#2 User is offline   mharnisch 

  • Contributor
  • PipPip
  • Group: Members
  • Posts: 80
  • Joined: 11-April 08

Posted 28 September 2011 - 08:20 AM

(Please don't forget code tags in your postings)

I can't see a directive telling the assembler that beginning at label a there will be Thumb instructions. When I insert a THUMB directive (and make the code UAL compliant to suppress warnings), the disassembler output is correct.
    	area AA, code, readonly
    	export __main
__main
    	mov r8,#0x80
    	adr r2,a
    	add r2,#0x01
    	bx  r2
    	mov r7,#0xff
    	thumb
a
    	movs r0,#0x00
    	movs r1,#0xff
    	end


fromelf -c says:
	$a
	AA
	__main
    	0x00000000:	e3a08080	....	MOV  	r8,#0x80
    	0x00000004:	e28f2008	. ..	ADR  	r2,{pc}+0x10 ; 0x14
    	0x00000008:	e2822001	. ..	ADD  	r2,r2,#1
    	0x0000000c:	e12fff12	../.	BX   	r2
    	0x00000010:	e3a070ff	.p..	MOV  	r7,#0xff
	$t
    	0x00000014:	2000    	.   	MOVS 	r0,#0
    	0x00000016:	21ff    	.!  	MOVS 	r1,#0xff


0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic