[Telink] Update to latest Zephyr (Update Telink image to 0.7.11) (#26675)

* [Telink] Update to latest Zephyr

* [Telink] Update docker image to 0.7.11

* [Telink] Remove custom RF power config

It replaces custom config for setting RF power with
CONFIG_OPENTHREAD_DEFAULT_TX_POWER added into zephyr.

Signed-off-by: Krystian Jankowski <krystian.jankowski@telink-semi.com>

* [telink] Move Zephyr v3 interface under definition

---------

Signed-off-by: Krystian Jankowski <krystian.jankowski@telink-semi.com>
Co-authored-by: Andrii Bilynskyi <andrii.bilynskyi@telink-semi.com>
Co-authored-by: Krystian Jankowski <krystian.jankowski@telink-semi.com>
diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml
index cf0317c..70784dd 100644
--- a/.github/workflows/examples-telink.yaml
+++ b/.github/workflows/examples-telink.yaml
@@ -38,7 +38,7 @@
         if: github.actor != 'restyled-io[bot]'
 
         container:
-            image: connectedhomeip/chip-build-telink:0.7.3
+            image: connectedhomeip/chip-build-telink:0.7.11
             volumes:
                 - "/tmp/bloat_reports:/tmp/bloat_reports"
 
diff --git a/config/telink/app/enable-gnu-std.cmake b/config/telink/app/enable-gnu-std.cmake
index e46c871..a8a63cf 100644
--- a/config/telink/app/enable-gnu-std.cmake
+++ b/config/telink/app/enable-gnu-std.cmake
@@ -15,5 +15,5 @@
 #
 
 add_library(gnu17 INTERFACE)
-target_compile_options(gnu17 INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17> -D_SYS__PTHREADTYPES_H_)
-target_link_libraries(app PRIVATE gnu17)
\ No newline at end of file
+target_compile_options(gnu17 INTERFACE $<$<COMPILE_LANGUAGE:CXX>:-std=gnu++17> -Wno-register -D_DEFAULT_SOURCE)
+target_link_libraries(app PRIVATE gnu17)
diff --git a/config/telink/app/zephyr.conf b/config/telink/app/zephyr.conf
index a8a4c0a..680c6b4 100644
--- a/config/telink/app/zephyr.conf
+++ b/config/telink/app/zephyr.conf
@@ -126,3 +126,20 @@
 
 # BLE MAC address
 CONFIG_B91_BLE_CTRL_MAC_FLASH_ADDR=0x1FE000
+
+# getopt version
+CONFIG_GETOPT_LONG=y
+
+# flash stream functionality
+CONFIG_STREAM_FLASH=y
+
+# In current config/zephyr/Kconfig
+# next deprecated values are selected
+# warning: Deprecated symbol CPLUSPLUS is enabled.
+# warning: Deprecated symbol LIB_CPLUSPLUS is enabled.
+# new one are:
+# CONFIG_CPP
+# CONFIG_LIBCPP_IMPLEMENTATION
+# See https://docs.zephyrproject.org/latest/releases/release-notes-3.3.html
+# Since not only Telink is using Zephyr just suppress warnings
+CONFIG_WARN_DEPRECATED=n
diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt
index e1953b3..8ff944f 100644
--- a/config/telink/chip-module/CMakeLists.txt
+++ b/config/telink/chip-module/CMakeLists.txt
@@ -48,7 +48,7 @@
 # Prepare compiler flags
 
 if (CONFIG_POSIX_API)
-    matter_add_flags(-D_SYS__PTHREADTYPES_H_)
+    matter_add_flags(-D_DEFAULT_SOURCE)
     matter_add_flags(-isystem${ZEPHYR_BASE}/include/zephyr/posix)
 endif()
 
diff --git a/examples/bridge-app/telink/prj.conf b/examples/bridge-app/telink/prj.conf
index 777ae51..72b6dce 100644
--- a/examples/bridge-app/telink/prj.conf
+++ b/examples/bridge-app/telink/prj.conf
@@ -67,4 +67,4 @@
 
 # Custom RF power values
 CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y
-CONFIG_CHIP_OPENTHREAD_TX_POWER=9
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
diff --git a/examples/lighting-app/telink/prj.conf b/examples/lighting-app/telink/prj.conf
index 90b2464..71a1345 100644
--- a/examples/lighting-app/telink/prj.conf
+++ b/examples/lighting-app/telink/prj.conf
@@ -67,4 +67,4 @@
 
 # Custom RF power values
 CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y
-CONFIG_CHIP_OPENTHREAD_TX_POWER=9
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
\ No newline at end of file
diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp
index 3418397..c6e455b 100644
--- a/examples/platform/telink/common/src/AppTaskCommon.cpp
+++ b/examples/platform/telink/common/src/AppTaskCommon.cpp
@@ -127,6 +127,8 @@
 
     shell_print(shell, "Performing board reboot...");
     sys_reboot();
+
+    return 0;
 }
 
 SHELL_STATIC_SUBCMD_SET_CREATE(sub_telink, SHELL_CMD(reboot, NULL, "Reboot board command", cmd_telink_reboot),
diff --git a/examples/temperature-measurement-app/telink/prj.conf b/examples/temperature-measurement-app/telink/prj.conf
index 3f1a6e5..63deb05 100644
--- a/examples/temperature-measurement-app/telink/prj.conf
+++ b/examples/temperature-measurement-app/telink/prj.conf
@@ -67,4 +67,4 @@
 
 # Custom RF power values
 CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y
-CONFIG_CHIP_OPENTHREAD_TX_POWER=9
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
diff --git a/examples/window-app/telink/prj.conf b/examples/window-app/telink/prj.conf
index b6e89b2..753040f 100644
--- a/examples/window-app/telink/prj.conf
+++ b/examples/window-app/telink/prj.conf
@@ -66,4 +66,4 @@
 
 # Custom RF power values
 CONFIG_B91_BLE_CTRL_RF_POWER_P9P11DBM=y
-CONFIG_CHIP_OPENTHREAD_TX_POWER=9
+CONFIG_OPENTHREAD_DEFAULT_TX_POWER=9
diff --git a/src/lib/shell/MainLoopZephyr.cpp b/src/lib/shell/MainLoopZephyr.cpp
index 17b5d84..b82b04c 100644
--- a/src/lib/shell/MainLoopZephyr.cpp
+++ b/src/lib/shell/MainLoopZephyr.cpp
@@ -28,8 +28,11 @@
     chip::Shell::streamer_set_shell(shell);
     return (Engine::Root().ExecCommand(argc - 1, argv + 1) == CHIP_NO_ERROR) ? 0 : -ENOEXEC;
 }
-
+#ifdef BOARD_TLSR9518ADK80D
+static int RegisterCommands(void)
+#else
 static int RegisterCommands(const struct device * dev)
+#endif /* BOARD_TLSR9518ADK80D */
 {
     Engine::Root().RegisterDefaultCommands();
     return 0;
diff --git a/src/lib/support/CHIPArgParser.cpp b/src/lib/support/CHIPArgParser.cpp
index 85aa4db..ed12345 100644
--- a/src/lib/support/CHIPArgParser.cpp
+++ b/src/lib/support/CHIPArgParser.cpp
@@ -45,6 +45,7 @@
 #include <stdint.h>
 #include <string.h>
 #include <strings.h>
+#include <unistd.h>
 
 #include <lib/support/CHIPMem.h>
 #include <lib/support/CHIPMemString.h>
diff --git a/src/platform/telink/ThreadStackManagerImpl.cpp b/src/platform/telink/ThreadStackManagerImpl.cpp
index 7b56409..09ee1ab 100644
--- a/src/platform/telink/ThreadStackManagerImpl.cpp
+++ b/src/platform/telink/ThreadStackManagerImpl.cpp
@@ -47,13 +47,6 @@
     otInstance * const instance = openthread_get_default_instance();
 
     ReturnErrorOnFailure(GenericThreadStackManagerImpl_OpenThread<ThreadStackManagerImpl>::DoInit(instance));
-#ifdef CONFIG_CHIP_OPENTHREAD_TX_POWER
-    /* On Zephyr platform otPlatRadioSetTransmitPower does not touch radio HW */
-    if (otPlatRadioSetTransmitPower(OTInstance(), CONFIG_CHIP_OPENTHREAD_TX_POWER) != OT_ERROR_NONE)
-    {
-        ChipLogError(DeviceLayer, "Can't set OpenThread TX power");
-    }
-#endif /* CONFIG_CHIP_OPENTHREAD_TX_POWER */
 
     UDPEndPointImplSockets::SetJoinMulticastGroupHandler([](InterfaceId, const IPAddress & address) {
         const otIp6Address otAddress = ToOpenThreadIP6Address(address);