This is the easiest way I could find to set up the project - set up a blank ST project and adding the files with virtual linking.
- Click File > New > C Project
- C Project
- Enter a Project Name
- Select Project type: Executable > Ac6 STM32 MCU Project
- Select Toolchains: Ac6 STM32 MCU GCC
- Click Next
- Select Configurations
- Click Next (Both configurations should be checked)
- Target Configuration
- Click "Create a new custom board"
- Keep Define new board
- Enter new board name: STM32F103
- Select board chip: STM32F1
- Select mcu: STM32F103RCTx
- Click OK
- Select the board you just made!
- Select Series: STM32F1
- Select Board: STM32F103 (or whatever was just named)
- Click Finish
- Click "Create a new custom board"
- Drag the "inc", "src", and "drivers" directory (from Finder, or whatever window you can view file directory structure) and drop them onto your project folder in SystemWorkbench
- It'll prompt you to select how files and folders should be imported: "Link to files and recreate folder structure with virtual folders“
- It'll prompt you to overwrite? - overwrite for both inc & src (you're overwriting empty directories)
- Replace the startup file by dragging the startup_stm32f103xe.s file into startup (via linking), and delete the existing startup_stm32.s file
- Include drivers directory in build:
- Right click on the directory
- Go to Resource Configurations > Exclude from Build...
- Deselect All
- click OK
- Exclude the drivers > cmsis directory
- Right click on the directory
- Go to Resource Configurations > Exclude from Build...
- Select All
- click OK
- Exclude some of the hal files in drivers > stm32f1xx_hal_driver > src:
- Select all the files
- Deselect adc_ex, adc, cortex, dma, gpio_ex, gpio, iwdg, rcc_ex, rcc, tim_ex, tim, uart, hal
- Go to Resource Configurations > Exclude from Build...
- Select All
- click OK
- Right click on your project folder
- Go to Properties
- Go to C/C++ General > Paths and Symbols
- Includes
- Click Add…
- Pick the directories below via File System (and check Add to all configurations)
- motor_controller/inc
- motor_controller/drivers/stm32f1xx_hal_driver/inc
- motor_controller/drivers/cmsis/device/st/stm32f1xx/inc
- motor_controller/drivers/cmsis/inc
- note if you try to add via workspace path, it doesn’t work since we do virtual linking
- Symbols
- Click Add.
- Name: STM32F103xE; no value
- Click OK
- Click Add.
Now you should be able to build & debug & add breakpoints!
Note that there might be some Symbol cannot be resolved errors, if this is the case, check to see in your Preferences > C/C++ > Indexer that "Index unused headers" is not checked. Even if it is, toggling it and applying it a few times might be the fix.