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

[kernel][kservice]add a hook for user to display user version information #5872

Draft
wants to merge 1 commit into
base: master
Choose a base branch
from

Conversation

xfwangqiang
Copy link
Contributor

@xfwangqiang xfwangqiang commented Apr 25, 2022

拉取/合并请求描述:(PR description)

[
在kservice.c的614行定义了一个weak修饰的rt_version_hook函数,这个函数在628行,被rt_show_version调用。用户层只需要在自己的文件中定义一个rt_version_hook函数,然后在里实现自己的版本信息,这样用户层的版本信息可以跟随系统版本信息显示。在kservice.c的614行定义了一个weak修饰的rt_version_hook函数,这个函数在628行,被rt_show_version调用。用户层只需要在自己的文件中定义一个rt_version_hook函数,然后在里实现自己的版本信息,这样用户层的版本信息可以跟随系统版本信息显示。
]

以下的内容不应该在提交PR时的message修改,修改下述message,PR会被直接关闭。请在提交PR后,浏览器查看PR并对以下检查项逐项check,没问题后逐条在页面上打钩。
The following content must not be changed in the submitted PR message. Otherwise, the PR will be closed immediately. After submitted PR, please use a web browser to visit PR, and check items one by one, and ticked them if no problem.

当前拉取/合并请求的状态 Intent for your PR

必须选择一项 Choose one (Mandatory):

  • 本拉取/合并请求是一个草稿版本 This PR is for a code-review and is intended to get feedback
  • 本拉取/合并请求是一个成熟版本 This PR is mature, and ready to be integrated into the repo

代码质量 Code Quality:

我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:

  • 已经仔细查看过代码改动的对比 Already check the difference between PR and old code
  • 代码风格正确,包括缩进空格,命名及其他风格 Style guide is adhered to, including spacing, naming and other styles
  • 没有垃圾代码,代码尽量精简,不包含#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up
  • 所有变更均有原因及合理的,并且不会影响到其他软件组件代码或BSP All modifications are justified and not affect other components or BSP
  • 对难懂代码均提供对应的注释 I've commented appropriately where code is tricky
  • 本拉取/合并请求代码是高质量的 Code in this PR is of high quality
  • 本拉取/合并使用formatting等源码格式化工具确保格式符合RT-Thread代码规范 This PR complies with RT-Thread code specification

@Guozhanxin Guozhanxin added the discussion This PR/issue needs to be discussed later label Apr 27, 2022
@@ -618,6 +625,7 @@ void rt_show_version(void)
rt_kprintf(" / | \\ %d.%d.%d build %s %s\n",
RT_VERSION, RT_SUBVERSION, RT_REVISION, __DATE__, __TIME__);
rt_kprintf(" 2006 - 2022 Copyright by RT-Thread team\n");
rt_version_hook(RT_VERSION, RT_SUBVERSION, RT_REVISION);
Copy link
Member

Choose a reason for hiding this comment

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

我是感觉这么写不太优雅,大家讨论下吧,

这个改动的需求是什么,是产品发布之后用于显示用户代码的版本用吗?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

是的,主要是希望显示用户代码的版本信息,我是觉得与系统的版本信息放在一起应该更好看,如果main线程里显示的话,可能会造成显示信息的不友好。我们之前在实际的产品中,一般都是会把我们厂家的信息,产品的信息,和版本信息显示在最前头,像rt-thread的版本信息一样。

Copy link
Member

Choose a reason for hiding this comment

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

rt_show_user_info?

@Guozhanxin Guozhanxin added the proposal proposal for future version label Apr 27, 2022
/**
* This function is a hook for user to display user version information
*/
RT_WEAK void rt_version_hook(rt_int32_t version, rt_int32_t sub, rt_int32_t revision)
Copy link
Member

Choose a reason for hiding this comment

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

名字感觉不是太合理,只是用于显示一些信息吗?或者把显示的信息用Kconfig进行配置?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

我目前主要是用来显示一些信息,用户的软件版本信息和硬件版本信息,使用Kconfig配置是挺好的一个思路,不过如果硬件版本是通过ADC或IO来获取的情况下,就不好处理了。

@mysterywolf mysterywolf added v5.0.0 and removed proposal proposal for future version labels Aug 15, 2022
@mysterywolf
Copy link
Member

image

@mysterywolf
Copy link
Member

提供一定板级信息函数,这样芯片信息,板卡信息都可以在show version时出现(STM32F407 探索者 neofetch?) #6233

@mysterywolf mysterywolf added the good first issue Good for newcomers 新手任务 label Oct 29, 2022
@mysterywolf mysterywolf marked this pull request as draft October 29, 2022 03:55
@supperthomas supperthomas changed the title [kservice]add a hook for user to display user version information [kernel][kservice]add a hook for user to display user version information May 4, 2023
@supperthomas supperthomas added the Kernel PR has src relate code label May 4, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
discussion This PR/issue needs to be discussed later good first issue Good for newcomers 新手任务 Kernel PR has src relate code
Projects
None yet
Development

Successfully merging this pull request may close these issues.

None yet

5 participants