Ejemplo n.º 1
0
Archivo: wap.py Proyecto: mistsys/pycs
    def __init__(self, ui, dbgio):
        self.ui = ui
        self.dbgio = dbgio
        self.device = vendor.get_device(self.ui, soc_name)
        self.dbgio.connect(self.device.cpu_info.name, 'swd')
        self.cpu = cortexm.cortexm(self, ui, self.dbgio, self.device)
        self.device.bind_cpu(self.cpu)
        self.mem = mem.mem(self.cpu)
        self.flash = flash.flash(flash_driver.flash(self.device), self.device,
                                 self.mem)
        gpio_drv = (gpio_driver.drv(self.device, gpio_cfg))
        self.gpio = gpio.gpio(gpio_drv)
        self.i2c = i2c.i2c(i2c_driver.bitbang(gpio_drv, 'P0.27', 'P0.26'))
        # setup the rtt client
        ram = self.device.ram
        self.rtt = rtt.rtt(self.cpu, mem.region('ram', ram.address, ram.size))

        self.menu_root = (
            ('cpu', self.cpu.menu, 'cpu functions'),
            ('da', self.cpu.cmd_disassemble, cortexm.help_disassemble),
            ('debugger', self.dbgio.menu, 'debugger functions'),
            ('exit', self.cmd_exit),
            ('flash', self.flash.menu, 'flash functions'),
            ('go', self.cpu.cmd_go),
            ('gpio', self.gpio.menu, 'gpio functions'),
            ('halt', self.cpu.cmd_halt),
            ('help', self.ui.cmd_help),
            ('history', self.ui.cmd_history, cli.history_help),
            ('i2c', self.i2c.menu, 'i2c functions'),
            ('map', self.device.cmd_map),
            ('mem', self.mem.menu, 'memory functions'),
            ('program', self.flash.cmd_program, flash.help_program),
            ('regs', self.cmd_regs, soc.help_regs),
            ('rtt', self.rtt.menu, 'rtt client functions'),
            ('vtable', self.cpu.cmd_vtable),
        )

        self.ui.cli.set_root(self.menu_root)
        self.set_prompt()
        self.dbgio.cmd_info(self.ui, None)
Ejemplo n.º 2
0
  def __init__(self, ui, dbgio):
    self.ui = ui
    self.dbgio = dbgio
    self.device = vendor.get_device(self.ui, soc_name)
    self.dbgio.connect(self.device.cpu_info.name, 'swd')
    self.cpu = cortexm.cortexm(self, ui, self.dbgio, self.device)
    self.device.bind_cpu(self.cpu)
    self.mem = mem.mem(self.cpu)
    self.flash = flash.flash(flash_driver.flash(self.device), self.device, self.mem)
    gpio_drv = (gpio_driver.drv(self.device, gpio_cfg))
    self.gpio = gpio.gpio(gpio_drv)
    self.i2c = i2c.i2c(i2c_driver.gpio(gpio_drv, 'P0.27', 'P0.26'))
    # setup the rtt client
    ram = self.device.ram
    self.rtt = rtt.rtt(self.cpu, mem.region('ram', ram.address, ram.size))

    self.menu_root = (
      ('cpu', self.cpu.menu, 'cpu functions'),
      ('da', self.cpu.cmd_disassemble, cortexm.help_disassemble),
      ('debugger', self.dbgio.menu, 'debugger functions'),
      ('exit', self.cmd_exit),
      ('flash', self.flash.menu, 'flash functions'),
      ('go', self.cpu.cmd_go),
      ('gpio', self.gpio.menu, 'gpio functions'),
      ('halt', self.cpu.cmd_halt),
      ('help', self.ui.cmd_help),
      ('history', self.ui.cmd_history, cli.history_help),
      ('i2c', self.i2c.menu, 'i2c functions'),
      ('map', self.device.cmd_map),
      ('mem', self.mem.menu, 'memory functions'),
      ('program', self.flash.cmd_program, flash.help_program),
      ('regs', self.cmd_regs, soc.help_regs),
      ('rtt', self.rtt.menu, 'rtt client functions'),
      ('vtable', self.cpu.cmd_vtable),
    )

    self.ui.cli.set_root(self.menu_root)
    self.set_prompt()
    self.dbgio.cmd_info(self.ui, None)