fix:The directory "sdkdir" is set incorrectly

This commit is contained in:
Dozingfiretruck 2022-09-11 14:28:58 +08:00 committed by guo
parent 2133b8536a
commit b4df964160
2 changed files with 7 additions and 5 deletions

View File

@ -40,7 +40,7 @@ target("${target}")
set_filename("rtthread.elf") set_filename("rtthread.elf")
after_build(function(target) after_build(function(target)
os.exec("${toolchain}-objcopy -O ihex rtthread.elf rtthread.hex") os.exec("${bindir}/${toolchain}-objcopy -O ihex rtthread.elf rtthread.hex")
os.exec("${toolchain}-objcopy -O binary rtthread.elf rtthread.bin") os.exec("${bindir}/${toolchain}-objcopy -O binary rtthread.elf rtthread.bin")
os.exec("${toolchain}-size rtthread.elf") os.exec("${bindir}/${toolchain}-size rtthread.elf")
end) end)

View File

@ -16,6 +16,7 @@ class XmakeProject:
self.env = env self.env = env
self.project = project self.project = project
self.sdkdir = "" self.sdkdir = ""
self.bindir = ""
self.toolchain = "" self.toolchain = ""
self.src_path = "" self.src_path = ""
self.inc_path = "" self.inc_path = ""
@ -26,7 +27,8 @@ class XmakeProject:
self.define = "" self.define = ""
def set_toolchain_path(self): 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 - # delete -
self.toolchain = rtconfig.PREFIX[:-1] self.toolchain = rtconfig.PREFIX[:-1]
@ -71,7 +73,7 @@ class XmakeProject:
with open(template_path, "r") as f: with open(template_path, "r") as f:
data = f.read() data = f.read()
data = Template(data) 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, define=self.define, cflags=self.cflags, cxxflags=self.cxxflags, asflags=self.asflags,
ldflags=self.ldflags, target="rt-thread") ldflags=self.ldflags, target="rt-thread")
with open("xmake.lua", "w") as f: with open("xmake.lua", "w") as f: