diff --git a/tools/xmake.lua b/tools/xmake.lua index c09941c483..07552919c9 100644 --- a/tools/xmake.lua +++ b/tools/xmake.lua @@ -40,7 +40,7 @@ target("${target}") set_filename("rtthread.elf") after_build(function(target) - os.exec("${toolchain}-objcopy -O ihex rtthread.elf rtthread.hex") - os.exec("${toolchain}-objcopy -O binary rtthread.elf rtthread.bin") - os.exec("${toolchain}-size rtthread.elf") + os.exec("${bindir}/${toolchain}-objcopy -O ihex rtthread.elf rtthread.hex") + os.exec("${bindir}/${toolchain}-objcopy -O binary rtthread.elf rtthread.bin") + os.exec("${bindir}/${toolchain}-size rtthread.elf") end) \ No newline at end of file diff --git a/tools/xmake.py b/tools/xmake.py index 2fee979d70..668e18eeab 100644 --- a/tools/xmake.py +++ b/tools/xmake.py @@ -16,6 +16,7 @@ class XmakeProject: self.env = env self.project = project self.sdkdir = "" + self.bindir = "" self.toolchain = "" self.src_path = "" self.inc_path = "" @@ -26,7 +27,8 @@ class XmakeProject: self.define = "" def set_toolchain_path(self): - self.sdkdir = os.path.abspath(rtconfig.EXEC_PATH).replace('\\', "/") + self.bindir = os.path.abspath(rtconfig.EXEC_PATH).replace('\\', "/") + self.sdkdir = self.bindir[:-4] # delete - self.toolchain = rtconfig.PREFIX[:-1] @@ -71,7 +73,7 @@ class XmakeProject: with open(template_path, "r") as f: data = f.read() data = Template(data) - data = data.safe_substitute(toolchain=self.toolchain, sdkdir=self.sdkdir, src_path=self.src_path, inc_path=self.inc_path, + data = data.safe_substitute(toolchain=self.toolchain, sdkdir=self.sdkdir, bindir=self.bindir, src_path=self.src_path, inc_path=self.inc_path, define=self.define, cflags=self.cflags, cxxflags=self.cxxflags, asflags=self.asflags, ldflags=self.ldflags, target="rt-thread") with open("xmake.lua", "w") as f: