Skip to content
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

CC26X2X7 Initial support of BLE Rendezvous #4865

Merged
merged 12 commits into from
Feb 17, 2021
Merged

Conversation

srickardti
Copy link
Contributor

Migrate to the new Texas Instruments CC26X2X7 LaunchPad. This allows
concurrent Full Thread Device and BLE operation. This Enables BLE
rendezvous on the CC26X2X7.

Thanks to Alexander D'Abreu for work on the DMM integration and CHIPoBLE
profile development for the TI platform.

Co-Authored-by: Alexander D'Abreu alexander.dabreu@ti.com

Problem

The Texas Instruments CC26X2 platform does not enable BLE Rendezvous according to the CHIP specification.

Summary of Changes

  • Migrates the build to denote the new CC26X2X7 platform support
  • Enables concurrent Thread and BLE operation for the CC26X2 platform.
  • Adds CHIPoBLE profile for BLE Rendezvous for TI CC26X2 platform

Fixes #4864

Migrate to the new Texas Instruments CC26X2X7 LaunchPad. This allows
concurrent Full Thread Device and BLE operation. This Enables BLE
rendezvous on the CC26X2X7.

Thanks to Alexander D'Abreu for work on the DMM integration and CHIPoBLE
profile development for the TI platform.

Co-Authored-by: Alexander D'Abreu <alexander.dabreu@ti.com>
src/platform/cc13x2_26x2/BLEManagerImpl.h Outdated Show resolved Hide resolved
Copy link
Contributor

@mspang mspang left a comment

Choose a reason for hiding this comment

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

The recommended board changed?

examples/lock-app/cc13x2x7_26x2x7/README.md Show resolved Hide resolved
"cc13x2_26x2/InetPlatformConfig.h",
"cc13x2_26x2/Logging.cpp",
"cc13x2_26x2/PlatformManagerImpl.cpp",
"cc13x2_26x2/PlatformManagerImpl.h",
"cc13x2_26x2/SystemPlatformConfig.h",
]

if (chip_enable_ble) {
configs -= [ "${build_root}/config/compiler:std_default" ]
configs += [ "//:sdk_posix_config" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

Something wrong here, sdk_posix_config should be specified relative to some $foo_root.

Copy link
Contributor

Choose a reason for hiding this comment

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

This needs fixing. I think you just need to add "${sdk_target_name}_posix_config" to public_configs of "${chip_root}/third_party/ti_simplelink_sdk" rather than configs.

err = BleLayer::Init(this, this, &SystemLayer);
if (err != CHIP_NO_ERROR)
{
while (1)
Copy link
Contributor

Choose a reason for hiding this comment

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

No better way to panic here?

}
else
{
ret = CHIP_ERROR_INVALID_ARGUMENT;
Copy link
Contributor

Choose a reason for hiding this comment

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

Use buffer size too small error?

and one below

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I'll update those, since the buffer size was statically allocated, we thought parameter would be a better fit.


EnqueueEvtHdrMsg(BLEManagerIMPL_CHIPOBLE_CLOSE_CONN_EVT, (void *) pMsg);

return (CHIP_NO_ERROR);
Copy link
Contributor

Choose a reason for hiding this comment

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

nit: Remove extra parenthesis?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

mis-match of our coding conventions from BLE, I'll remove them.

memset(pBuf, 0x00, dataLen);
if (!pMsg || !pBuf)
{
while (1)
Copy link
Contributor

Choose a reason for hiding this comment

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

No better panic?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

We could return a false. I will add this instead.

Copy link
Contributor

Choose a reason for hiding this comment

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

Would assert() or nlASSERT() be appropriate here?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I think we were unsure about what the best way forward is for these cases. For this one, returning a false is probably correct. There are others that the function does not have a return type, so we cannot propagate an error up. for that, would assert() be correct?

Copy link
Contributor

Choose a reason for hiding this comment

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

assert() should be preferred for any internal error or precondition failure. For public APIs, an error return may also be appropriate.

i.e., if the condition being false is not expected to happen unless there's a bug, we should assert.

Conversely, if an assert fires, it should be the case that there is a software bug or hardware failure

If an error condition happens that is not the result of a software bug, we must not assert.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

So for these functions, returning a false on an allocation failure makes sense.

On some of the others, like failing to allocate the BLE task, I could add the return value path or assert?

Copy link
Contributor

Choose a reason for hiding this comment

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

I think it's reasonable to assert if we cannot allocate the task - it'd a bug if we hit this and not recoverable.

@srickardti
Copy link
Contributor Author

@mspang Running the Thread stack and BLE stack together requires more Flash space than the CC2652R1 has available. The new CC2652R7 has 704K of flash to accommodate this requirement. Same platform with more Flash/RAM.

Copy link
Contributor

@woody-apple woody-apple left a comment

Choose a reason for hiding this comment

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

Approving pending @mspang

srickardti and others added 3 commits February 16, 2021 14:46
* Removed parens around return values.
* Propagated an error if possible.
* used assert() macro otherwise.
Copy link
Contributor

@mspang mspang left a comment

Choose a reason for hiding this comment

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

Request changes for the build file bit which should be fixed up.

"cc13x2_26x2/InetPlatformConfig.h",
"cc13x2_26x2/Logging.cpp",
"cc13x2_26x2/PlatformManagerImpl.cpp",
"cc13x2_26x2/PlatformManagerImpl.h",
"cc13x2_26x2/SystemPlatformConfig.h",
]

if (chip_enable_ble) {
configs -= [ "${build_root}/config/compiler:std_default" ]
configs += [ "//:sdk_posix_config" ]
Copy link
Contributor

Choose a reason for hiding this comment

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

This needs fixing. I think you just need to add "${sdk_target_name}_posix_config" to public_configs of "${chip_root}/third_party/ti_simplelink_sdk" rather than configs.

@srickardti
Copy link
Contributor Author

Hey, had to deal with some stuff AFK. The state of Texas isn't in the best state right now. I was looking into it and found the header that needed the TI-POSIX API was removed somewhere along the line of developing this feature. But the build configuration wasn't updated. I've removed the offending build config.

The issue with adding the TI-POSIX config to the ${chip_root}/third_party/ti_simplelink_sdk target's public configs is that there isn't a way to propagate a negative requirement to the dependencies. The headers conflict with some of the GNU definitions pulled in by -std=gnu++14 and -std=gnu11.

@mspang
Copy link
Contributor

mspang commented Feb 17, 2021

Hey, had to deal with some stuff AFK. The state of Texas isn't in the best state right now. I was looking into it and found the header that needed the TI-POSIX API was removed somewhere along the line of developing this feature. But the build configuration wasn't updated. I've removed the offending build config.

The issue with adding the TI-POSIX config to the ${chip_root}/third_party/ti_simplelink_sdk target's public configs is that there isn't a way to propagate a negative requirement to the dependencies. The headers conflict with some of the GNU definitions pulled in by -std=gnu++14 and -std=gnu11.

Ah, right, got it. The main thing that needs fixing is just using // to refer to it instead of simplelink_sdk_root, chip_root, or similar. I don't want us to depend on where the code is in the checkout, in general, so we have the foo_root variables to avoid it.

You can put a config in third_party/simplelink and reference it via simplelink_root. Or, for things that the application might replace, we have the option of using declare_args() to let the application provide the target label, and importing that declaration from a known path. That's the only way we should be referring to an application provided library or config target from common code such as src/platform.

@mspang
Copy link
Contributor

mspang commented Feb 17, 2021

Hey, had to deal with some stuff AFK. The state of Texas isn't in the best state right now. I was looking into it and found the header that needed the TI-POSIX API was removed somewhere along the line of developing this feature. But the build configuration wasn't updated. I've removed the offending build config.
The issue with adding the TI-POSIX config to the ${chip_root}/third_party/ti_simplelink_sdk target's public configs is that there isn't a way to propagate a negative requirement to the dependencies. The headers conflict with some of the GNU definitions pulled in by -std=gnu++14 and -std=gnu11.

Ah, right, got it. The main thing that needs fixing is just using // to refer to it instead of simplelink_sdk_root, chip_root, or similar. I don't want us to depend on where the code is in the checkout, in general, so we have the foo_root variables to avoid it.

You can put a config in third_party/simplelink and reference it via simplelink_root. Oe, for things that the application might replace, we have the option of using declare_arg() to point a group target at it. That's the only way we should be referring to an application provided library or config target from common code such as src/platform.

BTW, can we just replace gnu++14 with c++14 for the whole TI build, not on a target by target basis? If so, that's a good solution.

pBuf = (uint8_t *) ICall_malloc(dataLen);
if (NULL == pBuf)
{
ICall_free((void *) pBuf);

Choose a reason for hiding this comment

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

is this suppose to be ICall_free((void *) pMsg);

Copy link
Contributor Author

Choose a reason for hiding this comment

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

good catch, yes it is.

Choose a reason for hiding this comment

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

Thanks for the quick response. Waiting for all of the checks to complete, and I'll merge this in.

@mspang mspang merged commit e76ed54 into project-chip:master Feb 17, 2021
mspang added a commit to mspang/connectedhomeip that referenced this pull request Feb 23, 2021
This broke after e76ed54 ("CC26X2X7 Initial support of BLE Rendezvous (project-chip#4865)")

Tested via
  gn gen out/unified --args="target_os=\"all\" enable_ti_simplelink_builds=true ti_simplelink_sdk_root=\"$HOME/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng\" ti_sysconfig_root=\"$HOME/ti/sysconfig_1.7.0\" enable_linux_bridge_app_build=false"
mspang added a commit to mspang/connectedhomeip that referenced this pull request Feb 23, 2021
This broke after e76ed54 ("CC26X2X7 Initial support of BLE Rendezvous (project-chip#4865)")

ERROR at //config/cc13x2_26x2/toolchain/BUILD.gn:23:5: Unable to load "/home/spang/connectedhomeip2/examples/lock-app/cc13x2_26x2/args.gni".
    import("${chip_root}/examples/lock-app/cc13x2_26x2/args.gni")
    ^-----------------------------------------------------------
See //BUILD.gn:245:16: which caused the file to be included.
      deps = [ "${chip_root}/examples/lock-app/cc13x2_26x2(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2_26x2_lock_app)" ]
               ^--------------------------------------------------------------------------------

Fix the build file to use the new paths.

Tested via
  gn gen out/unified --args="target_os=\"all\" enable_ti_simplelink_builds=true ti_simplelink_sdk_root=\"$HOME/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng\" ti_sysconfig_root=\"$HOME/ti/sysconfig_1.7.0\" enable_linux_bridge_app_build=false"
mspang added a commit to mspang/connectedhomeip that referenced this pull request Feb 23, 2021
This broke after e76ed54 ("CC26X2X7 Initial support of BLE Rendezvous (project-chip#4865)")

ERROR at //config/cc13x2_26x2/toolchain/BUILD.gn:23:5: Unable to load "/home/spang/connectedhomeip2/examples/lock-app/cc13x2_26x2/args.gni".
    import("${chip_root}/examples/lock-app/cc13x2_26x2/args.gni")
    ^-----------------------------------------------------------
See //BUILD.gn:245:16: which caused the file to be included.
      deps = [ "${chip_root}/examples/lock-app/cc13x2_26x2(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2_26x2_lock_app)" ]
               ^--------------------------------------------------------------------------------

Fix the build file to use the new paths.

Tested via
  gn gen out/unified --args="target_os=\"all\" enable_ti_simplelink_builds=true ti_simplelink_sdk_root=\"$HOME/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng\" ti_sysconfig_root=\"$HOME/ti/sysconfig_1.7.0\" enable_linux_bridge_app_build=false"
woody-apple pushed a commit that referenced this pull request Feb 24, 2021
This broke after e76ed54 ("CC26X2X7 Initial support of BLE Rendezvous (#4865)")

ERROR at //config/cc13x2_26x2/toolchain/BUILD.gn:23:5: Unable to load "/home/spang/connectedhomeip2/examples/lock-app/cc13x2_26x2/args.gni".
    import("${chip_root}/examples/lock-app/cc13x2_26x2/args.gni")
    ^-----------------------------------------------------------
See //BUILD.gn:245:16: which caused the file to be included.
      deps = [ "${chip_root}/examples/lock-app/cc13x2_26x2(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2_26x2_lock_app)" ]
               ^--------------------------------------------------------------------------------

Fix the build file to use the new paths.

Tested via
  gn gen out/unified --args="target_os=\"all\" enable_ti_simplelink_builds=true ti_simplelink_sdk_root=\"$HOME/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng\" ti_sysconfig_root=\"$HOME/ti/sysconfig_1.7.0\" enable_linux_bridge_app_build=false"
alexhqwang pushed a commit to alexhqwang/connectedhomeip that referenced this pull request Sep 1, 2021
This broke after e76ed54 ("CC26X2X7 Initial support of BLE Rendezvous (project-chip#4865)")

ERROR at //config/cc13x2_26x2/toolchain/BUILD.gn:23:5: Unable to load "/home/spang/connectedhomeip2/examples/lock-app/cc13x2_26x2/args.gni".
    import("${chip_root}/examples/lock-app/cc13x2_26x2/args.gni")
    ^-----------------------------------------------------------
See //BUILD.gn:245:16: which caused the file to be included.
      deps = [ "${chip_root}/examples/lock-app/cc13x2_26x2(${chip_root}/config/cc13x2_26x2/toolchain:cc13x2_26x2_lock_app)" ]
               ^--------------------------------------------------------------------------------

Fix the build file to use the new paths.

Tested via
  gn gen out/unified --args="target_os=\"all\" enable_ti_simplelink_builds=true ti_simplelink_sdk_root=\"$HOME/ti/simplelink_cc13x2_26x2_sdk_4_40_05_02_eng\" ti_sysconfig_root=\"$HOME/ti/sysconfig_1.7.0\" enable_linux_bridge_app_build=false"

GitOrigin-RevId: 2891d6b
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Texas Instruments CC26X2 does not support BLE Rendezvous
8 participants