question about float point operation in WICED Smart 2.1.1

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

cross mob
Anonymous
Not applicable

In below discussion, i was informed that:

floating point arithmetic are not included within the ROM and SDK because they consume a lot of precious resources.

Re: Floating-Point Arithmetic

I made some simple tests best on hello sensor app on WICED 2.1.1

Test 1,

float a = 1.4;

float b = 2.9;

float c = a * b;

float d = b / a;

ble_trace2("c=%d, d=%d", c, d);

build passed and the output is c=4, d=2, which is a correct result.

However from the generated assembly(hello_sensor.s), i did not find any symbol like __aeabi_fmul or __aeabi_fdiv.

Test 2,

float my_fmul(float x, float y)

{

  return x*y;

}

float my_fdiv(float x, float y)

{

  return x/y;

}

float a = 1.4;

float b = 2.9;

float c = my_fmul(a, b);

float d = my_fdiv(b, a);

ble_trace2("c=%d, d=%d", c, d);

build passed and the result is "c=4, d=2" which is also a correct result.

From hello_sensor.s, i found below symbols:

.global__aeabi_fmul
bl__aeabi_fmul
.global__aeabi_fdiv
bl__aeabi_fdiv

I try to search which module did those two symbol reside in. Below is what i found in the generate list file:

_aeabi_cdrcmple                                  ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_d2ulz                                     ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_dadd                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_ddiv                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_dmul                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_drsub                                     ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_dsub                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_fdiv                                      ../../build/hello_sensor_tmp-BCM920736TAG_Q32-rom-ram-Wiced-release/hello_sensor.o

__aeabi_fmul                                      ../../build/hello_sensor_tmp-BCM920736TAG_Q32-rom-ram-Wiced-release/hello_sensor.o

__aeabi_lasr                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_llsl                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_llsr                                      ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_memclr                                    ../tier2/brcm/mandatory/bld/20736/patch.elf

__aeabi_memclr4                                   ../tier2/brcm/mandatory/bld/20736/patch.elf

I still have no idea where did these symbol come from:-(

Test 3:

A little bit modification on below function:

float my_fmul(float x, float y)

{

  x =x*y*x; // added

  return x*y;

}

Build OK.

Test 4:

Added one more line:

float my_fmul(float x, float y)

{

  x =x*y*x;

  y = x*y*x; // added

  return x*y;

}

Clean and build again, but this time i got many errors like:

C:\Data\Work\Broadcom\BLE\WICED_Smart_SDK\WICED-Smart-SDK-2.1.1\WICED-Smart-SDK_Test\Wiced-Smart\spar/../../Apps/hello_sensor_tmp/hello_sensor.c:398: undefined reference to `__aeabi_fmul'

I also check __aeabi_fmul and __aeabi_fdiv, they still appear in the hello_sensor.s and ***.list file.

why, why, why?

Any one can help me?

thanks

0 Likes
1 Solution
MichaelF_56
Moderator
Moderator
Moderator
250 sign-ins 25 comments on blog 10 comments on blog

This has been discussed over in this thread: Re: Floating-Point Arithmetic

Essentially, the recommendation was to use a fixed point math library like libfixmath.

With caching and the look-up-table disabled, this library compiles to under 2K. Unused function elimination is enabled by default for all applications in the SDK. So only functions that are accessed by the application will be included in the final image.

gsbhoot1020

View solution in original post

0 Likes
10 Replies