App-duino
view release on metacpan or search on metacpan
Revision history for App-duino
0.10 2013-05-17 18:28:30 Europe/Rome
- Use picocom, instead of the built-in terminal, if installed
0.09 2013-05-10 16:57:29 Europe/Rome
- Also remove .build if empty on "duino clean"
- General documentation improvements
- Add --fuses option to the upload command
- Add --uploader option to the upload command
0.08 2013-04-26 22:08:26 Europe/Rome
- Support direct *.hex file upload
- Rename --dir option to --root (incompatible change)
- Support using different hardware types (e.g. not-officially-supported MCUs)
- Do not die when a board config variable is not found (this caused "duino
build" to fail on pretty much every Arduino except Leonardo/Micro)
0.07 2013-04-20 19:04:09 Europe/Rome
- Improve output
0.06 2013-03-27 13:07:54 Europe/Rome
- Improve documentation (no functional changes)
- Improve output during build
- Check 'make' return value after build
0.05 2013-03-26 14:29:41 Europe/Rome
- Improve documentation (no functional changes)
- Fix 'models' and 'upload' commands
0.04 2013-03-26 14:03:54 Europe/Rome
- Add 'models' command to list supported Arduino models
- Add 'com' command to open a serial terminal to the Arduino (work in progress)
0.03 2013-03-26 11:34:53 Europe/Rome
- Improve documentation (no functional changes)
- Search files in sub-directories too on build
- Allow builds of different sketches in the same build directory
- Support build and upload of a single user-specified sketch
- Improve error messages
0.02 2013-03-25 00:07:03 Europe/Rome
- Make the duino.ini file optional (as it should have been from the start)
- Various documentation improvements (no functional changes)
0.01 2013-03-24 23:20:24 Europe/Rome
- Initial version
Makefile.PL
README
bin/duino
dist.ini
lib/App/duino.pm
lib/App/duino/Command.pm
lib/App/duino/Command/build.pm
lib/App/duino/Command/clean.pm
lib/App/duino/Command/com.pm
lib/App/duino/Command/models.pm
lib/App/duino/Command/upload.pm
t/00-compile.t
t/release-check-manifest.t
t/release-pod-syntax.t
=item List the supported Arduino models:
$ duino models
=item Build a sketch:
$ duino build --board uno
=item Upload the sketch to the Arduino:
$ duino upload --board uno --port /dev/ttyACM0
=item Build and upload a given sketch file:
$ duino build --board uno some_sketch.ino
$ duino upload --board uno --port /dev/ttyACM0 some_sketch.ino
=item Upload a previously built hex file:
$ duino upload --board uno some_file.hex
=item Communicate with the Arduino:
$ duino com --port /dev/ttyACM0
=item Clean the build directory:
$ duino clean --board uno
=back
=head1 DESCRIPTION
B<duino> is a command-line toolkit for working with Arduino boards that can
replace the Arduino IDE. It can be either used directly on the command-line or
integrated into third-party IDEs. With duino you can quickly build and upload
sketches to a variety of Arduino boards, and communicate with them using the
built-in serial monitor.
To work it needs the Arduino software environment that can be found on the
L<Arduino website|http://arduino.cc/en/Main/Software>, or in most package
repositories (e.g. the C<arduino-core> package on Debian/Ubuntu).
=cut
App::duino -> run;
=over 4
=item L<models|App::duino::Command::models>
List all known Arduino models.
=item L<build|App::duino::Command::build>
Build an Arduino sketch.
=item L<upload|App::duino::Command::upload>
Upload a sketch to an Arduino.
=item L<clean|App::duino::Command::clean>
Clean the build directory.
=item L<com|App::duino::Command::com>
Open a serial monitor to an Arduino
lib/App/duino/Command.pm view on Meta::CPAN
return $self -> ini($config) || $ENV{'ARDUINO_BOARD'} || 'uno'
if $config eq 'board';
return $ENV{'ARDUINO_PORT'} || '/dev/ttyACM0'
if $config eq 'port';
return $ENV{'ARDUINO_FUSES'} || 0
if $config eq 'fuses';
return $ENV{'ARDUINO_UPLOADER'} || undef
if $config eq 'uploader';
return $self -> ini($config) || $ENV{'ARDUINO_LIBS'} || ''
if $config eq 'libs';
return $ENV{'ARDUINO_SKETCHBOOK'} || "$ENV{'HOME'}/sketchbook"
if $config eq 'sketchbook';
return $ENV{'ARDUINO_ROOT'} || '/usr/share/arduino'
if $config eq 'root';
lib/App/duino/Command/build.pm view on Meta::CPAN
$(ECHO) 'Building $(notdir $<)'
$(CXX) -c $(CPPFLAGS) $(CXXFLAGS) $< -o $@
# various object conversions
$(OBJDIR)/%.hex: $(OBJDIR)/%.elf
$(ECHO) 'Generating $(notdir $@)'
$(OBJCOPY) -O ihex -R .eeprom $< $@
$(ECHO)
all: $(OBJDIR) $(TARGET_HEX)
$(ECHO) 'Built! Now you can run "duino upload"'
$(OBJDIR):
$(MKDIR) $(OBJDIR)
$(TARGET_ELF): $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS)
$(CC) $(LDFLAGS) -o $@ $(LOCAL_OBJS) $(CORE_LIB) $(OTHER_OBJS) -lc -lm
$(CORE_LIB): $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS)
$(ECHO) 'Linking $(notdir $(CORE_LIB))'
$(AR) rcs $@ $(CORE_OBJS) $(LIB_OBJS) $(USER_LIB_OBJS)
lib/App/duino/Command/com.pm view on Meta::CPAN
This command can be used to initiate a serial monitor with an Arduino board (or
any other device that supports serial communication). The C<picocom> terminal
emulator will be used if installed, otherwise a built-in RX-only terminal will
be started.
=cut
sub abstract { 'open a serial monitor to an Arduino' }
sub usage_desc { '%c upload %o [sketch.ino]' }
sub opt_spec {
my ($self) = @_;
return (
[ 'port|p=s', 'specify the serial port to use',
{ default => $self -> default_config('port') } ],
);
}
lib/App/duino/Command/upload.pm view on Meta::CPAN
package App::duino::Command::upload;
{
$App::duino::Command::upload::VERSION = '0.10';
}
use strict;
use warnings;
use App::duino -command;
use Cwd;
use POSIX;
use File::Basename;
=head1 NAME
App::duino::Command::upload - Upload a sketch to an Arduino
=head1 VERSION
version 0.10
=head1 SYNOPSIS
# this will find the *.hex file to upload in the board's build directory
$ duino upload --board uno --port /dev/ttyACM0
# explicitly provide the *.hex file
$ duino upload --board uno some_file.hex
=cut
sub abstract { 'upload a sketch to an Arduino' }
sub usage_desc { '%c upload %o [sketch.ino]' }
sub opt_spec {
my ($self) = @_;
return (
[ 'board|b=s', 'specify the board model',
{ default => $self -> default_config('board') } ],
[ 'port|p=s', 'specify the serial port to use',
{ default => $self -> default_config('port') } ],
[ 'fuses|f', 'write the fuses bits when uploading',
{ default => $self -> default_config('fuses') } ],
[ 'uploader|u=s', 'specify the uploader to use',
{ default => $self -> default_config('uploader') } ],
[ 'sketchbook|s=s', 'specify the user sketchbook directory',
{ default => $self -> default_config('sketchbook') } ],
[ 'root|d=s', 'specify the Arduino installation directory',
{ default => $self -> default_config('root') } ],
[ 'hardware|r=s', 'specify the hardware type to build for',
{ default => $self -> default_config('hardware') } ],
);
lib/App/duino/Command/upload.pm view on Meta::CPAN
my $name = basename getcwd;
($name = basename($args -> [0])) =~ s/\.[^.]+$//
if $args -> [0] and -e $args -> [0];
my $hex = ".build/$board/$name.hex";
$hex = $args -> [0] if $args -> [0] and $args -> [0] =~ /\.hex$/;
my $mcu = $self -> board_config($opt, 'build.mcu');
my $prog = $opt -> uploader ||
$self -> board_config($opt, 'upload.protocol') ||
$self -> board_config($opt, 'upload.using');
my $baud = $self -> board_config($opt, 'upload.speed');
my $avrdude = $self -> file($opt, 'hardware/tools/avrdude');
my $avrdude_conf = $self -> file($opt, 'hardware/tools/avrdude.conf');
print "Uploading to '" . $self -> board_config($opt, 'name') . "'...\n";
my @avrdude_opts;
push @avrdude_opts, '-C', $avrdude_conf;
push @avrdude_opts, '-p', $mcu;
lib/App/duino/Command/upload.pm view on Meta::CPAN
the default value (C<uno>) will be used.
=item B<--port>, B<-p>
The path to the Arduino serial port. The environment variable C<ARDUINO_PORT>
will be used if present and if the command-line option is not set. If neither
of them is set the default value (C</dev/ttyACM0>) will be used.
=item B<--fuses>, B<-f>
Whether to write the fuses bits when uploading. The environment variable
C<ARDUINO_FUSES> will be used if present and if the command-line option is not
set. If neither of them is set the default value (C<false>) will be used.
=item B<--uploader>, B<-u>
The uploader to use to upload. The environment variable C<ARDUINO_UPLOADER>
will be used if present and if the command-line option is not set. If neither
of them is set the default value specified in the C<boards.txt> file will be
used.
=item B<--sketchbook>, B<-s>
The path to the user's sketchbook directory. The environment variable
C<ARDUINO_SKETCHBOOK> will be used if present and if the command-line option is
not set. If neither of them is set the default value (C<$HOME/sketchbook>) will
be used.
lib/App/duino/Command/upload.pm view on Meta::CPAN
Copyright 2013 Alessandro Ghedini.
This program is free software; you can redistribute it and/or modify it
under the terms of either: the GNU General Public License as published
by the Free Software Foundation; or the Artistic License.
See http://dev.perl.org/licenses/ for more information.
=cut
1; # End of App::duino::Command::upload
( run in 4.079 seconds using v1.01-cache-2.11-cpan-b16cb0d3907 )