cancel
Showing results for 
Search instead for 
Did you mean: 

CubeIDE embedded MX code generation delete custom preprocessor symbols

egoltzman
Senior

In my CubeIDE 1.5.1 project I have proprietary custom defined symbols that deleted every time I generate the code from IOC.

How can I protect them from being removed?

1 ACCEPTED SOLUTION

Accepted Solutions
Cartu38 OpenDev
Lead II

MBEDTLS_CONFIG_FILE="mbedtls_config.h" is device configuration tool (aka. STM32CubeMX) reserved. Such symbol is introduce by tool if selecting MBEDTLS middleware.

0693W000007AokvQAC.jpg 

Such is reserved because required if such middleware set and has to be removed if unset.

Hopefully if doing custom setup out of device configuration tool you have a way to force it being preseved. See https://www.st.com/resource/en/user_manual/dm00104712-stm32cubemx-for-stm32-configuration-and-initialization-c-code-generation-stmicroelectronics.pdf

You have to add a .extSettings file at your project root.

Content of such file is in your case:

[Others]

Define = MBEDTLS_CONFIG_FILE:"mbedtls_config.h"

Please note ':' char is not a typo ... you will see such is set to '=' if build settings on the fly

View solution in original post

4 REPLIES 4
Cartu38 OpenDev
Lead II

Works for me.

Please could you share which symbol you're adding (one being removed by code update process). Some are device configuration tool reserved ... maybe part of.

egoltzman
Senior

The strange thing is that it not happened every time I generate and when it happened it effect only this define:

MBEDTLS_CONFIG_FILE="mbedtls_config.h"

While there is at lease another define that is also custom, so from this list:

USE_HAL_DRIVER
STM32H743xx
DEBUG
MBEDTLS_CONFIG_FILE="mbedtls_config.h"
CONFIG_MEDTLS_USE_MEMORY

I left with this after generating:

USE_HAL_DRIVER
STM32H743xx
DEBUG
CONFIG_MEDTLS_USE_MEMORY

Cartu38 OpenDev
Lead II

MBEDTLS_CONFIG_FILE="mbedtls_config.h" is device configuration tool (aka. STM32CubeMX) reserved. Such symbol is introduce by tool if selecting MBEDTLS middleware.

0693W000007AokvQAC.jpg 

Such is reserved because required if such middleware set and has to be removed if unset.

Hopefully if doing custom setup out of device configuration tool you have a way to force it being preseved. See https://www.st.com/resource/en/user_manual/dm00104712-stm32cubemx-for-stm32-configuration-and-initialization-c-code-generation-stmicroelectronics.pdf

You have to add a .extSettings file at your project root.

Content of such file is in your case:

[Others]

Define = MBEDTLS_CONFIG_FILE:"mbedtls_config.h"

Please note ':' char is not a typo ... you will see such is set to '=' if build settings on the fly

egoltzman
Senior

Thank you! Very helpful to me