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")
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)

View File

@ -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: