Beispiel #1
0
 def cmsis_rtx5_component(self):
   cs = self._pack.components_by_name("CMSIS.RTOS2.Keil RTX5*")
   cvs = { (SemanticVersion(c.version()), SemanticVersion(c.apiversion())) for c in cs }
   if len(cvs) == 1:
     return cvs.pop()
   elif len(cvs) > 1:
     self.warning("Not all RTX5 components have same version information: %s", str([ (c.name(), c.version(), c.apiversion()) for c in cs ]))
   return None, None
Beispiel #2
0
  def introduction_txt(self, file, component = None):
    table = self._cmtable_(file)
    if table is None:
      return None

    if component:
      m = re.search(re.escape(component)+"\s+[Vv]?(\d+.\d+(.\d+)?)", table[1][1].text, re.MULTILINE)
      if m:
        return SemanticVersion(m.group(1))
    else:
      return SemanticVersion(table[1][0].text)
Beispiel #3
0
 def cmsis_corea_component(self):
   rte = { 'components' : set(), 'Dcore' : "Cortex-A9", 'Dvendor' : "*", 'Dname' : "*", 'Dtz' : "*", 'Dsecure' : "*", 'Tcompiler' : "*", 'Toptions' : "*" }
   cs = self._pack.component_by_name(rte, "CMSIS.CORE")
   cvs = { SemanticVersion(c.version()) for c in cs }
   if len(cvs) > 1:
     self.warning("Not all CMSIS-Core(A) components have same version information: %s", str([ (c.name(), c.version()) for c in cs ]))
   return cvs.pop()
Beispiel #4
0
 def _xsd(self, file, rev=False, history=False):
   if rev:
     return self._all_(file)
   elif history:
     return self._regex_(file, ".*[0-9]+\. [A-Z][a-z]+ [12][0-9]+: (v)?(\d+.\d+(.\d+)?).*", 2)
   else:
     xsd = lxml.etree.parse(str(file)).getroot()
     return SemanticVersion(xsd.get("version", None))
Beispiel #5
0
 def _revhistory_(self, file, skip=0):
     table = self._cmtable_(file, skip)
     if table is not None:
         m = re.match("[Vv]?(\d+.\d+(.\d+)?)", table[1][0].text)
         if m:
             return SemanticVersion(m.group(1))
     else:
         self._logger.info("Revision History table not found in " + file)
     return None
Beispiel #6
0
 def cmsis_rtos2_api(self):
     rte = {
         'components': set(),
         'Dcore': "",
         'Dvendor': "",
         'Dname': "",
         'Dtz': "",
         'Tcompiler': "",
         'Toptions': ""
     }
     comp = sorted(self._pack.component_by_name(rte, "CMSIS.RTOS2"),
                   reverse=True)[0]
     return SemanticVersion(comp.version())
Beispiel #7
0
 def _pdsc(self, file, component = None):
   pack = None
   if not file in self._packs:
     pack = Pack(file, None)
     self._packs[file] = pack
   else:
     pack = self._packs[file]
   if component:
     history = pack.history()
     for r in sorted(history.keys(), reverse=True):
       m = re.search(re.escape(component)+"(:)?\s+[Vv]?(\d+.\d+(.\d+)?)", history[r], re.MULTILINE)
       if m:
         return SemanticVersion(m.group(2))
   else:
     return pack.version()
Beispiel #8
0
    def check_files(self):
        """Files referenced by pack description"""
        # Check schema of pack description
        self.verify_schema(self._pack.location(), "CMSIS/Utilities/PACK.xsd")

        # Check schema of SVD files
        svdfiles = {d.svdfile() for d in self._pack.devices() if d.svdfile()}
        for svd in svdfiles:
            if os.path.exists(svd):
                self.verify_schema(svd, "CMSIS/Utilities/CMSIS-SVD.xsd")
            else:
                self.warning("SVD File does not exist: %s!", svd)

        # Check component file version
        for c in self._pack.components():
            cv = c.version()
            for f in c.files():
                hv = f.version()
                if c is Api:
                    if f.isHeader():
                        if not hv:
                            self.verify_version(f.location(), cv)
                if hv:
                    self.verify_version(f.location(), SemanticVersion(hv))
Beispiel #9
0
 def cmsis_rtos2_api(self):
   cs = self._pack.components_by_name("CMSIS.RTOS2")
   cvs = { SemanticVersion(c.version()) for c in cs }
   if len(cvs) > 1:
     self.warning("Not all CMSIS-RTOS2 APIs have same version information: %s", str([ (c.name(), c.version()) for c in cs ]))
   return cvs.pop()