Review changes + including config header from toolchain.get_config_header() instead of hardcoding it to project file.

pull/4779/head
Jarno Komula 2017-07-20 13:10:06 +03:00 committed by Jaakko Heikkilä
parent 0b90c827bd
commit fbc4a89607
2 changed files with 34 additions and 21 deletions

View File

@ -15,8 +15,10 @@ See the License for the specific language governing permissions and
limitations under the License.
"""
import copy
from os import walk, sep
from os.path import splitext, basename, join, dirname
from os.path import splitext, basename, join, dirname, relpath
from random import randint
from tools.utils import mkdir
from tools.export.exporters import Exporter
@ -251,7 +253,7 @@ class Sw4STM32(Exporter):
def __gen_dir(self, dir_name):
"""
Method that created directory
Method that creates directory
"""
settings = join(self.export_dir, dir_name)
mkdir(settings)
@ -268,9 +270,9 @@ class Sw4STM32(Exporter):
This function removes ./ from str.
str must be converted with win_to_unix() before using this function.
"""
if path is None:
return None
if path[:2] == './':
if not path:
return path
if path.startswith('./'):
return path[2:]
return path
@ -302,15 +304,12 @@ class Sw4STM32(Exporter):
Method adds path to excluded list if not needed
and is not subdirectory of already excluded directory
"""
found = False
for used in self.include_path:
if path == used:
found = True
found = path in self.include_path
needtoadd = True
if not found:
for directory in self.exclude_dirs:
# Do not exclude subfolders from excluded folder
if path.find(directory+'/') != -1:
# Do not exclude subfolders from excluded folder
if directory+'/' in path:
needtoadd = False
if needtoadd:
self.exclude_dirs.append(path)
@ -326,6 +325,8 @@ class Sw4STM32(Exporter):
fp_hardware = "fpv5-d16"
fp_abi = "softfp"
config_header = self.filter_dot(self.toolchain.get_config_header())
self.resources.win_to_unix()
libraries = []
@ -346,7 +347,6 @@ class Sw4STM32(Exporter):
ld_script = self.filter_dot(self.resources.linker_script)
# self.lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
lib_dirs = [self.filter_dot(s) for s in self.resources.lib_dirs]
symbols = [s.replace('"', '"')
@ -355,6 +355,7 @@ class Sw4STM32(Exporter):
ctx = {
'name': self.project_name,
'include_paths': self.include_path,
'config_header': config_header,
'exclude_paths': self.exclude_dirs,
'linker_script': ld_script,
'library_paths': lib_dirs,
@ -363,8 +364,6 @@ class Sw4STM32(Exporter):
'symbols': symbols,
'board_name': self.BOARDS[self.target.upper()]['name'],
'mcu_name': self.BOARDS[self.target.upper()]['mcuId'],
'c_include_uid': self.__generate_uid(),
'cpp_include_uid': self.__generate_uid(),
'debug_config_uid': self.__generate_uid(),
'debug_tool_compiler_uid': self.__generate_uid(),
'debug_tool_compiler_input_uid': self.__generate_uid(),

View File

@ -36,9 +36,11 @@
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
<option id="gnu.c.compiler.option.include.files.{{c_include_uid}}" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/mbed_config.h"/>
{% if config_header %}
<option id="gnu.c.compiler.option.include.files.{{uid}}" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/{{config_header}}"/>
</option>
{% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{release_tool_compiler_input_uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
@ -56,9 +58,11 @@
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
<option id="gnu.cpp.compiler.option.include.files.{{cpp_include_uid}}" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/mbed_config.h"/>
</option>
{% if config_header %}
<option id="gnu.cpp.compiler.option.include.files.{{uid}}" name="Include files (-include)" superClass="gnu.cpp.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/{{config_header}}"/>
</option>
{% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
</tool>
@ -103,7 +107,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="{{exclude_paths}}" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="{{exclude_paths}}|Debug|Release" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>
@ -142,6 +146,11 @@
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
{% if config_header %}
<option id="gnu.c.compiler.option.include.files.{{uid}}" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/{{config_header}}"/>
</option>
{% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c.{{debug_tool_compiler_input_uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.c"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.c.compiler.input.s"/>
</tool>
@ -158,6 +167,11 @@
<listOptionValue builtIn="false" value="{{s}}"/>
{% endfor %}
</option>
{% if config_header %}
<option id="gnu.cpp.compiler.option.include.files.{{uid}}" name="Include files (-include)" superClass="gnu.c.compiler.option.include.files" useByScannerDiscovery="false" valueType="includeFiles">
<listOptionValue builtIn="false" value="${ProjDirPath}/{{config_header}}"/>
</option>
{% endif %}
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.cpp"/>
<inputType id="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s.{{uid}}" superClass="fr.ac6.managedbuild.tool.gnu.cross.cpp.compiler.input.s"/>
</tool>
@ -203,7 +217,7 @@
</toolChain>
</folderInfo>
<sourceEntries>
<entry excluding="{{exclude_paths}}" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
<entry excluding="{{exclude_paths}}|Debug|Release" flags="VALUE_WORKSPACE_PATH|RESOLVED" kind="sourcePath" name=""/>
</sourceEntries>
</configuration>
</storageModule>