msp430_bsl 0.1.2 → 0.3.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 +4 -4
- data/bin/upload_hex +14 -9
- data/lib/msp430_bsl/uart/connection.rb +4 -3
- data/lib/msp430_bsl/uart/exceptions.rb +5 -1
- data/lib/msp430_bsl/version.rb +1 -1
- metadata +3 -3
checksums.yaml
CHANGED
@@ -1,7 +1,7 @@
|
|
1
1
|
---
|
2
2
|
SHA256:
|
3
|
-
metadata.gz:
|
4
|
-
data.tar.gz:
|
3
|
+
metadata.gz: 35aba075d912b2875eecabcebfc4325f54af1cd3085d23249e9e54949797fe89
|
4
|
+
data.tar.gz: 18e8e770e7259aac7c1585f38f94adaeba67689589363ba12f8a143b5fd1b66b
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 95a9fd34842399eb965857bb83284d82d4f3a8b72f8912459c92f3dd57402c2d4599f9671b95c7bb91ad82595bc1326151f8bcdda0787aab069eb1bbaf58051f
|
7
|
+
data.tar.gz: c24a4ba28dffbda9f6404c7bcbdfc2155cfe3a17c6f2c49d39a33c1c8fcdeb5e625c18f254d376e74e425b23d3c092c09bc912ffaecb4ff5ed16316371c599db
|
data/bin/upload_hex
CHANGED
@@ -1,7 +1,5 @@
|
|
1
1
|
#!/usr/bin/env ruby
|
2
2
|
|
3
|
-
require 'bundler/setup'
|
4
|
-
Bundler.require
|
5
3
|
require 'slop'
|
6
4
|
require_relative '../lib/msp430_bsl'
|
7
5
|
|
@@ -10,7 +8,6 @@ STDOUT.sync = true
|
|
10
8
|
|
11
9
|
include Msp430Bsl::Utils
|
12
10
|
|
13
|
-
HIGH_SPEED_UART_BAUD = 115200.freeze
|
14
11
|
MAX_WRITE_ATTEMPTS = 3
|
15
12
|
|
16
13
|
@opts = {}
|
@@ -19,9 +16,10 @@ begin
|
|
19
16
|
o.string '-d', '--device', 'Mandatory: Path to serial programmer device', required: true
|
20
17
|
o.string '-f', '--hexfile', 'Mandatory: Path to HEX file to load', required: true
|
21
18
|
o.string '-g', '--logfile', 'Path to logfile'
|
22
|
-
o.string '-l', '--loglevel', "Logger level. One of ['fatal', 'error', 'warn', 'info', 'debug'].
|
23
|
-
o.
|
24
|
-
o.bool '-
|
19
|
+
o.string '-l', '--loglevel', "Logger level. One of ['fatal', 'error', 'warn', 'info', 'debug']. Default: 'debug'", default: :debug
|
20
|
+
o.integer '-b', '--baud', 'BAUD rate with which communicate to BSL. Default: 115200', default: 115200
|
21
|
+
o.bool '-e', '--erase_info', 'Erase info memory. Default: false', default: false # TODO: implement
|
22
|
+
o.bool '-c', '--check', 'Verify flash content after each data block write. Default: true', default: true
|
25
23
|
o.bool '-h', '--help', 'Print this help' do
|
26
24
|
puts "#{o}\n"
|
27
25
|
exit
|
@@ -37,6 +35,12 @@ end
|
|
37
35
|
|
38
36
|
logger = build_logger_from @opts
|
39
37
|
|
38
|
+
unless Msp430Bsl::Configs::BAUD_RATES.include? @opts[:baud]
|
39
|
+
logger.error "BAUD rate #{@opts[:baud]} not supported. Available BAUD rates: #{ Msp430Bsl::Configs::BAUD_RATES.join ', ' }"
|
40
|
+
exit
|
41
|
+
end
|
42
|
+
|
43
|
+
# Build UART Connection
|
40
44
|
@board = Msp430Bsl::Uart::Connection.new @opts[:device], logger: logger
|
41
45
|
|
42
46
|
# Enter BSL
|
@@ -48,9 +52,9 @@ logger.info 'Mass erasing FLASH'
|
|
48
52
|
logger.info "Unlocking BSL's password protected commands"
|
49
53
|
@board.send_command :rx_password, data: Msp430Bsl::Configs::CMD_RX_PASSWORD
|
50
54
|
# Switch UART to max speed
|
51
|
-
logger.info
|
52
|
-
@board.send_command :change_baud_rate, data: Msp430Bsl::Configs::BAUD_RATES[
|
53
|
-
@board.set_uart_speed
|
55
|
+
logger.info "Changing UART BAUD to #{@opts[:baud]}"
|
56
|
+
@board.send_command :change_baud_rate, data: Msp430Bsl::Configs::BAUD_RATES[@opts[:baud]]
|
57
|
+
@board.set_uart_speed @opts[:baud]
|
54
58
|
|
55
59
|
# If everything has gone well so far...
|
56
60
|
hexfile = Msp430Bsl::HexFile.new @opts[:hexfile]
|
@@ -122,3 +126,4 @@ end
|
|
122
126
|
|
123
127
|
logger.info 'Closing connection'
|
124
128
|
@board.close_connection
|
129
|
+
logger.info 'Upload done!'
|
@@ -8,12 +8,12 @@ module Msp430Bsl
|
|
8
8
|
|
9
9
|
UART_CONFIGS = { data_bits: 8, stop_bits: 1, parity: SerialPort::EVEN }.transform_keys(&:to_s).freeze
|
10
10
|
|
11
|
-
WAIT_FOR_ACK_MAX =
|
12
|
-
WAIT_FOR_RESPONSE_MAX =
|
11
|
+
WAIT_FOR_ACK_MAX = 1000.millis
|
12
|
+
WAIT_FOR_RESPONSE_MAX = 1000.millis
|
13
13
|
|
14
14
|
MEM_START_MAIN_FLASH = 0x8000
|
15
15
|
|
16
|
-
CORE_COMMANDS_BUFFER_SIZE
|
16
|
+
CORE_COMMANDS_BUFFER_SIZE = 260
|
17
17
|
|
18
18
|
attr_reader :serial_port, :device_path, :logger, :cmd_buff_size
|
19
19
|
|
@@ -23,6 +23,7 @@ module Msp430Bsl
|
|
23
23
|
@cmd_buff_size = opts.fetch :cmd_buf_size, CORE_COMMANDS_BUFFER_SIZE
|
24
24
|
|
25
25
|
@serial_port = SerialPort.new @device_path
|
26
|
+
@serial_port.flow_control = SerialPort::NONE
|
26
27
|
end
|
27
28
|
|
28
29
|
def close_connection
|
@@ -13,7 +13,11 @@ module Msp430Bsl
|
|
13
13
|
end
|
14
14
|
class MessageNotSupported < StandardError
|
15
15
|
def initialize(value)
|
16
|
-
message =
|
16
|
+
message = if value
|
17
|
+
"message with value 0x#{value.to_hex_str} not supported"
|
18
|
+
else
|
19
|
+
"message without a value"
|
20
|
+
end
|
17
21
|
super(message)
|
18
22
|
end
|
19
23
|
end
|
data/lib/msp430_bsl/version.rb
CHANGED
metadata
CHANGED
@@ -1,14 +1,14 @@
|
|
1
1
|
--- !ruby/object:Gem::Specification
|
2
2
|
name: msp430_bsl
|
3
3
|
version: !ruby/object:Gem::Version
|
4
|
-
version: 0.
|
4
|
+
version: 0.3.0
|
5
5
|
platform: ruby
|
6
6
|
authors:
|
7
7
|
- Alessandro Verlato
|
8
8
|
autorequire:
|
9
9
|
bindir: bin
|
10
10
|
cert_chain: []
|
11
|
-
date: 2023-
|
11
|
+
date: 2023-10-18 00:00:00.000000000 Z
|
12
12
|
dependencies:
|
13
13
|
- !ruby/object:Gem::Dependency
|
14
14
|
name: zeitwerk
|
@@ -112,7 +112,7 @@ required_rubygems_version: !ruby/object:Gem::Requirement
|
|
112
112
|
- !ruby/object:Gem::Version
|
113
113
|
version: '0'
|
114
114
|
requirements: []
|
115
|
-
rubygems_version: 3.
|
115
|
+
rubygems_version: 3.4.20
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Texas Instrument MSP430 BSL Ruby library
|