<commit_before># Copyright 2014 <NAME>, Analog Devices
# Licensed under GPLv3
# This is fully functional sam-ba client capable of loading a binary executable onto the internal flash of a sam3u processor.
# This code is not impacted by any of the bugs in the ROM

import bitstring
import glob
import sys
import time
import usb

# make sure we're using >=pyusb-1
if usb.version_info[0] < 1:
    print "pyusb-1 or newer is required"
    sys.exit(1)

print "please wait..."

raw = open("./m1000.bin").read()
raw += '\x00'*(256-len(raw)%256)

fw = bitstring.ConstBitStream(bytes=raw)

dev = usb.core.find(idVendor=0x03eb,idProduct=0x6124)

try:
	dev.detach_kernel_driver(0)
	dev.detach_kernel_driver(1)
except:
	pass

dev.set_configuration(1)
regBase = 0x400e0800
flashBase = 0x80000<commit_msg>scripts/sam-ba.py: exit if no device is found<commit_after># Copyright 2014 <NAME>, Analog Devices
# Licensed under GPLv3
# This is fully functional sam-ba client capable of loading a binary executable onto the internal flash of a sam3u processor.
# This code is not impacted by any of the bugs in the ROM

import bitstring
import glob
import sys
import time
import usb

# make sure we're using >=pyusb-1
if usb.version_info[0] < 1:
    print "pyusb-1 or newer is required"
    sys.exit(1)

print "please wait..."

raw = open("./m1000.bin").read()
raw += '\x00'*(256-len(raw)%256)

fw = bitstring.ConstBitStream(bytes=raw)

dev = usb.core.find(idVendor=0x03eb,idProduct=0x6124)
if dev is None:
    print "no device found"
    sys.exit(1)

try:
	dev.detach_kernel_driver(0)
	dev.detach_kernel_driver(1)
except:
	pass

dev.set_configuration(1)
regBase = 0x400e0800
flashBase = 0x80000
{'fraction_non_alphanumeric': 0.10406698564593302, 'fraction_numerical': 0.05801435406698564, 'mean_word_length': 4.503289473684211, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '64516', 'n_tokens_mistral': 648, 'n_tokens_neox': 581, 'n_words': 190}