arduino cli

构建Arduino命令编译

说明:用户在云端填入联网信息如:esp8266需要连接的wifi信息等。获取信息后在服务端生成esp8266的二进制.hex烧写文件。用户下载.hex文件后,利用烧写工具烧写到开发板中。

搭建arduino-cli

一、参考网址:github库
二、大致步骤:

  • 下载安装arduino-cli
    https://github.com/arduino/arduino-cli
  • 测试arduino-cli是否安装成功,
$ arduino-cli sketch new MyFirstSketch
Sketch created in: /home/luca/Arduino/MyFirstSketch 

Linux默认创建位置$HOME/Arduino/目录下
Mac os默认位置为$HOME/Documents/Arduino/

  • 添加esp8266开发板
    在$HOME/Arduino/目录下:创建arduino-cli.yaml文件,填入以下内容
board_manager:
  additional_urls:
    - http://arduino.esp8266.com/stable/package_esp8266com_index.json

然后运行:

arduino-cli core update-index
arduino-cli core install esp8266:esp8266

查询开发板信息:

arduino-cli board listall
  • 查询开发板所属的类型
$ arduino-cli core search nodemcu
Searching for platforms matching 'nodemcu'

ID              Version Name   
esp8266:esp8266 2.5.1   esp8266
  • 编译
arduino-cli compile -b esp8266:esp8266:nodemcu ~/Documents/Arduino/MySketch

遇到的问题

一、编译失败

错误信息:

Build options changed, rebuilding all
xtensa-lx106-elf-g++: internal compiler error: Killed (program cc1plus)
xtensa-lx106-elf-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
xtensa-lx106-elf-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
xtensa-lx106-elf-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
xtensa-lx106-elf-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
xtensa-lx106-elf-g++: internal compiler error: Killed (program cc1plus)
Please submit a full bug report,
with preprocessed source if appropriate.
See  for instructions.
Error: exit status 4
Compilation failed.

解决办法

sudo dd if=/dev/zero of=/swapfile bs=64M count=16
#count的大小就是增加的swap空间的大小,64M是块大小,所以空间大小是bs*count=1024MB
sudo mkswap /swapfile
#把刚才空间格式化成swap格式
sudo swapon /swapfile
#使用刚才创建的swap空间

你可能感兴趣的:(arduino cli)