-
Notifications
You must be signed in to change notification settings - Fork 5.2k
[kernel][kservice]add a hook for user to display user version information #5872
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
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -608,6 +608,13 @@ char *strdup(const char *s) __attribute__((alias("rt_strdup"))); | |
#endif /* __ARMCC_VERSION */ | ||
#endif /* RT_USING_HEAP */ | ||
|
||
/** | ||
* 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) | ||
{ | ||
} | ||
|
||
/** | ||
* This function will show the version of rt-thread rtos | ||
*/ | ||
|
@@ -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 commentThe 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 commentThe 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 commentThe reason will be displayed to describe this comment to others. Learn more. rt_show_user_info? |
||
} | ||
RTM_EXPORT(rt_show_version); | ||
|
||
|
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来获取的情况下,就不好处理了。