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

[Telink] Use common Zephyr heap & Update Telink image to 16 #29531

Merged
merged 3 commits into from
Oct 2, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-telink:12
image: ghcr.io/project-chip/chip-build-telink:16
options: --user root

steps:
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ jobs:
if: github.actor != 'restyled-io[bot]'

container:
image: ghcr.io/project-chip/chip-build-telink:12
image: ghcr.io/project-chip/chip-build-telink:16
volumes:
- "/tmp/bloat_reports:/tmp/bloat_reports"

Expand Down
17 changes: 8 additions & 9 deletions config/telink/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -143,6 +143,10 @@ config B9X_BLE_CTRL_MASTER_MAX_NUM
config B9X_BLE_CTRL_SLAVE_MAX_NUM
default 1

config B9X_BLE_CTRL_RF_POWER
default 3 if PM
default 9

choice B9X_BLE_CTRL_MAC_TYPE
default B9X_BLE_CTRL_MAC_TYPE_RANDOM_STATIC
endchoice
Expand Down Expand Up @@ -220,6 +224,10 @@ config OPENTHREAD_SLAAC
config OPENTHREAD_MANUAL_START
default y

config OPENTHREAD_DEFAULT_TX_POWER
default 3 if PM
default 9

config NET_TX_STACK_SIZE
default 554 if PM

Expand Down Expand Up @@ -247,15 +255,6 @@ config MBEDTLS_USER_CONFIG_ENABLE
config MBEDTLS_USER_CONFIG_FILE
default "telink-mbedtls-config.h"

config MBEDTLS_ENABLE_HEAP
default y

# TBD: Something wrong with this heap. Need to be investigated. Cirrently just set minimal size
config MBEDTLS_HEAP_SIZE
default 0

config OPENTHREAD_EXTERNAL_HEAP
default y

# getopt version
config GETOPT_LONG
Expand Down
4 changes: 0 additions & 4 deletions examples/all-clusters-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,3 @@ CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
4 changes: 0 additions & 4 deletions examples/all-clusters-minimal-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,3 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
4 changes: 0 additions & 4 deletions examples/bridge-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
4 changes: 0 additions & 4 deletions examples/chef/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,3 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
4 changes: 0 additions & 4 deletions examples/lighting-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
4 changes: 0 additions & 4 deletions examples/ota-requestor-app/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,3 @@ CONFIG_CHIP_LIB_SHELL=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
3 changes: 0 additions & 3 deletions examples/platform/telink/project_include/OpenThreadConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -35,9 +35,6 @@

#define OPENTHREAD_CONFIG_LOG_OUTPUT OPENTHREAD_CONFIG_LOG_OUTPUT_DEBUG_UART

#undef OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT
#define OPENTHREAD_CONFIG_ENABLE_BUILTIN_MBEDTLS_MANAGEMENT 1

#undef OPENTHREAD_CONFIG_LOG_LEVEL
#if (CONFIG_LOG_MODE_MINIMAL)
#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_NONE
Expand Down
4 changes: 0 additions & 4 deletions examples/shell/telink/prj.conf
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,3 @@ CONFIG_CHIP_CERTIFICATION_DECLARATION_STORAGE=n

# Enable Power Management
CONFIG_PM=n

# Custom RF power values
CONFIG_B9X_BLE_CTRL_RF_POWER_P9P11DBM=y
CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
12 changes: 6 additions & 6 deletions src/platform/Zephyr/PlatformManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ PlatformManagerImpl PlatformManagerImpl::sInstance{ sChipThreadStack };

static k_timer sOperationalHoursSavingTimer;

#if !CONFIG_NORDIC_SECURITY_BACKEND
#if !CONFIG_NORDIC_SECURITY_BACKEND && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
static int app_entropy_source(void * data, unsigned char * output, size_t len, size_t * olen)
{
const struct device * entropy = DEVICE_DT_GET(DT_CHOSEN(zephyr_entropy));
Expand All @@ -71,7 +71,7 @@ static int app_entropy_source(void * data, unsigned char * output, size_t len, s

return ret;
}
#endif // !CONFIG_NORDIC_SECURITY_BACKEND
#endif // !CONFIG_NORDIC_SECURITY_BACKEND && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)

void PlatformManagerImpl::OperationalHoursSavingTimerEventHandler(k_timer * timer)
{
Expand Down Expand Up @@ -108,20 +108,20 @@ CHIP_ERROR PlatformManagerImpl::_InitChipStack(void)
{
CHIP_ERROR err;

#if !CONFIG_NORDIC_SECURITY_BACKEND
#if !CONFIG_NORDIC_SECURITY_BACKEND && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
// Minimum required from source before entropy is released ( with mbedtls_entropy_func() ) (in bytes)
const size_t kThreshold = 16;
#endif // !CONFIG_NORDIC_SECURITY_BACKEND
#endif // !CONFIG_NORDIC_SECURITY_BACKEND && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)

// Initialize the configuration system.
err = Internal::ZephyrConfig::Init();
SuccessOrExit(err);

#if !CONFIG_NORDIC_SECURITY_BACKEND
#if !CONFIG_NORDIC_SECURITY_BACKEND && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)
// Add entropy source based on Zephyr entropy driver
err = chip::Crypto::add_entropy_source(app_entropy_source, NULL, kThreshold);
SuccessOrExit(err);
#endif // !CONFIG_NORDIC_SECURITY_BACKEND
#endif // !CONFIG_NORDIC_SECURITY_BACKEND && !defined(CONFIG_MBEDTLS_ZEPHYR_ENTROPY)

// Call _InitChipStack() on the generic implementation base class to finish the initialization process.
err = Internal::GenericPlatformManagerImpl_Zephyr<PlatformManagerImpl>::_InitChipStack();
Expand Down
8 changes: 8 additions & 0 deletions src/platform/telink/telink-mbedtls-config.h
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,14 @@
#ifndef MBEDTLS_TSLR9_CONF_H
#define MBEDTLS_TSLR9_CONF_H

#ifdef MBEDTLS_PLATFORM_MEMORY
#undef MBEDTLS_PLATFORM_MEMORY
#endif

#ifdef MBEDTLS_MEMORY_BUFFER_ALLOC_C
#undef MBEDTLS_MEMORY_BUFFER_ALLOC_C
#endif

#define MBEDTLS_HKDF_C
#define MBEDTLS_PKCS5_C
#define MBEDTLS_X509_CREATE_C
Expand Down
Loading