Setting compiler and linker options from Mbed Studio

Hello there,

I’m trying to compile and link code using Mbed Studio, including a library file (comprising Rust code) built externally. I’ve got a bunch of linker errors caused by incompatible char width. An example:

Error: L6242E: Cannot link object ./rust-libs/ as its attributes are incompatible with the image attributes.
… wchart-16 clashes with wchart-32.

I’d like to try and address these (and other errors which will no doubt pop up) by setting compiler/linker options to make the compiled code compatible with the compiler settings for the library. The Rust toolset has limited control over some things, so I’d like to fix it on this side. Is there a way to set compiler and linker options from Mbed Studio, or do I need to use the CLI tools instead?

I’m running Mbed studio in Windows, and (for purposes of bringing up the toolchain) using the mbed-os-example-blinky project template with modifications to main.cpp to add a call to a test function in my library, which I have added to a new directory in the code tree so that Mbed Studio can see it. The target is DISCO_H747I (an STM32H747 dev board). All other project settings are as installed defaults.

Any help gratefully received!


OK, so I found the settings in mbed-os-example-blinky\mbed-os\tools\profiles\debug.json (there’s a json file for each build profile). I couldn’t find any documentation for this configuration location, and found it by searching the code tree for some options I knew were being used.

I set -fno-short-wchar and it now links and runs.