Skip to content

Ble conditional compilation #13811

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

Merged
merged 6 commits into from
Nov 6, 2020
Merged

Conversation

pan-
Copy link
Member

@pan- pan- commented Oct 23, 2020

Summary of changes

This PR improves code size of the BLE solution when central, secure connection and signing are disabled.
It saves about 8K of code size when these conditions are met. The saving are achieved using conditional compilation. This previously wasn't required at the pal classes where concrete and not virtual.

It also disable handling of BT5.2 events at the HCI level, this handling was disabled in layer above

Impact of changes

Code size reduction when peripheral, central, secure connection, extended advertising, periodic advertising or signing are disabled.

Migration actions required

None

Documentation


Pull request type

[x] Patch update (Bug fix / Target update / Docs update / Test update / Refactor)
[] Feature update (New feature / Functionality change / New API)
[] Major update (Breaking change E.g. Return code change / API behaviour change)

Test results

[] No Tests required for this change (E.g docs only update)
[] Covered by existing mbed-os tests (Greentea or Unittest)
[x] Tests / results supplied as part of this PR

Reviewers


pan- added 4 commits October 23, 2020 10:37
Previously (most) of the code was not pulled in because the pal interface was not virtual.
Depends on the role (central or peripheral), signing enabled and secure connection enabled.
These events are not used nor triggered by any of our APIs. It saves ~1.4k of flash
@ciarmcom ciarmcom added the release-type: patch Indentifies a PR as containing just a patch label Oct 23, 2020
@ciarmcom ciarmcom requested a review from a team October 23, 2020 16:00
@ciarmcom
Copy link
Member

@pan-, thank you for your changes.
@ARMmbed/mbed-os-maintainers please review.

@@ -217,6 +217,7 @@ static const hciEvtParse_t hciEvtParseFcnTbl[] =
hciEvtParseLeConnCteReqEnableCmdCmpl,
hciEvtParseLeConnCteRspEnableCmdCmpl,
hciEvtParseLeReadAntennaInfoCmdCmpl,
#if 0

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

there's a #define that you can use that selects the ble version 5.1 which compiles cis/bis etc. out

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I haven't seen any in the host.

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

if this is landing in mbed-os then we should make one

I guess you could change the size of the array to avoid the nulls

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I improved this in the last commit.

@@ -1135,11 +1146,12 @@ ble_error_t Gap::reset()
_connectable_payload_size_exceeded.clear();
_set_is_connectable.clear();

#if BLE_FEATURE_EXTENDED_ADVERTISING
Copy link
Member

@paul-szczepanek-arm paul-szczepanek-arm Oct 23, 2020

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

this is not human parsable anymore, I can't even work out if the curly brace below creates a mismatch

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I will rework this one. I agree it is a mess.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

done.

@pan-
Copy link
Member Author

pan- commented Oct 27, 2020

@paul-szczepanek-arm I improved the PR based on your suggestions, please review.

@0xc0170
Copy link
Contributor

0xc0170 commented Nov 5, 2020

CI started

@mergify mergify bot added needs: CI and removed needs: review labels Nov 5, 2020
@mbed-ci
Copy link

mbed-ci commented Nov 5, 2020

Jenkins CI Test : ✔️ SUCCESS

Build Number: 1 | 🔒 Jenkins CI Job | 🌐 Logs & Artifacts

CLICK for Detailed Summary

jobs Status
jenkins-ci/mbed-os-ci_unittests ✔️
jenkins-ci/mbed-os-ci_build-greentea-ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-greentea-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-cloud-example-ARM ✔️
jenkins-ci/mbed-os-ci_build-example-GCC_ARM ✔️
jenkins-ci/mbed-os-ci_build-example-ARM ✔️
jenkins-ci/mbed-os-ci_dynamic-memory-usage ✔️
jenkins-ci/mbed-os-ci_greentea-test ✔️
jenkins-ci/mbed-os-ci_cloud-client-pytest ✔️

@0xc0170 0xc0170 merged commit c29a2e2 into ARMmbed:master Nov 6, 2020
@mergify mergify bot removed the ready for merge label Nov 6, 2020
@mbedmain mbedmain added Release-pending and removed release-type: patch Indentifies a PR as containing just a patch Release-pending labels Nov 18, 2020
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants