mbed official / mbed-sdk-tools

export/e2studio/__init__.py

Committer:
theotherjimmy
Date:
2018-09-25
Revision:
43:2a7da56ebd24
Parent:
41:2a77626a4c21

File content as of revision 43:2a7da56ebd24:

"""
mbed SDK
Copyright (c) 2011-2016 ARM Limited

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.
"""
from os import remove
from tools.export.gnuarmeclipse import GNUARMEclipse

class E2Studio(GNUARMEclipse):
    NAME = 'e2 studio'
    TOOLCHAIN = 'GCC_ARM'

    TARGETS = [
        'RZ_A1H',
        'VK_RZ_A1H',
        'GR_LYCHEE',
    ]

    # override
    def generate(self):

        jinja_ctx = self.create_jinja_ctx()

        self.gen_file('e2studio/.cproject.tmpl', jinja_ctx, '.cproject', trim_blocks=True, lstrip_blocks=True)
        self.gen_file('e2studio/.gdbinit.tmpl', jinja_ctx, '.gdbinit')
        self.gen_file('e2studio/launch5x.tmpl', jinja_ctx, '%s OpenOCD 5x.launch' % self.project_name, trim_blocks=True, lstrip_blocks=True)
        self.gen_file('e2studio/launch.tmpl', jinja_ctx, '%s OpenOCD.launch' % self.project_name, trim_blocks=True, lstrip_blocks=True)

        self.gen_file('gnuarmeclipse/.project.tmpl', jinja_ctx, '.project', trim_blocks=True, lstrip_blocks=True)
        self.gen_file_nonoverwrite('gnuarmeclipse/mbedignore.tmpl', jinja_ctx, '.mbedignore')
        self.gen_file('gnuarmeclipse/makefile.targets.tmpl', jinja_ctx, 'makefile.targets', trim_blocks=True, lstrip_blocks=True)

    @staticmethod
    def clean(project_name):
        remove('%s OpenOCD 5x.launch' % project_name)
        remove('%s OpenOCD.launch' % project_name)