From 1170548ea5fa0eebd38eeef321a03247b588a859 Mon Sep 17 00:00:00 2001 From: Alex Tsitsiura Date: Thu, 12 Oct 2023 22:50:12 +0300 Subject: [PATCH] [Telink] Flash various sizes support (#29726) * add different flash sizes * add different flash sizes in exampe's CMake * add offset argument to mfg_tool * generate factory data for different flash sizes * generate factory data for different flash sizes * generate factory data for different flash sizes * generate factory data for different flash sizes * [Telink] Update CI * [Telink] change path * Restyled by prettier-markdown * [Telink] set correct app name --------- Co-authored-by: Dmytro Kashkarov Co-authored-by: Restyled.io --- .github/workflows/examples-telink.yaml | 16 +++---- config/telink/chip-module/CMakeLists.txt | 28 ++++++++---- .../chip-module/generate_factory_data.cmake | 11 +++++ .../telink/CMakeLists.txt | 12 +++++- .../air-quality-sensor-app/telink/README.md | 9 +++- .../all-clusters-app/telink/CMakeLists.txt | 12 +++++- examples/all-clusters-app/telink/Readme.md | 9 +++- .../telink/CMakeLists.txt | 12 +++++- .../all-clusters-minimal-app/telink/Readme.md | 9 +++- examples/bridge-app/telink/CMakeLists.txt | 12 +++++- examples/bridge-app/telink/README.md | 9 +++- examples/chef/telink/CMakeLists.txt | 12 +++++- .../contact-sensor-app/telink/CMakeLists.txt | 12 +++++- examples/contact-sensor-app/telink/README.md | 9 +++- .../light-switch-app/telink/CMakeLists.txt | 12 +++++- examples/light-switch-app/telink/README.md | 9 +++- .../telink/factory_data.overlay | 22 ---------- examples/lighting-app/telink/CMakeLists.txt | 12 +++++- examples/lighting-app/telink/README.md | 9 +++- .../lighting-app/telink/factory_data.overlay | 22 ---------- examples/lighting-app/telink/shell.overlay | 21 --------- examples/lock-app/telink/CMakeLists.txt | 12 +++++- examples/lock-app/telink/README.md | 9 +++- .../ota-requestor-app/telink/CMakeLists.txt | 12 +++++- examples/ota-requestor-app/telink/Readme.md | 16 +++++-- .../telink/common/include/AppTaskCommon.h | 4 ++ .../telink/common/src/AppTaskCommon.cpp | 4 ++ examples/pump-app/telink/CMakeLists.txt | 12 +++++- examples/pump-app/telink/README.md | 9 +++- .../pump-controller-app/telink/CMakeLists.txt | 12 +++++- examples/pump-controller-app/telink/README.md | 9 +++- .../telink/CMakeLists.txt | 12 +++++- .../resource-monitoring-app/telink/README.md | 9 +++- examples/shell/telink/CMakeLists.txt | 12 +++++- examples/shell/telink/README.md | 7 +++ .../smoke-co-alarm-app/telink/CMakeLists.txt | 12 +++++- examples/smoke-co-alarm-app/telink/README.md | 9 +++- .../telink/CMakeLists.txt | 12 +++++- .../telink/README.md | 9 +++- examples/thermostat/telink/CMakeLists.txt | 12 +++++- examples/thermostat/telink/Readme.md | 9 +++- examples/window-app/telink/CMakeLists.txt | 12 +++++- examples/window-app/telink/README.md | 9 +++- scripts/build/build/targets.py | 2 + scripts/build/builders/telink.py | 16 +++++-- .../build/testdata/all_targets_linux_x64.txt | 2 +- scripts/tools/telink/mfg_tool.py | 5 +-- src/platform/telink/1m_flash.overlay | 39 +++++++++++++++++ src/platform/telink/2m_flash.overlay | 43 +++++++++++++++++++ src/platform/telink/4m_flash.overlay | 43 +++++++++++++++++++ src/platform/telink/tlsr9518adk80d.overlay | 36 ---------------- src/platform/telink/tlsr9528a.overlay | 36 ---------------- 52 files changed, 509 insertions(+), 215 deletions(-) delete mode 100644 examples/light-switch-app/telink/factory_data.overlay delete mode 100644 examples/lighting-app/telink/factory_data.overlay delete mode 100644 examples/lighting-app/telink/shell.overlay create mode 100644 src/platform/telink/1m_flash.overlay create mode 100644 src/platform/telink/2m_flash.overlay create mode 100644 src/platform/telink/4m_flash.overlay diff --git a/.github/workflows/examples-telink.yaml b/.github/workflows/examples-telink.yaml index 34afad3e0657e0..0f7a42d4ab8a04 100644 --- a/.github/workflows/examples-telink.yaml +++ b/.github/workflows/examples-telink.yaml @@ -124,25 +124,25 @@ jobs: - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (B91) Lighting App with RPC, Shell and Factory Data + - name: Build example Telink (B91) Lighting App with OTA, RPC, Factory Data and 4Mb flash run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-rpc-shell-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9518adk80d lighting-app-rpc-shell-factory-data \ - out/telink-tlsr9518adk80d-light-rpc-shell-factory-data/zephyr/zephyr.elf \ + telink tlsr9518adk80d lighting-app-ota-rpc-factory-data-4mb \ + out/telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output (keep tools) run: rm -rf ./out/telink* - - name: Build example Telink (B92) Light Switch App with RPC, Shell and Factory Data + - name: Build example Telink (B92) Light Switch App with OTA, Shell, Factory Data run: | ./scripts/run_in_build_env.sh \ - "./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-rpc-shell-factory-data' build" + "./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-ota-shell-factory-data' build" .environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \ - telink tlsr9528a light-switch-app-rpc-shell-factory-data \ - out/telink-tlsr9528a-light-switch-rpc-shell-factory-data/zephyr/zephyr.elf \ + telink tlsr9528a light-switch-app-ota-shell-factory-data \ + out/telink-tlsr9528a-light-switch-ota-shell-factory-data/zephyr/zephyr.elf \ /tmp/bloat_reports/ - name: clean out build output diff --git a/config/telink/chip-module/CMakeLists.txt b/config/telink/chip-module/CMakeLists.txt index a4c9d2cbf9bcdf..323bc55d6a1a1c 100644 --- a/config/telink/chip-module/CMakeLists.txt +++ b/config/telink/chip-module/CMakeLists.txt @@ -166,6 +166,13 @@ else() unset(GLOBAL_BOOTLOADER_CONF_OVERLAY_FILE) endif() +set(BLOCK_SIZE "1024") + +# get code-partition mcuboot_partition size +dt_nodelabel(dts_partition_path NODELABEL "boot_partition") +dt_reg_size(mcuboot_size PATH ${dts_partition_path}) +math(EXPR boot_blocks "${mcuboot_size} / ${BLOCK_SIZE}" OUTPUT_FORMAT DECIMAL) + if (CONFIG_CHIP_OTA_IMAGE_BUILD) add_custom_target(build_mcuboot ALL COMMAND @@ -177,7 +184,7 @@ if (CONFIG_CHIP_OTA_IMAGE_BUILD) COMMAND dd if=${PROJECT_BINARY_DIR}/../modules/chip-module/build_mcuboot/zephyr/zephyr.bin of=${PROJECT_BINARY_DIR}/zephyr.bin COMMAND - dd if=${PROJECT_BINARY_DIR}/zephyr.signed.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=100 + dd if=${PROJECT_BINARY_DIR}/zephyr.signed.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=${BLOCK_SIZE} seek=${boot_blocks} ) chip_ota_image(chip-ota-image @@ -189,16 +196,21 @@ if (CONFIG_CHIP_OTA_IMAGE_BUILD) add_dependencies(chip-ota-image ${ZEPHYR_FINAL_EXECUTABLE}) endif() +# get code-partition factory_partition address +dt_nodelabel(dts_partition_path NODELABEL "factory_partition") +dt_reg_addr(factory_size PATH ${dts_partition_path}) +math(EXPR factory_blocks "${factory_size} / ${BLOCK_SIZE}" OUTPUT_FORMAT DECIMAL) + if (CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE) - add_custom_target(merge_factory_data ALL - COMMAND - dd if=${PROJECT_BINARY_DIR}/factory/factory_data.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=1052 - ) -if (CONFIG_CHIP_OTA_IMAGE_BUILD) + add_custom_target(merge_factory_data ALL + COMMAND + dd if=${PROJECT_BINARY_DIR}/factory/factory_data.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=${BLOCK_SIZE} seek=${factory_blocks} + ) + if (CONFIG_CHIP_OTA_IMAGE_BUILD) add_dependencies(merge_factory_data merge_mcuboot) -else() + else() add_dependencies(merge_factory_data ${ZEPHYR_FINAL_EXECUTABLE}) -endif() + endif() endif() # ============================================================================== diff --git a/config/telink/chip-module/generate_factory_data.cmake b/config/telink/chip-module/generate_factory_data.cmake index 9ba1903266c2dc..5dfaa8e839dc4e 100644 --- a/config/telink/chip-module/generate_factory_data.cmake +++ b/config/telink/chip-module/generate_factory_data.cmake @@ -116,6 +116,17 @@ if(CONFIG_CHIP_DEVICE_ENABLE_KEY) string(APPEND script_args "--enable-key \"${CONFIG_CHIP_DEVICE_ENABLE_KEY}\"\n") endif() +# get code-partition factory_partition address +dt_nodelabel(dts_partition_path NODELABEL "factory_partition") +dt_reg_addr(factory_off PATH ${dts_partition_path}) + +# get code-partition factory_partition size +dt_nodelabel(dts_partition_path NODELABEL "factory_partition") +dt_reg_size(factory_size PATH ${dts_partition_path}) + +string(APPEND script_args "--offset ${factory_off}\n") +string(APPEND script_args "--size ${factory_size}\n") + string(APPEND script_args "--output \"${output_path}\"/factory\n") set(factory_data_bin ${output_path}/factory/factory_data.bin) diff --git a/examples/air-quality-sensor-app/telink/CMakeLists.txt b/examples/air-quality-sensor-app/telink/CMakeLists.txt index 937002d7cee1ba..fd5a5b14256426 100644 --- a/examples/air-quality-sensor-app/telink/CMakeLists.txt +++ b/examples/air-quality-sensor-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/air-quality-sensor-app/telink/README.md b/examples/air-quality-sensor-app/telink/README.md index 371a26cc00639e..eecc7e8bbdbaa6 100644 --- a/examples/air-quality-sensor-app/telink/README.md +++ b/examples/air-quality-sensor-app/telink/README.md @@ -31,6 +31,13 @@ You can use this example as a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -115,7 +122,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/all-clusters-app/telink/CMakeLists.txt b/examples/all-clusters-app/telink/CMakeLists.txt index 9c0da32bce0083..3b3f3ac44bf4cd 100644 --- a/examples/all-clusters-app/telink/CMakeLists.txt +++ b/examples/all-clusters-app/telink/CMakeLists.txt @@ -32,13 +32,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/all-clusters-app/telink/Readme.md b/examples/all-clusters-app/telink/Readme.md index d83ba75fb1353b..a8881b7fdeb024 100644 --- a/examples/all-clusters-app/telink/Readme.md +++ b/examples/all-clusters-app/telink/Readme.md @@ -33,6 +33,13 @@ creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -117,7 +124,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/all-clusters-minimal-app/telink/CMakeLists.txt b/examples/all-clusters-minimal-app/telink/CMakeLists.txt index ea026b2a834bfa..a7bb51ba0e67fe 100644 --- a/examples/all-clusters-minimal-app/telink/CMakeLists.txt +++ b/examples/all-clusters-minimal-app/telink/CMakeLists.txt @@ -32,13 +32,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/all-clusters-minimal-app/telink/Readme.md b/examples/all-clusters-minimal-app/telink/Readme.md index aa751fecabea42..53c750b806baf7 100644 --- a/examples/all-clusters-minimal-app/telink/Readme.md +++ b/examples/all-clusters-minimal-app/telink/Readme.md @@ -33,6 +33,13 @@ for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -100,7 +107,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/bridge-app/telink/CMakeLists.txt b/examples/bridge-app/telink/CMakeLists.txt index 7fb0bb6d81f4c9..1b65dc3bf543e7 100644 --- a/examples/bridge-app/telink/CMakeLists.txt +++ b/examples/bridge-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/bridge-app/telink/README.md b/examples/bridge-app/telink/README.md index 48ae3eaec0a6e6..fd3d70c21e9b84 100644 --- a/examples/bridge-app/telink/README.md +++ b/examples/bridge-app/telink/README.md @@ -110,6 +110,13 @@ defined: $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -262,7 +269,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/chef/telink/CMakeLists.txt b/examples/chef/telink/CMakeLists.txt index 2886513e7a39e7..d52ce7446f12ed 100755 --- a/examples/chef/telink/CMakeLists.txt +++ b/examples/chef/telink/CMakeLists.txt @@ -38,13 +38,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/contact-sensor-app/telink/CMakeLists.txt b/examples/contact-sensor-app/telink/CMakeLists.txt index 8eaba1825577c6..128d7afbf89744 100755 --- a/examples/contact-sensor-app/telink/CMakeLists.txt +++ b/examples/contact-sensor-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/contact-sensor-app/telink/README.md b/examples/contact-sensor-app/telink/README.md index 3131839f440452..cef7f3364dd7dd 100755 --- a/examples/contact-sensor-app/telink/README.md +++ b/examples/contact-sensor-app/telink/README.md @@ -31,6 +31,13 @@ You can use this example as a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -119,7 +126,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/light-switch-app/telink/CMakeLists.txt b/examples/light-switch-app/telink/CMakeLists.txt index 32b787a216c279..dd2bfed8dae203 100755 --- a/examples/light-switch-app/telink/CMakeLists.txt +++ b/examples/light-switch-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/light-switch-app/telink/README.md b/examples/light-switch-app/telink/README.md index 10e2500ab457fd..6dc9970c5c732e 100755 --- a/examples/light-switch-app/telink/README.md +++ b/examples/light-switch-app/telink/README.md @@ -36,6 +36,13 @@ creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -240,7 +247,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/light-switch-app/telink/factory_data.overlay b/examples/light-switch-app/telink/factory_data.overlay deleted file mode 100644 index 4f7289d9bd15ca..00000000000000 --- a/examples/light-switch-app/telink/factory_data.overlay +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2023 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This file should be used as a configuration overlay to enable Factory Data. - -# Enable factory data support. -CONFIG_CHIP_FACTORY_DATA=y -CONFIG_CHIP_FACTORY_DATA_BUILD=y -CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y diff --git a/examples/lighting-app/telink/CMakeLists.txt b/examples/lighting-app/telink/CMakeLists.txt index 6a579b959110e4..e4dd1a4adc4094 100644 --- a/examples/lighting-app/telink/CMakeLists.txt +++ b/examples/lighting-app/telink/CMakeLists.txt @@ -48,13 +48,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${USB_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE ${USB_CONF_OVERLAY_FILE} prj.conf) diff --git a/examples/lighting-app/telink/README.md b/examples/lighting-app/telink/README.md index b09df9c49fe3aa..666af084b2a8bf 100644 --- a/examples/lighting-app/telink/README.md +++ b/examples/lighting-app/telink/README.md @@ -34,6 +34,13 @@ a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -205,7 +212,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/lighting-app/telink/factory_data.overlay b/examples/lighting-app/telink/factory_data.overlay deleted file mode 100644 index 4f7289d9bd15ca..00000000000000 --- a/examples/lighting-app/telink/factory_data.overlay +++ /dev/null @@ -1,22 +0,0 @@ -# -# Copyright (c) 2023 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This file should be used as a configuration overlay to enable Factory Data. - -# Enable factory data support. -CONFIG_CHIP_FACTORY_DATA=y -CONFIG_CHIP_FACTORY_DATA_BUILD=y -CONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y diff --git a/examples/lighting-app/telink/shell.overlay b/examples/lighting-app/telink/shell.overlay deleted file mode 100644 index 6c4922bc475aeb..00000000000000 --- a/examples/lighting-app/telink/shell.overlay +++ /dev/null @@ -1,21 +0,0 @@ -# -# Copyright (c) 2023 Project CHIP Authors -# -# Licensed under the Apache License, Version 2.0 (the "License"); -# you may not use this file except in compliance with the License. -# You may obtain a copy of the License at -# -# http://www.apache.org/licenses/LICENSE-2.0 -# -# Unless required by applicable law or agreed to in writing, software -# distributed under the License is distributed on an "AS IS" BASIS, -# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. -# See the License for the specific language governing permissions and -# limitations under the License. -# - -# This file should be used as a configuration overlay to enable Shell. - -# Enable Shell support. -CONFIG_SHELL=y -CONFIG_CHIP_LIB_SHELL=y diff --git a/examples/lock-app/telink/CMakeLists.txt b/examples/lock-app/telink/CMakeLists.txt index c89c1695680006..10771bd371c76e 100755 --- a/examples/lock-app/telink/CMakeLists.txt +++ b/examples/lock-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/lock-app/telink/README.md b/examples/lock-app/telink/README.md index 9cca961b6262f6..2d8e0349d571a1 100755 --- a/examples/lock-app/telink/README.md +++ b/examples/lock-app/telink/README.md @@ -34,6 +34,13 @@ a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -122,7 +129,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/ota-requestor-app/telink/CMakeLists.txt b/examples/ota-requestor-app/telink/CMakeLists.txt index 2ae1595e8ee483..81c559cfa73127 100644 --- a/examples/ota-requestor-app/telink/CMakeLists.txt +++ b/examples/ota-requestor-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/ota-requestor-app/telink/Readme.md b/examples/ota-requestor-app/telink/Readme.md index 805f70a0d5435c..867f498f9df917 100755 --- a/examples/ota-requestor-app/telink/Readme.md +++ b/examples/ota-requestor-app/telink/Readme.md @@ -27,6 +27,13 @@ $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -106,14 +113,15 @@ feature for another Telink example: - set CONFIG_CHIP_OTA_REQUESTOR=y in corresponding "prj.conf" configuration file. -- remove "boards/tlsr9518adk80d.overlay" file to enable 2MB flash storage. After build application with enabled OTA feature, use next binary files: -- zephyr_final.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider -- zephyr.bin - ignore this file. -- zephyr.signed.bin - ignore this file. + +All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have +higher SW version than base SW. Set CONFIG_CHIP_DEVICE_SOFTWARE_VERSION=2 in +corresponding “prj.conf” configuration file. Usage of OTA: diff --git a/examples/platform/telink/common/include/AppTaskCommon.h b/examples/platform/telink/common/include/AppTaskCommon.h index 7204df2ba4b7a9..6652a55210f601 100644 --- a/examples/platform/telink/common/include/AppTaskCommon.h +++ b/examples/platform/telink/common/include/AppTaskCommon.h @@ -76,8 +76,12 @@ class AppTaskCommon { kButtonId_ExampleAction = 1, kButtonId_FactoryReset, +#if APP_USE_THREAD_START_BUTTON kButtonId_StartThread, +#endif +#if APP_USE_BLE_START_BUTTON kButtonId_StartBleAdv +#endif } ButtonId; #endif diff --git a/examples/platform/telink/common/src/AppTaskCommon.cpp b/examples/platform/telink/common/src/AppTaskCommon.cpp index 0638b64b1e355f..41899c8a1f9c73 100644 --- a/examples/platform/telink/common/src/AppTaskCommon.cpp +++ b/examples/platform/telink/common/src/AppTaskCommon.cpp @@ -357,12 +357,16 @@ void AppTaskCommon::ButtonEventHandler(ButtonId_t btnId, bool btnPressed) case kButtonId_FactoryReset: FactoryResetButtonEventHandler(); break; +#if APP_USE_THREAD_START_BUTTON case kButtonId_StartThread: StartThreadButtonEventHandler(); break; +#endif +#if APP_USE_BLE_START_BUTTON case kButtonId_StartBleAdv: StartBleAdvButtonEventHandler(); break; +#endif } } #endif diff --git a/examples/pump-app/telink/CMakeLists.txt b/examples/pump-app/telink/CMakeLists.txt index bed10accba40b8..8d42d5f79762c5 100755 --- a/examples/pump-app/telink/CMakeLists.txt +++ b/examples/pump-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/pump-app/telink/README.md b/examples/pump-app/telink/README.md index ca97a9ec18c32d..a5a656c68adeea 100755 --- a/examples/pump-app/telink/README.md +++ b/examples/pump-app/telink/README.md @@ -35,6 +35,13 @@ reference for creating your own pump application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -123,7 +130,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/pump-controller-app/telink/CMakeLists.txt b/examples/pump-controller-app/telink/CMakeLists.txt index ba1298e6e30525..dca66f8dd31702 100755 --- a/examples/pump-controller-app/telink/CMakeLists.txt +++ b/examples/pump-controller-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/pump-controller-app/telink/README.md b/examples/pump-controller-app/telink/README.md index 41089fcc94a6ac..14153386de3b5e 100755 --- a/examples/pump-controller-app/telink/README.md +++ b/examples/pump-controller-app/telink/README.md @@ -36,6 +36,13 @@ your own pump application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -124,7 +131,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/resource-monitoring-app/telink/CMakeLists.txt b/examples/resource-monitoring-app/telink/CMakeLists.txt index 92d26f99545850..dde35e61e378b8 100644 --- a/examples/resource-monitoring-app/telink/CMakeLists.txt +++ b/examples/resource-monitoring-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/resource-monitoring-app/telink/README.md b/examples/resource-monitoring-app/telink/README.md index 13962d281f43ac..3b6645171511e0 100644 --- a/examples/resource-monitoring-app/telink/README.md +++ b/examples/resource-monitoring-app/telink/README.md @@ -31,6 +31,13 @@ You can use this example as a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -115,7 +122,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/shell/telink/CMakeLists.txt b/examples/shell/telink/CMakeLists.txt index fe3d961ca02758..0bd2d490411bec 100755 --- a/examples/shell/telink/CMakeLists.txt +++ b/examples/shell/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/shell/telink/README.md b/examples/shell/telink/README.md index 19d115dc64cca1..2ff00f0046473f 100755 --- a/examples/shell/telink/README.md +++ b/examples/shell/telink/README.md @@ -31,6 +31,13 @@ You can use this example as a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` diff --git a/examples/smoke-co-alarm-app/telink/CMakeLists.txt b/examples/smoke-co-alarm-app/telink/CMakeLists.txt index 9fa08fbdb436b1..e916aa52f9425b 100755 --- a/examples/smoke-co-alarm-app/telink/CMakeLists.txt +++ b/examples/smoke-co-alarm-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/smoke-co-alarm-app/telink/README.md b/examples/smoke-co-alarm-app/telink/README.md index 185f68213a3271..f36ecb97d5925e 100755 --- a/examples/smoke-co-alarm-app/telink/README.md +++ b/examples/smoke-co-alarm-app/telink/README.md @@ -31,6 +31,13 @@ You can use this example as a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -121,7 +128,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/temperature-measurement-app/telink/CMakeLists.txt b/examples/temperature-measurement-app/telink/CMakeLists.txt index 53c2781458cb5c..fd8a6e33132970 100644 --- a/examples/temperature-measurement-app/telink/CMakeLists.txt +++ b/examples/temperature-measurement-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/temperature-measurement-app/telink/README.md b/examples/temperature-measurement-app/telink/README.md index ea722c693d7679..fda373eedf2ca9 100644 --- a/examples/temperature-measurement-app/telink/README.md +++ b/examples/temperature-measurement-app/telink/README.md @@ -35,6 +35,13 @@ creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -104,7 +111,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/thermostat/telink/CMakeLists.txt b/examples/thermostat/telink/CMakeLists.txt index 9abe4bd422a37f..f1588efa2c48e7 100755 --- a/examples/thermostat/telink/CMakeLists.txt +++ b/examples/thermostat/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/thermostat/telink/Readme.md b/examples/thermostat/telink/Readme.md index a1ff048488b436..b73e5866b03173 100755 --- a/examples/thermostat/telink/Readme.md +++ b/examples/thermostat/telink/Readme.md @@ -31,6 +31,13 @@ You can use this example as a reference for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -115,7 +122,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/examples/window-app/telink/CMakeLists.txt b/examples/window-app/telink/CMakeLists.txt index 5b695943fd3f1b..781e487c9a4ff6 100644 --- a/examples/window-app/telink/CMakeLists.txt +++ b/examples/window-app/telink/CMakeLists.txt @@ -31,13 +31,21 @@ else() unset(GLOBAL_DTC_OVERLAY_FILE) endif() +if(EXISTS "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/${FLASH_SIZE}_flash.overlay") + message(STATUS "Flash memory size is set to: " ${FLASH_SIZE} "b") +else() + set(FLASH_DTC_OVERLAY_FILE "${CHIP_ROOT}/src/platform/telink/2m_flash.overlay") + message(STATUS "Flash memory size is set to: 2mb") +endif() + if(DTC_OVERLAY_FILE) set(DTC_OVERLAY_FILE - "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" + "${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}" CACHE STRING "" FORCE ) else() - set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) + set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}) endif() set(CONF_FILE prj.conf) diff --git a/examples/window-app/telink/README.md b/examples/window-app/telink/README.md index 876764c2fb0b88..372dbcf8dba809 100644 --- a/examples/window-app/telink/README.md +++ b/examples/window-app/telink/README.md @@ -34,6 +34,13 @@ for creating your own application. $ west build -b ``` + Also use key `-DFLASH_SIZE`, if your board has memory size different from 2 + MB, for example, `-DFLASH_SIZE=1m` or `-DFLASH_SIZE=1m`: + + ```bash + $ west build -b tlsr9518adk80d -- -DFLASH_SIZE=4m + ``` + 4. Flash binary: ``` @@ -186,7 +193,7 @@ feature for another Telink example: After build application with enabled OTA feature, use next binary files: -- zephyr.bin - main binary to flash PCB (Use 2MB PCB). +- zephyr.bin - main binary to flash PCB (Use at least 2MB PCB). - zephyr-ota.bin - binary for OTA Provider All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have diff --git a/scripts/build/build/targets.py b/scripts/build/build/targets.py index 17807371745ea6..6d755495b50969 100755 --- a/scripts/build/build/targets.py +++ b/scripts/build/build/targets.py @@ -719,9 +719,11 @@ def BuildTelinkTarget(): TargetPart('window-covering', app=TelinkApp.WINDOW_COVERING), ]) + target.AppendModifier('ota', enable_ota=True) target.AppendModifier('shell', enable_shell=True) target.AppendModifier('rpc', enable_rpcs=True) target.AppendModifier('factory-data', enable_factory_data=True) + target.AppendModifier('4mb', enable_4mb_flash=True) return target diff --git a/scripts/build/builders/telink.py b/scripts/build/builders/telink.py index 9487a17a36dbb0..39bdbe9675a2ad 100644 --- a/scripts/build/builders/telink.py +++ b/scripts/build/builders/telink.py @@ -136,15 +136,19 @@ def __init__(self, runner, app: TelinkApp = TelinkApp, board: TelinkBoard = TelinkBoard, + enable_ota: bool = False, enable_shell: bool = False, enable_rpcs: bool = False, - enable_factory_data: bool = False): + enable_factory_data: bool = False, + enable_4mb_flash: bool = False): super(TelinkBuilder, self).__init__(root, runner) self.app = app self.board = board + self.enable_ota = enable_ota self.enable_shell = enable_shell self.enable_rpcs = enable_rpcs self.enable_factory_data = enable_factory_data + self.enable_4mb_flash = enable_4mb_flash def get_cmd_prefixes(self): if not self._runner.dry_run: @@ -165,14 +169,20 @@ def generate(self): return flags = [] + if self.enable_ota: + flags.append("-DCONFIG_CHIP_OTA_REQUESTOR=y") + if self.enable_shell: - flags.append("-DOVERLAY_CONFIG=shell.overlay") + flags.append("-DCONFIG_CHIP_LIB_SHELL=y") if self.enable_rpcs: flags.append("-DOVERLAY_CONFIG=rpc.overlay") if self.enable_factory_data: - flags.append("-DOVERLAY_CONFIG=factory_data.overlay") + flags.append("-DCONFIG_CHIP_FACTORY_DATA=y -DCONFIG_CHIP_FACTORY_DATA_BUILD=y -DCONFIG_CHIP_FACTORY_DATA_MERGE_WITH_FIRMWARE=y") + + if self.enable_4mb_flash: + flags.append("-DFLASH_SIZE=4m") if self.options.pregen_dir: flags.append(f"-DCHIP_CODEGEN_PREGEN_DIR={shlex.quote(self.options.pregen_dir)}") diff --git a/scripts/build/testdata/all_targets_linux_x64.txt b/scripts/build/testdata/all_targets_linux_x64.txt index 4c65d6c04db464..c325aa52fb57d9 100644 --- a/scripts/build/testdata/all_targets_linux_x64.txt +++ b/scripts/build/testdata/all_targets_linux_x64.txt @@ -22,5 +22,5 @@ nrf-native-posix-64-tests qpg-qpg6105-{lock,light,shell,persistent-storage} stm32-stm32wb5mm-dk-light tizen-arm-{all-clusters,all-clusters-minimal,chip-tool,light,tests}[-no-ble][-no-thread][-no-wifi][-asan][-ubsan] -telink-{tlsr9518adk80d,tlsr9528a}-{air-quality-sensor,all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,resource-monitoring,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-shell][-rpc][-factory-data] +telink-{tlsr9518adk80d,tlsr9528a}-{air-quality-sensor,all-clusters,all-clusters-minimal,bridge,contact-sensor,light,light-switch,lock,ota-requestor,pump,pump-controller,resource-monitoring,shell,smoke-co-alarm,temperature-measurement,thermostat,window-covering}[-ota][-shell][-rpc][-factory-data][-4mb] openiotsdk-{shell,lock}[-mbedtls][-psa] diff --git a/scripts/tools/telink/mfg_tool.py b/scripts/tools/telink/mfg_tool.py index 3725707d7c9c78..c55e1fe4ca3c4a 100644 --- a/scripts/tools/telink/mfg_tool.py +++ b/scripts/tools/telink/mfg_tool.py @@ -642,10 +642,9 @@ def base64_str(s): return base64.b64decode(s) basic_args.add_argument('--part_number', type=str, required=False, help='Provide human-readable product number') part_gen_args = parser.add_argument_group('Partition generator options') - part_gen_args.add_argument('--offset', type=allow_any_int, default=0x107000, + part_gen_args.add_argument('--offset', type=allow_any_int, help='Partition offset - an address in devices NVM memory, where factory data will be stored') - part_gen_args.add_argument('--size', type=allow_any_int, default=0x1000, - help='The maximum partition size') + part_gen_args.add_argument('--size', type=allow_any_int, help='The maximum partition size') args = parser.parse_args() diff --git a/src/platform/telink/1m_flash.overlay b/src/platform/telink/1m_flash.overlay new file mode 100644 index 00000000000000..698d7721d5012c --- /dev/null +++ b/src/platform/telink/1m_flash.overlay @@ -0,0 +1,39 @@ +/* + * In case of change partitions size - check if factory data size is correct + * in matter/connectedhomeip/config/telink/chip-module/CMakeLists.txt, variable "FD_SEEK" + * Also check matter/connectedhomeip/config/telink/chip-module/generate_factory_data.cmake, + * variable "FD_OFFSET" and argument "size" + */ + +&flash { + reg = <0x20000000 0x100000>; + + partitions { + /delete-node/ partition@0; + /delete-node/ partition@20000; + /delete-node/ partition@88000; + /delete-node/ partition@f0000; + /delete-node/ partition@f4000; + /delete-node/ partition@fe000; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x19000>; + }; + slot0_partition: partition@19000 { + label = "image-0"; + reg = <0x19000 0xDC000>; + }; + factory_partition: partition@F5000 { + label = "factory-data"; + reg = <0xF5000 0x1000>; + }; + storage_partition: partition@F6000 { + label = "storage"; + reg = <0xF6000 0x8000>; + }; + vendor_partition: partition@fe000 { + label = "vendor-data"; + reg = <0xfe000 0x2000>; + }; + }; +}; diff --git a/src/platform/telink/2m_flash.overlay b/src/platform/telink/2m_flash.overlay new file mode 100644 index 00000000000000..8a12e9c02aad02 --- /dev/null +++ b/src/platform/telink/2m_flash.overlay @@ -0,0 +1,43 @@ +/* + * In case of change partitions size - check if factory data size is correct + * in matter/connectedhomeip/config/telink/chip-module/CMakeLists.txt, variable "FD_SEEK" + * Also check matter/connectedhomeip/config/telink/chip-module/generate_factory_data.cmake, + * variable "FD_OFFSET" and argument "size" + */ + +&flash { + reg = <0x20000000 0x200000>; + + partitions { + /delete-node/ partition@0; + /delete-node/ partition@20000; + /delete-node/ partition@88000; + /delete-node/ partition@f0000; + /delete-node/ partition@f4000; + /delete-node/ partition@fe000; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x19000>; + }; + slot0_partition: partition@19000 { + label = "image-0"; + reg = <0x19000 0xee000>; + }; + factory_partition: partition@107000 { + label = "factory-data"; + reg = <0x107000 0x1000>; + }; + storage_partition: partition@108000 { + label = "storage"; + reg = <0x108000 0x8000>; + }; + slot1_partition: partition@110000 { + label = "image-1"; + reg = <0x110000 0xee000>; + }; + vendor_partition: partition@1fe000 { + label = "vendor-data"; + reg = <0x1fe000 0x2000>; + }; + }; +}; diff --git a/src/platform/telink/4m_flash.overlay b/src/platform/telink/4m_flash.overlay new file mode 100644 index 00000000000000..52a3f1c9a6f2fc --- /dev/null +++ b/src/platform/telink/4m_flash.overlay @@ -0,0 +1,43 @@ +/* + * In case of change partitions size - check if factory data size is correct + * in matter/connectedhomeip/config/telink/chip-module/CMakeLists.txt, variable "FD_SEEK" + * Also check matter/connectedhomeip/config/telink/chip-module/generate_factory_data.cmake, + * variable "FD_OFFSET" and argument "size" + */ + +&flash { + reg = <0x20000000 0x400000>; + + partitions { + /delete-node/ partition@0; + /delete-node/ partition@20000; + /delete-node/ partition@88000; + /delete-node/ partition@f0000; + /delete-node/ partition@f4000; + /delete-node/ partition@fe000; + boot_partition: partition@0 { + label = "mcuboot"; + reg = <0x00000000 0x19000>; + }; + slot0_partition: partition@19000 { + label = "image-0"; + reg = <0x19000 0x1ee000>; + }; + factory_partition: partition@207000 { + label = "factory-data"; + reg = <0x207000 0x1000>; + }; + storage_partition: partition@208000 { + label = "storage"; + reg = <0x208000 0x8000>; + }; + slot1_partition: partition@210000 { + label = "image-1"; + reg = <0x210000 0x1ee000>; + }; + vendor_partition: partition@3fe000 { + label = "vendor-data"; + reg = <0x3fe000 0x2000>; + }; + }; +}; diff --git a/src/platform/telink/tlsr9518adk80d.overlay b/src/platform/telink/tlsr9518adk80d.overlay index c419f8116441e5..7ad86efd5edc0a 100644 --- a/src/platform/telink/tlsr9518adk80d.overlay +++ b/src/platform/telink/tlsr9518adk80d.overlay @@ -78,39 +78,3 @@ pinctrl-0 = <&pwm_ch0_pb4_default &pwm_ch1_pb5_default &pwm_ch2_pe2_default &pwm_ch3_pe0_default>; }; -&flash { - reg = <0x20000000 0x200000>; - - partitions { - /delete-node/ partition@0; - /delete-node/ partition@20000; - /delete-node/ partition@88000; - /delete-node/ partition@f0000; - /delete-node/ partition@f4000; - /delete-node/ partition@fe000; - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x19000>; - }; - slot0_partition: partition@19000 { - label = "image-0"; - reg = <0x19000 0xee000>; - }; - factory_partition: partition@107000 { - label = "factory-data"; - reg = <0x107000 0x1000>; - }; - storage_partition: partition@108000 { - label = "storage"; - reg = <0x108000 0x8000>; - }; - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x110000 0xee000>; - }; - vendor_partition: partition@1fe000 { - label = "vendor-data"; - reg = <0x1fe000 0x2000>; - }; - }; -}; diff --git a/src/platform/telink/tlsr9528a.overlay b/src/platform/telink/tlsr9528a.overlay index c57cc0eb0341e2..9ba662d284ef37 100644 --- a/src/platform/telink/tlsr9528a.overlay +++ b/src/platform/telink/tlsr9528a.overlay @@ -78,39 +78,3 @@ pinctrl-0 = <&pwm_ch0_pd0_default &pwm_ch1_pd1_default &pwm_ch2_pe2_default &pwm_ch3_pe0_default>; }; -&flash { - reg = <0x20000000 0x200000>; - - partitions { - /delete-node/ partition@0; - /delete-node/ partition@20000; - /delete-node/ partition@88000; - /delete-node/ partition@f0000; - /delete-node/ partition@f4000; - /delete-node/ partition@fe000; - boot_partition: partition@0 { - label = "mcuboot"; - reg = <0x00000000 0x19000>; - }; - slot0_partition: partition@19000 { - label = "image-0"; - reg = <0x19000 0xee000>; - }; - factory_partition: partition@107000 { - label = "factory-data"; - reg = <0x107000 0x1000>; - }; - storage_partition: partition@108000 { - label = "storage"; - reg = <0x108000 0x8000>; - }; - slot1_partition: partition@110000 { - label = "image-1"; - reg = <0x110000 0xee000>; - }; - vendor_partition: partition@1fe000 { - label = "vendor-data"; - reg = <0x1fe000 0x2000>; - }; - }; -};