msp430_bsl 0.1.1 → 0.2.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 +10 -8
- data/lib/msp430_bsl/uart/exceptions.rb +5 -1
- data/lib/msp430_bsl/uart/peripheral_interface.rb +1 -0
- 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: 6f8dd8c87262211f1ebb94d9399262f04b57d713d02e78c5b0409ef21d01fe55
|
4
|
+
data.tar.gz: 58a14360aa3a75747cb57a1c74f73ce9ac2509169e1ccb661328632a720316be
|
5
5
|
SHA512:
|
6
|
-
metadata.gz:
|
7
|
-
data.tar.gz:
|
6
|
+
metadata.gz: 634b16289e8c5ba1d14c207e0f57f4a51e057a87081d3a699e18e145c09d23432a09c55317e7e19d5eb26d97dcb51eb3f87d156aa6834e1d0b322e58ab244a75
|
7
|
+
data.tar.gz: 42ee1e8a9b67ea7a316f429a4ba70784f58b1513548fb1e29ba0da476c3dd67d271701480da31e9177af6920ac72b291230665a01243ffe3a413d934fbb264ae
|
data/bin/upload_hex
CHANGED
@@ -10,7 +10,6 @@ STDOUT.sync = true
|
|
10
10
|
|
11
11
|
include Msp430Bsl::Utils
|
12
12
|
|
13
|
-
HIGH_SPEED_UART_BAUD = 115200.freeze
|
14
13
|
MAX_WRITE_ATTEMPTS = 3
|
15
14
|
|
16
15
|
@opts = {}
|
@@ -19,9 +18,10 @@ begin
|
|
19
18
|
o.string '-d', '--device', 'Mandatory: Path to serial programmer device', required: true
|
20
19
|
o.string '-f', '--hexfile', 'Mandatory: Path to HEX file to load', required: true
|
21
20
|
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 '-
|
21
|
+
o.string '-l', '--loglevel', "Logger level. One of ['fatal', 'error', 'warn', 'info', 'debug']. Default: 'debug'", default: :debug
|
22
|
+
o.integer '-b', '--baud', 'BAUD rate with which communicate to BSL. Default: 115200', default: 115200
|
23
|
+
o.bool '-e', '--erase_info', 'Erase info memory. Default: false', default: false # TODO: implement
|
24
|
+
o.bool '-c', '--check', 'Verify flash content after each data block write. Default: true', default: true
|
25
25
|
o.bool '-h', '--help', 'Print this help' do
|
26
26
|
puts "#{o}\n"
|
27
27
|
exit
|
@@ -37,6 +37,7 @@ end
|
|
37
37
|
|
38
38
|
logger = build_logger_from @opts
|
39
39
|
|
40
|
+
# Build UART Connection
|
40
41
|
@board = Msp430Bsl::Uart::Connection.new @opts[:device], logger: logger
|
41
42
|
|
42
43
|
# Enter BSL
|
@@ -48,9 +49,9 @@ logger.info 'Mass erasing FLASH'
|
|
48
49
|
logger.info "Unlocking BSL's password protected commands"
|
49
50
|
@board.send_command :rx_password, data: Msp430Bsl::Configs::CMD_RX_PASSWORD
|
50
51
|
# 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
|
52
|
+
logger.info "Changing UART BAUD to #{@opts[:baud]}"
|
53
|
+
@board.send_command :change_baud_rate, data: Msp430Bsl::Configs::BAUD_RATES[@opts[:baud]]
|
54
|
+
@board.set_uart_speed @opts[:baud]
|
54
55
|
|
55
56
|
# If everything has gone well so far...
|
56
57
|
hexfile = Msp430Bsl::HexFile.new @opts[:hexfile]
|
@@ -98,7 +99,7 @@ line_groups.each do |group|
|
|
98
99
|
if curr_data_packet.empty?
|
99
100
|
# Use current line's addr as packet addr
|
100
101
|
curr_data_packet << line
|
101
|
-
curr_data_size +=
|
102
|
+
curr_data_size += line.data_length + Msp430Bsl::Uart::PeripheralInterface::TOTAL_SIZE
|
102
103
|
elsif (curr_data_size + line.data_length) <= Msp430Bsl::Uart::Connection::CORE_COMMANDS_BUFFER_SIZE
|
103
104
|
# If there's still room, append the line data
|
104
105
|
curr_data_packet << line
|
@@ -122,3 +123,4 @@ end
|
|
122
123
|
|
123
124
|
logger.info 'Closing connection'
|
124
125
|
@board.close_connection
|
126
|
+
logger.info 'Upload done!'
|
@@ -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.2.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.4.
|
115
|
+
rubygems_version: 3.4.20
|
116
116
|
signing_key:
|
117
117
|
specification_version: 4
|
118
118
|
summary: Texas Instrument MSP430 BSL Ruby library
|