CW 10.6 MQX 4.1.1 math functions

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

CW 10.6 MQX 4.1.1 math functions

1,061 Views
gorakk
Contributor IV

I'm having some issues with math functions - possibly the same issue as seen in:

CW 10.6 Kinetis - "incompatible implicit declaration" of all math.h functions?

but the fix described in that post only causes more errors for me.

To make sure it wasn't just something wrong with my project I cloned the twrk60f120m BSP and then started a new project from the MQX gpio example.  To gpio.c I added:

#include <math.h>

#define PI 3.14159265

and in main_task():

    {

        double param, result;

        param = 30.0;

        result = sin( param * PI / 180 );

        printf( "The sine of %f degrees is %f.\n", param, result );

    }

This built with no errors but gave the following warning:

../Sources/gpio.c: In function 'main_task':

../Sources/gpio.c:78:9: warning: implicit declaration of function 'sin' [-Wimplicit-function-declaration]

After selecting "Enable automatic library configurations" as shown in that other post, I did a Clean Project and a Build Project and there were numerous errors as shown below.

Does anyone have any suggestions?

**** Build of configuration twrk60f120m_Int_Flash_Debug for project project_test ****

"C:\\Freescale\\CW MCU v10.6\\gnu\\bin\\mingw32-make" -j8 all

'Building file: ../Sources/gpio.c'

'Executing target #1 ../Sources/gpio.c'

'Invoking: ARM Ltd Windows GCC C Compiler'

"C:/Freescale/CW MCU v10.6/Cross_Tools/arm-none-eabi-gcc-4_7_3/bin/arm-none-eabi-gcc" "../Sources/gpio.c" @"Sources/gpio.args" -Wa,-adhlns="Sources/gpio.o.lst" -MMD -MP -MF"Sources/gpio.d" -o"Sources/gpio.o"

In file included from <command-line>:0:0:

C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/EWL_C/include/lib_ewl.prefix:16:0: warning: "_EWL_C99" redefined [enabled by default]

C:/Freescale/CW MCU v10.6/MCU/ARM_GCC_Support/ewl/EWL_C/include/stdbool.h:20:3: warning: #warning "EWL support for C99 is not enabled" [-Wcpp]

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:808:53: error: expected ')' before '_processor_number'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/queue.h:110:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/queue.h:114:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/queue.h:117:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/lwsem.h:108:5: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/nvic.h:36:58: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1255:49: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1257:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1331:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1384:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1391:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1410:62: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1435:48: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1457:88: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1458:89: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1459:91: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1460:96: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1462:25: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1464:25: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1466:25: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1468:25: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1472:25: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1473:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1494:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1495:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/bsp/mqx.h:1496:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/lwmem.h:128:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:201:4: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:205:1: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:207:52: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:208:53: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:209:55: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:210:55: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:211:60: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:212:69: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:213:60: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:214:69: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:215:59: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:216:68: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:217:59: error: unknown type name 'bool'

C:/AACode/Freescale/Freescale_MQX_4_1/lib/CLONE_twrk60f120m.cw10gcc/debug/psp/psp_time.h:218:68: error: unknown type name 'bool'

mingw32-make: *** [Sources/gpio.o] Error 1

Tags (4)
0 Kudos
4 Replies

506 Views
matthewkendall
Contributor V

On a slightly tangential note: there is not much point using double if you are going to approximate pi to eight decimal places. Might as well use float, which will be faster too since the M4F FPU is single-precision.

0 Kudos

506 Views
DavidS
NXP Employee
NXP Employee

Hi Allen,

Please grab ZIP and review MSWord document inside ZIP to see is it resolves your issue.

hello2twrk70f120m_CMSIS_FPU.zip

Regards,

David

0 Kudos

506 Views
gorakk
Contributor IV

David,

Thanks for the info =)

What I ultimately did to solve the issue is described in this post:

Re: K60 usage of mathematical functions

Allen

0 Kudos

506 Views
DavidS
NXP Employee
NXP Employee

Thanks for update and glad it is solved.

Regards,

David

0 Kudos