Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ports/uno: Add missing snek-uno-install files
The .gitignore caused these files to not get added. Signed-off-by: Keith Packard <keithp@keithp.com>
- Loading branch information
1 parent
01a19e4
commit 67c7a68
Showing
3 changed files
with
131 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -1,4 +1,4 @@ | ||
snek-uno-* | ||
snek-uno-*.elf | ||
snek-uno-*.hex | ||
snek-uno-*.map | ||
snek-uno-install |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,54 @@ | ||
.\" | ||
.\" Copyright © 2020 Keith Packard <keithp@keithp.com> | ||
.\" | ||
.\" This program is free software; you can redistribute it and/or modify | ||
.\" it under the terms of the GNU General Public License as published by | ||
.\" the Free Software Foundation, either version 3 of the License, or | ||
.\" (at your option) any later version. | ||
.\" | ||
.\" This program is distributed in the hope that it will be useful, but | ||
.\" WITHOUT ANY WARRANTY; without even the implied warranty of | ||
.\" MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU | ||
.\" General Public License for more details. | ||
.\" | ||
.TH SNEK-MEGA-INSTALL 1 "snek-uno-install" "" | ||
.SH NAME | ||
snek-uno-install \- Install Snek to Arduino Uno | ||
.SH SYNOPSIS | ||
.B "snek-uno-install" [OPTION]... [COMMAND] | ||
.SH DESCRIPTION | ||
.I snek-uno-install | ||
installs the Snek programming language on an ATmega328P Arduino Uno | ||
board, including the ability to re-program the ATmega16u2 chip used as | ||
a usbserial converter. | ||
.SH OPTIONS | ||
.TP | ||
\-port <port> | ||
Specifies the serial port to use when programming the ATmega328p chip, | ||
the default is '/dev/ttyACM0'. | ||
.TP | ||
\-isp <ISP model> | ||
Specifies the programmer to use when programming the ATmega16u2 chip | ||
used as a usb to serial converter, common options are 'usbtiny' | ||
and 'avrisp2'. The default is 'usbtiny'. | ||
.TP | ||
\-hex <snek.hex> | ||
Specifies the hex file to load to the board. The default is the | ||
currently installed version of Snek when programming the ATmega328p, and the | ||
currently installed version of the usbserial program when programming | ||
the ATmega16u2. | ||
.SH COMMANDS | ||
.TP | ||
snek | ||
Loads Snek to the target device. This is the default command. Note | ||
that snekde will not be able to get/put programs to the device without | ||
also reprogramming the ATmega16u2 device used as a usb to serial | ||
converter on the Arduino Uno board. | ||
.TP | ||
usbserial | ||
Loads the updated usbserial converter firmware to the ATmega16u2 | ||
device on the Arduino Uno board. This version supports the XON/XOFF | ||
flow control required for SnekDE to be able to successfully | ||
communicate with Snek running on the ATmega328p processor. | ||
.SH AUTHOR | ||
Keith Packard |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,76 @@ | ||
#!/bin/sh | ||
|
||
SHAREDIR="@SHAREDIR@" | ||
|
||
SNEKMEGA="$SHAREDIR/snek-uno-@SNEK_VERSION@.hex" | ||
USBSERIAL="$SHAREDIR/Arduino-usbserial-atmega16u2-Uno-Rev3.hex" | ||
PORT=/dev/ttyACM0 | ||
ISP=usbtiny | ||
HEX=default | ||
|
||
action="snek" | ||
|
||
mode=arg | ||
|
||
for i in "$@"; do | ||
case "$mode" in | ||
arg) | ||
case "$i" in | ||
snek|usbserial) | ||
action="$i" | ||
;; | ||
-port|--port) | ||
mode=port | ||
;; | ||
-isp|--isp) | ||
mode=isp | ||
;; | ||
-hex|--hex) | ||
mode=hex | ||
;; | ||
*) | ||
echo "Usage: $0 {-port /dev/ttyACM0} {-isp avrisp2} {-hex snek-uno.hex} {snek|usbserial}" 1>&2 | ||
exit 1 | ||
;; | ||
esac | ||
;; | ||
isp) | ||
ISP="$i" | ||
mode=arg | ||
;; | ||
port) | ||
PORT="$i" | ||
mode=arg | ||
;; | ||
hex) | ||
HEX="$i" | ||
mode=arg | ||
;; | ||
esac | ||
done | ||
|
||
case "$HEX" in | ||
default) | ||
case "$action" in | ||
snek) | ||
HEX="${SNEKMEGA}" | ||
;; | ||
usbserial) | ||
HEX="${USBSERIAL}" | ||
;; | ||
esac | ||
;; | ||
esac | ||
|
||
case "$action" in | ||
snek) | ||
avrdude -pATMEGA328P -carduino -P$PORT -b115200 -D -U flash:w:"${HEX}":i | ||
;; | ||
usbserial) | ||
avrdude -pm16u2 -c$ISP -U flash:w:"${HEX}":i | ||
;; | ||
*) | ||
echo "Usage: $0 {-port /dev/ttyACM0} {-isp avrisp2} {-hex snek-uno.hex} {snek|usbserial}" 1>&2 | ||
exit 1 | ||
;; | ||
esac |