Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Compiler flag mismatch between project and target level [solved]
#1
Hi,

Thank you for this incredible work and for the new release! I'm using EmBitz for 7 years now.

I'm switching a project form 1.11 to 2.00 (start new project, add files, adjust settings) and I've found something.

The default optimisation C compiler flags for a new project (STM32H743): Debug: -O0; Release: -O2
When I set the -O0 at the project settings level (without touching anything else) it seems that the release target using the project settings from now on (policy: append), but to my surprise the compiled output is much smaller than the debug target.
It turned out that in the projects .ebp file the setting is still -O2.

   

This is a bug or I missed something?

Thanks!
Reply
#2
Quote:Thank you for this incredible work and for the new release! I'm using EmBitz for 7 years now.

I'm switching a project form 1.11 to 2.00 (start new project, add files, adjust settings) and I've found something.

The default optimisation C compiler flags for a new project (STM32H743): Debug: -O0; Release: -O2
...


Could you give a step-by-step procedure how to reproduce this?
Reply
#3
Sure!

- Create a new project for the STM32H743VI (debugger output: EB monitor; HAL not used)
- Go to Project -> Build options... -> Project settings -> C - Flags -> Check Optimization disabled [-O0]
- Click OK than save project

After I build both targets the build log clearly shows that there is two optimisation flags for the release target. It seems that the -O2 flag overrides the -O0 flag.

<b>-------------- Build: Debug in CompilerFlags ---------------</b><br />
arm-none-eabi-gcc.exe -mcpu=cortex-m7  -mthumb -mfpu=fpv5-d16 -D__HEAP_SIZE=0x0000 -D__STACK_SIZE=0x0100 -mfloat-abi=hard -O0 -fno-strict-aliasing -g2 -Wall -fdata-sections -ffunction-sections

<b>-------------- Build: Release in CompilerFlags ---------------</b><br />
arm-none-eabi-gcc.exe -mcpu=cortex-m7  -mthumb -mfpu=fpv5-d16 -D__HEAP_SIZE=0x0000 -D__STACK_SIZE=0x0100 -mfloat-abi=hard -O0 -fno-strict-aliasing -fdata-sections -ffunction-sections -O2 -g2

I've checked other flags and the problem is the same. For example, if the target contains the -g2 flag and than I set the -g1 flag in the project settings, in the build log I can see both the -g1 and -g2 flags.
And this is true for the 1.11 version also.

If I change the target policy to 'Use project options only', the problem has gone.

As you can see in the previously attached image the target checkboxes are greyed out and shows the project settings. But in the background the target settings doens't changed, and they still appended to the project settings.
Reply
#4
Ah, now I see what you mean.

To be honest, I never thought about this when I introduced that option masking of high levels on low levels ( System->project->target). And it has been this way from the beginning.

You right, I will fix this.
Thanks.
Reply


Forum Jump:


Users browsing this thread: 1 Guest(s)