cancel
Showing results for 
Search instead for 
Did you mean: 

project structure changes when switching from debug to release mode

HDaji.1
Senior

I have a compilation error when I switch from debug mode to release mode, as showed in the pic below:

stm32_project_error.PNG

What did I miss? 

 

1 ACCEPTED SOLUTION

Accepted Solutions

Check the Include Paths settings for the "Release" build vs prior "Debug" ones that worked and found the include file.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

View solution in original post

5 REPLIES 5
HDaji.1
Senior

Below are the compiling commands:

  • Debug compiling command:
    arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m4 -std=gnu11 -g3 -DDEBUG -DUSE_HAL_DRIVER -DSTM32F411xE -DUSE_FULL_LL_DRIVER -c -I../Core/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -I"D:/ST/workspace_CoTSHM/I2C_HAL/FATFS/App" -I"D:/ST/workspace_CoTSHM/I2C_HAL/FATFS/Target" -I"D:/ST/workspace_CoTSHM/I2C_HAL/Middlewares/Third_Party/FatFs/src" -O0 -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfloat-abi=hard -mthumb -o "Core/Src/main.o"
  • Release compiling command:
    arm-none-eabi-gcc "../Core/Src/main.c" -mcpu=cortex-m4 -std=gnu11 -DUSE_HAL_DRIVER -DSTM32F411xE -DUSE_FULL_LL_DRIVER -c -I../Core/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc -I../Drivers/STM32F4xx_HAL_Driver/Inc/Legacy -I../Drivers/CMSIS/Device/ST/STM32F4xx/Include -I../Drivers/CMSIS/Include -Os -ffunction-sections -fdata-sections -Wall -fstack-usage -MMD -MP -MF"Core/Src/main.d" -MT"Core/Src/main.o" --specs=nano.specs -mfpu=fpv4-sp-d16 -mfloat-abi=hard -mthumb -o "Core/Src/main.o"

In the release case, two folders were omitted strangely by the IDE. 

Check the Include Paths settings for the "Release" build vs prior "Debug" ones that worked and found the include file.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

I thought IDE would take care of that. 🤔

I just did and the compilation error is gone; but got error of undefined reference to a few functions. I guess there is still some diff in setting details.

I am trying to optimize my code to increase its running speed. 

  • Do you have any good reference or guideline on how to do it, @Tesla DeLorean ?
  • Generally how much faster can release mode achieve than debug one?

 

Depends, the IDE treats the two contexts differently, so if you, or whomever created the project, add paths to one they won't automatically appear in the other.

The Release built typically enables optimization, removes assert and other verbose debug information. How much it improves things depends on the code, but it should shrink the size, and increase the speed in measurable amounts. Review the .MAP file output, and perhaps benchmark your critical code.

Tips, Buy me a coffee, or three.. PayPal Venmo
Up vote any posts that you find helpful, it shows what's working..

It looks to me Debug and Release are two totally different projects.

I have to add source folders other than Core and Drivers manually to project Release mode. Otherwise, IDE won't compile them, thus leading to linking errors.