1 reply
Mar '21

galagaking

Thank you for sharing the PlatformIO info. This addition might be helpful. If you want to use SAMD processors (like WIO Terminal or MKR WAN 1300), be aware of the ‘printing floats’ issue. As stated here Empty array when printing results the result of the predictions is empty. You can solve this by adding these buildflags to your platformio.ini file:

build_flags = 
 -Wl,-u_printf_float
 -D__STATIC_FORCEINLINE='__STATIC_INLINE'

The first line will add printing float capabilities to your code, the second line is needed for older versions of CMSIS (ie. included in SAMD21/51 packages).

Another way to fix this is in your main.cpp file by adding the following line to your setup code:

asm(".global _printf_float");

and adding the macros as described in Slow DSP Operations:

 #define __STATIC_FORCEINLINE                   __attribute__((always_inline)) static inline
 #define __SSAT(ARG1, ARG2) \
 __extension__ \
 ({                          \
   int32_t __RES, __ARG1 = (ARG1); \
   __ASM volatile ("ssat %0, %1, %2" : "=r" (__RES) :  "I" (ARG2), "r" (__ARG1) : "cc" ); \
   __RES; \
  })