-
Notifications
You must be signed in to change notification settings - Fork 2.1k
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
Conversation
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 <[email protected]>
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.
The recommended board changed?
src/platform/BUILD.gn
Outdated
"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" ] |
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.
Something wrong here, sdk_posix_config should be specified relative to some $foo_root.
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 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) |
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.
No better way to panic here?
} | ||
else | ||
{ | ||
ret = CHIP_ERROR_INVALID_ARGUMENT; |
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.
Use buffer size too small error?
and one below
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'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); |
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.
nit: Remove extra parenthesis?
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.
mis-match of our coding conventions from BLE, I'll remove them.
memset(pBuf, 0x00, dataLen); | ||
if (!pMsg || !pBuf) | ||
{ | ||
while (1) |
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.
No better panic?
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.
We could return a false
. I will add this instead.
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.
Would assert() or nlASSERT() be appropriate here?
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 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?
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.
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.
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.
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?
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 think it's reasonable to assert if we cannot allocate the task - it'd a bug if we hit this and not recoverable.
@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. |
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.
Approving pending @mspang
* Removed parens around return values. * Propagated an error if possible. * used assert() macro otherwise.
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.
Request changes for the build file bit which should be fixed up.
src/platform/BUILD.gn
Outdated
"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" ] |
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 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.
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 |
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. |
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); |
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.
is this suppose to be ICall_free((void *) pMsg);
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.
good catch, yes it is.
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.
Thanks for the quick response. Waiting for all of the checks to complete, and I'll merge this in.
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"
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"
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"
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"
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
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 [email protected]
Problem
The Texas Instruments CC26X2 platform does not enable BLE Rendezvous according to the CHIP specification.
Summary of Changes
Fixes #4864