mcuxpresso IDE and complex numbers

cancel
Showing results for 
Show  only  | Search instead for 
Did you mean: 

mcuxpresso IDE and complex numbers

1,918 Views
dkh
NXP Employee
NXP Employee

What do I need to do to be able to use complex numbers in my mcuxpresso project?  I am setting up an interface right now to an AFE I have and I need to be able to calculate complex numbers.

 

I am currently using GCC to compile and it cannot find the complex.h header file.

 

Thanks,

Dennis

7 Replies

1,767 Views
ZhangJennie
NXP TechSupport
NXP TechSupport

Hi

Complex is a new function in C99 standard. Newlib is a GNU C/C++library. It can support complex. But Redlib is NXP own (non-GNU) ISO C90 standard C library, with some C99 extensions. it doesn't support  complex type and have no complex.h head file.

I suggest you read

What are Redlib and Newlib? 

If you search "complex.h" under MCUXpresso IDE install folder, you will find it.

Have a nice day,

Jun Zhang

0 Kudos

871 Views
abdurrehman98
Contributor I

Hi, i also want to use complex number in my code for frdm k64f board. I am using MCU expresso compiler. Should I also use NewlibNano. Do I have to use any header file inside the code to use complex numbers.

I would appreciate your response.

0 Kudos

1,766 Views
dkh
NXP Employee
NXP Employee

Thank you.

So for a customer using mcuxpresso IDE, mcuxpresso sdk and wanting to use complex numbers

What is our recommendation ?

What exactly needs to be changed in settings to get the best code size, performance, and maintain compatibility

If they are using a device like the LPC55S69 ?

Regards,

Dennis

0 Kudos

1,766 Views
converse
Senior Contributor V

Switch the project to newlib or newlibnano. How to do this is described in the document link provided by Jennie.
hint: it’s trivial

0 Kudos

1,766 Views
dkh
NXP Employee
NXP Employee

I understand. I already have made the change. What I was looking for was if there are any additional changes

After switching to newlib that would improve performance, compile times, code size, compatibility, etc.

That would allow a customer to fine tune his environment.

0 Kudos

868 Views
abdurrehman98
Contributor I
Hi, can you share the code where you have used complex numbers.
0 Kudos

1,766 Views
converse
Senior Contributor V

I'd suggest using newlibnano (which is a smaller version of the standard newlib, with a few features removed, but is a lot smaller code size). Also take a look at this

https://community.nxp.com/thread/388981