Skip to main content
egoltzman
Senior
January 11, 2021
Solved

CubeIDE embedded MX code generation delete custom preprocessor symbols

  • January 11, 2021
  • 4 replies
  • 1361 views

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?

This topic has been closed for replies.
Best answer by Cartu38 OpenDev

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

4 replies

Cartu38 OpenDev
Graduate II
January 11, 2021

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
egoltzmanAuthor
Senior
January 11, 2021

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
Cartu38 OpenDevBest answer
Graduate II
January 11, 2021

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
egoltzmanAuthor
Senior
January 11, 2021

Thank you! Very helpful to me