How to use the tockloader.app_padding.PaddingApp function in tockloader

To help you get started, we’ve selected a few tockloader examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github tock / tockloader / tockloader / tockloader.py View on Github external
# Iterate all of the apps, and see if we can make this work based on
			# having apps compiled for the correct addresses. If so, great! If
			# not, error for now.
			to_flash_apps = []
			app_address = address
			for app in apps:
				# Ask the app where we can put it that is greater than or equal
				# to the current address we are looking at.
				next_loadable_address = app.get_next_loadable_address(app_address)
				if next_loadable_address == app_address:
					to_flash_apps.append(app)
					app_address += app.get_size()

				elif next_loadable_address != None:
					# Need to add padding.
					padding_app = PaddingApp(next_loadable_address - app_address)
					to_flash_apps.append(padding_app)
					app_address += padding_app.get_size()

					to_flash_apps.append(app)
					app_address += app.get_size()

				else:
					logging.error('Trying to find a location for app "{}"'.format(app))
					logging.error('  Address to use is {:#x}'.format(app_address))
					raise TockLoaderException('Could not load apps due to address mismatches')


			# Actually write apps to the board.
			app_address = address
			if self.args.bundle_apps:
				# Tockloader has been configured to bundle all apps as a single