示例#1
0
 def read_symbol(self, name, shape=int):
   if Gum.meta['symbols'][name]['mem'] == 'flash':
     arr = self.read_flash(Gum.meta['symbols'][name]['adr'], bytearray(Gum.meta['symbols'][name]['size']))
   else:
     arr = uart.access(0, Gum.meta['symbols'][name]['adr'], bytearray(Gum.meta['symbols'][name]['size']))
 
   if shape == int:
     return tools.to_int(arr)
   else:
     return arr
示例#2
0
 def read_symbol_dbgcp(self, name, shape=int):
   if Gum.meta['symbols'][name]['mem'] == 'ram' and \
      Gum.meta['symbols']['__dbg2cp_start']['adr'] <= Gum.meta['symbols'][name]['adr'] < Gum.meta['symbols']['__dbg2cp_end']['adr']:
     offset = Gum.meta['symbols']['__dbgcp_start']['adr'] - Gum.meta['symbols']['__dbg2cp_start']['adr']
     arr = uart.access(0, Gum.meta['symbols'][name]['adr'] + offset, bytearray(Gum.meta['symbols'][name]['size']))
   else:
     raise Exception("Not a dbgcp symbol.")
 
   if shape == int:
     return tools.to_int(arr)
   else:
     return arr
示例#3
0
defines = {
    #  "F_CPU"   : 9216000,
    #  "BAUD"    : 230400,
    "F_CPU": 16000000,
    "BAUD": 38400,
    #  "NDEBUG" : "",
    "__ASSERT_USE_STDERR": "",  # I have my own assert right now anyway
    "__DELAY_BACKWARD_COMPATIBLE__": "",  # compile error with 4.7.2
    "PLAIN_CONSOLE": 0,
    "BUILD_SEC": build_time[0],
    "BUILD_MIN": build_time[1],
    "BUILD_HOUR": build_time[2],
    "BUILD_WEEKDAY": build_time[3],
    "BUILD_DAY": build_time[4],
    "BUILD_MONTH": build_time[5],
    "BUILD_YEAR": tools.to_int(build_time[6:8])
}

cflags = (
    #"-g3",   # gstabs+
    #"-ggdb3", # dwarf # segmentation fault in lto1
    #"-feliminate-dwarf2-dups",
    "-gdwarf-4",
    "-g3",
    "-gstrict-dwarf",
    "-Os",
    #"-v", "-save-temps", # GCC debugging
    #"-mmcu=atmega32",
    "-mmcu=atmega328p",
    "-std=gnu99",
示例#4
0
  def skeleton(self, body, gumi = None):
    html = el('html')
    html.attrib['xmlns'] = 'http://www.w3.org/1999/xhtml'
    head = el('head')
    title = el('title')
    title.text = "Arduino"
    head.append(title)
    html.append(head)
    body.append(el('hr'))
    link_tab = el('table')
    tr = el('tr')
    for i in dir(self):
      attr = eval('self.' + i)
      if hasattr(attr, 'link') and hasattr(attr, 'exposed') and attr.exposed:
        td = el('td')
        a = el('a')
        a.attrib['href'] = attr.__name__
        a.text = attr.link
        td.append(a)
        tr.append(td)
    link_tab.append(tr)
    body.append(link_tab)
    body.append(el('hr'))
   
    if gumi:
      times = el('p')
      times.text = ""
      
      daylist   = [ 'Mon', 'Tue', 'Wed', 'Thu', 'Fri', 'Sat', 'Sun' ]
      monthlist = [ 'Jan', 'Feb', 'Mar', 'Apr', 'May', 'Jun', 'Jul', 'Aug', 'Sep', 'Oct', 'Nov', 'Dec' ]
      date = gumi.read_symbol('date', None)
      
      times.text += "%s, %d %s %2d " % (daylist[date[3]], date[4] + 1, monthlist[date[5]], tools.to_int(date[6:8])) # date
      times.text += "%d:%02d:%02d " % (date[2], date[1], date[0])
      
      uptime = gumi.read_symbol('uptime')
      up_days   = uptime / (60 * 60 * 24)
      uptime   %= (60 * 60 * 24)
      up_hours  = uptime / (60 * 60)
      uptime   %= (60 * 60)
      up_mins  = uptime / 60 
      uptime   %= 60

      times.text += "(Uptime: %dd %dh %dm %ds)" % (up_days, up_hours, up_mins, uptime)
      body.append(times)

    html.append(body)
    page = ""
    page += '<?xml version="1.0" encoding="UTF-8"?>'
    page += '<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Strict//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-strict.dtd">'
    page += xml.etree.ElementTree.tostring(html).decode()
    return page
示例#5
0
#  "F_CPU"   : 9216000,
#  "BAUD"    : 230400,
  "F_CPU"   : 16000000,
  "BAUD"    : 38400,
#  "NDEBUG" : "",
  "__ASSERT_USE_STDERR" : "", # I have my own assert right now anyway
  "__DELAY_BACKWARD_COMPATIBLE__" : "", # compile error with 4.7.2
  "PLAIN_CONSOLE" : 0,

  "BUILD_SEC"     : build_time[0],
  "BUILD_MIN"     : build_time[1],
  "BUILD_HOUR"    : build_time[2],
  "BUILD_WEEKDAY" : build_time[3],
  "BUILD_DAY"     : build_time[4],
  "BUILD_MONTH"   : build_time[5],
  "BUILD_YEAR"    : tools.to_int(build_time[6:8])
}

cflags = (
#"-g3",   # gstabs+
#"-ggdb3", # dwarf # segmentation fault in lto1
#"-feliminate-dwarf2-dups",
"-gdwarf-4", "-g3",
"-gstrict-dwarf",

"-Os",
#"-v", "-save-temps", # GCC debugging
#"-mmcu=atmega32",
"-mmcu=atmega328p",
"-std=gnu99",