For STM32 development I use STM32CubeMX to generate the project and the initialisation code, and then I load it in SW4STM to edit and compile the code. One of the main attractions of STM32CubeMX is that it sets up all the of the dependencies and middleware in your project configuration.
I was modifying my Post-Build steps in Project->Properties->C/C++ Build->Settings when I accidentally deleted all of the entries in my configuration by clicking “Restore Defaults”. This cleared all of my compiler, linker and assembler settings that STM32CubeMX generates.
The result of this is a bunch of build-errors.
Normally if you mess up something, you can just regenerate the project using STM32CubeMX and, as long as you put your user code in the right places, it will regenerate the auto-generated part of the project without touching your code. However it turns out that it doesn’t necessarily regenerate your project settings. Of course you could manually re-enter the settings yourself, however the whole appeal of STM32CubeMX is that I don’t need to know this stuff – so I don’t.
I found a solution after a few hours of trying stuff out:
- Close the project in System Workbench (SW4STM32): Right click on your project, delete, OK. (This does not actually delete from disk as the name implies).
- Open a terminal and cd to your workspace. Delete the .settings folder and the .cproject file using the command: rm .cproject; rm -rf .settings/
- Regenerate your project in STM32CubeMX
- Reopen the project in System Workbench (SW4STM32)
The project properties should have been restored and those build errors gone.