vscode上安装完platformio后,创建一个新项目,始终在转圈,查阅官网文档后发现可以使用ctl在终端中创建项目,本文方案的前提是终端走了代理。
根据官网命令安装ctl:
curl -fsSL -o get-platformio.py https://raw.githubusercontent.com/platformio/platformio-core-installer/master/get-platformio.py
python3 get-platformio.py
注意,我使用的linux环境。
安装完后运行pio boards查找开发板信息
例如:
❯ pio boards c52rc
Platform: intel_mcs51
ID MCU Frequency Flash RAM Name
STC89C52RC STC89C52RC 11MHz 8KB 512B Generic STC89C52RC
此时创建一个项目文件夹,然后告知pio开发板id即可创建目录。
❯ mkdir learn
❯ cd learn
❯ pio project init --board STC89C52RC
The following files/directories have been created in /home/vscode/sdcc/learn
include - Put project header files here
lib - Put project specific (private) libraries here
src - Put project source files here
platformio.ini - Project Configuration File
Resolving STC89C52RC dependencies…
Tool Manager: Installing platformio/toolchain-sdcc @ >=1.40100.0,<1.40401.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: toolchain-sdcc@1.40100.12072 has been installed!
Tool Manager: Installing platformio/tool-scons @ ~4.40700.0
Downloading [####################################] 100%
Unpacking [####################################] 100%
Tool Manager: tool-scons@4.40700.0 has been installed!
Already up-to-date.
Project has been successfully initialized!
整个下载过程耗时不到5s.此时在platform页面创建也能秒进,应该是这个ide默认不会走代理,导致第一次初始化项目由于网络问题卡死。