mirror of https://github.com/ARMmbed/mbed-os.git
Allow users to set armcc and iccarm in path.
Raise exceptin instead of exit. Corrected error for arm-none-eabi-gcc/g++ set in path.pull/2418/head
parent
51245ceb7a
commit
cd229bacc3
|
@ -198,9 +198,9 @@ def check_toolchain_path(function):
|
||||||
"""
|
"""
|
||||||
def perform_check(self, *args, **kwargs):
|
def perform_check(self, *args, **kwargs):
|
||||||
if not exists(self.toolchain_path):
|
if not exists(self.toolchain_path):
|
||||||
print('[ERROR] Toolchain path for %s does not exist.\n'
|
error_string = 'Could not find executable for %s.\n Currently ' \
|
||||||
'Current value: %s' % (self.name, self.toolchain_path))
|
'set search path: %s'% (self.name, self.toolchain_path)
|
||||||
sys.exit(-1)
|
raise Exception(error_string)
|
||||||
return function(self, *args, **kwargs)
|
return function(self, *args, **kwargs)
|
||||||
return perform_check
|
return perform_check
|
||||||
|
|
||||||
|
|
|
@ -15,12 +15,12 @@ See the License for the specific language governing permissions and
|
||||||
limitations under the License.
|
limitations under the License.
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from os.path import join, dirname, splitext, basename, exists
|
from os.path import join, dirname, splitext, basename
|
||||||
|
from distutils.spawn import find_executable
|
||||||
|
|
||||||
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
||||||
from tools.hooks import hook_tool
|
from tools.hooks import hook_tool
|
||||||
from tools.utils import mkdir
|
from tools.utils import mkdir
|
||||||
import copy
|
|
||||||
|
|
||||||
class ARM(mbedToolchain):
|
class ARM(mbedToolchain):
|
||||||
LINKER_EXT = '.sct'
|
LINKER_EXT = '.sct'
|
||||||
|
@ -56,6 +56,11 @@ class ARM(mbedToolchain):
|
||||||
else:
|
else:
|
||||||
cpu = target.core
|
cpu = target.core
|
||||||
|
|
||||||
|
if not TOOLCHAIN_PATHS['ARM']:
|
||||||
|
exe = find_executable('armcc')
|
||||||
|
if exe:
|
||||||
|
TOOLCHAIN_PATHS['ARM'] = dirname(dirname(exe))
|
||||||
|
|
||||||
ARM_BIN = join(TOOLCHAIN_PATHS['ARM'], "bin")
|
ARM_BIN = join(TOOLCHAIN_PATHS['ARM'], "bin")
|
||||||
ARM_INC = join(TOOLCHAIN_PATHS['ARM'], "include")
|
ARM_INC = join(TOOLCHAIN_PATHS['ARM'], "include")
|
||||||
|
|
||||||
|
|
|
@ -16,6 +16,7 @@ limitations under the License.
|
||||||
"""
|
"""
|
||||||
import re
|
import re
|
||||||
from os.path import join, basename, splitext, dirname, exists
|
from os.path import join, basename, splitext, dirname, exists
|
||||||
|
from distutils.spawn import find_executable
|
||||||
|
|
||||||
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
||||||
from tools.hooks import hook_tool
|
from tools.hooks import hook_tool
|
||||||
|
@ -110,7 +111,10 @@ class GCC(mbedToolchain):
|
||||||
self.ar = join(tool_path, "arm-none-eabi-ar")
|
self.ar = join(tool_path, "arm-none-eabi-ar")
|
||||||
self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
|
self.elf2bin = join(tool_path, "arm-none-eabi-objcopy")
|
||||||
|
|
||||||
self.toolchain_path = tool_path
|
if tool_path:
|
||||||
|
self.toolchain_path = main_cc
|
||||||
|
else:
|
||||||
|
self.toolchain_path = find_executable("arm-none-eabi-gcc") or ''
|
||||||
|
|
||||||
def parse_dependencies(self, dep_path):
|
def parse_dependencies(self, dep_path):
|
||||||
dependencies = []
|
dependencies = []
|
||||||
|
|
|
@ -17,6 +17,7 @@ limitations under the License.
|
||||||
import re
|
import re
|
||||||
from os import remove
|
from os import remove
|
||||||
from os.path import join, exists, dirname, splitext, exists
|
from os.path import join, exists, dirname, splitext, exists
|
||||||
|
from distutils.spawn import find_executable
|
||||||
|
|
||||||
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
from tools.toolchains import mbedToolchain, TOOLCHAIN_PATHS
|
||||||
from tools.hooks import hook_tool
|
from tools.hooks import hook_tool
|
||||||
|
@ -50,6 +51,12 @@ class IAR(mbedToolchain):
|
||||||
cpuchoice = "Cortex-M7"
|
cpuchoice = "Cortex-M7"
|
||||||
else:
|
else:
|
||||||
cpuchoice = target.core
|
cpuchoice = target.core
|
||||||
|
|
||||||
|
if not TOOLCHAIN_PATHS['IAR']:
|
||||||
|
exe = find_executable('iccarm')
|
||||||
|
if exe:
|
||||||
|
TOOLCHAIN_PATHS['IAR'] = dirname(dirname(exe))
|
||||||
|
|
||||||
# flags_cmd are used only by our scripts, the project files have them already defined,
|
# flags_cmd are used only by our scripts, the project files have them already defined,
|
||||||
# using this flags results in the errors (duplication)
|
# using this flags results in the errors (duplication)
|
||||||
# asm accepts --cpu Core or --fpu FPU, not like c/c++ --cpu=Core
|
# asm accepts --cpu Core or --fpu FPU, not like c/c++ --cpu=Core
|
||||||
|
|
Loading…
Reference in New Issue