Clone of official tools

Revision:
43:2a7da56ebd24
Parent:
40:7d3fa6b99b2b
--- a/export/cmsis/__init__.py	Mon Nov 06 13:17:14 2017 -0600
+++ b/export/cmsis/__init__.py	Tue Sep 25 13:43:09 2018 -0500
@@ -2,13 +2,13 @@
 from os.path import sep, join, exists
 from itertools import groupby
 from xml.etree.ElementTree import Element, tostring
-import ntpath
 import re
 import json
 
 from tools.arm_pack_manager import Cache
 from tools.targets import TARGET_MAP
 from tools.export.exporters import Exporter, TargetNotSupportedException
+from tools.utils import split_path
 
 class fileCMSIS():
     """CMSIS file class.
@@ -37,7 +37,8 @@
         if not target_info:
             raise TargetNotSupportedException("Target not supported in CMSIS pack")
         self.url = target_info['pdsc_file']
-        self.pack_url, self.pack_id = ntpath.split(self.url)
+        self.pdsc_url, self.pdsc_id, _ = split_path(self.url)
+        self.pack_url, self.pack_id, _ = split_path(target_info['pack_file'])
         self.dname = target_info["_cpu_name"]
         self.core = target_info["_core"]
         self.dfpu = target_info['processor']['fpu']
@@ -97,6 +98,7 @@
         cpu = cpu.replace("Cortex-","ARMC")
         cpu = cpu.replace("+","P")
         cpu = cpu.replace("F","_FP")
+        cpu = cpu.replace("-NS", "")
         return cpu
 
 
@@ -142,7 +144,7 @@
     def generate(self):
         srcs = self.resources.headers + self.resources.s_sources + \
                self.resources.c_sources + self.resources.cpp_sources + \
-               self.resources.objects + self.resources.libraries + \
+               self.resources.objects + self.libraries + \
                [self.resources.linker_script]
         srcs = [fileCMSIS(src, src) for src in srcs if src]
         ctx = {
@@ -152,3 +154,8 @@
             'date': ''
         }
         self.gen_file('cmsis/cpdsc.tmpl', ctx, 'project.cpdsc')
+
+
+    @staticmethod
+    def clean(_):
+        os.remove('project.cpdsc')