How to use standard version of printf/snprintf on IAR EWARM

Toolchain:
IAR Embeded Workbench ARM
Toolchain version:
89.20.2
MbedOS version:
6.9.0
Target:
nucleo-L476RG

Hi, I am trying to debug mbed application on IAR.
I want to use standard version of printf/snprintf instead of minimal-printf because I want to print floating poit.
I know I need to change the parameter target.printf_lib with the value minimal-printf in mbed_app.json , but I cannot find mbed_app.json.
Could you please advise how to do for using standard version of printf/snprintf on IAR?

What I did are as show below.

  1. Open program named “mbed-os-example-mbed5-blinky” on Mbed Online compiler.
  2. Change revision newest one to 6.9.0.
  3. Export the program to IAR Embedded Workbench

Thank you

Hi,

You can set std for the target.printf_lib if you want to use standard version of printf.

For more detail, see here:

The mbed-os-example-mbed5-blinky example does not have mbed_app.json file by default, so you can create the mbed_app.json file in your project something like:

{
    "target_overrides": {
      "*": {
        "target.c_lib": "std",
        "target.printf_lib": "std"
      }
    }
}

And then, export the program to IAR Embedded Workbench.

Thanks,
Toyo

Hi,

Thank you for your answer.
Your answer works for my problem!

I have one more question.
Can I add and modify mbed_app.json file after that I export program to IAR?

Hi Yanase-san,

Can I add and modify mbed_app.json file after that I export program to IAR?

I don’t think the IAR Embedded Workbench IDE is able to parse mbed_app.json configuration file.
I found a description here:

The configuration system interprets only one mbed_app.json during mbed compile or mbed export , unlike library configurations.

So, if you change your configuration in the mbed_app.json, you need to export your project again.

Thanks,
Toyo

Hi, Toyo

Blockquote I don’t think the IAR Embedded Workbench IDE is able to parse mbed_app.json configuration file.
Blockquote The configuration system interprets only one mbed_app.json during mbed compile or mbed export , unlike library configurations.

I understood. I will re-export when I modify mbed_app.json.

Thank you, Soichiro.