Topic : ARM math library

Forum : ARM

Original Post
Post Information Post
May 13, 2009 - 10:02am
Guest

Hi.

I am trying to transport an application for another microprocessor to STM32 using RIDE7 and GNU compiler.

Thanks to the help of raisonance support and this forum, I have solved almost all the linker errors.

At this moment, I only have two problems:
* The linker doesn't find 3 mathematical functions: "pow", "log" and "exp" Where may I find those functions. They are supposed to be included in the math library. Where may I find information about gcc libraries?
* The application that I am trying to compile, uses malloc and free functions. I have changed all the code to avoid calling them. With this change I have solved some linker errors, but it remains one: sbrkr.c:(.text+0x12): undefined reference to `_sbrk'. I am trying to find, in the linker map file, where is the reference to this symbol, but I haven't found it.

May any one help me.
Best Regards

Replies
Post Information Post
+1
0
-1
May 13, 2009 - 11:54am
Raisonance Support Team

Hi,

About the math functions...

Seeing the way you have modified your linker script (for other readers, this is a reference to other threads), I think that your problem is that the math functions are called from the libraries that you include in the link using the GROUP command in your custom linker script, which is included in the main linker script AFTER the math library. Therefore, at the time the linker scans the math library, it does not know that it will need these functions. And it does not go back to them after scanning your libraries that call the math functions. Remember that the GCC linker scans the input files sequentially and does not go back.

You should just need to add the math library in your GROUP command.
See the main linker script (application.elf.ld) to get the pointer to the math library.

About the sbrk...

Add a dummy __sbrk function in your code, link the application, and then the generated map file should be much more explicit about where __sbrk and sbrk.o are called from.
I cannot say anything more without an example project showing the problem. (maybe just with the map file, but I cannot guarantee that)

Best Regards,

Vincent

+1
0
-1
May 13, 2009 - 1:05pm
Guest

Hi,

Thanks very much for the information.

I have added libm.a to the GROUP and now I have no linker errors.
It's time to put to work the program.

I will send, to your mail, the map file of the project to see if you can find the reference to _sbrk.

Best regards.