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] Manual Zephyr SDK update to check CI jobs #345

Closed
wants to merge 8 commits into from
Closed
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
7 changes: 4 additions & 3 deletions .github/workflows/chef.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
branches:
- master
- 'v*-branch'
- update_zephyr_3.7
pull_request:
merge_group:

Expand Down Expand Up @@ -109,9 +110,9 @@ jobs:
uses: ./.github/actions/checkout-submodules-and-bootstrap
with:
platform: telink
# - name: Update Zephyr to specific revision (for developers purpose)
# shell: bash
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py f762f1a1027284e63e338e6d83deeade62f355b0"
- name: Update Zephyr to specific revision (for developers purpose)
shell: bash
run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py f54781b9ce54b2ce580d714f14054d756bfdc309"
- name: CI Examples Telink
shell: bash
run: |
Expand Down
21 changes: 19 additions & 2 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -19,6 +19,7 @@ on:
branches:
- master
- 'v*-branch'
- update_zephyr_3.7
pull_request:
merge_group:

Expand Down Expand Up @@ -57,8 +58,17 @@ jobs:
with:
gh-context: ${{ toJson(github) }}

# - name: Update Zephyr to specific revision (for developers purpose)
# run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py f762f1a1027284e63e338e6d83deeade62f355b0"
- name: Update Zephyr SDK (Temporary change for debugging purpose)
run: |
cd /opt/telink \
rm -rf zephyr-sdk-0.16.1 \
curl --location https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz --output zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz \
tar xvf zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz \
rm -rf zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz \
zephyr-sdk-0.17.0/setup.sh -t riscv64-zephyr-elf

- name: Update Zephyr to specific revision (for developers purpose)
run: scripts/run_in_build_env.sh "python3 scripts/tools/telink/update_zephyr.py f54781b9ce54b2ce580d714f14054d756bfdc309"

- name: Build example Telink (B92 retention) Air Quality Sensor App
# Run test for master and s07641069 PRs
Expand All @@ -77,6 +87,7 @@ jobs:
- name: Build example Telink (W91) All Clusters App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
# TODO: remove continue-on-error
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
Expand Down Expand Up @@ -142,6 +153,7 @@ jobs:

- name: Build example Telink (W91) Lighting App with OTA, Factory Data
# Run test for master and all PRs
# TODO: remove continue-on-error
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
Expand Down Expand Up @@ -253,6 +265,8 @@ jobs:
- name: Build example Telink (B92 retention) Smoke CO Alarm App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
# TODO: remove continue-on-error
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a_retention-smoke-co-alarm' build"
Expand All @@ -267,6 +281,8 @@ jobs:
- name: Build example Telink (B91 Mars) Temperature Measurement App with OTA
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
# TODO: remove continue-on-error
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-temperature-measurement-mars-ota' build"
Expand Down Expand Up @@ -295,6 +311,7 @@ jobs:
- name: Build example Telink (W91) Window Covering App
# Run test for master and s07641069 PRs
if: github.event.pull_request.number == null || github.event.pull_request.head.repo.full_name == 's07641069/connectedhomeip'
# TODO: remove continue-on-error
continue-on-error: true
run: |
./scripts/run_in_build_env.sh \
Expand Down
4 changes: 0 additions & 4 deletions config/telink/app/bootloader.conf
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,6 @@ CONFIG_BOOT_SWAP_USING_SCRATCH=n
# With disabled option the only image magic is validated
CONFIG_BOOT_VALIDATE_SLOT0=y

# Maximum number of image sectors supported by the bootloader.
# Maximum signed image size: 512 * 4096 = 2M Bytes
CONFIG_BOOT_MAX_IMG_SECTORS=512

# Sets log level for modules which don't specify it explicitly.
# When set to 0 it means log will not be activated for those modules.
# Levels are:
Expand Down
4 changes: 0 additions & 4 deletions config/telink/app/bootloader_compress_lzma.conf
Original file line number Diff line number Diff line change
Expand Up @@ -22,10 +22,6 @@ CONFIG_BOOT_UPGRADE_ONLY=y
# With disabled option the only image magic is validated
CONFIG_BOOT_VALIDATE_SLOT0=y

# Maximum number of image sectors supported by the bootloader.
# Maximum signed image size: 512 * 4096 = 2M Bytes
CONFIG_BOOT_MAX_IMG_SECTORS=512

# Sets log level for modules which don't specify it explicitly.
# When set to 0 it means log will not be activated for those modules.
# Levels are:
Expand Down
2 changes: 1 addition & 1 deletion config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ add_dependencies(process_binaries ${ZEPHYR_FINAL_EXECUTABLE})
# Define 'build_mcuboot' target for building the MCUBoot bootloader
# ==============================================================================

if (CONFIG_BOOTLOADER_MCUBOOT AND CONFIG_SOC_SERIES_RISCV_TELINK_B9X)
if (CONFIG_BOOTLOADER_MCUBOOT AND CONFIG_SOC_RISCV_TELINK_B9X)
add_custom_target(build_mcuboot ALL
COMMAND
west build -b ${BASE_BOARD} -d build_mcuboot ${ZEPHYR_BASE}/../bootloader/mcuboot/boot/zephyr
Expand Down
3 changes: 1 addition & 2 deletions config/telink/chip-module/Kconfig
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,6 @@ config BOOTLOADER_MCUBOOT
bool
select IMG_MANAGER
select STREAM_FLASH
select STREAM_FLASH_ERASE
select TELINK_W91_N22_MATTER_OTA_LAYOUT if BOARD_TLSR9118BDK40D

config CHIP_OTA_REQUESTOR_BUFFER_SIZE
Expand Down Expand Up @@ -251,5 +250,5 @@ config CHIP_TASK_STACK_SIZE

config CHIP_USE_MARS_SENSOR
bool "Use Mars board sensor"
depends on SOC_SERIES_RISCV_TELINK_B9X && (BOARD_TLSR9518ADK80D || BOARD_TLSR9518ADK80D_RETENTION)
depends on CONFIG_SOC_RISCV_TELINK_B9X && (BOARD_TLSR9518ADK80D || BOARD_TLSR9518ADK80D_RETENTION)
default n
28 changes: 21 additions & 7 deletions config/telink/chip-module/Kconfig.defaults
Original file line number Diff line number Diff line change
Expand Up @@ -77,11 +77,29 @@ config SYSTEM_WORKQUEUE_STACK_SIZE
default 616 if PM

config HEAP_MEM_POOL_SIZE
default 256
default 1280

config COMMON_LIBC_MALLOC_ARENA_SIZE
default 12288

choice LIBC_IMPLEMENTATION
default NEWLIB_LIBC
endchoice

config MBEDTLS_ENTROPY_ENABLED
bool
default y

config MBEDTLS_ZEPHYR_ENTROPY
bool
default y

config MBEDTLS_CTR_DRBG_ENABLED
default y

config MBEDTLS_CIPHER_AES_ENABLED
default y

config NET_IPV6_MLD
default n if PM
default y
Expand All @@ -100,11 +118,11 @@ config NET_PKT_TX_COUNT
default 8

config NET_BUF_RX_COUNT
default 16 if PM
default 4 if PM
default 32

config NET_BUF_TX_COUNT
default 16 if PM
default 4 if PM
default 32

config GPIO
Expand Down Expand Up @@ -406,10 +424,6 @@ config MBEDTLS_ECDH_C
config MBEDTLS_ECDSA_C
default y

# getopt version
config GETOPT_LONG
default y

# Disable not used shell modules

config SHELL_WILDCARD
Expand Down
2 changes: 1 addition & 1 deletion examples/platform/telink/common/src/mainCommon.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -174,6 +174,6 @@ int main(void)
err = GetAppTask().StartApp();

exit:
LOG_ERR("Exit err %" CHIP_ERROR_FORMAT, err.Format());
LOG_ERR("Exit err %d" , err.Format());
return (err == CHIP_NO_ERROR) ? EXIT_SUCCESS : EXIT_FAILURE;
}
3 changes: 2 additions & 1 deletion examples/platform/telink/zephyr_ext/zephyr_key_matrix.c
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,8 @@ static void key_matrix_poll(struct key_matrix_data * key_matrix, bool init)
/* Key matrix scan worker */
static void key_matrix_scan_work(struct k_work * item)
{
struct key_matrix_data * key_matrix = CONTAINER_OF(item, struct key_matrix_data, work);
struct key_matrix_data * key_matrix =
CONTAINER_OF(k_work_delayable_from_work(item), struct key_matrix_data, work);

(void) k_work_schedule(&key_matrix->work, K_MSEC(KEY_MATRIX_SCAN_PERIOD_MS));
key_matrix_poll(key_matrix, false);
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/telink/zephyr_ext/zephyr_key_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,8 @@ static void key_pool_poll(struct key_pool_data * key_pool, bool init)
/* Key pool scan worker */
static void key_pool_event_work(struct k_work * item)
{
struct key_pool_data * key_pool = CONTAINER_OF(item, struct key_pool_data, work);
struct key_pool_data * key_pool =
CONTAINER_OF(k_work_delayable_from_work(item), struct key_pool_data, work);

key_pool_poll(key_pool, false);
}
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/telink/zephyr_ext/zephyr_led_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,8 @@ static void led_pool_aux_update(const struct led_pool_data * led_pool)
/* Led pool worker */
static void led_pool_event_work(struct k_work * item)
{
struct led_pool_data * led_pool = CONTAINER_OF(item, struct led_pool_data, work);
struct led_pool_data * led_pool =
CONTAINER_OF(k_work_delayable_from_work(item), struct led_pool_data, work);

led_pool_aux_update(led_pool);
(void) k_work_reschedule(&led_pool->work, led_pool_aux_timeout(led_pool));
Expand Down
3 changes: 2 additions & 1 deletion examples/platform/telink/zephyr_ext/zephyr_pwm_pool.c
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,8 @@ static void pwm_pool_aux_update(const struct pwm_pool_data * pwm_pool)
/* Pwm pool worker */
static void pwm_pool_event_work(struct k_work * item)
{
struct pwm_pool_data * pwm_pool = CONTAINER_OF(item, struct pwm_pool_data, work);
struct pwm_pool_data * pwm_pool =
CONTAINER_OF(k_work_delayable_from_work(item), struct pwm_pool_data, work);

pwm_pool_aux_update(pwm_pool);
(void) k_work_reschedule(&pwm_pool->work, pwm_pool_aux_timeout(pwm_pool));
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@ RUN set -x \
# Setup toolchain
WORKDIR /opt/telink
RUN set -x \
&& curl --location https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.16.1/zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz --output zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& tar xvf zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& rm -rf zephyr-sdk-0.16.1_linux-x86_64_minimal.tar.xz \
&& zephyr-sdk-0.16.1/setup.sh -t riscv64-zephyr-elf \
&& curl --location https://github.com/zephyrproject-rtos/sdk-ng/releases/download/v0.17.0/zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz --output zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz \
&& tar xvf zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz \
&& rm -rf zephyr-sdk-0.17.0_linux-x86_64_minimal.tar.xz \
&& zephyr-sdk-0.17.0/setup.sh -t riscv64-zephyr-elf \
&& : # last line

# Setup Zephyr
Expand All @@ -34,7 +34,7 @@ RUN set -x \

FROM ghcr.io/project-chip/chip-build:${VERSION}

COPY --from=build /opt/telink/zephyr-sdk-0.16.1/ /opt/telink/zephyr-sdk-0.16.1/
COPY --from=build /opt/telink/zephyr-sdk-0.17.0/ /opt/telink/zephyr-sdk-0.17.0/
COPY --from=build /opt/telink/zephyrproject/ /opt/telink/zephyrproject/

RUN set -x \
Expand All @@ -45,4 +45,4 @@ RUN set -x \
&& : # last line

ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.16.1
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.17.0
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ COPY --from=android /usr/lib/kotlinc /usr/lib/kotlinc
COPY --from=psoc6 /opt/Tools/ModusToolbox /opt/Tools/ModusToolbox

COPY --from=telink /opt/telink/zephyrproject /opt/telink/zephyrproject
COPY --from=telink /opt/telink/zephyr-sdk-0.16.1 /opt/telink/zephyr-sdk-0.16.1
COPY --from=telink /opt/telink/zephyr-sdk-0.17.0 /opt/telink/zephyr-sdk-0.17.0

COPY --from=tizen /opt/tizen-sdk /opt/tizen-sdk

Expand Down Expand Up @@ -125,7 +125,7 @@ ENV QEMU_ESP32=/opt/espressif/qemu/qemu-system-xtensa
ENV QEMU_ESP32_DIR=/opt/espressif/qemu
ENV SYSROOT_AARCH64=/opt/ubuntu-22.04.1-aarch64-sysroot
ENV TELINK_ZEPHYR_BASE=/opt/telink/zephyrproject/zephyr
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.16.1
ENV TELINK_ZEPHYR_SDK_DIR=/opt/telink/zephyr-sdk-0.17.0
ENV TI_SYSCONFIG_ROOT=/opt/ti/sysconfig_1.18.1
ENV ZEPHYR_BASE=/opt/NordicSemiconductor/nrfconnect/zephyr
ENV ZEPHYR_SDK_INSTALL_DIR=/opt/NordicSemiconductor/nRF5_tools/zephyr-sdk-0.16.5
Expand Down
16 changes: 14 additions & 2 deletions src/platform/telink/BLEManagerImpl.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -40,13 +40,25 @@
#include <zephyr/bluetooth/addr.h>
#include <zephyr/bluetooth/gatt.h>
#include <zephyr/drivers/flash.h>
#include <zephyr/random/rand32.h>
#include <zephyr/random/random.h>
#include <zephyr/storage/flash_map.h>
#include <zephyr/sys/byteorder.h>
#include <zephyr/sys/util.h>

extern "C" {
extern __attribute__((noinline)) void telink_bt_blc_mac_init(uint8_t * bt_mac);

#ifdef CONFIG_BT_B9X

extern __attribute__((noinline)) int b9x_bt_blc_mac_init(uint8_t *bt_mac);
/**
* @brief bt mac initialization
*/
__attribute__((noinline)) void telink_bt_blc_mac_init(uint8_t *bt_mac)
{
b9x_bt_blc_mac_init(bt_mac);
}
#endif

}

#if defined(CONFIG_PM) && !defined(CONFIG_CHIP_ENABLE_PM_DURING_BLE)
Expand Down
2 changes: 1 addition & 1 deletion src/platform/telink/FactoryDataParser.c
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ static inline bool uint16_decode(zcbor_state_t * states, uint16_t * value)
bool ParseFactoryData(uint8_t * buffer, uint16_t bufferSize, struct FactoryData * factoryData)
{
memset(factoryData, 0, sizeof(*factoryData));
ZCBOR_STATE_D(states, MAX_FACTORY_DATA_NESTING_LEVEL, buffer, bufferSize, 1);
ZCBOR_STATE_D(states, MAX_FACTORY_DATA_NESTING_LEVEL, buffer, bufferSize, 1, 0);

bool res = zcbor_map_start_decode(states);
struct zcbor_string currentString;
Expand Down
3 changes: 3 additions & 0 deletions src/platform/telink/SystemPlatformConfig.h
Original file line number Diff line number Diff line change
Expand Up @@ -55,3 +55,6 @@ struct ChipDeviceEvent;
#endif

// ========== Platform-specific Configuration Overrides =========

// Disable Zephyr Socket extensions module, as the Zephyr RTOS now implements recvmsg()
#define CHIP_SYSTEM_CONFIG_USE_ZEPHYR_SOCKET_EXTENSIONS 0
18 changes: 9 additions & 9 deletions src/platform/telink/tlsr9258a_2m_flash.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -9,23 +9,23 @@

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x13000>;
reg = <0x00000000 0xf000>;
};
slot0_partition: partition@13000 {
slot0_partition: partition@f000 {
label = "image-0";
reg = <0x13000 0xef000>;
reg = <0xf000 0xf1000>;
};
factory_partition: partition@102000 {
factory_partition: partition@100000 {
label = "factory-data";
reg = <0x102000 0x1000>;
reg = <0x100000 0x1000>;
};
storage_partition: partition@103000 {
storage_partition: partition@101000 {
label = "storage";
reg = <0x103000 0xc000>;
reg = <0x101000 0xc000>;
};
slot1_partition: partition@10f000 {
slot1_partition: partition@10d000 {
label = "image-1";
reg = <0x10f000 0xef000>;
reg = <0x10d000 0xf1000>;
};
vendor_partition: partition@1fe000 {
label = "vendor-data";
Expand Down
6 changes: 3 additions & 3 deletions src/platform/telink/tlsr9518adk80d_1m_flash.overlay
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@

boot_partition: partition@0 {
label = "mcuboot";
reg = <0x00000000 0x19000>;
reg = <0x00000000 0xf000>;
};
slot0_partition: partition@19000 {
slot0_partition: partition@f000 {
label = "image-0";
reg = <0x19000 0xd9000>;
reg = <0xf000 0xe3000>;
};
factory_partition: partition@f2000 {
label = "factory-data";
Expand Down
Loading
Loading