avrupload 0.1.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- checksums.yaml +7 -0
- data/bin/avrupload +8 -0
- data/lib/avrupload.rb +114 -0
- data/lib/avrupload/avrdudeproxy.rb +42 -0
- data/lib/avrupload/version.rb +3 -0
- metadata +92 -0
checksums.yaml
ADDED
@@ -0,0 +1,7 @@
|
|
1
|
+
---
|
2
|
+
SHA1:
|
3
|
+
metadata.gz: 8d05bc57ceac0903bfe914dbad125cc7ad526cc6
|
4
|
+
data.tar.gz: d5a8665aa0123bbfb2d1ff0f0e7a2eae6fcfa49f
|
5
|
+
SHA512:
|
6
|
+
metadata.gz: 91d3c131ede9ba1c685138a66eab049f96a30826233af1dcf73c27d06145459cbe6f0e1dbc207e838c65c67fd3c26aa90d50b9ce0dcdcb6c88b8280150c1a680
|
7
|
+
data.tar.gz: 7a230d72c9261cb6d60193d2d8e52d74d878be9e4effbeaecc24e0503013777bc3aad0ed3e6f6029a2475dd523535fe05d21251fc9afe44d34bc41a572614ba4
|
data/bin/avrupload
ADDED
data/lib/avrupload.rb
ADDED
@@ -0,0 +1,114 @@
|
|
1
|
+
#
|
2
|
+
# AvrUpload library
|
3
|
+
# Copyright (C) 2016, 2017 Michel Megens <dev@bietje.net>
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
#
|
18
|
+
|
19
|
+
require 'optparse'
|
20
|
+
require 'optparse/time'
|
21
|
+
require 'ostruct'
|
22
|
+
|
23
|
+
require 'avrupload/avrdudeproxy'
|
24
|
+
require 'avrupload/version'
|
25
|
+
|
26
|
+
module AvrUpload
|
27
|
+
class << self
|
28
|
+
def start(args)
|
29
|
+
options = AvrUpload.parse(args)
|
30
|
+
proxy = AvrDudeProxy.new(options)
|
31
|
+
proxy.upload
|
32
|
+
end
|
33
|
+
|
34
|
+
def parse(args)
|
35
|
+
options = OpenStruct.new
|
36
|
+
|
37
|
+
options.tty_fix = false
|
38
|
+
options.hex = nil
|
39
|
+
options.mcu = nil
|
40
|
+
options.programmer = nil
|
41
|
+
options.port = nil
|
42
|
+
options.baud = 115200
|
43
|
+
options.config = "/etc/avrdude.conf"
|
44
|
+
|
45
|
+
parser = OptionParser.new do |p|
|
46
|
+
p.banner = "Usage: avr_upload [options]"
|
47
|
+
p.separator ""
|
48
|
+
p.separator "Specific options:"
|
49
|
+
|
50
|
+
p.on('-f', '--tty-fix', "Reset the TTY config before uploading") do
|
51
|
+
options.tty_fix = true
|
52
|
+
end
|
53
|
+
|
54
|
+
p.on('-H [FILE]', '--hex [FILE]',
|
55
|
+
'Hex file to upload to the AVR program memory') do |file|
|
56
|
+
options.hex = file
|
57
|
+
end
|
58
|
+
|
59
|
+
p.on('-m [MCU]', '--mcu [MCU]',
|
60
|
+
'The type of MCU you are trying to upload to') do |mcu|
|
61
|
+
options.mcu = mcu
|
62
|
+
end
|
63
|
+
|
64
|
+
p.on('-p [PROGRAMMER]', '--programmer [PROGRAMMER]',
|
65
|
+
'Programmer to use to upload the hex file to the AVR') do |prog|
|
66
|
+
options.programmer = prog
|
67
|
+
end
|
68
|
+
|
69
|
+
p.on('-P [PORT]', '--port [PORT]',
|
70
|
+
'Serial port to which the board is connected') do |port|
|
71
|
+
options.port = port
|
72
|
+
end
|
73
|
+
|
74
|
+
p.on('-b [BAUD]', '--baud [BAUD]',
|
75
|
+
'Serial baud rate to use') do |baud|
|
76
|
+
options.baud = baud
|
77
|
+
end
|
78
|
+
|
79
|
+
p.on('-c [FILE]', '--config [FILE]',
|
80
|
+
'Config file for avrdude, defaults to /etc/avrdude.conf') do |conf|
|
81
|
+
options.config = conf
|
82
|
+
end
|
83
|
+
|
84
|
+
p.separator ""
|
85
|
+
p.separator "Common options:"
|
86
|
+
|
87
|
+
p.on_tail('-h', '--help', "Show this message") do
|
88
|
+
puts p
|
89
|
+
exit
|
90
|
+
end
|
91
|
+
|
92
|
+
p.on_tail('-v', '--version', 'Show the version number') do
|
93
|
+
puts "AVR uploader #{AvrUpload::VERSION}"
|
94
|
+
exit
|
95
|
+
end
|
96
|
+
end
|
97
|
+
|
98
|
+
parser.parse!
|
99
|
+
mandatory = [:programmer, :hex, :mcu, :port]
|
100
|
+
missing = mandatory.select do |param|
|
101
|
+
param if options[param].nil?
|
102
|
+
end
|
103
|
+
|
104
|
+
unless missing.empty?
|
105
|
+
puts "Missing mandatory options: #{missing.to_s}"
|
106
|
+
puts ""
|
107
|
+
puts parser
|
108
|
+
exit 1
|
109
|
+
end
|
110
|
+
|
111
|
+
options
|
112
|
+
end
|
113
|
+
end
|
114
|
+
end
|
@@ -0,0 +1,42 @@
|
|
1
|
+
#
|
2
|
+
# AVRDude proxy class
|
3
|
+
# Copyright (C) 2016, 2017 Michel Megens <dev@bietje.net>
|
4
|
+
#
|
5
|
+
# This program is free software: you can redistribute it and/or modify
|
6
|
+
# it under the terms of the GNU General Public License as published by
|
7
|
+
# the Free Software Foundation, either version 3 of the License, or
|
8
|
+
# (at your option) any later version.
|
9
|
+
#
|
10
|
+
# This program is distributed in the hope that it will be useful,
|
11
|
+
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
12
|
+
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
13
|
+
# GNU General Public License for more details.
|
14
|
+
#
|
15
|
+
# You should have received a copy of the GNU General Public License
|
16
|
+
# along with this program. If not, see <http://www.gnu.org/licenses/>.
|
17
|
+
#
|
18
|
+
|
19
|
+
module AvrUpload
|
20
|
+
class AvrDudeProxy
|
21
|
+
attr_reader :mcu, :port, :programmer, :hex, :baud, :config
|
22
|
+
|
23
|
+
AVRDUDE_CMD = "avrdude -DqV ".freeze
|
24
|
+
|
25
|
+
def initialize(options)
|
26
|
+
@mcu = options[:mcu]
|
27
|
+
@port = options[:port]
|
28
|
+
@prog = @programmer = options[:programmer]
|
29
|
+
@hex = options[:hex]
|
30
|
+
@baud = options[:baud]
|
31
|
+
@config = options[:config]
|
32
|
+
end
|
33
|
+
|
34
|
+
def upload
|
35
|
+
avrdude_args = AVRDUDE_CMD
|
36
|
+
avrdude_args += "-p #{@mcu} -c #{@prog} -b #{@baud} -P #{@port} -C #{@config} "
|
37
|
+
avrdude_args += "-U flash:w:#{@hex}:i"
|
38
|
+
|
39
|
+
`#{avrdude_args}`
|
40
|
+
end
|
41
|
+
end
|
42
|
+
end
|
metadata
ADDED
@@ -0,0 +1,92 @@
|
|
1
|
+
--- !ruby/object:Gem::Specification
|
2
|
+
name: avrupload
|
3
|
+
version: !ruby/object:Gem::Version
|
4
|
+
version: 0.1.0
|
5
|
+
platform: ruby
|
6
|
+
authors:
|
7
|
+
- Michel Megens
|
8
|
+
autorequire:
|
9
|
+
bindir: bin
|
10
|
+
cert_chain: []
|
11
|
+
date: 2017-09-22 00:00:00.000000000 Z
|
12
|
+
dependencies:
|
13
|
+
- !ruby/object:Gem::Dependency
|
14
|
+
name: bundler
|
15
|
+
requirement: !ruby/object:Gem::Requirement
|
16
|
+
requirements:
|
17
|
+
- - "~>"
|
18
|
+
- !ruby/object:Gem::Version
|
19
|
+
version: '1.13'
|
20
|
+
type: :development
|
21
|
+
prerelease: false
|
22
|
+
version_requirements: !ruby/object:Gem::Requirement
|
23
|
+
requirements:
|
24
|
+
- - "~>"
|
25
|
+
- !ruby/object:Gem::Version
|
26
|
+
version: '1.13'
|
27
|
+
- !ruby/object:Gem::Dependency
|
28
|
+
name: rake
|
29
|
+
requirement: !ruby/object:Gem::Requirement
|
30
|
+
requirements:
|
31
|
+
- - "~>"
|
32
|
+
- !ruby/object:Gem::Version
|
33
|
+
version: '10.0'
|
34
|
+
type: :development
|
35
|
+
prerelease: false
|
36
|
+
version_requirements: !ruby/object:Gem::Requirement
|
37
|
+
requirements:
|
38
|
+
- - "~>"
|
39
|
+
- !ruby/object:Gem::Version
|
40
|
+
version: '10.0'
|
41
|
+
- !ruby/object:Gem::Dependency
|
42
|
+
name: rspec
|
43
|
+
requirement: !ruby/object:Gem::Requirement
|
44
|
+
requirements:
|
45
|
+
- - "~>"
|
46
|
+
- !ruby/object:Gem::Version
|
47
|
+
version: '3.0'
|
48
|
+
type: :development
|
49
|
+
prerelease: false
|
50
|
+
version_requirements: !ruby/object:Gem::Requirement
|
51
|
+
requirements:
|
52
|
+
- - "~>"
|
53
|
+
- !ruby/object:Gem::Version
|
54
|
+
version: '3.0'
|
55
|
+
description: avrupload enforces certain TTY settings before uploading hex files using
|
56
|
+
avrdude
|
57
|
+
email:
|
58
|
+
- dev@bietje.net
|
59
|
+
executables:
|
60
|
+
- avrupload
|
61
|
+
extensions: []
|
62
|
+
extra_rdoc_files: []
|
63
|
+
files:
|
64
|
+
- bin/avrupload
|
65
|
+
- lib/avrupload.rb
|
66
|
+
- lib/avrupload/avrdudeproxy.rb
|
67
|
+
- lib/avrupload/version.rb
|
68
|
+
homepage: http://etaos.bietje.net
|
69
|
+
licenses:
|
70
|
+
- GPLv3
|
71
|
+
metadata: {}
|
72
|
+
post_install_message:
|
73
|
+
rdoc_options: []
|
74
|
+
require_paths:
|
75
|
+
- lib
|
76
|
+
required_ruby_version: !ruby/object:Gem::Requirement
|
77
|
+
requirements:
|
78
|
+
- - ">="
|
79
|
+
- !ruby/object:Gem::Version
|
80
|
+
version: '0'
|
81
|
+
required_rubygems_version: !ruby/object:Gem::Requirement
|
82
|
+
requirements:
|
83
|
+
- - ">="
|
84
|
+
- !ruby/object:Gem::Version
|
85
|
+
version: '0'
|
86
|
+
requirements: []
|
87
|
+
rubyforge_project:
|
88
|
+
rubygems_version: 2.2.2
|
89
|
+
signing_key:
|
90
|
+
specification_version: 4
|
91
|
+
summary: AVRdude for PC with difficult behaviour
|
92
|
+
test_files: []
|