PlatformIO Community

Mbed_printf library


#1

Please add mbed_printf library in libraries manager

https://github.com/ARMmbed/minimal-printf


#2

Does it work with this line in platformio.ini?

[env:myenv]
board = ...
lib_deps = https://github.com/ARMmbed/minimal-printf.git

#3

*** [.pioenvs/nucleo_f303k8/lib184/minimal-printf/TESTS/minimal-printf/compliance/main.o] Error 1


#4

Clone the library into your project’s lib/ folder yourself and remove the TESTS/ folder, you mustn’t compile the unittests.


#5
#include <mbed.h>
#include "mbed_printf.h"

AnalogIn temperature(PA_3);

int main()
{
  while (1)
  {
    if (temperature > 0.5)
    {
      mbed_printf("Too hot! (%f)", temperature.read());
    }
  }
}

/home/asus/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld: .pioenvs/disco_f407vg/lib3f1/libminimal-printf.a(mbed_printf_implementation.o): in function mbed_minimal_putchar': /home/asus/Documents/PlatformIO/Projects/f407vgt6/lib/minimal-printf/mbed_printf_implementation.c:180: undefined reference toMBED_PRINT_CHARACTER’
/home/asus/.platformio/packages/toolchain-gccarmnoneeabi/bin/…/lib/gcc/arm-none-eabi/8.2.1/…/…/…/…/arm-none-eabi/bin/ld: .pioenvs/disco_f407vg/lib3f1/libminimal-printf.a(mbed_printf_implementation.o): in function mbed_minimal_formatted_string': /home/asus/Documents/PlatformIO/Projects/f407vgt6/lib/minimal-printf/mbed_printf_implementation.c:431: undefined reference toMBED_INITIALIZE_PRINT’
collect2: error: ld returned 1 exit status
*** [.pioenvs/disco_f407vg/firmware.elf] Error 1