[fpc-devel] ARM vs Thumb2 - can't have both

David Welch dwelch at dwelch.com
Mon Aug 22 04:00:29 CEST 2011


except for a few older ARM's both platforms support thumb code, so 
anything that is shared could be compiled for thumb with some target 
specific trampolines to get there

ARM:

0x00000:  b _pre_start
...

_pre_start:
     ldr r0,_start
     bx r0
     .pool


cortex-m3:
0x0000:  _stac_top
0x0004:  .word _start


.thumb_func
_start:
     limit to thumb instructions (no thumb2)

same works for interrupts as well...

If everything is written in an thumb interwork fashion then you can jump 
around from target specific block to target specific block,  PASCALMAIN 
can be arm for the arm target and thumb2 for the cortex-m3 target for 
example and it all works.

BTW if you add .thumb_func

          .thumb_func
	.globl _start
	.text
_start:


you dont have to do this:
	.long _start+1
you can do this instead:
	.long _start

at least for gnu as, not sure if this code is targeted at different 
assemblers.


On 08/21/2011 05:58 PM, John Clymer wrote:
> Been playing with the ARM / Thumb2 part - specifically for the Thumb2
> line-up.
>
> The compiler proper can be built to switch between the two with a
> command line switch. However, the RTL gets called as <ARCH>-<SYSTEM>,
> this only allows the RTL to compiled for one or the other.
>
> This may be by design - in which case there should be a big BOLD note
> added to the Arm port page. Or it may be unintentional - in which case
> it should be switched to <ARCH>-<CPU>-<SYSTEM> OR Thumb2 should get
> rolled out as a separate <ARCH>.
>
> Not sure I will have time to get into changing <ARCH>, but if there is a
> [somewhat] easy fix to add <CPU> to the RTL path for architectures that
> support it, I may have time to dig into that.
>
> John
>
>
>
> _______________________________________________
> fpc-devel maillist  -  fpc-devel at lists.freepascal.org
> http://lists.freepascal.org/mailman/listinfo/fpc-devel




More information about the fpc-devel mailing list