-
Notifications
You must be signed in to change notification settings - Fork 8.1k
boards: 96boards: carbon: Increase main stack size when using Bluetooth #89490
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: main
Are you sure you want to change the base?
Conversation
FYI, #74345 Have you done some extensive Bluetooth use case testing on 96b_carbon board? This is using hci_spi on the nRF51 SoC, don't you see assertions in the Controller? |
I can understand |
After migrating from |
I tested the aforementioned samples and they worked fine. I flashed the upstream |
@cvinayak, PTAL |
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 doesn't make sense to me. The Zephyr Bluetooth stack doesn't inherently use any main thread stack at all - it all depends on the application, which could e.g. do Bluetooth initialization in some completely different thread. Such changes should be done on a per-application level. Either update the main stack for the app in prj.conf
(if it's justifiable) or add a board-specific overlay to the app.
I agree with @jhedberg here. In the case of the use of |
@HoZHel, I understand the carbon board is a two chip platform with BLE host running on STM32F4 and BLE controller in nRF51. I also understand that the problem you are reporting is located in the host, so it’s unlikely that increasing main stack size in the host could fix or mask a problem in the controller. |
This pull request has been marked as stale because it has been open (more than) 60 days with no activity. Remove the stale label or add a comment saying that you would like to have the label removed otherwise this pull request will automatically be closed in 14 days. Note, that you can always re-open a closed pull request at any time. |
Yes. The application is beacon and zephyr/modules/mbedtls/zephyr_init.c Lines 65 to 67 in 169cf86
In order to be sure that calling ![]() 0x20005240 - 0x20004e40 = 0x400 which corresponds to ![]() Therefore, any Bluetooth sample on this board requires the main stack size of greater than 1024 bytes. |
@HoZHel, thanks a lot for your detailed explanation and the reason why main stack should be increased, so we can say that if mbedtls is needed, main stack size should be increased. Possibly the check in KConfig should be: |
What you are suggesting is related to |
Agree to above. The stack size increase is due to inclusion of MBEDTLS (in the main MCU, STM32F4, firmware) which could be any other subsystem depending on MBEDTLS (hence, (@HoZHel, thank you for the thorough analysis) |
Increase main stack size when MBEDTLS_INIT is enabled to avoid stack overflow as it consumes 1536 bytes. Signed-off-by: Ali Hozhabri <[email protected]>
2b8766b
to
274aade
Compare
Changed |
|
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
The change looks more reasonable now, but is it really only this board that's affected by the increased stack consumption when |
That’s good point in my opinion, it can be linked to all STM32F4 or to all CM4 based SoC without embedded RNG. We could accept the currency proposal at board level, as first step and investigate later or we could limit to STM32F4. Any suggestion or preference? In general, I think the C stack sizing is a difficult problem and I don’t know whether a standard policy exists in Zephyr. |
My worry is that we already have a bunch of these and there are more on their way , e.g. in #96692 there's this:
The above would likely need to be to be changed to use I'm not 100% objecting to the current solution in this PR, but the more we let into the tree the harder it will be to track everything down later when we want to make a cleaner and more generic solution. |
Increase main stack size when Bluetooth is enabled to avoid stack overflow.
samples/bluetooth/beacon
was considered for this change. It has also been tested withsamples/bluetooth/peripheral_hr
.