Page 1 of 1

add math.h to stm32f4 project

Posted: Thu Jan 22, 2015 11:20 pm
by deadlyboy
hi.
i know it's stupid question but i'm new in ChibiOS and compiling through makefiles and ....
i usually use IAR for programming my STM micro controllers but now i need an OS and CHibi is really good.
i think based on architecture the math.h should be different. im using stm32f4(Cortex m4)
so if any body can help me to add Math.h to my project to use POW() and ..... for Float numbers i would be so Appreciated .
--
Thanks
MA.

Re: add math.h to stm32f4 project

Posted: Fri Jan 23, 2015 9:42 am
by Giovanni
Hi,

I am missing your point, what is the problem in including math.h?

If it is about floating point, there are settings related to the FPU in the makefile. Another point, Keil is supported by ChibiOS and there are Keil demos in the distribution, you may give it a try.

Giovanni

Re: add math.h to stm32f4 project

Posted: Fri Jan 23, 2015 2:46 pm
by deadlyboy
hi again
i just want to including proper math.h to my project in chibi studio , i don't like to use iar or keil compiler.
where to download or use math.h ?
how to address these file in makefile ??

Re: add math.h to stm32f4 project

Posted: Fri Jan 23, 2015 2:56 pm
by Giovanni
Hi,

You just need to put:

#include <math.h>

in your program, the compiler already has the header.

Giovanni

Re: add math.h to stm32f4 project

Posted: Sat Jan 24, 2015 9:01 am
by deadlyboy
:D

it seems it hasn't .
error : Unresolved inclusion: <math.h>

Re: add math.h to stm32f4 project

Posted: Sat Jan 24, 2015 9:28 am
by Giovanni
Works for me.

It must be something in the compiler you use.

Giovanni

Re: add math.h to stm32f4 project

Posted: Sat Jan 24, 2015 12:36 pm
by deadlyboy
that's right , it is my compiler problem

i searched in the folder ChibiStudio and it's sub folder . i found 4 math.h file in these directories
1- C:\ChibiStudio\tools\GNU Tools ARM Embedded\4.7 2014q2\arm-none-eabi\include\c++\4.7.4\tr1

2- C:\ChibiStudio\tools\GNU Tools ARM Embedded\4.7 2014q2\arm-none-eabi\include

3- C:\ChibiStudio\tools\gcc-arm-none-eabi-4_8-140405\arm-none-eabi\include\c++\4.8.3\tr1

4- C:\ChibiStudio\tools\gcc-arm-none-eabi-4_8-140405\arm-none-eabi\include

first i add address 2 to the project -> properties -> C/C++ General -> paths and Symbols -> includes
and unresolved inclusion error became solved but when i used POW function in my code an error happened : undefined references to 'pow'
i changed address 2 to 4 and the error happened again.

is there any configuration that i should do in the Makefile ?? because same error happened when i want to compile a function that was in another .c file until i put the name of that .c file in CSRC field in Makefile

Re: add math.h to stm32f4 project

Posted: Sat Jan 24, 2015 1:25 pm
by Giovanni
There are no configurations to do, ChibiStudio should work out of the box. Try installing the latest version.

Giovanni

Re: add math.h to stm32f4 project

Posted: Sun Jan 25, 2015 8:58 am
by deadlyboy
thanks Giovanni for such a fast attention, the problem solved .

1- i add the address of include file of arm-none-eabi.... to the " project -> properties -> C/C++ General -> paths and Symbols -> includes " as i mentioned in last comment
2 - i just add -lm to makefile and it's COMPILER OPTION (USE_OPT) and it compiled well .


thanks again
--
Sincerely
AM