add math.h to stm32f4 project

ChibiOS public support forum for topics related to the STMicroelectronics STM32 family of micro-controllers.

Moderator: RoccoMarco

Post Reply
deadlyboy
Posts: 27
Joined: Wed Nov 26, 2014 9:27 am

add math.h to stm32f4 project

Post 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.
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: add math.h to stm32f4 project

Post 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
deadlyboy
Posts: 27
Joined: Wed Nov 26, 2014 9:27 am

Re: add math.h to stm32f4 project

Post 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 ??
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: add math.h to stm32f4 project

Post by Giovanni »

Hi,

You just need to put:

#include <math.h>

in your program, the compiler already has the header.

Giovanni
deadlyboy
Posts: 27
Joined: Wed Nov 26, 2014 9:27 am

Re: add math.h to stm32f4 project

Post by deadlyboy »

:D

it seems it hasn't .
error : Unresolved inclusion: <math.h>
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: add math.h to stm32f4 project

Post by Giovanni »

Works for me.

It must be something in the compiler you use.

Giovanni
deadlyboy
Posts: 27
Joined: Wed Nov 26, 2014 9:27 am

Re: add math.h to stm32f4 project

Post 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
User avatar
Giovanni
Site Admin
Posts: 14892
Joined: Wed May 27, 2009 8:48 am
Has thanked: 1202 times
Been thanked: 996 times

Re: add math.h to stm32f4 project

Post by Giovanni »

There are no configurations to do, ChibiStudio should work out of the box. Try installing the latest version.

Giovanni
deadlyboy
Posts: 27
Joined: Wed Nov 26, 2014 9:27 am

Re: add math.h to stm32f4 project

Post 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
Post Reply