7 years, 3 months ago.

Compiler optimization with GCC when using mbed CLI

Hi,

I have setup GCC_ARM toolchain for using mbed CLI and I am having a hard time trying to figure out how compiler options can be added with "mbed compile". I am guessing "mbed compile" would use a Makefile to define compile options?

Also, does anyone know how what is the default optimization level of mbed's compiler?

Thanks!

you can pass optimizations direclty, so something like `mbed compile -j0` or `mbed compile profile small` can work. You can either specify the size directly, or use one of the default profiles which are small, default and debug in order of smallest to largest respectively.

posted by Austin Blackstone 06 Jan 2017

1 Answer

7 years, 3 months ago.

Hi Priyanka,

mbed compile could be used with -D option. For example: mbed compile -t GCC_ARM -m K64F -DFRED_TEST

And there are some pre-defined jason file which contain the compile options for all kinds of toolchain. You could use the --profile option to change the default one. For example: mbed compile -t GCC_ARM -m K64F --profile mbed-os/tools/profiles/debug.json

more details you could check it here: https://docs.mbed.com/docs/mbed-os-handbook/en/5.2/dev_tools/cli/#compile-time-customizations

Thanks.

Accepted Answer