1
votes

I am using a stm32 which uses GNU Arm Embedded Toolchain which uses the newLib.

I added some the skeletons from asn1c and run into a linker problem when using floats. The Linker error says:

undefined reference to `ilogb'

It seems to me that newLib does not implement ilogb (see man ilogb)

How do I use ilogb with newLib or is there an alternative function I can call?

1
it looks like problem in ASN.1, not in GCC. Try to read from here: sourceforge.net/p/asn1c/discussion/357921/thread/aa2f2ca4Alexey Esaulenko
Hmm, your link looks more like primary problem in compiling the example. The author had forgotten to define the ` -DPDU=MyPDU`. I have no problem in compiling with the "normal" gcc on my host machine. The problem occurs when compiling with the mention arm-toolchain which uses the newLib.eDeviser
I dont know anything about ASN.1, but simple call to ilogb(123.456) works fine in my project (I use latest gcc from arm.com and newlib-nano).Alexey Esaulenko
Oh, that sounds interesting. a simple call to ilogb does really not work for me. Would you please show your output of arm-none-eabi-gcc --versioneDeviser
I am try to build this yadi.sk/d/jFmO8ss-3YA3Gf code with -mfloat-abi=softfp -mfpu=fpv4-sp-d16 and -mfloat-abi=soft. Everything works with C:\Program Files (x86)\GNU Tools ARM Embedded\7 2017-q4-major\bin>"arm-none-eabi-g++.exe" --version arm-none-eabi-g++.exe (GNU Tools for Arm Embedded Processors 7-2017-q4-major) 7.2.1 20170904 (release) [ARM/embedded-7-branch revision 255204]Alexey Esaulenko

1 Answers

0
votes

Maybe an alternative is to implement your own version of ilogb as it is done in here.