arduino ide 功能过于简单,连最基本的断点调式功能都不提供。经过串口查看调式数据实在是很不便捷,经过某种方式远程调式arduino是颇有必要的。html
此次尝试是在64位fedora 22下进行,使用的arduino板子类型为leonardo
.须要python 2 支持.python
bash$ uname -a >Linux heymind-laptop 4.0.5-300.fc22.x86_64 #1 SMP Mon Jun 8 16:15:26 UTC 2015 x86_64 x86_64 x86_64 GNU/Linux
PlatformIO is a cross-platform code builder and the missing library manager.linux
之前我在linux开放arduino时候使用的是ino
工具,PlatformIO
和它相似,只不过它功能更增强大,支持的芯片种类繁多,包括stm32,avr都有支持link.对于IDE 也有很好的配置教程link,甚至还提供库管理(没用过).redis
bashpip install platformio && pip install --egg scons
安装很简单。bash
bashplatformio platforms install atmelavr platformio platforms show atmelavr
这是一个相似于仿真器的程序,他能够经过usb串口与单片机通讯,并模拟出一个gdb server
,能够经过avr-gdb
或者其余IDE进行debug.eclipse
下载源代码:http://ftp.yzu.edu.tw/nongnu//simulavr/simulavr-1.0.0.tar.gzide
以后进入目录./configure
,有可能报错工具
Could not locate libbfd.so/libbfd.a and/or bfd.h.ui
解决依赖。this
bashdnf install binutils-devel
编译有可能报错,
systemclock.cpp:70:8: note: use ‘this->resize’ instead
只须要手动修改一下这个文件,按照提示修改便可。总体安装流程以下:
bash./configure make make install
初始化工程
bashplatformio init --borad=leonardo
以后能够在src
里编辑代码,将库依赖放到lib
里。
用platformio run
上传到板子。
启动gdb server
bashsimulavr --gdbserver -p 4242 --device atmega16
使用gdb进行调式(也能够在 QT Creator , eclipse中进行,配置过程类似)
bash$ avr-gdb >GNU gdb (GDB) 7.1 Copyright (C) 2010 Free Software Foundation, Inc. License GPLv3+: GNU GPL version 3 or later <http://gnu.org/licenses/gpl.html> This is free software: you are free to change and redistribute it. There is NO WARRANTY, to the extent permitted by law. Type "show copying" and "show warranty" for details. This GDB was configured as "--host=x86_64-unknown-linux-gnu --target=avr". For bug reporting instructions, please see: ><http://www.gnu.org/software/gdb/bugs/>. (gdb) target remote localhost:4242 >Remote debugging using localhost:4242 >warning: Can not parse XML target description; XML support was disabled at compile time (gdb) add-symbol-file /home/exodus/workspace/arduino/platformio-try/.pioenvs/leonardo/firmware.elf 0 >add symbol table from file "/home/exodus/workspace/arduino/platformio-try/.pioenvs/leonardo/firmware.elf" at > .text_addr = 0x0 (y or n) y >Reading symbols from /home/exodus/workspace/arduino/platformio-try/.pioenvs/leonardo/firmware.elf...done. (gdb) list >23 int atexit(void (*func)()) { return 0; } 24 25 // Weak empty variant initialization function. 26 // May be redefined by variant files. 27 void initVariant() __attribute__((weak)); 28 void initVariant() { } 29 30 int main(void) >31 {
好了,就到这里了,arduino从如今起调式就很美好了~ 往后有机会再写写如何在ide中进行调式,争取配置出一个完美的IDE~