2019-02-17 11:19 AM
We are using the ST MCSDK, it is very helpful. In MCSDK/MCLib/Any/Src there is a function called STM_FaultProcessing. It is auto generated by Cube. We have one line we want to add to it that turns an LED on alerting the user to a problem.
This works, but if we then auto generate code, it gets removed.
We attempted to put our own user code brackets around the line to protect it:
But the auto generation writes over it anyway.
Is there any way to insert custom USER CODE sections into areas that do not natively have these sections? If not, can anyone suggest (besides generate->diff->remodify) a good way to keep additions to the ST generated code?
2019-02-17 11:26 AM
USER CODE sections can't be user created. Workaround maybe needed with side effects to take care.
For example, find the master source directory which files will be copied at generation, and edit it.
Next library upgrade, pouf! In the meantime, you can edit the code without any user code as long as you track what you changes.
Otherwise, copy your project to safe haven, and compare the new generated code vs your reference for update. Windiff mastering required.
2019-02-17 12:06 PM
Yes, Windiff will likely be the path. Thanks...
2023-12-02 06:08 PM
Hi
Today is 2023 and next month is 2024 working on STM32U5A5 and note such as complex library, feature and stuff with some bug/issue in the code generator. Do you think it is about time to upgrade the feature to allow USER CODE sections that control or prevent overriding the modified code? or at least add a comment of the previous code before overridden code (below it) via an easy search pattern, ie //!!!PREVCODE: old code details (with enable/disable option)
Thank for consideration
R.