Skip to content

Add compatibility with 8devices NUY #22

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 4 commits into
base: master
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
43 changes: 43 additions & 0 deletions arduino/bossa/Makefile
Original file line number Diff line number Diff line change
@@ -0,0 +1,43 @@
#
# Copyright (C) 2006-2012 OpenWrt.org
# This is free software, licensed under the GNU General Public License v2.
# See /LICENSE for more information.
#

include $(TOPDIR)/rules.mk

PKG_NAME:=bossa
PKG_VERSION:=2014-10-17
PKG_RELEASE:=$(PKG_SOURCE_VERSION)

PKG_SOURCE_PROTO:=git
PKG_SOURCE_URL:=https://github.com/8devices/BOSSA.git
PKG_SOURCE_SUBDIR:=$(PKG_NAME)-$(PKG_VERSION)
PKG_SOURCE_VERSION:=fd0cb87d15e320afc3577445286ee215b8077102
PKG_SOURCE:=$(PKG_NAME)-$(PKG_VERSION)-$(PKG_SOURCE_VERSION).tar.gz

include $(INCLUDE_DIR)/package.mk

define Package/bossa
SECTION:=utils
CATEGORY:=Utilities
DEPENDS:=+libstdcpp
TITLE:=Utility to flash ARM microcontrollers
endef

define Package/bossa/description
BOSSA is a flash programming utility for Atmel's SAM family of flash-based
ARM microcontrollers. The motivation behind BOSSA is to create a simple,
easy-to-use, open source utility to replace Atmel's SAM-BA software.
endef

define Build/Compile
$(MAKE) -C $(PKG_BUILD_DIR) $(TARGET_CONFIGURE_OPTS) CFLAGS="$(TARGET_CFLAGS)" bin/bossac
endef

define Package/bossa/install
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/bin/bossac $(1)/usr/bin/
endef

$(eval $(call BuildPackage,bossa))
10 changes: 7 additions & 3 deletions arduino/uSDaemon/files/sbin/uSDaemon
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@
# 'block-mount' package within OpenWRT

. /lib/functions/post_mount.sh
. /lib/ar71xx.sh

TIME=2

Expand Down Expand Up @@ -66,8 +67,11 @@ umount_disconnected_devices()
}

while [ true ]; do
umount_disconnected_devices
update_connected_devices
case $(ar71xx_board_name) in
yun)
umount_disconnected_devices
update_connected_devices
;;
esac
sleep $TIME
done

2 changes: 2 additions & 0 deletions arduino/yun-scripts/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,8 @@ define Package/yun-scripts/install
$(INSTALL_BIN) ./files/usr/bin/upgrade-all $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/extract-built-date $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/extract-built-date-from-sysupgrade-image $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/get-gpio-conf $(1)/usr/bin
$(INSTALL_BIN) ./files/usr/bin/run-bossac $(1)/usr/bin

$(INSTALL_BIN) ./files/etc/init.d/rename-wifi-if-access-point $(1)/etc/init.d
$(INSTALL_BIN) ./files/etc/init.d/generate_new_gpg_key $(1)/etc/init.d
Expand Down
22 changes: 22 additions & 0 deletions arduino/yun-scripts/files/usr/bin/get-gpio-conf
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
#!/bin/sh

# Resolve differences between different GPIO configurations

. /lib/ar71xx.sh

case $(ar71xx_board_name) in
nuy)
GPIO_MCU_RESET=12
GPIO_SPI_OE=22
GPIO_HANDSHAKE_OE=16
GPIO_UART_OE=17
AVRDUDE_CONF="/etc/avrdude_nuy.conf"
;;
yun)
GPIO_MCU_RESET=18
GPIO_SPI_OE=21
GPIO_HANDSHAKE_OE=22
GPIO_UART_OE=23
AVRDUDE_CONF="/etc/avrdude_yun.conf"
;;
esac
12 changes: 7 additions & 5 deletions arduino/yun-scripts/files/usr/bin/reset-mcu
Original file line number Diff line number Diff line change
@@ -1,8 +1,10 @@
#!/bin/sh

echo 18 > /sys/class/gpio/export
echo "high" > /sys/class/gpio/gpio18/direction
echo 1 > /sys/class/gpio/gpio18/value
echo 0 > /sys/class/gpio/gpio18/value
echo 18 > /sys/class/gpio/unexport
source /usr/bin/get-gpio-conf

echo $GPIO_MCU_RESET > /sys/class/gpio/export
echo "high" > /sys/class/gpio/gpio$GPIO_MCU_RESET/direction
echo 1 > /sys/class/gpio/gpio$GPIO_MCU_RESET/value
echo 0 > /sys/class/gpio/gpio$GPIO_MCU_RESET/value
echo $GPIO_MCU_RESET > /sys/class/gpio/unexport

12 changes: 7 additions & 5 deletions arduino/yun-scripts/files/usr/bin/run-avrdude
Original file line number Diff line number Diff line change
@@ -1,13 +1,15 @@
#!/bin/sh

echo 1 > /sys/class/gpio/gpio21/value
avrdude -q -q -c linuxgpio -C /etc/avrdude.conf -p m32u4 -U efuse:r:/tmp/efuse:d
source /usr/bin/get-gpio-conf

echo 1 > /sys/class/gpio/gpio$GPIO_SPI_OE/value
avrdude -q -q -c linuxgpio -C $AVRDUDE_CONF -p m32u4 -U efuse:r:/tmp/efuse:d
read EFUSE < /tmp/efuse
rm -f /tmp/efuse
if [ "x$EFUSE" = "x203" ] # 203 = 0xCB
then
avrdude -c linuxgpio -C /etc/avrdude.conf -p m32u4 -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xCB:m -Uflash:w:$1:i $2
avrdude -c linuxgpio -C $AVRDUDE_CONF -p m32u4 -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xCB:m -Uflash:w:$1:i $2
else
avrdude -c linuxgpio -C /etc/avrdude.conf -p m32u4 -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFB:m -Uflash:w:$1:i $2
avrdude -c linuxgpio -C $AVRDUDE_CONF -p m32u4 -U lfuse:w:0xFF:m -U hfuse:w:0xD8:m -U efuse:w:0xFB:m -Uflash:w:$1:i $2
fi
echo 0 > /sys/class/gpio/gpio21/value
echo 0 > /sys/class/gpio/gpio$GPIO_SPI_OE/value
19 changes: 19 additions & 0 deletions arduino/yun-scripts/files/usr/bin/run-bossac
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
#!/bin/sh

init_pids=$(pgrep init)
shell_pids=$(pgrep ash)

touch /tmp/block_init_askfirst

#kill init and ash processes that have ttyATH0 opened
for pid in $init_pids $shell_pids; do
blocks=$(ls -l /proc/$pid/fd/ | grep /dev/ttyATH0)
if [ "x$blocks" != "x" ]
then
kill $pid
fi
done

bossac $@

rm /tmp/block_init_askfirst
3 changes: 2 additions & 1 deletion utils/avrdude/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -59,7 +59,8 @@ endef

define Package/avrdude/install
$(INSTALL_DIR) $(1)/etc
$(INSTALL_CONF) ./files/avrdude.conf $(1)/etc/
$(INSTALL_CONF) ./files/avrdude_yun.conf $(1)/etc/
$(INSTALL_CONF) ./files/avrdude_nuy.conf $(1)/etc/
$(INSTALL_DIR) $(1)/usr/bin
$(INSTALL_BIN) $(PKG_BUILD_DIR)/avrdude $(1)/usr/bin/
endef
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -989,16 +989,10 @@ programmer
id = "linuxgpio";
desc = "Use the Linux sysfs interface to bitbang GPIO lines";
type = "linuxgpio";
# for DS1 board
# reset = ~18;
# for DS2 board
# reset = ~7;
# for DS2_B board
reset = ~18;
sck = 11;
# mosi = 6;
mosi = 27;
miso = 8;
reset = ~12;
sck = 19;
mosi = 20;
miso = 21;
;

# some ultra cheap programmers use bitbanging on the
Expand Down
Loading