micro_ros_stm32cubemx_utils icon indicating copy to clipboard operation
micro_ros_stm32cubemx_utils copied to clipboard

Building library with optimization

Open Dmivaka opened this issue 1 year ago • 1 comments

Hi! I'm trying to build libmicroros.a with enabled optimization (-O3) for use with STM32CubeIDE. I didn't understand how to properly pass desired flag into the build environment, so I modified extract_flags.py instead:

    if len(optimization):
        out = out + " " + "-O3"

-O3 flag shows in the building log (with unmodified extract_flags.py there's -O0). Build finishes successfully, but the libmicroros.a size is exactly the same as for the unoptimized build. So the question is how to properly build the library with the optimization enabled. Thanks!

Dmivaka avatar Dec 26 '23 13:12 Dmivaka

Add the optimization flags to the cross compilation toolchain: https://github.com/micro-ROS/micro_ros_stm32cubemx_utils/blob/iron/microros_static_library/library_generation/toolchain.cmake

pablogs9 avatar Jan 05 '24 08:01 pablogs9