-
Notifications
You must be signed in to change notification settings - Fork 8k
Bluetooth: HCI_UART: Update main stack and refactor conf files #23104
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
Bluetooth: HCI_UART: Update main stack and refactor conf files #23104
Conversation
CC: @rugeGerritsen |
All checks passed. Tip: The bot edits this comment instead of posting a new one, so you can check the comment's history to see earlier messages. |
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.
This whole branch seems unnecessary to me. The condition is identical to the branch above it and you're not doing any long-duration work in that branch.
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.
yeah, removed it.
318fe66
to
5b360a0
Compare
static u32_t prio_ts; | ||
|
||
if (k_uptime_get_32() - prio_ts > K_SECONDS(5)) { | ||
STACK_ANALYZE("main thread stack", |
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.
STACK_ANALYZE is deprecated, please do not use it.
You want a k_thread_foreach() loop and call k_thread_stack_space_get() on each 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.
Will replace STACK_ANALYZE usage. But need a way to do it for main stack. k_thread_foreach will not give me main stack.
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.
Replaced with suggestion.
include/debug/stack.h
Outdated
#include <logging/log.h> | ||
#include <stdbool.h> | ||
|
||
extern K_THREAD_STACK_DEFINE(z_main_stack, CONFIG_MAIN_STACK_SIZE); |
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.
do not put these here, they are private to the kernel
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.
I need an alternative so that I can debug the main stack.
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.
Removed
you should really separate out the patches which are strictly bug fixes into a separate PR to get them in faster. |
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.
needs changes
@andrewboie Your suggestion does not give me the stack usage of the threads mentioned, with the k_thread_foreach(_unlocked) I only get "BT RX" and "BT RX pri" threads. Not the main stack or any of the others. Another thing I noticed is that k_thread_foreach does not iterate over the static threads either, but adding code for that did not give me main stack usage.
|
@andrewboie Sorry for the noise, it appears to be a logging issue. I only get some of the LOG_INF statements. Using printk I see it all. |
5b360a0
to
75c43c1
Compare
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.
Could you please update the sample's README.rst
with info on how to use this debug.conf
?
75c43c1
to
d8dd663
Compare
d8dd663
to
51302e8
Compare
Update main stack size for nrf5 boards. This is to support an alternative hci_driver that has a higher stack size usage in hci driver open. Measured stack usage in this case to 808/1024. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Refactor conf files to use prj.conf + board/<board>.conf configuration. This allows us to have put common configurations into the prj.conf and have board specific configs in each board file. This also respects adding additional prj.conf files such as -DCONF_FILE='nrf5.conf debug.conf' to add debug configuration. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Remove BT_CTLR_DTM_HCI=y config which is not supported for this board. This produced the following warning: warning: BT_CTLR_DTM_HCI was assigned the value 'y' but got the value 'n'. Check these unsatisfied dependencies: BT_CTLR_DTM_HCI_SUPPORT (=n). Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
Remove data length and phy update set to 'n' on board that does not support these features anyway. BT_CTLR_DATA_LEN_SUPPORTED and BT_CTLR_PHY_UPDATE_SUPPORTED are both set to 'n'. Signed-off-by: Joakim Andersson <joakim.andersson@nordicsemi.no>
51302e8
to
a935834
Compare
Split the stack debug changes into a new PR. |
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.
LGTM, thanks!
@andrewboie The things you objected to have been removed from the PR. |
For Nordic alternative HCI driver the main stack usage caused stack overflow issues.
Refactor conf files to recommended CONF_FILE usage as the current CONF_FILE mechanism does not work when providing extra CONF_FILE or CONF_OVERLAY. Configurations will be lost in this case.