msp430_bsl 0.1.2 → 0.2.0

Sign up to get free protection for your applications and to get access to all the features.
checksums.yaml CHANGED
@@ -1,7 +1,7 @@
1
1
  ---
2
2
  SHA256:
3
- metadata.gz: 4348c30b38b554c1acc4ae87bf794d41b5b0e093187b0d943a549524bbdb524e
4
- data.tar.gz: ed9d5f99c55f4f773d30aada91db6e581a4b2a2659b68cf478da4c3c348f4aed
3
+ metadata.gz: 6f8dd8c87262211f1ebb94d9399262f04b57d713d02e78c5b0409ef21d01fe55
4
+ data.tar.gz: 58a14360aa3a75747cb57a1c74f73ce9ac2509169e1ccb661328632a720316be
5
5
  SHA512:
6
- metadata.gz: c6d2884fb6079fb1a5211803dfcb9793316a69556287ffd3ddec8d6c9f0fab2f4972484b1eb7bcd97bf9ebf3ce89e46ad113f640ddc8c717ddd8ac7ad0de2724
7
- data.tar.gz: 642e82aa7eb54c4b60b81f02e311b40e3891820e1b67e0ec51c120f4d99e10af9ae2714375aea899eac64e9bd0c668d09161e9716f768ae86f7075bce31d26a9
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']. Defaults to 'debug'", default: :debug
23
- o.bool '-e', '--erase_info', 'Erase info memory', default: false # TODO: implement
24
- o.bool '-c', '--check', 'Verify flash content after each data block write', default: true
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 'Changing UART BAUD to 115200'
52
- @board.send_command :change_baud_rate, data: Msp430Bsl::Configs::BAUD_RATES[HIGH_SPEED_UART_BAUD]
53
- @board.set_uart_speed HIGH_SPEED_UART_BAUD
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]
@@ -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 = "message with value 0x#{value.to_hex_str} not supported"
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
@@ -1,3 +1,3 @@
1
1
  module Msp430Bsl
2
- VERSION = '0.1.2'.freeze
2
+ VERSION = '0.2.0'.freeze
3
3
  end
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.1.2
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-08-17 00:00:00.000000000 Z
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.3.7
115
+ rubygems_version: 3.4.20
116
116
  signing_key:
117
117
  specification_version: 4
118
118
  summary: Texas Instrument MSP430 BSL Ruby library