Skip to content
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

Merged
merged 9 commits into from
May 10, 2022
Merged

add keil-c51 toolchain & rules & review #2349

merged 9 commits into from
May 10, 2022

Conversation

DawnMagnet
Copy link
Contributor

加入新的Keil_v5里的C51工具链,具体包含C51.exe,BL51.exe,OH51.exe,整合为C51 sdk和C51 toolchain,添加c51.static rule

  • Before adding new features and new modules, please go to issues to submit the relevant feature description first.
  • Write good commit messages and use the same coding conventions as the rest of the project.
  • Please commit code to dev branch and we will merge into master branch in feature
  • Ensure your edited codes with four spaces instead of TAB.

  • 增加新特性和新模块之前,请先到issues提交相关特性说明,经过讨论评估确认后,再进行相应的代码提交,避免做无用工作。
  • 编写友好可读的提交信息,并使用与工程代码相同的代码规范,代码请用4个空格字符代替tab缩进。
  • 请提交代码到dev分支,如果通过,我们会在特定时间合并到master分支上。
  • 为了规范化提交日志的格式,commit消息,不要用中文,请用英文描述。

function _check(program)
local c51 = assert(find_tool("c51"), "c51 not found")
-- make temp source file
local tmpdir = os.tmpfile()
Copy link
Member

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)
Copy link
Member

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
Copy link
Member

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)
Copy link
Member

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)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

同上

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")
Copy link
Member

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)

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

用 progress 统一进度格式

after_link(function(target)
import("lib.detect.find_tool")
local oh = assert(find_tool("oh51"), "oh51 not found")
os.iorunv(oh.program, {target:targetfile()})
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

log 追加了 .hex ,实际生成倒是没 .hex 么。。

end
end)

after_link(function(target)
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

另外,加个 on_changed ,确保仅仅 targetfile 有改动后,才做转换,不要每次都去执行

import("lib.detect.find_tool")
import("detect.sdks.find_c51")
local c51 = find_c51()

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

空行删了

import("core.project.depend")
depend.on_changed(function()
import("lib.detect.find_tool")
import("utils.progress")
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

import 挪到开头

@waruqi waruqi merged commit 4ceb562 into xmake-io:dev May 10, 2022
@waruqi
Copy link
Member

waruqi commented May 10, 2022

Thanks! 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants