I have found this:
<LINK_TEXT text=“http://infocenter.arm.com/help/topic/co … CAIGH.html”>http://infocenter.arm.com/help/topic/com.arm.doc.dui0493e/BABCAIGH.html</LINK_TEXT>
linker switch “–no_blx_thumb_arm” that prevents using BLX… unfortunately no such switch is supported by toolchain I am using.
But I have found this:
</s><i>
</i>C:\Programs\Devel\Gcc\arm-2011.03\arm-none-eabi\bin>ld --help | find "blx"
--use-blx Enable use of BLX instructions
<e>
Explanation:
The `–use-blx’ switch enables the linker to use ARM/Thumb BLX instructions (available on ARMv5t and above) in various situations. Currently it is used to perform calls via the PLT from Thumb code using BLX rather than using BX and a mode-switching stub before each PLT entry. This should lead to such calls executing slightly faster.
it seems that it is enabled by default and no way to turn it off… I tried setting -march-armv3 but it produced the same assembly
Update:
I managed to work around the BLX issue, by enabling long calls “-mlong-calls” it will produce this assembly:
[code]
Disassembly of section .text:
20005000 :
20005000: b513 push {r0, r1, r4, lr}
20005002: 4b05 ldr r3, [pc, #20] ; (20005018 <main+0x18>)
20005004: 2014 movs r0, #20
20005006: 9300 str r3, [sp, #0]
20005008: 21a0 movs r1, #160 ; 0xa0
2000500a: 2200 movs r2, #0
2000500c: f64f 73ff movw r3, #65535 ; 0xffff
20005010: 4c02 ldr r4, [pc, #8] ; (2000501c <main+0x1c>)
20005012: 47a0 blx r4
20005014: 2001 movs r0, #1
20005016: bd1c pop {r2, r3, r4, pc}
20005018: 20005020 .word 0x20005020
2000501c: 200050e0 .word 0x200050e0
20005020: 6c6c6548 .word 0x6c6c6548
20005024: 2121216f .word 0x2121216f
…
Disassembly of section .plt:
200050cc <.plt>:
200050cc: e52de004 push {lr} ; (str lr, [sp, #-4]!)
200050d0: e59fe004 ldr lr, [pc, #4] ; 200050dc <_ebss+0x18>
200050d4: e08fe00e add lr, pc, lr
200050d8: e5bef008 ldr pc, [lr, #8]!
200050dc: 00000064 .word 0x00000064
200050e0: e28fc600 add ip, pc, #0, 12 <---- here
200050e4: e28cca00 add ip, ip, #0, 20
200050e8: e5bcf064 ldr pc, [ip, #100]! ; 0x64
[/code]
Now it hangs at 200050e0. Now I am a little bit confused - does the stm32f108 support ARM 32 bit instructions?