How to use the tockloader.openocd.OpenOCD 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
'''
		Select and then open the correct channel to talk to the board.

		For the bootloader, this means opening a serial port. For JTAG, not much
		needs to be done.
		'''

		# Verify both openocd and jlink are not set.
		if getattr(self.args, 'jlink', False) and getattr(self.args, 'openocd', False):
			raise TockLoaderException('Cannot use both --jlink and --openocd options')

		# Get an object that allows talking to the board.
		if hasattr(self.args, 'jlink') and self.args.jlink:
			self.channel = JLinkExe(self.args)
		elif hasattr(self.args, 'openocd') and self.args.openocd:
			self.channel = OpenOCD(self.args)
		else:
			self.channel = BootloaderSerial(self.args)

		# And make sure the channel is open (e.g. open a serial port).
		self.channel.open_link_to_board()