Sha256: c7b91c86592eddaae1760d010a57ac58038f70fa1adc3112cfbc690f88cf2f4e

Contents?: true

Size: 764 Bytes

Versions: 1

Compression:

Stored size: 764 Bytes

Contents

options = {}
opt_parser = OptionParser.new do |opts|
  opts.banner = <<-END
Usage: origen cr:import FILE [options]

Import the given file into Origen format.
This will output a Ruby module that can then be included in an Origen model
to add the contained registers, sub-blocks, etc.

END
  opts.on('-o', '--output PATH', String, 'Override the default output file') { |t| options[:output] = t }
end
opt_parser.parse! ARGV

file = ARGV[0]
unless file
  puts 'You must supply a file to import!'
  exit
end

unless File.exist?(file)
  puts 'That file does not exist!'
  exit
end

snippet = IO.read(file, 2000)  # Read first 2000 characters
case snippet
when /CMSIS-SVD.xsd/
  CrossOrigen::CMSISSVD.new(nil).import(file, options)
else
  puts 'Unknown file format!'
end

Version data entries

1 entries across 1 versions & 1 rubygems

Version Path
cross_origen-0.7.0 lib/cross_origen/commands/import.rb