cancel
Showing results for 
Search instead for 
Did you mean: 

ModusToolbox Bluetooth SDK

PICH_4397076
New Contributor

Dear All,,,

I am using ModusToolbox with BTSDK 1.4.

To use math function, I included math.h, and -lm flags via IDE Project  properties.

During build, I got the following errors.

How can I add libm successfully?

c:/users/pilheon/modustoolbox_1.1/tools/gcc-7.2.1-1.0/bin/../lib/gcc/arm-none-eabi/7.2.1/../../../../arm-none-eabi/lib/thumb/v7e-m\libm.a(lib_a-w_pow.o): In function `pow':

w_pow.c:(.text.pow+0x104): undefined reference to `__errno'

w_pow.c:(.text.pow+0x11e): undefined reference to `__errno'

w_pow.c:(.text.pow+0x17c): undefined reference to `__errno'

w_pow.c:(.text.pow+0x240): undefined reference to `__errno'

w_pow.c:(.text.pow+0x24a): undefined reference to `__errno'

collect2.exe: error: ld returned 1 exit status

make[1]: *** [BLE_Mesh_Dimmer_mainapp.elf] Error 1

make: *** [all] Error 2

Pls, let us know how to do!

Thanks,

0 Likes
1 Solution
AnjanaM_61
Moderator
Moderator

Hi,

Not sure how well we can be expected to support issues with external libraries. Could you please try add the flag -lc also ?

As in the following link which looks close to your issue: http://pinguino.cc/forum/showthread.php?tid=4463

Thanks,

Anjana

View solution in original post

5 Replies
AnjanaM_61
Moderator
Moderator

Hello ,

Could you please try the below format in make file with lib file location ?

CY_APP_INCLUDES += -I$(CY_WICED_LIB_COMP_FULL)/../examples/BT-SDK/20706-A2_Bluetooth/apps/demo/audio/headset

Thanks,

Anjana

0 Likes
PICH_4397076
New Contributor

Dear All,,,

I do not know what to do with what you gave me.

I want you to inform me step by step in detail about what I shoud do.

For your reference, The development environment is the below.

-. KIT : CYBT-213043-MESH

-. IDE : ModusToolbox 1.1

-. BT SDK 1.4

-. Code Example : Download BT SDK 1.4 example from GIT

-. Under Testing : mesh location client / server among snip folder in code example.

Thanks,

0 Likes
AnjanaM_61
Moderator
Moderator

Hi,

Not sure how well we can be expected to support issues with external libraries. Could you please try add the flag -lc also ?

As in the following link which looks close to your issue: http://pinguino.cc/forum/showthread.php?tid=4463

Thanks,

Anjana

View solution in original post

PICH_4397076
New Contributor

Dear All,,,

First, My development environment is the below.

-. KIT : CYBT-213043-MESH

-. IDE : ModusToolbox 1.1

-. BT SDK 1.4

-. Code Example : Download BT SDK 1.4 example from GIT

-. Under Testing : mesh location client / server among snip folder in code example.

I needed to use the math library, and as per your instructions, I set the linker setting as shown below, and the build was successful.

pastedImage_0.png

But, the math library results are strange. (Pls, refer to the below console capture screen)

Below is the test code to check if the math library works correctly in my application.

*** test code ***

WICED_BT_TRACE("\r\nTest \r\n");

    extern int __2sprintf(char * str, const char * format, ...);

    char str[20] = {0,};

    double result_1 = 0.0;

    double result_2 = 0.0;

    double d = 3.14;

    float f = 3.14f;

    result_1 = pow(2.5, 2.5);

    __2sprintf(str,"pow 결과 : %lf", result_1);

    WICED_BT_TRACE("%s\r\n", str);

    __2sprintf(str,"double 결과 : %lf", d);

    WICED_BT_TRACE("%s\r\n", str);

    result_2 = floor(2.5);

    __2sprintf(str,"floor 결과 : %lf", result_2);

    WICED_BT_TRACE("%s\r\n", str);

    __2sprintf(str,"float 결과 : %f", f);

    WICED_BT_TRACE("%s\r\n", str);

*** test console screen ***

Test

pow 결과 : -302344360.000000

double 결과 : 3.140000

floor 결과 : 0.000000

float 결과 : 3.140000

Can you tell me what's wrong with using MATH LIBRARY?

Thanks,

0 Likes
AnjanaM_61
Moderator
Moderator

Hi,

Thanks for confirming the build succeed. Also please note, %f is not supported in our SDK lib

I never tested with any external math lib. Could you please point out from where you downloaded the library?

Thanks,

Anjana

0 Likes