Import Mbed OS hard-float snapshot
This commit is contained in:
117
tools/export/vscode/__init__.py
Normal file
117
tools/export/vscode/__init__.py
Normal file
@@ -0,0 +1,117 @@
|
||||
# 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 __future__ import print_function, absolute_import
|
||||
from builtins import str
|
||||
|
||||
|
||||
from os.path import join, exists, realpath, relpath, basename, isfile, splitext
|
||||
from os import makedirs, listdir, remove, rmdir
|
||||
import json
|
||||
|
||||
from tools.export.makefile import Makefile, GccArm, Armc5, IAR
|
||||
|
||||
class VSCode(Makefile):
|
||||
"""Generic VSCode project. Intended to be subclassed by classes that
|
||||
specify a type of Makefile.
|
||||
"""
|
||||
def generate(self):
|
||||
"""Generate Makefile and VSCode launch and task files
|
||||
"""
|
||||
super(VSCode, self).generate()
|
||||
|
||||
# So.... I want all .h and .hpp files in self.resources.inc_dirs
|
||||
all_directories = []
|
||||
|
||||
for directory in self.resources.inc_dirs:
|
||||
if not directory:
|
||||
continue
|
||||
|
||||
if directory == ".":
|
||||
all_directories.append("${workspaceFolder}/*")
|
||||
else:
|
||||
all_directories.append(directory.replace("./", "${workspaceFolder}/") + "/*")
|
||||
|
||||
cpp_props = {
|
||||
"configurations": [
|
||||
{
|
||||
"name": "Windows",
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/mbed_config.h"
|
||||
],
|
||||
"compilerPath": self.toolchain.cppc[0],
|
||||
"intelliSenseMode": "gcc-x64",
|
||||
"includePath": all_directories,
|
||||
"defines": [symbol for symbol in self.toolchain.get_symbols()]
|
||||
},
|
||||
{
|
||||
"name": "Mac",
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/mbed_config.h"
|
||||
],
|
||||
"compilerPath": self.toolchain.cppc[0],
|
||||
"includePath": all_directories,
|
||||
"defines": [symbol for symbol in self.toolchain.get_symbols()]
|
||||
},
|
||||
{
|
||||
"name": "Linux",
|
||||
"forcedInclude": [
|
||||
"${workspaceFolder}/mbed_config.h"
|
||||
],
|
||||
"compilerPath": self.toolchain.cppc[0],
|
||||
"includePath": all_directories,
|
||||
"defines": [symbol for symbol in self.toolchain.get_symbols()]
|
||||
}
|
||||
]
|
||||
}
|
||||
|
||||
ctx = {
|
||||
'name': self.project_name,
|
||||
'elf_location': join('BUILD', self.project_name)+'.elf',
|
||||
'c_symbols': self.toolchain.get_symbols(),
|
||||
'asm_symbols': self.toolchain.get_symbols(True),
|
||||
'target': self.target,
|
||||
'include_paths': self.resources.inc_dirs,
|
||||
'load_exe': str(self.LOAD_EXE).lower(),
|
||||
'cpp_props': json.dumps(cpp_props, indent=4, separators=(',', ': '))
|
||||
}
|
||||
|
||||
if not exists(join(self.export_dir, '.vscode')):
|
||||
makedirs(join(self.export_dir, '.vscode'))
|
||||
|
||||
config_files = ['launch', 'settings', 'tasks', 'c_cpp_properties']
|
||||
for file in config_files:
|
||||
if not exists('.vscode/%s.json' % file):
|
||||
self.gen_file('vscode/%s.tmpl' % file, ctx,
|
||||
'.vscode/%s.json' % file)
|
||||
else:
|
||||
print('Keeping existing %s.json' % file)
|
||||
|
||||
@staticmethod
|
||||
def clean(_):
|
||||
for f in ['launch', 'settings', 'tasts', 'c_cpp_properties']:
|
||||
remove(".vscode/%s.json" % f)
|
||||
rmdir(".vscode")
|
||||
|
||||
class VSCodeGcc(VSCode, GccArm):
|
||||
LOAD_EXE = True
|
||||
NAME = "VSCode-GCC-ARM"
|
||||
|
||||
class VSCodeArmc5(VSCode, Armc5):
|
||||
LOAD_EXE = True
|
||||
NAME = "VSCode-Armc5"
|
||||
|
||||
class VSCodeIAR(VSCode, IAR):
|
||||
LOAD_EXE = True
|
||||
NAME = "VSCode-IAR"
|
||||
1
tools/export/vscode/c_cpp_properties.tmpl
Normal file
1
tools/export/vscode/c_cpp_properties.tmpl
Normal file
@@ -0,0 +1 @@
|
||||
{{cpp_props}}
|
||||
64
tools/export/vscode/launch.tmpl
Normal file
64
tools/export/vscode/launch.tmpl
Normal file
@@ -0,0 +1,64 @@
|
||||
{
|
||||
"version": "0.2.0",
|
||||
"configurations": [
|
||||
{
|
||||
"name": "C++ Launch",
|
||||
"type": "cppdbg",
|
||||
"request": "launch",
|
||||
"program": "${workspaceRoot}/BUILD/${workspaceRootFolderName}.elf",
|
||||
"args": [],
|
||||
"stopAtEntry": true,
|
||||
"cwd": "${workspaceRoot}",
|
||||
"environment": [],
|
||||
"externalConsole": false,
|
||||
"debugServerArgs": "",
|
||||
"serverLaunchTimeout": 20000,
|
||||
"filterStderr": true,
|
||||
"filterStdout": false,
|
||||
"serverStarted": "GDB\\ server\\ started",
|
||||
"preLaunchTask": "make",
|
||||
"setupCommands": [
|
||||
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
|
||||
{ "text": "-file-exec-and-symbols ${workspaceRoot}/BUILD/${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
|
||||
{ "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
|
||||
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
|
||||
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
|
||||
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
|
||||
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }
|
||||
],
|
||||
"logging": {
|
||||
"moduleLoad": true,
|
||||
"trace": true,
|
||||
"engineLogging": true,
|
||||
"programOutput": true,
|
||||
"exceptions": true
|
||||
},
|
||||
"linux": {
|
||||
"MIMode": "gdb",
|
||||
"MIDebuggerPath": "arm-none-eabi-gdb",
|
||||
"debugServerPath": "pyocd-gdbserver"
|
||||
},
|
||||
"osx": {
|
||||
"MIMode": "gdb",
|
||||
"MIDebuggerPath": "arm-none-eabi-gdb",
|
||||
"debugServerPath": "pyocd-gdbserver"
|
||||
},
|
||||
"windows": {
|
||||
"preLaunchTask": "make.exe",
|
||||
"MIMode": "gdb",
|
||||
"MIDebuggerPath": "arm-none-eabi-gdb.exe",
|
||||
"debugServerPath": "pyocd-gdbserver.exe",
|
||||
"setupCommands": [
|
||||
{ "text": "-environment-cd ${workspaceRoot}\\BUILD" },
|
||||
{ "text": "-target-select remote localhost:3333", "description": "connect to target", "ignoreFailures": false },
|
||||
{ "text": "-file-exec-and-symbols ${workspaceRootFolderName}.elf", "description": "load file", "ignoreFailures": false},
|
||||
{ "text": "-interpreter-exec console \"monitor endian little\"", "ignoreFailures": false },
|
||||
{ "text": "-interpreter-exec console \"monitor reset\"", "ignoreFailures": false },
|
||||
{ "text": "-interpreter-exec console \"monitor halt\"", "ignoreFailures": false },
|
||||
{ "text": "-interpreter-exec console \"monitor arm semihosting enable\"", "ignoreFailures": false },
|
||||
{ "text": "-target-download", "description": "flash target", "ignoreFailures": false }
|
||||
]
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
5
tools/export/vscode/settings.tmpl
Normal file
5
tools/export/vscode/settings.tmpl
Normal file
@@ -0,0 +1,5 @@
|
||||
// Place your settings in this file to overwrite default and user settings.
|
||||
{
|
||||
"C_Cpp.addWorkspaceRootToIncludePath": false,
|
||||
"C_Cpp.intelliSenseEngine": "Tag Parser"
|
||||
}
|
||||
30
tools/export/vscode/tasks.tmpl
Normal file
30
tools/export/vscode/tasks.tmpl
Normal file
@@ -0,0 +1,30 @@
|
||||
{
|
||||
// See https://go.microsoft.com/fwlink/?LinkId=733558
|
||||
// for the documentation about the tasks.json format
|
||||
"version": "0.1.0",
|
||||
"name": "make",
|
||||
"isShellCommand": true,
|
||||
"showOutput": "always",
|
||||
"problemMatcher": {
|
||||
"owner": "cpp",
|
||||
"fileLocation": ["relative", "${workspaceRoot}/mbed-os"],
|
||||
"pattern": {
|
||||
"regexp": "^(.*):(\\d+):(\\d+):\\s+(warning|error):\\s+(.*)$",
|
||||
"file": 1,
|
||||
"line": 2,
|
||||
"column": 3,
|
||||
"severity": 4,
|
||||
"message": 5
|
||||
}
|
||||
},
|
||||
"args": ["-j"],
|
||||
"linux": {
|
||||
"command": "make"
|
||||
},
|
||||
"osx": {
|
||||
"command": "make"
|
||||
},
|
||||
"windows": {
|
||||
"command": "make.exe"
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user