Skip to main content
HDaji.1
Senior
October 30, 2023
Solved

project structure changes when switching from debug to release mode

  • October 30, 2023
  • 2 replies
  • 2315 views

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? 

 

This topic has been closed for replies.
Best answer by Tesla DeLorean

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

2 replies

HDaji.1
HDaji.1Author
Senior
October 30, 2023

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. 

Tesla DeLorean
Tesla DeLoreanBest answer
Guru
October 30, 2023

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 VenmoUp vote any posts that you find helpful, it shows what's working..
HDaji.1
HDaji.1Author
Senior
October 30, 2023

I thought IDE would take care of that. :thinking_face:

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?

 

Tesla DeLorean
Guru
October 30, 2023

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 VenmoUp vote any posts that you find helpful, it shows what's working..