Using Thermistor but pow() and log() functions inaccessible.

Tip / Sign in to post questions, reply, level up, and achieve exciting badges. Know more

cross mob
RiAs_1660756
Level 4
Level 4
25 sign-ins 25 replies posted 10 replies posted

I am using PSoC Creator 3.3 CP2 (3.3.0.7343) on Win 7.  My chip is a CY8C4125PVI-482 and I want to use the Thermistor calculator.  

   

Building fails with the following messages:

   

M0120 Build error: undefined reference to `log'

   

M0120 Build error: undefined reference to `pow'

   

M0120 Build error: The command 'arm-none-eabi-gcc.exe' failed with exit code '1'.

   

I have created a new project with only the thermistor with no optimisations.  The code is:

   
#include <project.h>  int main() {     uint32 resistance = 5000;          CyGlobalIntEnable; /* Enable global interrupts. */      for(;;)     {         My_Nice_Thermistor_GetTemperature(resistance);         resistance++;         if(resistance > 300000)             resistance = 5000;     } }
   

I've tried 'include'ing <math.h> but that isn't it.  I guess there's a library missing; but what one?!

   

If I download the sample for CY8C3866AXI-040 (CE95381) it builds fine.  But that's 8051 not ARM so doesn't help me much.

   

All help received with pathetic gratitude by PSoC newcomer.

   

- Richard.

0 Likes
1 Solution
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Richard!

   

In Creator go to Project -> Build Settings -> Linker -> General

   

Add "m" (without the quotes) into Additional Libraries. This will add the math library "Libm.a" to your project.

   

 

   

Happy coding

   

Bob

View solution in original post

0 Likes
5 Replies
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

Welcome in the forum, Richard!

   

In Creator go to Project -> Build Settings -> Linker -> General

   

Add "m" (without the quotes) into Additional Libraries. This will add the math library "Libm.a" to your project.

   

 

   

Happy coding

   

Bob

0 Likes
odissey1
Level 9
Level 9
First comment on KBA 1000 replies posted 750 replies posted

Richard,

   

as alternative you may also consider fast thermistor calculator, which was made for higher precision and speed than Cypress's stock component is providing:

   

http://www.cypress.com/forum/psoc-community-components/fast-thermistor-calculator

0 Likes
RiAs_1660756
Level 4
Level 4
25 sign-ins 25 replies posted 10 replies posted

Thank you Bob and Odissey1 for your suggestions.  It's nice to be back on the rails!

   

Oddly, adding the "m" didn't fix the original project but did fix my minimalist project.  I had to rebuild the project from scratch with the "m" added from the start.  Otherwise I got a different raft of compiler objections.

   

I'll look into Odissey1's work later as it's interesting and useful for another occasion.  This current project is just a toe-in-the-water exercise that is a thermal monitor to go in one of our products as an add-on.  It needs accuracy of about 2 degrees at best!  But it gives me a chance to get some practical experience with the PSoC goodies.

   

Once again, guys, many thanks for your assistance.

   

- Richard.

0 Likes
Bob_Marlowe
Level 10
Level 10
First like given 50 questions asked 10 questions asked

You're always welcome, Richard.

   

 

   

Bob

0 Likes
Anonymous
Not applicable

Hi..i am a new user here. I was also looking for same thing and find the answer as given below, so you should follow this,In Creator go to Project -> Build Settings -> Linker -> General. Add "m" (without the quotes) into Additional Libraries. This will add the math library "Libm.a" to your project.

   

 

   

pcb assembly

0 Likes