Source: Damogran Labs: https://damogranlabs.com/2019/01/vs-code-stm32-ide-keil-project/
Version: 1.0
There are couple of things that user needs to know and be aware when using 'importKeilProject.py' script.
- Script needs STM32CubeMX and '.ioc' files must be associated with CubeMX by default. Default installation must be used.
- CPU firmware package for correct family must exist (the same CPU family as in imported Keil project). Download them with CubeMX.
Script prepare 'Makefile' as it would be generated by STM32CubeMX and a starting VS Code workspace. Generated 'Makefile' and workspace can than be used with 'update.py' script to generate everything (as described in other readmes), needed for VS Code STM32 IDE.
- Create a backup copy of your Keil project folder, just in case anything goes wrong.
- Copy 'ideScripts' folder in the root of the Keil project.
- Run 'importKeilProject.py' python script.
- Inspect all 'WARNINGS:'. See Notes below.
- If project was successfully generated (eg. Makefile and VS Code workspace created), you can continue with running 'update.py' script.
- This script is intended to simplify importing existing Keil projects, but does not handle all complex Keil-specific settings. For example, Linker flags/memory address settings, modified startup files, ... It was created to port existing projects, that were once generated with CubeMX (and Keil MDK-ARM as output settings) or Keil STM software pack, to VS Code workspace solution.
- 'startup_*.s' file is overwritten with default one. This is due Keil and GCC syntax and compiler incompatibility.
- With each run, VS Code workspace and Makefile are overwritten. Hopefully you would only need to run it once.
- Inspect 'WARNING:'(s) and add missing sources, includes and invalid paths manually.
- This script does not support multi-target Keil projects. See here.
- First, Keil workspace file ('*.uvproj') is located. This file is than parsed to get all c/asm sources, includes, defines and other relevant data.
- CPU name is parsed and CubeMX is used to create blank temporary workspace with 'Makefile' as output setting. This means, c/asm compiler/linker flags are correctly set with default CubeMX settings.
- Makefile is copied, cleaned and filled with Keil project data.
- Startup file is copied and startup file source path is replaced in Makefile
- Temporary files are deleted.
- VS Code workspace is created.
Please report any issues, bugs and thoughts.