Skip to content
Merged
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
19 changes: 10 additions & 9 deletions tools/building.py
Original file line number Diff line number Diff line change
Expand Up @@ -210,15 +210,16 @@ def PrepareBuilding(env, root_directory, has_libcpu=False, remove_components = [
envm = utils.ImportModule('env_utility')
# from env import GetSDKPath
exec_path = envm.GetSDKPath(rtconfig.CC)
if 'gcc' in rtconfig.CC:
exec_path = os.path.join(exec_path, 'bin')

if os.path.exists(exec_path):
Env['log'].debug('set CC to ' + exec_path)
rtconfig.EXEC_PATH = exec_path
os.environ['RTT_EXEC_PATH'] = exec_path
else:
Env['log'].debug('No Toolchain found in path(%s).' % exec_path)
if exec_path != None:
if 'gcc' in rtconfig.CC:
exec_path = os.path.join(exec_path, 'bin')

if os.path.exists(exec_path):
Env['log'].debug('set CC to ' + exec_path)
rtconfig.EXEC_PATH = exec_path
os.environ['RTT_EXEC_PATH'] = exec_path
else:
Env['log'].debug('No Toolchain found in path(%s).' % exec_path)
except Exception as e:
# detect failed, ignore
Env['log'].debug(e)
Expand Down
12 changes: 11 additions & 1 deletion tools/env_utility.py
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,15 @@ def GetSDKPath(name):
sdk_pkgs = GetSDKPackagePath()

if sdk_pkgs:
# read env/tools/scripts/sdk_cfg.json for curstomized SDK path
if os.path.exists(os.path.join(sdk_pkgs, '..', 'sdk_cfg.json')):
with open(os.path.join(sdk_pkgs, '..', 'sdk_cfg.json'), 'r', encoding='utf-8') as f:
sdk_cfg = json.load(f)
for item in sdk_cfg:
if item['name'] == name:
sdk = os.path.join(sdk_pkgs, item['path'])
return sdk

# read packages.json under env/tools/scripts/packages
with open(os.path.join(sdk_pkgs, 'pkgs.json'), 'r', encoding='utf-8') as f:
# packages_json = f.read()
Expand All @@ -68,7 +77,8 @@ def GetSDKPath(name):
package = json.load(f)

if package['name'] == name:
return os.path.join(sdk_pkgs, package['name'] + '-' + item['ver'])
sdk = os.path.join(sdk_pkgs, package['name'] + '-' + item['ver'])
return sdk

# not found named package
return None
Expand Down
Loading