作为一名物联网工程的学生,硬件开发必不可少。但绝大多数硬件ide都是为windows准备的。
这次来使用vscode进行开发硬件
1、vscode开发优势:界面美观、代码补齐、不改代码的前提下减少重复重复编译而直接上传。
2、环境配置:vscode(安装好platformIO插件),cubeMX生成stm32工程目录
3.1、esp系列芯片配置步骤
(1)、安装PlatfromIO
(2)、创建新工程
(进行长时间的等待、下载源好像在国外、如果有梯子的话应该会快很多)
(3)、配置端口,波特率等进行测试
3.2、stm32系列芯片配置步骤
(1)、同样是下载好platformIO插件,但这里还需要cubeMX初始化代码生成器。
(2)、全部安装好之后,先打开cubeMX,新建项目选择路径、开发版型号和项目名称。
这里选择的是STM32F03C8,Toolchain/IDE一定选择makefile
(3)打开vscode新建项目选择相应的开发版,项目名和路径,项目名,开发版,路径一定与在cubeMX中的相同。
(4)将platformio.ini配置一下
; PlatformIO Project Configuration File
;
; Build options: build flags, source filter
; Upload options: custom upload port, speed and extra flags
; Library options: dependencies, extra library storages
; Advanced options: extra scripting
;
; Please visit documentation for the other options and examples
; https://docs.platformio.org/page/projectconf.html
[env:genericSTM32F103C8]
platform = ststm32
board = genericSTM32F103C8
framework = stm32cube
debug_tool = jlink
upload_protocol = jlink ;选择jlink作为下载和调试器
[platformio]
include_dir=Core/Inc
src_dir=Core/Src ;头文件引用路径
然后生成项目,开始测试,烧录测试