This post is older than 2 years and might not be relevant anymore
More Info: Consider searching for newer posts

Problem with GNU compiler(2013q4) with SDK 6.1

Hi ,

I have a code like below.

__attribute__((used, long_call, section(".data"))) void function_1()
{
   unsigned int a;
   unsigned int b[10];
   int c;


   c= a-((a/ 10)* 10);
   b[i] = c;
   a= a/10;
}

when I tried to build I got the error as follows

1. relocation truncated to fit: R_ARM_THM_CALL against symbol `__aeabi_uidivmod' defined in .text section in C:/Program Files/GNU Tools ARM Embedded/4.8 2013q4/lib/gcc/arm-none-eabi/4.8.3/armv6-m\libgcc.a(_udivsi3.o)
2. relocation truncated to fit: R_ARM_THM_CALL against symbol `__aeabi_uidiv' defined in .text section in C:/Program Files/GNU Tools ARM Embedded/4.8 2013q4/lib/gcc/arm-none-eabi/4.8.3/armv6-m\libgcc.a(_udivsi3.o)

Can anyone suggest me and help me how I can resolve this issue.

Regards, Anand

EDIT: format

Parents
  • When you post code can you please use the post-code button so it looks like code instead of a jumbled mess of text, it's hard to read.

    You used long_call in your function_1 definition to ensure anyone calling it uses a full 32-bit call, because you're putting it in the data segment. However you are then trying to call back to a normal system routine to do divide, which is in your code/text segment and is too far away for a normal

    bl <immediate>

    instruction on ARM, so it fails at link time.

    If you compile the one .c file containing your RAM-based function with the -mlong_calls option that will make the udiv calls full 32-bit.

    Why are you doing this anyway by the way? What's the need to run the code out of RAM?

  • Hi RK,

    After changing the long_calls to mlong_calls , the same error I am facing. Can you please tell me what could be the cause.

    Regards, Anand

Reply Children
No Data
Related