Skip to main content
DavePfz
Senior
September 25, 2026
Question

Issue with BLE_HeartRateFreeRTOS on STM32

Whenever I generate the code for the example, the file hrs_app.c gets truncated to about 5K. This cases some warnings. If I copy the file from the example area to the care generated by CubeMX, it is 8K and the warnings are not issued.

Is this a problem with CubeMX or is it operator error?

2 replies

ST Technical Moderator
September 30, 2026

Hello ​@DavePfz 

Let me thank you for your feedback.

When CubeMX regenerates the project, files that are part of the user/application layer may be overwritten by the generated template content. If hrs_app.c in the generated project is smaller than the version in the example package, it usually means the file was regenerated from the CubeMX template rather than copied as-is from the reference example.

The BLE example contains application code that is not always preserved automatically during regeneration. Copying the reference hrs_app.c from the example into the generated project restores the complete implementation and removes the warnings, which is consistent with the example structure.

What to check

  • Verify that the correct BLE middleware/example package version is being used.
  • Compare the generated hrs_app.c with the one from the original example package.
  • Ensure user code is placed only in the designated /* USER CODE BEGIN */ sections, so it survives regeneration.
  • If the project was created by modifying an example, re-importing the example structure may be safer than regenerating only from CubeMX.

Thanks.

Mahmoud

 

To give better visibility on the answered topics, please click on Accept as Solution on the reply which solved your issue or answered your question.
DavePfz
DavePfzAuthor
Senior
September 30, 2026

Hi Mahmoud,

My primary point is that this was done by MX for some reason. There was no code added by me. I was merely trying to get the basic example working in my “sandbox.” I only thought that someone on the “team’ might be interested and be able to fix the problem for other users.

Thanks, Dave