Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
def command_unsticky_app (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Making apps no longer sticky...')
tock_loader.set_flag(args.name, 'sticky', False)
def command_install (args):
check_and_run_make(args)
# Load in all TABs
tabs = collect_tabs(args)
# Install the apps on the board
tock_loader = TockLoader(args)
tock_loader.open()
# Figure out how we want to do updates
replace = 'yes'
if args.no_replace:
replace = 'no'
logging.status('Installing app{} on the board...'.format(helpers.plural(len(tabs))))
tock_loader.install(tabs, replace=replace, erase=args.erase, sticky=args.sticky)
def command_set_attribute (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Setting attribute...')
tock_loader.set_attribute(args.key, args.value)
def command_list_attributes (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Listing attributes...')
tock_loader.list_attributes()
def command_erase_apps (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Removing apps...')
tock_loader.erase_apps()
def command_sticky_app (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Making apps sticky...')
tock_loader.set_flag(args.name, 'sticky', True)
def command_dump_flash_page (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Getting page of flash...')
tock_loader.dump_flash_page(args.page)
def command_enable_app (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Enabling apps...')
tock_loader.set_flag(args.name, 'enable', True)
def command_remove_attribute (args):
tock_loader = TockLoader(args)
tock_loader.open()
logging.status('Removing attribute...')
tock_loader.remove_attribute(args.key)
binary = bytes()
count = 0
for binary_name in args.binary:
# check that file isn't a `.hex` file
if binary_name.endswith('.hex'):
exception_string = 'Error: Cannot flash ".hex" files.'
exception_string += ' Likely you meant to use a ".bin" file but used an intel hex file by accident.'
raise TockLoaderException(exception_string)
# add contents to binary
with open(binary_name, 'rb') as f:
binary += f.read()
count += 1
# Flash the binary to the chip
tock_loader = TockLoader(args)
tock_loader.open()
plural = 'y'
if count > 1:
plural = 'ies'
logging.status('Flashing binar{} to board...'.format(plural))
tock_loader.flash_binary(binary, args.address)