Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions project_generator/project.py
Original file line number Diff line number Diff line change
Expand Up @@ -164,6 +164,8 @@ def get_project_template(name="Default", output_type='exe', debugger=None, build
'name': name, # project name
'output_type': output_type, # output type, default - exe
'target': '', # target
'device': '', # device name'
'pack' : '', #pack name
'tools_supported': [], # Tools which are supported,
}
project_template.update(ProjectTemplate._get_common_data_template())
Expand Down
33 changes: 33 additions & 0 deletions project_generator/templates/csolution.cproject.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
project:
setups:
- setup: Options for {{name}}
add-path:
{% for path in include_paths %}- {{path}}
{% endfor %}
debug: 'on'
define:
{% for symbol in macros %}- {{symbol | replace ('"', '\\"') }}
{% endfor %}
misc:
- C:
{% for flag in misc['c_flags'] %}- {{flag}}
{% endfor %}
C-CPP:
{% for flag in misc['cxx_flags'] %}- {{flag}}
{% endfor %}
Link:
{% for flag in misc['ld_flags'] %}- {{flag}}
{% endfor %}
- ASM:
{% for flag in misc['asm_flags'] %}- {{flag}}
{% endfor %}
linker:
- script: {{linker_file}}
groups:{% for group_name,files in groups.items() %}
- group: {{group_name}}
files:{% for file in files %}
- file: {{file.path}}{% endfor %}
{% endfor %}

components:
- component: ARM::CMSIS:CORE
19 changes: 19 additions & 0 deletions project_generator/templates/csolution.csolution.yml.tmpl
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
# This project was exported via the project generator.
# More information https://github.com/project-generator/project_generator
solution:
created-for: [email protected]
packs:
- pack: ARM::CMSIS
- pack: {{pack}}
compiler: AC6
target-types:
- type: Debug
device: {{device}}
debug: on
optimize: none
- type: Release
device: {{device}}
debug: off
optimize: size
projects:
- project: {{name}}.cproject.yml
72 changes: 72 additions & 0 deletions project_generator/tools/csolution.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,72 @@
# Copyright 2015 0xc0170
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
# http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

import os
import copy
import logging
import subprocess

from os.path import basename,join, normpath, dirname, exists
from .tool import Tool, Exporter
from .cmake import CMake
from .gccarm import MakefileGccArm
from ..util import SOURCE_KEYS

logger = logging.getLogger('progen.tools.csolution')

class csolution(CMake):

file_types = {'cpp': 1, 'c': 1, 's': 1, 'obj': 1, 'lib': 1, 'h': 1}
def __init__(self, workspace, env_settings):
super(csolution, self).__init__(workspace, env_settings)
self.logging = logging
self.workspace['preprocess_linker_file'] = True

@staticmethod
def get_toolnames():
return ['csolution']

@staticmethod
def get_toolchain():
return 'armclang'

def _expand_one_file(self, source, new_data, extension):
return {'path': source, 'name': basename(source), 'type': str(self.file_types[extension.lower()])}

def export_project(self):
""" Processes groups and misc options specific for eclipse, and run generator """
output = copy.deepcopy(self.generated_project)
data_for_make = self.workspace.copy()

expanded_dic = self.workspace.copy()
expanded_dic['rel_path'] = data_for_make['output_dir']['rel_path']
groups = self._get_groups(expanded_dic)
expanded_dic['groups'] = {}
for group in groups:
expanded_dic['groups'][group] = []
self._iterate(self.workspace, expanded_dic)

# delete default group
if 'default' in expanded_dic['groups']:
del expanded_dic['groups']['default']

# Project file
project_path, output['files']['cproj'] = self.gen_file_jinja(
'csolution.cproject.yml.tmpl', expanded_dic, expanded_dic['name']+'.cproject.yml', data_for_make['output_dir']['path'])
project_path, output['files']['proj_file'] = self.gen_file_jinja(
'csolution.csolution.yml.tmpl', expanded_dic, expanded_dic['name']+'.csolution.yml', data_for_make['output_dir']['path'])
return output

def get_workspace_template(self):
return 'cmakelist_armclang_workspace.tmpl'
2 changes: 2 additions & 0 deletions project_generator/tools_supported.py
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,7 @@
from .tools.cmakearmcc import CMakeArmcc
from .tools.cmakearmclang import CMakeArmClang
from .tools.visual_studio import VisualStudioMakeGCCARM, VisualStudioGDB
from .tools.csolution import csolution

class ToolsSupported:
""" Represents all tools available """
Expand Down Expand Up @@ -74,6 +75,7 @@ class ToolsSupported:
'cmake_armclang': CMakeArmClang,
'visual_studio_gdb': VisualStudioGDB,
'visual_studio_make_gcc_arm': VisualStudioMakeGCCARM,
'csolution': csolution,
}

TOOLCHAINS = list(set([v.get_toolchain() for k, v in TOOLS_DICT.items() if v.get_toolchain() is not None]))
Expand Down
Loading