1

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?

eDeviser
  • 1,605
  • 2
  • 17
  • 44
  • 1
    it looks like problem in ASN.1, not in GCC. Try to read from here: https://sourceforge.net/p/asn1c/discussion/357921/thread/aa2f2ca4/ – Alexey Esaulenko Jun 18 '18 at 12:22
  • 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 Jun 19 '18 at 05:43
  • 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 Jun 19 '18 at 17:27
  • 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 --version` – eDeviser Jun 20 '18 at 06:21
  • I am try to build this https://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 Jun 20 '18 at 09:13

1 Answers1

0

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

eDeviser
  • 1,605
  • 2
  • 17
  • 44