-
-
Notifications
You must be signed in to change notification settings - Fork 774
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
add keil-c51 toolchain & rules & review #2349
Conversation
| function _check(program) | ||
| local c51 = assert(find_tool("c51"), "c51 not found") | ||
| -- make temp source file | ||
| local tmpdir = os.tmpfile() |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
local tmpdir = os.tmpfile() .. ".dir"
| local c51 = assert(find_tool("c51"), "c51 not found") | ||
| -- make temp source file | ||
| local tmpdir = os.tmpfile() | ||
| os.mkdir(tmpdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
不用加,io.writefile 会自动创建
| os.runv(program, {objfile, "TO", binfile}) | ||
| -- remove files | ||
| os.rmdir(tmpdir) | ||
| end |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
这个空一行
| function _check(program) | ||
| -- make temp source file | ||
| local tmpdir = os.tmpfile() | ||
| os.mkdir(tmpdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
| local bl51 = assert(find_tool("bl51"), "bl51 not found") | ||
| -- make temp source file | ||
| local tmpdir = os.tmpfile() | ||
| os.mkdir(tmpdir) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
同上
xmake/rules/c51/xmake.lua
Outdated
| import("lib.detect.find_tool") | ||
| local oh = assert(find_tool("oh51"), "oh51 not found") | ||
| os.iorunv(oh.program, {target:targetfile()}) | ||
| cprint("${color.warning} hex file generated %s", target:targetfile() .. ".hex") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
after_link(function(target, opt)
import("utils.progress")
progress.show(opt.progress, "${color.build.target}generating.$(mode) %s", targetfile)There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
用 progress 统一进度格式
xmake/rules/c51/xmake.lua
Outdated
| after_link(function(target) | ||
| import("lib.detect.find_tool") | ||
| local oh = assert(find_tool("oh51"), "oh51 not found") | ||
| os.iorunv(oh.program, {target:targetfile()}) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
log 追加了 .hex ,实际生成倒是没 .hex 么。。
xmake/rules/c51/xmake.lua
Outdated
| end | ||
| end) | ||
|
|
||
| after_link(function(target) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
另外,加个 on_changed ,确保仅仅 targetfile 有改动后,才做转换,不要每次都去执行
xmake/toolchains/c51/xmake.lua
Outdated
| import("lib.detect.find_tool") | ||
| import("detect.sdks.find_c51") | ||
| local c51 = find_c51() | ||
|
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
空行删了
xmake/rules/c51/xmake.lua
Outdated
| import("core.project.depend") | ||
| depend.on_changed(function() | ||
| import("lib.detect.find_tool") | ||
| import("utils.progress") |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
import 挪到开头
|
Thanks! 👍 |
加入新的Keil_v5里的C51工具链,具体包含C51.exe,BL51.exe,OH51.exe,整合为C51 sdk和C51 toolchain,添加c51.static rule