Пример #1
0
 def get_padding(self):
   fake_header = tbfh.TBFHeader("")
   fake_header.version = 2
   fake_header.fields["header_size"] = 0x10
   fake_header.fields["total_size"] = (
       SUPPORTED_BOARDS[self.args.board].app_address -
       SUPPORTED_BOARDS[self.args.board].padding_address)
   fake_header.fields["flags"] = 0
   return fake_header.get_binary()
Пример #2
0
 def install_padding(self):
     fake_header = tbfh.TBFHeader("")
     fake_header.version = 2
     fake_header.fields["header_size"] = 0x10
     fake_header.fields["total_size"] = 0x10000
     fake_header.fields["flags"] = 0
     padding = fake_header.get_binary()
     info("Flashing padding application")
     args = copy.copy(self.tockloader_default_args)
     setattr(args, "address", 0x30000)
     tock = loader.TockLoader(args)
     tock.open(args)
     try:
         tock.flash_binary(padding, args.address)
     except TockLoaderException as e:
         fatal("Couldn't install padding: {}".format(str(e)))
Пример #3
0
 def install_padding(self):
     fake_header = tbfh.TBFHeader("")
     fake_header.version = 2
     fake_header.fields["header_size"] = 0x10
     fake_header.fields["total_size"] = 0x10000
     fake_header.fields["flags"] = 0
     padding = fake_header.get_binary()
     if self.args.dfu:
         info("Save padding")
         padding_filename = os.path.join(self.tab_folder, "padding.bin")
         with open(padding_filename, "wb") as f:
             f.write(padding)
     else:
         info("Flashing padding application")
         args = copy.copy(self.tockloader_default_args)
         setattr(args, "address", 0x30000)
         tock = tockloader.TockLoader(args)
         tock.open(args)
         try:
             tock.flash_binary(padding, args.address)
         except TockLoaderException as e:
             fatal("Couldn't install padding: {}".format(str(e)))