[fpc-devel] arm embedded cortexm3 procedure address
Geoffrey Barton
mrb at periphon.net
Thu Jul 15 11:12:07 CEST 2010
On 14 Jul 2010, at 17:35, Jonas Maebe wrote:
> Geoffrey Barton wrote on Wed, 14 Jul 2010:
>
>> the resulting constant disassembles as:-
>>
>> 1bc: 000001a5 .word 0x000001a5
>>
>> which seems to be one greater than the address of the procedure.
>> Is this right?
>
> Yes.
>
>> If so, why?
>
> To identify the code as Thumb code.
I was aware of the requirement to add one to the address of an ISR,
but not to other calls.
A normal procedural call seems to assemble as a 'BL' to an even
address? I must be missing something:-)
>
>> also, why does the compiler sometimes add a 'nop' to the end of a
>> procedure (as above)?
>
> The default alignment of routines is 4 bytes. And it's most likely
> the assembler or linker that adds the nop, rather than the compiler.
Yes, right. Probably the linker. Presumably because it is slightly
faster.
thanks,
Geoffrey
>
>
> Jonas
>
> ----------------------------------------------------------------
> This message was sent using IMP, the Internet Messaging Program.
>
> _______________________________________________
> 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