[En-Nut-Discussion] relocation truncated to fit: R_ARM_PC24

Andre Riesberg andre at riesberg-net.de
Wed Oct 6 06:56:01 CEST 2010


Harald Kipp schrieb:
> On 05.10.2010 16:06, Michael Jones wrote:
>   
>> at91_efc.c:(.text+0xb8): relocation truncated to fit: R_ARM_PC24 against symbol `At91EfcCmd' defined in .ramfunc section in ...\libnutarch.a(at91_efc.o)
>> collect2: ld returned 1 exit status
>>     
>
> A vague guess: The compiler generates a call, which allows a 24 bit
> offset only, but the distance between your flash code and the RAM
> requires a larger offset.
>
> To fix it immediately you may try the following hack:
>
> 1. Create a local copy of at91_efc.c in your app dir.
> 2. Compile it individually, adding the compile option -mlong-calls
> 3. Link the local at91_efc.o before linking libnutarch.a
>
> Mh... right now I do not have the slightest idea how to solve this
> generally.
>
> I remember, that André Riesberg added the missing .ramfunc segment to
> several linker scripts. Possibly he stumbled over the same problem and
> already found a solution.
>
> André? Are you listening?
>
> Regards,
>
> Harald
> _______________________________________________
> http://lists.egnite.de/mailman/listinfo/en-nut-discussion
>
>
>   
Yes, I do. I add the .ramfunc segment to support by bootloader.

I checked the generated code. The ram function is called by a bx 
instruction. So the maximum call distance is the full 32 bit address range.

 129 0078 1C309FE5         ldr    r3, .L24+20 <--- Get  the address of 
the function
 130 007c 0FE0A0E1         mov    lr, pc
 131 0080 13FF2FE1         bx    r3  <--- Call the function
 132                  .L22:
...
 136                  .L24:
 137 0088 00000000         .word    .LC0
 138 008c 02000000         .word    .LC1
 139 0090 26000000         .word    .LC2
 140 0094 4A000000         .word    .LC3
 141 0098 7A000000         .word    .LC4
 142 009c 00000000         .word    WriteFlash     <--- The address of 
the function in ram
 143                      .size    Upgrade, .-Upgrade

Do you run the the CPU in THUMB mode?
Why is the "At91EfcCmd" function placed in ram?
Or, why is the distance from from the call position to the function so far?
Could you please check the list files to figure out how the ram function 
is called?

Greeting
André





 





More information about the En-Nut-Discussion mailing list