[kernel][kservice]add a hook for user to display user version information#5872
Draft
xfwangqiang wants to merge 1 commit intoRT-Thread:masterfrom
Draft
[kernel][kservice]add a hook for user to display user version information#5872xfwangqiang wants to merge 1 commit intoRT-Thread:masterfrom
xfwangqiang wants to merge 1 commit intoRT-Thread:masterfrom
Conversation
Guozhanxin
reviewed
Apr 27, 2022
| 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); |
Member
There was a problem hiding this comment.
我是感觉这么写不太优雅,大家讨论下吧,
这个改动的需求是什么,是产品发布之后用于显示用户代码的版本用吗?
Contributor
Author
There was a problem hiding this comment.
是的,主要是希望显示用户代码的版本信息,我是觉得与系统的版本信息放在一起应该更好看,如果main线程里显示的话,可能会造成显示信息的不友好。我们之前在实际的产品中,一般都是会把我们厂家的信息,产品的信息,和版本信息显示在最前头,像rt-thread的版本信息一样。
| /** | ||
| * 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) |
Member
There was a problem hiding this comment.
名字感觉不是太合理,只是用于显示一些信息吗?或者把显示的信息用Kconfig进行配置?
Contributor
Author
There was a problem hiding this comment.
我目前主要是用来显示一些信息,用户的软件版本信息和硬件版本信息,使用Kconfig配置是挺好的一个思路,不过如果硬件版本是通过ADC或IO来获取的情况下,就不好处理了。
Member
Member
|
提供一定板级信息函数,这样芯片信息,板卡信息都可以在show version时出现(STM32F407 探索者 neofetch?) #6233 |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.

拉取/合并请求描述:(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):
代码质量 Code Quality:
我在这个拉取/合并请求中已经考虑了 As part of this pull request, I've considered the following:
#if 0代码,不包含已经被注释了的代码 All redundant code is removed and cleaned up