Skip to content

Commit

Permalink
[TI] Test Event #8 feedback (#16495)
Browse files Browse the repository at this point in the history
* Platform updates found from TE#8

OpenThread config added DNS client support to fully enable SRP.

Configuration limiting OpenThread message buffers removed for higher memory
devices. It was found that the OpenThread stack would not de-fragment the long
packets needed for OTA. This ended up silently failing before the packets
reached the LwIP stack.

GN build updated to include missing dependencies.

KVS updated to return proper CHIP_ERROR value instead of a platform error.

AES hardware acceleration disabled due to a runtime error. This is likely a
missing `mbedtls_aes_free()` call. Further debug is required before
re-enabling.

* Centralize TI OpenThread config

* Restyled by whitespace

* Restyled by clang-format

* Restyled by gn

* add CHIP DNS configuration

* Update length calculation for NVS

* Restyled by clang-format

Co-authored-by: Restyled.io <[email protected]>
  • Loading branch information
2 people authored and pull[bot] committed Jun 23, 2023
1 parent 0794451 commit c4f3a39
Show file tree
Hide file tree
Showing 11 changed files with 71 additions and 109 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,7 @@
*
*/

#ifndef OPENTHREAD_PLATFORM_CONFIG_H
#define OPENTHREAD_PLATFORM_CONFIG_H

// Disable the Nordic-supplied OpenThread logging facilities and use
// the facilities provided by the CHIP Device Layer
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP

// When operating in a less than ideal RF environment, having a more forgiving configuration
// of OpenThread makes thread a great deal more reliable.
#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0
#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4

// Enable periodic parent search to speed up finding a better parent.
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65
#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0

// Use smaller maximum interval to speed up reattaching.
#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms

#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0
#define UART_AS_SERIAL_TRANSPORT 1
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1

#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
#pragma once

// Use the TI-supplied default platform configuration for remainder
#include "openthread-core-cc13x2_26x2-config.h"

#endif // OPENTHREAD_PLATFORM_CONFIG_H
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,7 @@
*
*/

#ifndef OPENTHREAD_PLATFORM_CONFIG_H
#define OPENTHREAD_PLATFORM_CONFIG_H

// Disable the Nordic-supplied OpenThread logging facilities and use
// the facilities provided by the CHIP Device Layer
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP

// When operating in a less than ideal RF environment, having a more forgiving configuration
// of OpenThread makes thread a great deal more reliable.
#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0
#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4

// Enable periodic parent search to speed up finding a better parent.
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65
#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0

// Use smaller maximum interval to speed up reattaching.
#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms

#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0
#define UART_AS_SERIAL_TRANSPORT 1
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1

#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
#pragma once

// Use the TI-supplied default platform configuration for remainder
#include "openthread-core-cc13x2_26x2-config.h"

#endif // OPENTHREAD_PLATFORM_CONFIG_H
11 changes: 9 additions & 2 deletions examples/pump-controller-app/cc13x2x7_26x2x7/main/AppTask.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,9 @@

#if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
#include <app/clusters/ota-requestor/BDXDownloader.h>
#include <app/clusters/ota-requestor/DefaultOTARequestorStorage.h>
#include <app/clusters/ota-requestor/GenericOTARequestorDriver.h>
#include <app/clusters/ota-requestor/OTARequestor.h>
#include <platform/GenericOTARequestorDriver.h>
#include <platform/cc13x2_26x2/OTAImageProcessorImpl.h>
#endif
#include <app-common/zap-generated/attributes/Accessors.h>
Expand Down Expand Up @@ -68,6 +69,7 @@ AppTask AppTask::sAppTask;

#if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
static OTARequestor sRequestorCore;
static DefaultOTARequestorStorage sRequestorStorage;
static GenericOTARequestorDriver sRequestorUser;
static BDXDownloader sDownloader;
static OTAImageProcessorImpl sImageProcessor;
Expand All @@ -77,7 +79,8 @@ void InitializeOTARequestor(void)
// Initialize and interconnect the Requestor and Image Processor objects
SetRequestorInstance(&sRequestorCore);

sRequestorCore.Init(&Server::GetInstance(), &sRequestorUser, &sDownloader);
sRequestorStorage.Init(chip::Server::GetInstance().GetPersistentStorage());
sRequestorCore.Init(chip::Server::GetInstance(), sRequestorStorage, sRequestorUser, sDownloader);
sImageProcessor.SetOTADownloader(&sDownloader);
sDownloader.SetImageProcessorDelegate(&sImageProcessor);
sRequestorUser.Init(&sRequestorCore, &sImageProcessor);
Expand Down Expand Up @@ -200,6 +203,10 @@ int AppTask::Init()

ConfigurationMgr().LogDeviceConfig();

#if defined(CHIP_DEVICE_CONFIG_ENABLE_OTA_REQUESTOR)
InitializeOTARequestor();
#endif

// QR code will be used with CHIP Tool
PrintOnboardingCodes(chip::RendezvousInformationFlags(chip::RendezvousInformationFlag::kBLE));

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -23,38 +23,7 @@
*
*/

#ifndef OPENTHREAD_PLATFORM_CONFIG_H
#define OPENTHREAD_PLATFORM_CONFIG_H

// Disable the Nordic-supplied OpenThread logging facilities and use
// the facilities provided by the CHIP Device Layer
#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP

// When operating in a less than ideal RF environment, having a more forgiving configuration
// of OpenThread makes thread a great deal more reliable.
#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0
#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4

// Enable periodic parent search to speed up finding a better parent.
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65
#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0

// Use smaller maximum interval to speed up reattaching.
#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms

#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0
#define UART_AS_SERIAL_TRANSPORT 1
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1

#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
#pragma once

// Use the TI-supplied default platform configuration for remainder
#include "openthread-core-cc13x2_26x2-config.h"

#endif // OPENTHREAD_PLATFORM_CONFIG_H
2 changes: 2 additions & 0 deletions src/platform/cc13x2_26x2/BUILD.gn
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,8 @@ static_library("cc13x2_26x2") {
"${chip_root}/src/crypto",
"${chip_root}/src/platform:platform_base",
]
public_configs =
[ "${chip_root}/src/lib/address_resolve:default_address_resolve_config" ]

if (chip_enable_ble) {
sources += [
Expand Down
22 changes: 13 additions & 9 deletions src/platform/cc13x2_26x2/CC13X2_26X2Config.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,6 +212,7 @@ CHIP_ERROR CC13X2_26X2Config::ReadKVS(const char * key, void * value, size_t val
NVINTF_itemID_t val_item = CC13X2_26X2Config::kConfigKey_KVS_value.nvID;
uint16_t subID;
size_t len;
uint16_t read_len;

VerifyOrExit(FindKVSSubID(key, subID) == NVINTF_SUCCESS, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND);

Expand All @@ -220,19 +221,22 @@ CHIP_ERROR CC13X2_26X2Config::ReadKVS(const char * key, void * value, size_t val
len = sNvoctpFps.getItemLen(val_item);
VerifyOrExit(len > 0, err = CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND); // key not found

VerifyOrExit(sNvoctpFps.readItem(val_item, (uint16_t) offset_bytes, (uint16_t) value_size, value) == NVINTF_SUCCESS,
if ((offset_bytes + value_size) > len)
{
// trying to read up to the end of the element
read_len = len - offset_bytes;
}
else
{
read_len = value_size;
}

VerifyOrExit(sNvoctpFps.readItem(val_item, (uint16_t) offset_bytes, read_len, value) == NVINTF_SUCCESS,
err = CHIP_ERROR_PERSISTED_STORAGE_FAILED);

if (read_bytes_size)
{
if (len - offset_bytes > value_size)
{
*read_bytes_size = value_size;
}
else
{
*read_bytes_size = len - offset_bytes;
}
*read_bytes_size = read_len;
}

exit:
Expand Down
1 change: 1 addition & 0 deletions src/platform/cc13x2_26x2/CHIPDevicePlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -54,4 +54,5 @@
#define CHIP_DEVICE_CONFIG_ENABLE_PAIRING_AUTOSTART 0

#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_SRP_CLIENT 1
#define CHIP_DEVICE_CONFIG_ENABLE_THREAD_DNS_CLIENT 1
#define CHIP_DEVICE_CONFIG_ENABLE_EXTENDED_DISCOVERY 1
1 change: 1 addition & 0 deletions src/platform/cc13x2_26x2/ConfigurationManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -77,6 +77,7 @@ CHIP_ERROR ConfigurationManagerImpl::Init()
}
err = CHIP_NO_ERROR;

exit:
return err;
}

Expand Down
10 changes: 9 additions & 1 deletion src/platform/cc13x2_26x2/KeyValueStoreManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -41,10 +41,18 @@ KeyValueStoreManagerImpl KeyValueStoreManagerImpl::sInstance;
CHIP_ERROR KeyValueStoreManagerImpl::_Get(const char * key, void * value, size_t value_size, size_t * read_bytes_size,
size_t offset_bytes) const
{
CHIP_ERROR err;

VerifyOrReturnError(key, CHIP_ERROR_INVALID_ARGUMENT);
VerifyOrReturnError(value, CHIP_ERROR_INVALID_ARGUMENT);

return CC13X2_26X2Config::ReadKVS(key, value, value_size, read_bytes_size, offset_bytes);
err = CC13X2_26X2Config::ReadKVS(key, value, value_size, read_bytes_size, offset_bytes);

if (err == CHIP_DEVICE_ERROR_CONFIG_NOT_FOUND)
{
err = CHIP_ERROR_PERSISTED_STORAGE_VALUE_NOT_FOUND;
}
return err;
}

CHIP_ERROR KeyValueStoreManagerImpl::_Put(const char * key, const void * value, size_t value_size)
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@

/* Enable Hardware Acceleration */

#define MBEDTLS_AES_ALT
//#define MBEDTLS_AES_ALT
#define MBEDTLS_ECDH_COMPUTE_SHARED_ALT
#define MBEDTLS_ECDH_GEN_PUBLIC_ALT
#define MBEDTLS_ECDSA_SIGN_ALT
Expand Down
32 changes: 32 additions & 0 deletions src/platform/cc13x2_26x2/openthread-core-cc13x2_26x2-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -28,5 +28,37 @@

#pragma once

#ifdef DeviceFamily_CC13X2_CC26X2

/* Number of message buffers reduced to fit into CC26x2x3 RAM */
#define OPENTHREAD_CONFIG_NUM_MESSAGE_BUFFERS 22

#endif // DeviceFamily_CC13X2_CC26X2

#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_APP

// When operating in a less than ideal RF environment, having a more forgiving configuration
// of OpenThread makes thread a great deal more reliable.
#define OPENTHREAD_CONFIG_TMF_ADDRESS_QUERY_MAX_RETRY_DELAY 120 // default is 28800
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_DIRECT 15 // default is 3
#define OPENTHREAD_CONFIG_MAC_DEFAULT_MAX_FRAME_RETRIES_INDIRECT 1 // default is 0
#define OPENTHREAD_CONFIG_MAC_MAX_TX_ATTEMPTS_INDIRECT_POLLS 16 // default is 4

// Enable periodic parent search to speed up finding a better parent.
#define OPENTHREAD_CONFIG_PARENT_SEARCH_ENABLE 1 // default is 0
#define OPENTHREAD_CONFIG_PARENT_SEARCH_RSS_THRESHOLD -45 // default is -65
#define OPENTHREAD_CONFIG_MLE_INFORM_PREVIOUS_PARENT_ON_REATTACH 1 // default is 0

// Use smaller maximum interval to speed up reattaching.
#define OPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_MAXIMUM_INTERVAL (60 * 10 * 1000) // default 1200000 ms

#define OPENTHREAD_CONFIG_JOINER_ENABLE 1
#define OPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE 0
#define UART_AS_SERIAL_TRANSPORT 1
#define OPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE 1

#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1
#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1
#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1
#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1
#define OPENTHREAD_CONFIG_DNS_CLIENT_SERVICE_DISCOVERY_ENABLE 1

0 comments on commit c4f3a39

Please sign in to comment.