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

  • I didn't say change long_calls to mlong_calls I said compile that .c file with the -mlong_calls (or possibly -mlong-calls) compile option which should make it use long calls for all calls OUT of that piece of c code. I believe the pragma just makes it use long calls for calls INTO that piece of c, which you had already with your attribute, which also put it in the data segment. So put that back, take the pragma out and add the compilation flag to that one .c module so that when it compiles you get something like

    gcc -o out.o -mlong_calls out.c 
    

    That's where you need it to be. If you check the assembler instead of BLX calls you should get an LDR to load the register and then a BL Rx.

    By the way you're not necessarily helping yourself very much as the division library you are calling will still end up in Flash, so you'll be back to Flash to execute that anyway.

Related