Skip to content

Commit 8f62e82

Browse files
s07641069interferrestyled-commitsandriy-bilynskyyhaiwentelink
authored andcommitted
[Telink] Zephyr 3.3 & 3.7 support (project-chip#37582)
* [Telink] Zephyr v3.7 update changes Adopted changes for Telink B9x board series for upcoming update of Zephyr version. Fixed err output from InitChipStack in mainCommon. Tested advertisement tested manually. * [Telink] Manual Zephyr SDK update to check CI jobs * [Telink] Fix build errors: - STREAM_FLASH_ERASE has direct dependencies STREAM_FLASH - GETOPT_LONG multiple definition error * [Telink] CONFIG_BOOT_MAX_IMG_SECTORS_AUTO used * [Telink] Fix build errors * [Telink] Reduce mcuboot partition size to 60Kb - Apply change for flash overlays <=2Mb - Possible after reducing CONFIG_BOOT_MAX_IMG_SECTORS * [Telink] Reduce NET_BUF_*_COUNT (to be tested) * [Telink] avoid using NEWLIB_LIBC (use PICOLIB) * Restyled by whitespace * Restyled by clang-format * [Telink] Update Zephyr revision & SDK * [Telink] Adopt TL3218 to latest Zephyr version * [Telink] Use 4mb flash for (B92) Light Switch App target build * [Telink] Fix W91 target build * [Telink] Fix B91 Mars target build * [Telink] Use correct if SOC_RISCV_TELINK_TL321X * [Telink] Fix retention target builds * [Telink] fixed W91 WiFi interface init reverted GetWifiInterface in InetUtils changes, added syntax fixes to Kconfigs.default * [Telink] Update to latest zephyr (develop_new_matter_fixes) hash * [Telink] memory layout and default config changes Reduced mcuboot partition by 0x1000 and removed two other partitions getting 0x3000 to distribute 0x4000 between slot0 and slot 1. Kconfig.defaults changes to reduce ROM usage on B92 lighting OTA. To be improved [Telink] reduced MCUboot partition for most targets increase of slot0,1, bootloader config changes [Telink] Fixed B9x platform startup Lack of MBEDTLS_ZEPHYR_ENTROPY config in defaults which led to InitChipStack 172 error. As result entropy failed in src/platform/Zephyr/PlatformManagerImpl.cpp [Telink] fixed B9x commissioning Reverted network buffers configs [Telink] TL3218 commissioning fixes Changes to fix TLx commissioning on new Zephyr [Telink] Zephyr revision update After merge updates. Kconfig change to fix TL3218 commissioning Reduced RAM usage to build TL3218 by COMMON_LIBC_MALLOC_ARENA_SIZE changing [Telink] zephyr version change, cleanup Changed MCUBOOT logs config, same for LZMA * [Telink] W91 OTA, Factory data commissioning fix Fixes full config target commissioning for W91. Been failing on `SendAttestationRequest` step, finished with `general error 0x01`. Tested manually with chip-tool on RPi on tlsr9118bdk40d * [Telink] W91 stacks increase Increased NET_MGMT_EVENT_STACK_SIZE by 122 B and IPC_SERVICE_BACKEND_ICMSG_WQ_STACK_SIZE by 256 B so that net_mgmt and icmsg_workq stack were used <90%. Jenkins reported thread analyzer warnings on that. * [Telink] review changes draft Reverted NET_BUF_RX/TX_COUNT * [Telink] Add tl7218 board. * [Telink] Fix compilation warnings. * [Telink] Fix config option. * [Telink] Cleanup MbedTLS configuration. * [Telink] Update tl721x default Kconfig - update the default values for BT_RX_STACK_SIZE and COMMON_LIBC_MALLOC_ARENA_SIZE for TL721X Signed-off-by: Jinmiao Yu <jinmiao.yu@telink-semi.com> * [Telink] Remove unused files * [Telink] Update Zephyr revision * [Telink] Clean config types * [Telink] Update Zephyr revision * [Telink] Increase BLE_CTRL_THREAD_STACK_SIZE (B92 SoC retention test) * [Telink] Fix compilation warninig * [Telink] TL7218 upgrade to support version A2 * [Telink] Remove unused file after resolve merge conflict * [Telink] Add tl7218_retention target * riscv: telink: seperate ram for tl3218x . - use retention mode to seperate ram. - reserve more ram for ilm. Signed-off-by: Haiwen Xia <haiwen.xia@telink-semi.com> * [Telink] Fix broken GitHub CI after adding tl721x target * [Telink] remove temporary LZMA for tl321x due to bug * [Telink] Fix TELINK_TLX_MATTER_RETENTION_LAYOUT typo for BOARD_TL3218 * [Telink] Add GPIO/PWM required for TL721X telink-semi/hal_telink@62edeab * [Telink] Temporary disable B95 OTA failed build B95 will be removed fully in next commits * [Telink] Add missed clean out build output step * [Telink] adopt WiFi driver * [Telink] remove b95 SoC / TLSR9258a board (replaced by TL721x) * [Telink] Revert InetUtils.cpp Telink dependency * [Telink] zephyr versions compatibility changes (project-chip#382) * [Telink] zephyr versions compatibility changes * [Telink] Change Window Covering App default SoC W91 doesn't support PM * [Telink] Update Zephyr revision * [Telink] sync B92 flash layout * [Telink] Remove temp b92 4mb change * [Telink] Avoid main stack owerflow for w91 * [Telink] Update Zephyr revision * [Telink] manual sync after merge master * [Telink] Increase Main Stack size for W91 Update Zephyr revision * [Telink] Zephyr 3.3 backward compatibility support * riscv: telink: fix insufficient RAM when config LZMA (project-chip#384) - adjust the zephyr hash to 930b6d4 . Signed-off-by: Fengtai Xie <fengtai.xie@telink-semi.com> * riscv: telink: add retention mode for buteo (project-chip#385) * riscv: telink: Update Zephyr hash - adjust the zephyr hash to 9e39d9f . - add tl3218x_retention target . Signed-off-by: Fengtai Xie <fengtai.xie@telink-semi.com> * riscv: telink: remove retention build target for buteo Signed-off-by: Fengtai Xie <fengtai.xie@telink-semi.com> * [Telink] Add comment --------- Signed-off-by: Fengtai Xie <fengtai.xie@telink-semi.com> Co-authored-by: Alex Tsitsiura <s07641069@gmail.com> * [Telink] Fix commisioning issue due to missed MbedTLS module TODO: fix compilation warnings * telink: tl7218x: fix tercel retention (Update Zephyr hash) * [Telink] Optimize add MbedTLS definitions for Zephyr 3.3 without warnings * [Telink] Use latest hash for Zephyr 3.3 * [Telink] Disable debug part --------- Signed-off-by: Jinmiao Yu <jinmiao.yu@telink-semi.com> Signed-off-by: Haiwen Xia <haiwen.xia@telink-semi.com> Signed-off-by: Fengtai Xie <fengtai.xie@telink-semi.com> Co-authored-by: interfer <diman1436@gmail.com> Co-authored-by: Restyled.io <commits@restyled.io> Co-authored-by: Dmytro Huz <75682372+interfer@users.noreply.github.com> Co-authored-by: Andrii Bilynskyi <andrii.bilynskyi@telink-semi.com> Co-authored-by: Haiwen Xia <haiwen.xia@telink-semi.com> Co-authored-by: Serhii Salamakha <serhii.salamakha@gmail.com> Co-authored-by: fengtai-telink <fengtai.xie@telink-semi.com>
1 parent 3faaffa commit 8f62e82

24 files changed

+1608
-89
lines changed

.github/workflows/examples-telink.yaml

+18-13
Original file line numberDiff line numberDiff line change
@@ -175,6 +175,9 @@ jobs:
175175
out/telink-tl3218x-light-ota-compress-lzma-shell-factory-data/zephyr/zephyr.elf \
176176
/tmp/bloat_reports/
177177
178+
- name: clean out build output (keep tools)
179+
run: rm -rf ./out/telink*
180+
178181
- name: Build example Telink (tl321x_retention) Light Switch App with OTA, Shell, Factory Data
179182
# Run test for master and all PRs
180183
run: |
@@ -311,19 +314,21 @@ jobs:
311314
- name: clean out build output
312315
run: rm -rf ./out
313316

314-
- name: Build example Telink (B91 Mars) Temperature Measurement App with OTA
315-
# Run test for master and s07641069 PRs
316-
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
317-
run: |
318-
./scripts/run_in_build_env.sh \
319-
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement-mars-ota' build"
320-
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
321-
telink tlsr9518adk80d temperature-measurement-app-mars-ota \
322-
out/telink-tlsr9518adk80d-temperature-measurement-mars-ota/zephyr/zephyr.elf \
323-
/tmp/bloat_reports/
324-
325-
- name: clean out build output
326-
run: rm -rf ./out
317+
# B91 Mars adopted only for Zephyr 3.7
318+
# Will be uncommented in next commits
319+
# - name: Build example Telink (B91 Mars) Temperature Measurement App with OTA
320+
# # Run test for master and s07641069 PRs
321+
# if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
322+
# run: |
323+
# ./scripts/run_in_build_env.sh \
324+
# "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement-mars-ota' build"
325+
# .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
326+
# telink tlsr9518adk80d temperature-measurement-app-mars-ota \
327+
# out/telink-tlsr9518adk80d-temperature-measurement-mars-ota/zephyr/zephyr.elf \
328+
# /tmp/bloat_reports/
329+
330+
# - name: clean out build output
331+
# run: rm -rf ./out
327332

328333
- name: Build example Telink (B91) Thermostat App
329334
# Run test for master and s07641069 PRs

config/telink/app/bootloader.conf

+3
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ CONFIG_BOOT_SWAP_USING_SCRATCH=n
2929
# With disabled option the only image magic is validated
3030
CONFIG_BOOT_VALIDATE_SLOT0=y
3131

32+
# Required for Zephyr 3.3 and replased with CONFIG_BOOT_MAX_IMG_SECTORS_AUTO in new versions
3233
# Maximum number of image sectors supported by the bootloader.
3334
# Maximum signed image size: 512 * 4096 = 2M Bytes
3435
CONFIG_BOOT_MAX_IMG_SECTORS=512
@@ -40,3 +41,5 @@ CONFIG_BOOT_MAX_IMG_SECTORS=512
4041
# - INFO, LOG_LEVEL_INF
4142
# - DEBUG, LOG_LEVEL_DBG
4243
CONFIG_MCUBOOT_LOG_LEVEL_INF=y
44+
45+
CONFIG_PICOLIBC=y

config/telink/app/bootloader_compress_lzma.conf

+3
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ CONFIG_BOOT_UPGRADE_ONLY=y
2222
# With disabled option the only image magic is validated
2323
CONFIG_BOOT_VALIDATE_SLOT0=y
2424

25+
# Required for Zephyr 3.3 and replased with CONFIG_BOOT_MAX_IMG_SECTORS_AUTO in new versions
2526
# Maximum number of image sectors supported by the bootloader.
2627
# Maximum signed image size: 512 * 4096 = 2M Bytes
2728
CONFIG_BOOT_MAX_IMG_SECTORS=512
@@ -42,3 +43,5 @@ CONFIG_SIZE_OPTIMIZATIONS=y
4243

4344
# Enable support LZMA compression
4445
CONFIG_COMPRESS_LZMA=y
46+
47+
CONFIG_PICOLIBC=y

config/telink/chip-module/CMakeLists.txt

+2-1
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,7 @@ endif()
5656
matter_add_flags(-DNL_ASSERT_USE_FLAGS_DEFAULT=1)
5757

5858
zephyr_include_directories(${CHIP_ROOT}/src/platform/telink/)
59+
zephyr_include_directories(${CHIP_ROOT}/src/platform/telink/wifi/${ZEPHYR_VERSION_STRING})
5960

6061
zephyr_get_compile_flags(ZEPHYR_CFLAGS_C C)
6162
matter_add_cflags("${ZEPHYR_CFLAGS_C}")
@@ -64,7 +65,7 @@ matter_add_cxxflags("${ZEPHYR_CFLAGS_CC}")
6465
zephyr_get_gnu_cpp_standard(ZEPHYR_GNU_CPP_STD)
6566
matter_add_cxxflags(${ZEPHYR_GNU_CPP_STD})
6667

67-
matter_add_flags(-DMBEDTLS_USER_CONFIG_FILE=<telink-mbedtls-config.h>)
68+
matter_add_flags(-DMBEDTLS_USER_CONFIG_FILE=<${CONFIG_MBEDTLS_CFG_FILE}>)
6869

6970
# Set up custom OpenThread configuration
7071

config/telink/chip-module/Kconfig

+1-1
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ config BOOTLOADER_MCUBOOT
4646
select IMG_MANAGER
4747
select STREAM_FLASH
4848
select STREAM_FLASH_ERASE
49-
select TELINK_W91_N22_MATTER_OTA_LAYOUT if BOARD_TLSR9118BDK40D
49+
select TELINK_W91_N22_MATTER_OTA_LAYOUT if BOARD_TLSR9118BDK40D || BOARD_TLSR9118BDK40D_V1
5050

5151
config CHIP_OTA_REQUESTOR_BUFFER_SIZE
5252
int "OTA Requestor image buffer size"

config/telink/chip-module/Kconfig.defaults

+45-17
Original file line numberDiff line numberDiff line change
@@ -24,6 +24,10 @@ config CHIP_PROJECT_CONFIG
2424
string "Project configuration file for Matter"
2525
default "include/CHIPProjectConfig.h"
2626

27+
config ZEPHYR_VERSION_3_3
28+
bool "Using Zephyr version 3.3"
29+
default n
30+
2731
config LOG
2832
default y
2933

@@ -62,6 +66,7 @@ config POSIX_MAX_FDS
6266
# Application stack size
6367
config MAIN_STACK_SIZE
6468
default 3240 if PM || SOC_RISCV_TELINK_TL321X
69+
default 4608 if SOC_RISCV_TELINK_W91 && !ZEPHYR_VERSION_3_3
6570
default 4096
6671

6772
config INIT_STACKS
@@ -79,11 +84,12 @@ config SYSTEM_WORKQUEUE_STACK_SIZE
7984
default 616 if PM
8085

8186
config HEAP_MEM_POOL_SIZE
82-
default 256
87+
default 256 if ZEPHYR_VERSION_3_3
88+
default 1280
8389

8490
config COMMON_LIBC_MALLOC_ARENA_SIZE
85-
default 20716 if SOC_RISCV_TELINK_TL321X || SOC_SERIES_RISCV_TELINK_B9X_RETENTION
86-
default 16384 if SOC_RISCV_TELINK_TL721X
91+
default 20716 if SOC_SERIES_RISCV_TELINK_B9X_RETENTION || (SOC_RISCV_TELINK_TL321X && ZEPHYR_VERSION_3_3)
92+
default 16384 if SOC_RISCV_TELINK_TL721X || (SOC_RISCV_TELINK_TL321X && !ZEPHYR_VERSION_3_3)
8793
default 12288
8894

8995
config NET_IPV6_MLD
@@ -171,7 +177,8 @@ config BT_DEVICE_NAME_GATT_WRITABLE
171177
if SOC_RISCV_TELINK_B9X || SOC_RISCV_TELINK_TLX
172178

173179
config TL_BLE_CTRL_THREAD_STACK_SIZE
174-
default 648
180+
default 648 if ZEPHYR_VERSION_3_3
181+
default 680
175182

176183
config TL_BLE_CTRL_MASTER_MAX_NUM
177184
default 0
@@ -193,13 +200,9 @@ endif # SOC_RISCV_TELINK_B9X || SOC_RISCV_TELINK_TLX
193200

194201
endif # BT
195202

196-
# Board retention config
197-
# Cut down the ram cost by matter's change,it can keep ramcode (driver).
198-
# No need load the ramcode every time in thread mode (retention mode).
199-
# If the ram is not enough , can change it back , initial setting is n.
200203
if BOARD_TLSR9528A_RETENTION || BOARD_TLSR9518ADK80D_RETENTION
201204
config SOC_SERIES_RISCV_TELINK_B9X_NON_RETENTION_RAM_CODE
202-
default n if PM
205+
default y if PM
203206

204207
config TELINK_B9X_MATTER_RETENTION_LAYOUT
205208
default y if PM
@@ -236,7 +239,7 @@ config CHIP_OTA_REQUESTOR
236239
default y
237240

238241
config MCUBOOT_SIGNATURE_KEY_FILE
239-
default "bootloader/mcuboot/root-ec-p256.pem" if BOARD_TLSR9118BDK40D
242+
default "bootloader/mcuboot/root-ec-p256.pem" if BOARD_TLSR9118BDK40D || BOARD_TLSR9118BDK40D_V1
240243
depends on BOOTLOADER_MCUBOOT
241244

242245
# In current config/zephyr/Kconfig
@@ -350,6 +353,8 @@ config CHIP_WIFI
350353
select NET_IPV6_ND # enable Neighbor Discovery to handle Router Advertisements
351354
select NET_IPV6_NBR_CACHE
352355
select NET_STATISTICS_USER_API
356+
imply MBEDTLS_ENTROPY_C
357+
imply MBEDTLS_KEY_EXCHANGE_RSA_ENABLED
353358

354359
if CHIP_WIFI
355360

@@ -404,7 +409,14 @@ config CHIP_WIFI_CONNECTION_RECOVERY_JITTER
404409
within range [-JITTER; +JITTER].
405410

406411
config NET_MGMT_EVENT_STACK_SIZE
407-
default 1128
412+
default 1128 if ZEPHYR_VERSION_3_3
413+
default 1250
414+
415+
if !ZEPHYR_VERSION_3_3
416+
config IPC_SERVICE_BACKEND_ICMSG_WQ_STACK_SIZE
417+
int "Size of RX work queue stack"
418+
default 2304 if TELINK_W91_IPC_DISPATCHER
419+
endif
408420

409421
endif # CHIP_WIFI
410422

@@ -419,12 +431,9 @@ config CHIP_ENABLE_PAIRING_AUTOSTART
419431
config MBEDTLS
420432
default y
421433

422-
config MBEDTLS_USER_CONFIG_ENABLE
434+
config MBEDTLS_CIPHER_AES_ENABLED
423435
default y
424436

425-
config MBEDTLS_USER_CONFIG_FILE
426-
default "telink-mbedtls-config.h"
427-
428437
config MBEDTLS_CIPHER_CCM_ENABLED
429438
default y
430439

@@ -443,10 +452,29 @@ config MBEDTLS_ECDH_C
443452
config MBEDTLS_ECDSA_C
444453
default y
445454

446-
# getopt version
447-
config GETOPT_LONG
455+
config MBEDTLS_PKCS5_C
456+
default y
457+
458+
config MBEDTLS_KEY_EXCHANGE_ECDH_ECDSA_ENABLED
459+
default y
460+
461+
if !ZEPHYR_VERSION_3_3
462+
config MBEDTLS_ENTROPY_POLL_ZEPHYR
463+
bool "Provide entropy data to Mbed TLS through entropy driver or random generator"
464+
default y
465+
466+
config MBEDTLS_HKDF_C
467+
bool "HMAC-based Extract-and-Expand Key Derivation Function"
448468
default y
449469

470+
config MBEDTLS_X509_CSR_WRITE_C
471+
bool "X.509 Certificate Signing Requests writing"
472+
default y
473+
endif # !ZEPHYR_VERSION_3_3
474+
475+
config GETOPT_LONG
476+
default y if ZEPHYR_VERSION_3_3
477+
450478
# Disable not used shell modules
451479

452480
config SHELL_WILDCARD

examples/platform/telink/common.cmake

+22-1
Original file line numberDiff line numberDiff line change
@@ -13,6 +13,27 @@
1313
# See the License for the specific language governing permissions and
1414
# limitations under the License.
1515

16+
# Generate Zephyr version files for backward compatibility
17+
file(STRINGS "$ENV{ZEPHYR_BASE}/VERSION" ZEPHYR_VERSION_STRING REGEX "[0-9]+")
18+
string(REGEX REPLACE "[^0-9;]" "" ZEPHYR_VERSION_STRING "${ZEPHYR_VERSION_STRING}")
19+
string(REPLACE ";" "." ZEPHYR_VERSION_STRING "${ZEPHYR_VERSION_STRING}")
20+
file(WRITE "${CMAKE_BINARY_DIR}/modules/chip-module/zephyr_version.gni" "ZEPHYR_VERSION_STRING = \"${ZEPHYR_VERSION_STRING}\"\n")
21+
if(${ZEPHYR_VERSION_STRING} MATCHES "^3\\.3")
22+
set(ZEPHYR_VERSION_OVERLAY_FILE "${CMAKE_BINARY_DIR}/zephyr_version.conf")
23+
file(WRITE ${ZEPHYR_VERSION_OVERLAY_FILE} "CONFIG_ZEPHYR_VERSION_3_3=y\n")
24+
25+
function(add_compile_definitions)
26+
foreach(flag IN LISTS ARGN)
27+
add_definitions(-D${flag})
28+
list(APPEND MATTER_CFLAGS "-D${flag}")
29+
endforeach()
30+
set(MATTER_CFLAGS "${MATTER_CFLAGS}" PARENT_SCOPE)
31+
endfunction()
32+
33+
# Add required MbedTLS defines for Zephyr 3.3
34+
add_compile_definitions(MBEDTLS_HKDF_C MBEDTLS_X509_CREATE_C MBEDTLS_X509_CSR_WRITE_C)
35+
endif()
36+
1637
string(REPLACE "_retention" "" BASE_BOARD ${BOARD})
1738
string(REGEX REPLACE "_v[0-9]+" "" BASE_BOARD ${BASE_BOARD})
1839

@@ -117,7 +138,7 @@ else()
117138
endif()
118139

119140
if(NOT CONF_FILE)
120-
set(CONF_FILE ${USB_CONF_OVERLAY_FILE} ${MARS_CONF_OVERLAY_FILE} prj.conf)
141+
set(CONF_FILE ${USB_CONF_OVERLAY_FILE} ${MARS_CONF_OVERLAY_FILE} ${ZEPHYR_VERSION_OVERLAY_FILE} prj.conf)
121142
endif()
122143

123144
# Load NCS/Zephyr build system

src/platform/Zephyr/InetUtils.cpp

+6-6
Original file line numberDiff line numberDiff line change
@@ -43,15 +43,15 @@ net_if * GetInterface(Inet::InterfaceId ifaceId)
4343
#if CHIP_DEVICE_CONFIG_ENABLE_WIFI
4444
net_if * GetWiFiInterface()
4545
{
46-
// TODO: Remove dependency after Telink Zephyr update
47-
// net_if_get_first_wifi() is not available in Zephyr 3.3.99
48-
#if !defined(CONFIG_SOC_RISCV_TELINK_W91)
49-
return net_if_get_first_wifi();
50-
#else
46+
// TODO: Remove dependency after Telink Zephyr 3.3 support is removed
47+
// net_if_get_first_wifi() is not available in Zephyr 3.3
48+
#if defined(CONFIG_SOC_RISCV_TELINK_W91) && defined(CONFIG_ZEPHYR_VERSION_3_3)
5149
return GetInterface();
50+
#else
51+
return net_if_get_first_wifi();
5252
#endif
5353
}
54-
#endif
54+
#endif // CHIP_DEVICE_CONFIG_ENABLE_WIFI
5555

5656
} // namespace InetUtils
5757
} // namespace DeviceLayer

src/platform/telink/BLEManagerImpl.cpp

+4
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,11 @@
4040
#include <zephyr/bluetooth/addr.h>
4141
#include <zephyr/bluetooth/gatt.h>
4242
#include <zephyr/drivers/flash.h>
43+
#if defined(CONFIG_ZEPHYR_VERSION_3_3)
4344
#include <zephyr/random/rand32.h>
45+
#else
46+
#include <zephyr/random/random.h>
47+
#endif
4448
#include <zephyr/storage/flash_map.h>
4549
#include <zephyr/sys/byteorder.h>
4650
#include <zephyr/sys/util.h>

src/platform/telink/BUILD.gn

+5-4
Original file line numberDiff line numberDiff line change
@@ -96,14 +96,15 @@ static_library("telink") {
9696
}
9797

9898
if (chip_enable_wifi) {
99+
import("$root_build_dir/zephyr_version.gni")
99100
sources += [
100101
"OTAImageProcessorImplWiFi.h",
101-
"wifi/ConnectivityManagerImplWiFi.cpp",
102+
"wifi/" + ZEPHYR_VERSION_STRING + "/ConnectivityManagerImplWiFi.cpp",
102103
"wifi/ConnectivityManagerImplWiFi.h",
103-
"wifi/TelinkWiFiDriver.cpp",
104+
"wifi/" + ZEPHYR_VERSION_STRING + "/TelinkWiFiDriver.cpp",
104105
"wifi/TelinkWiFiDriver.h",
105-
"wifi/WiFiManager.cpp",
106-
"wifi/WiFiManager.h",
106+
"wifi/" + ZEPHYR_VERSION_STRING + "/WiFiManager.cpp",
107+
"wifi/" + ZEPHYR_VERSION_STRING + "/WiFiManager.h",
107108
]
108109
}
109110

src/platform/telink/ConnectivityManagerImpl.cpp

+5
Original file line numberDiff line numberDiff line change
@@ -23,6 +23,7 @@
2323
#include <platform/ConnectivityManager.h>
2424
#include <platform/Zephyr/InetUtils.h>
2525
#include <platform/internal/BLEManager.h>
26+
#include <zephyr/net/net_if.h>
2627

2728
#include <platform/internal/GenericConnectivityManagerImpl_UDP.ipp>
2829

@@ -76,7 +77,11 @@ CHIP_ERROR JoinLeaveMulticastGroup(net_if * iface, const Inet::IPAddress & addre
7677

7778
if (maddr && !net_if_ipv6_maddr_is_joined(maddr))
7879
{
80+
#if defined(CONFIG_ZEPHYR_VERSION_3_3)
7981
net_if_ipv6_maddr_join(maddr);
82+
#else
83+
net_if_ipv6_maddr_join(iface, maddr);
84+
#endif
8085
}
8186
}
8287
else if (operation == UDPEndPointImplSockets::MulticastOperation::kLeave)

src/platform/telink/FactoryDataParser.c

+4
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,11 @@ static inline bool uint16_decode(zcbor_state_t * states, uint16_t * value)
4343
bool ParseFactoryData(uint8_t * buffer, uint16_t bufferSize, struct FactoryData * factoryData)
4444
{
4545
memset(factoryData, 0, sizeof(*factoryData));
46+
#if defined(CONFIG_ZEPHYR_VERSION_3_3)
4647
ZCBOR_STATE_D(states, MAX_FACTORY_DATA_NESTING_LEVEL, buffer, bufferSize, 1);
48+
#else
49+
ZCBOR_STATE_D(states, MAX_FACTORY_DATA_NESTING_LEVEL, buffer, bufferSize, 1, 0);
50+
#endif
4751

4852
bool res = zcbor_map_start_decode(states);
4953
struct zcbor_string currentString;

src/platform/telink/SystemPlatformConfig.h

+6-1
Original file line numberDiff line numberDiff line change
@@ -55,10 +55,15 @@ struct ChipDeviceEvent;
5555
#define CHIP_SYSTEM_CONFIG_USE_SOCKETS 1
5656

5757
// Reduce packet buffer pool size (default 15) to reduce ram consumption
58-
#if defined CONFIG_PM || defined CONFIG_SOC_RISCV_TELINK_TL321X
58+
#if defined(CONFIG_PM) || defined(CONFIG_SOC_RISCV_TELINK_TL321X)
5959
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 0
6060
#else
6161
#define CHIP_SYSTEM_CONFIG_PACKETBUFFER_POOL_SIZE 8
6262
#endif
6363

6464
// ========== Platform-specific Configuration Overrides =========
65+
66+
// Disable Zephyr Socket extensions module, as the Zephyr RTOS now implements recvmsg()
67+
#if !defined(CONFIG_ZEPHYR_VERSION_3_3)
68+
#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0
69+
#endif

0 commit comments

Comments
 (0)