-
Notifications
You must be signed in to change notification settings - Fork 5.1k
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
base: master
Are you sure you want to change the base?
Conversation
@@ -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); |
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.
我是感觉这么写不太优雅,大家讨论下吧,
这个改动的需求是什么,是产品发布之后用于显示用户代码的版本用吗?
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.
是的,主要是希望显示用户代码的版本信息,我是觉得与系统的版本信息放在一起应该更好看,如果main线程里显示的话,可能会造成显示信息的不友好。我们之前在实际的产品中,一般都是会把我们厂家的信息,产品的信息,和版本信息显示在最前头,像rt-thread的版本信息一样。
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.
rt_show_user_info?
/** | ||
* 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) |
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.
名字感觉不是太合理,只是用于显示一些信息吗?或者把显示的信息用Kconfig进行配置?
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.
我目前主要是用来显示一些信息,用户的软件版本信息和硬件版本信息,使用Kconfig配置是挺好的一个思路,不过如果硬件版本是通过ADC或IO来获取的情况下,就不好处理了。
提供一定板级信息函数,这样芯片信息,板卡信息都可以在show version时出现(STM32F407 探索者 neofetch?) #6233 |
拉取/合并请求描述:(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