diff options
| author | ruki <[email protected]> | 2021-11-17 12:14:04 +0800 |
|---|---|---|
| committer | ruki <[email protected]> | 2021-11-17 12:14:04 +0800 |
| commit | dcffc69b622da2048f6ee529f5974cb66cd6dc1a (patch) | |
| tree | a7accc6ce1eb8784a39429c3ee5114926429dcff | |
| parent | 7f3706c2ad219d6632b3be0a4705042ced0d0233 (diff) | |
add microlib runtime for mdk
| -rw-r--r-- | tests/projects/mdk/hello/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/languages/asm/xmake.lua | 3 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armasm.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armcc.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armclang.lua | 7 | ||||
| -rw-r--r-- | xmake/modules/core/tools/armlink.lua | 7 | ||||
| -rw-r--r-- | xmake/rules/mdk/xmake.lua | 1 |
7 files changed, 34 insertions, 1 deletions
diff --git a/tests/projects/mdk/hello/xmake.lua b/tests/projects/mdk/hello/xmake.lua index 97d640297..6afb714af 100644 --- a/tests/projects/mdk/hello/xmake.lua +++ b/tests/projects/mdk/hello/xmake.lua @@ -1,5 +1,7 @@ add_rules("mode.debug", "mode.release") +set_runtimes("microlib") + target("foo") add_rules("mdk.static") add_files("src/foo/*.c") @@ -8,5 +10,4 @@ target("hello") add_deps("foo") add_rules("mdk.console") add_files("src/*.c", "src/*.s") - add_defines("__EVAL", "__MICROLIB") add_includedirs("src/lib/cmsis") diff --git a/xmake/languages/asm/xmake.lua b/xmake/languages/asm/xmake.lua index cb9aa22f5..bdf4a4514 100644 --- a/xmake/languages/asm/xmake.lua +++ b/xmake/languages/asm/xmake.lua @@ -40,6 +40,7 @@ language("asm") , "target.includedirs" , "target.defines" , "target.undefines" + , "target.runtimes" , "toolchain.includedirs" , "toolchain.defines" , "toolchain.undefines" @@ -52,6 +53,7 @@ language("asm") , "target.rpathdirs" , "target.strip" , "target.symbols" + , "target.runtimes" , "toolchain.linkdirs" , "toolchain.rpathdirs" , "config.links" @@ -63,6 +65,7 @@ language("asm") , "target.linkdirs" , "target.strip" , "target.symbols" + , "target.runtimes" , "toolchain.linkdirs" , "config.links" , "target.links" diff --git a/xmake/modules/core/tools/armasm.lua b/xmake/modules/core/tools/armasm.lua index 3065fe0a3..3ae578c55 100644 --- a/xmake/modules/core/tools/armasm.lua +++ b/xmake/modules/core/tools/armasm.lua @@ -92,6 +92,13 @@ function nf_language(self, stdname) end end +-- make runtime flag +function nf_runtime(self, runtime) + if runtime == "microlib" then + return {"--pd", "__MICROLIB SETA 1"} + end +end + -- make the define flag function nf_define(self, macro) return {"--pd", macro .. " SETA 1"} diff --git a/xmake/modules/core/tools/armcc.lua b/xmake/modules/core/tools/armcc.lua index 6215242ec..403e143f0 100644 --- a/xmake/modules/core/tools/armcc.lua +++ b/xmake/modules/core/tools/armcc.lua @@ -45,6 +45,13 @@ function nf_symbol(self, level) end end +-- make runtime flag +function nf_runtime(self, runtime) + if runtime == "microlib" then + return "-D__MICROLIB" + end +end + -- make the optimize flag function nf_optimize(self, level) local maps = diff --git a/xmake/modules/core/tools/armclang.lua b/xmake/modules/core/tools/armclang.lua index 42bec8fd5..dcec82015 100644 --- a/xmake/modules/core/tools/armclang.lua +++ b/xmake/modules/core/tools/armclang.lua @@ -23,3 +23,10 @@ inherit("gcc") function init(self) _super.init(self) end + +-- make runtime flag +function nf_runtime(self, runtime) + if runtime == "microlib" then + return "-D__MICROLIB" + end +end diff --git a/xmake/modules/core/tools/armlink.lua b/xmake/modules/core/tools/armlink.lua index 02c2b4800..e25a81967 100644 --- a/xmake/modules/core/tools/armlink.lua +++ b/xmake/modules/core/tools/armlink.lua @@ -41,6 +41,13 @@ function nf_linkdir(self, dir) return {"--userlibpath", dir} end +-- make runtime flag +function nf_runtime(self, runtime) + if runtime == "microlib" then + return "--library_type=microlib" + end +end + -- make the link arguments list function linkargv(self, objectfiles, targetkind, targetfile, flags) return self:program(), table.join("-o", targetfile, objectfiles, flags) diff --git a/xmake/rules/mdk/xmake.lua b/xmake/rules/mdk/xmake.lua index f45e04c6e..0c491b528 100644 --- a/xmake/rules/mdk/xmake.lua +++ b/xmake/rules/mdk/xmake.lua @@ -40,3 +40,4 @@ rule("mdk.static") -- set default output binary target:set("kind", "static") end) + |
