summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorruki <[email protected]>2025-01-24 22:39:31 +0800
committerruki <[email protected]>2025-01-24 22:39:31 +0800
commit99e74d6106e97fa3fc3315ef646d59deff01621f (patch)
treec38adf339673be8da950caafa9122a5d4f07a2ea
parentff79cf6354f0f8a67451a6f481dcbbf1d347220c (diff)
add ti-c6000 toolchain
-rw-r--r--xmake/modules/detect/tools/find_ar6x.lua48
-rw-r--r--xmake/modules/detect/tools/find_asm6x.lua48
-rw-r--r--xmake/toolchains/ti-c6000/xmake.lua47
3 files changed, 143 insertions, 0 deletions
diff --git a/xmake/modules/detect/tools/find_ar6x.lua b/xmake/modules/detect/tools/find_ar6x.lua
new file mode 100644
index 000000000..9df72e8e6
--- /dev/null
+++ b/xmake/modules/detect/tools/find_ar6x.lua
@@ -0,0 +1,48 @@
+--!A cross-platform build utility based on Lua
+--
+-- 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.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_ar6x.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find ar6x
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local ar6x = find_ar6x()
+-- local ar6x, version = find_ar6x({program = "ar6x", version = true})
+--
+-- @endcode
+--
+function main(opt)
+ opt = opt or {}
+ opt.check = "--help"
+ opt.command = "--help"
+ local program = find_program(opt.program or "ar6x", opt)
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/xmake/modules/detect/tools/find_asm6x.lua b/xmake/modules/detect/tools/find_asm6x.lua
new file mode 100644
index 000000000..9d1caafe2
--- /dev/null
+++ b/xmake/modules/detect/tools/find_asm6x.lua
@@ -0,0 +1,48 @@
+--!A cross-platform build utility based on Lua
+--
+-- 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.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file find_asm6x.lua
+--
+
+-- imports
+import("lib.detect.find_program")
+import("lib.detect.find_programver")
+
+-- find asm6x
+--
+-- @param opt the argument options, e.g. {version = true}
+--
+-- @return program, version
+--
+-- @code
+--
+-- local asm6x = find_asm6x()
+-- local asm6x, version = find_asm6x({program = "asm6x", version = true})
+--
+-- @endcode
+--
+function main(opt)
+ opt = opt or {}
+ opt.check = "--help"
+ opt.command = "--help"
+ local program = find_program(opt.program or "asm6x", opt)
+ local version = nil
+ if program and opt.version then
+ version = find_programver(program, opt)
+ end
+ return program, version
+end
diff --git a/xmake/toolchains/ti-c6000/xmake.lua b/xmake/toolchains/ti-c6000/xmake.lua
new file mode 100644
index 000000000..717b7029f
--- /dev/null
+++ b/xmake/toolchains/ti-c6000/xmake.lua
@@ -0,0 +1,47 @@
+--!A cross-platform build utility based on Lua
+--
+-- 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.
+--
+-- Copyright (C) 2015-present, TBOOX Open Source Group.
+--
+-- @author ruki
+-- @file xmake.lua
+--
+
+toolchain("ti-c6000")
+ set_kind("standalone")
+ set_homepage("https://www.ti.com")
+ set_description("TI-CGT compiler for C6000 DSP")
+
+ set_toolset("cc", "cl6x")
+ set_toolset("cxx", "cl6x")
+ set_toolset("ld", "cl6x")
+ set_toolset("sh", "cl6x")
+ set_toolset("ar", "ar6x")
+ set_toolset("strip", "strip6x")
+ set_toolset("as", "asm6x")
+
+ on_check(function (toolchain)
+ return import("lib.detect.find_tool")("cl6x")
+ end)
+
+ on_load(function (toolchain)
+ local march = "-mv64+"
+ if march then
+ toolchain:add("cxflags", march)
+ toolchain:add("mxflags", march)
+ toolchain:add("asflags", march)
+ toolchain:add("ldflags", march)
+ toolchain:add("shflags", march)
+ end
+ end)