我想使用ArduinoMakefile通过命令行将代码推送到SleepyPi Board。
它是传感器项目的一部分,其RaspberryPi3通过GPIO连接此Arduino电源板以管理其电源控制。
我在使用resin.io部署的docker容器中执行此操作。
我的Makefile看起来像这样:
PROJECT_DIR = /sonah/src/sleepypi/run/script2
ARDMK_DIR = $(PROJECT_DIR)
ARDUINO_DIR = /usr/share/arduino
USER_LIB_PATH := /usr/share/arduino/libraries
BOARD_TAG = sleepypi
MONITOR_BAUDRATE = 115200
AVR_TOOLS_DIR = /usr
AVRDUDE = /usr/bin/avrdude
CFLAGS_STD = -std=gnu11
CXXFLAGS_STD = -std=gnu++11
CXXFLAGS += -pedantic -Wall -Wextra
MONITOR_PORT = /dev/ttyS0
CURRENT_DIR = $(shell basename $(CURDIR))
OBJDIR = $(PROJECT_DIR)/bin/$(BOARD_TAG)/$(CURRENT_DIR)
include $(ARDMK_DIR)/Arduino.mk
当我运行它时,我收到以下消息:
root@raspberrypi3-c49223e:/sonah/src/sleepypi/run/script2# make upload
-------------------------
Arduino.mk Configuration:
- [AUTODETECTED] CURRENT_OS = LINUX
- [USER] ARDUINO_DIR = /usr/share/arduino
- [USER] ARDMK_DIR = /sonah/src/sleepypi/run/script2
- [AUTODETECTED] ARDUINO_VERSION = 105
- [DEFAULT] ARCHITECTURE =
- [DEFAULT] ARDMK_VENDOR = arduino
- [DEFAULT] ARDUINO_SKETCHBOOK =
- [USER] AVR_TOOLS_DIR = /usr
- [COMPUTED] ARDUINO_LIB_PATH = /usr/share/arduino/libraries (from ARDUINO_DIR)
- [COMPUTED] ARDUINO_VAR_PATH = /usr/share/arduino/hardware/arduino//variants (from ARDUINO_DIR)
- [COMPUTED] BOARDS_TXT = /usr/share/arduino/hardware/arduino//boards.txt (from ARDUINO_DIR)
- [USER] USER_LIB_PATH = /usr/share/arduino/libraries
- [DEFAULT] PRE_BUILD_HOOK = pre-build-hook.sh
- [USER] BOARD_TAG = sleepypi
- [COMPUTED] CORE = arduino (from build.core)
- [COMPUTED] VARIANT = standard (from build.variant)
- [USER] OBJDIR = /sonah/src/sleepypi/run/script2/bin/sleepypi/script2
- [COMPUTED] ARDUINO_CORE_PATH = /usr/share/arduino/hardware/arduino//cores/arduino (from ARDUINO_DIR, BOARD_TAG and boards.txt)
- [USER] MONITOR_BAUDRATE = 115200
- [DEFAULT] OPTIMIZATION_LEVEL = s
- [DEFAULT] MCU_FLAG_NAME = mmcu
- [USER] CFLAGS_STD = -std=gnu11
- [USER] CXXFLAGS_STD = -std=gnu++11
- [COMPUTED] DEVICE_PATH = /dev/ttyS0 (from MONITOR_PORT)
- [DEFAULT] FORCE_MONITOR_PORT =
- [AUTODETECTED] Size utility: AVR-aware for enhanced output
- [COMPUTED] BOOTLOADER_PARENT = /usr/share/arduino/hardware/arduino//bootloaders (from ARDUINO_DIR)
- [COMPUTED] ARDMK_VERSION = 1.6
- [COMPUTED] CC_VERSION = 4.8.1 (avr-gcc)
-------------------------
mkdir -p /sonah/src/sleepypi/run/script2/bin/sleepypi/script2
make reset
make[1]: Entering directory '/sonah/src/sleepypi/run/script2'
/sonah/src/sleepypi/run/script2/bin/ard-reset-arduino /dev/ttyS0
make[1]: /sonah/src/sleepypi/run/script2/bin/ard-reset-arduino: Command not found
/sonah/src/sleepypi/run/script2/Arduino.mk:1600: recipe for target 'reset' failed
make[1]: *** [reset] Error 127
make[1]: Leaving directory '/sonah/src/sleepypi/run/script2'
/sonah/src/sleepypi/run/script2/Arduino.mk:1558: recipe for target 'upload' failed
make: *** [upload] Error
我很想了解我做错了什么,以及如何解决它。 我必须承认我不是arduino和串行通信的专家。
答案 0 :(得分:1)
Arduino-Makefile项目随附该二进制文件:
$ ls -alh ~/dev/Arduino-Makefile/bin/
total 32K
drwxr-xr-x 2 kotori kotori 4.0K Aug 11 20:11 .
drwxr-xr-x 7 kotori kotori 4.0K Aug 11 20:11 ..
-rwxr-xr-x 1 kotori kotori 10K Aug 11 20:11 ardmk-init
-rwxr-xr-x 1 kotori kotori 4.1K Aug 11 20:11 ard-reset-arduino
-rwxr-xr-x 1 kotori kotori 2.4K Aug 11 20:11 robotis-loader
它正在检查位置,因为您的ARDMK_DIR变量设置为/ sonah / src / sleepypi / run / script2。这需要指向您将Arduino-Makefile项目下载到的位置。
如果在〜/ .bashrc文件中设置此变量,它将正常工作。 这是我在该文件中设置的方式:
export ARDMK_DIR="~/dev/Arduino-Makefile"
或将其放在每个项目Makefile的顶部:
ARDMK_DIR="/where/you/downloaded/Arduino-Makefile"