»
Quick Links
Page 1 of 1
Switching from ARM to Thumb mode
#1
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
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
#2
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.
fromelf -c says:
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
Share this topic:
Page 1 of 1














