2020-12-19 07:46 PM
I have semi-recent backups, but this has created a lot of extra work.
Is this a problem specific to the versions I am using?
2020-12-19 07:59 PM
Ensure you have it set up to preserve user code.
Project Manager -> Code Generator -> Keep User Code when re-generating
If that's set, could be a bug. Could be you deleted some important comments. See if you can replicate if if you're interested.
2020-12-19 09:29 PM
Thank you for your reply. I have copied files from a backup version into the current project. I then went to the MX.ioc file and modified an unused gpio pin and selected generate. Everything worked as it has in the past. I am not sure what happened in my previous attempt.
For now I can continue on, but will make very frequent backups.
2020-12-20 07:59 PM
An update to my original question. I do have Keep User Code when re-generating checked. However when I re-generated the cubeMX configuration many of the User Code sections were eliminated. (Some were retained) This is the second time I have seen this happen, although I have re-generated the code multiple times. I cannot determine why, or predict when this happens. I think there is a bug in the CubeMX generation function.
2020-12-20 08:00 PM
This only affects the main.c file as far as I have seen.
2020-12-21 06:58 PM
After more investigating I have found that the User Code is removed when you select Generate Peripheral initialization as a pair of '.c/.h' files per peripheral.
I don't know why this selection is not compatible with Keep User Code when re-generating. I think it is a bug in CubeMX.
2021-07-13 06:12 AM
Thanks for your observation. This issue is explored further in this thread.
2021-07-13 07:17 AM
Suggestion:
Also:
and:
Paul