Keil MDK 工具提供的配置工具可以方便的STM32CUBEMX结合起来使用,完成新建项目的初始化配置。
MCU -- STM32F373RC
keil MDK 5.25
STM32CubeMX 4.26
1. 新建项目,选择对应的MCU型号
2. 在配置工具里选择STM32CubeMX,配置如下:
3. 点击OK,会询问是否运行STM32CubeMX,点击运行STM32CubeMX:
4. 在CubeMX中配置了外部晶振,USART1,PC13输出口(LED指示灯)
时钟配置:
USART1和PC13都按默认配置,不去修改。
点击生成代码:
生成代码后,不要打开项目,选择取消,并关闭CubeMX:
5. 在MDK下导入更新:
编译项目,应该没有警告和错误:
如果要使用LL库,在C/C++编译选项里添加 USE_FULL_LL_DRIVER 定义。
6. 后面需要修改或增加MCU的IO分配和初始化,在MDK配置工具里点击三角形的按钮就可调用CubeMX来配置。