Skip to content

Commit

Permalink
Revert "[Telink] Flash various sizes support (#29726)"
Browse files Browse the repository at this point in the history
This reverts commit 500fb4a because Telink CI
started failing after it merged.
  • Loading branch information
bzbarsky-apple committed Oct 13, 2023
1 parent d1b59df commit b1ec0cd
Show file tree
Hide file tree
Showing 52 changed files with 215 additions and 509 deletions.
16 changes: 8 additions & 8 deletions .github/workflows/examples-telink.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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 OTA, RPC, Factory Data and 4Mb flash
- name: Build example Telink (B91) Lighting App with RPC, Shell and Factory Data
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9518adk80d-light-rpc-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9518adk80d lighting-app-ota-rpc-factory-data-4mb \
out/telink-tlsr9518adk80d-light-ota-rpc-factory-data-4mb/zephyr/zephyr.elf \
telink tlsr9518adk80d lighting-app-rpc-shell-factory-data \
out/telink-tlsr9518adk80d-light-rpc-shell-factory-data/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 OTA, Shell, Factory Data
- name: Build example Telink (B92) Light Switch App with RPC, Shell and Factory Data
run: |
./scripts/run_in_build_env.sh \
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-ota-shell-factory-data' build"
"./scripts/build/build_examples.py --target 'telink-tlsr9528a-light-switch-rpc-shell-factory-data' build"
.environment/pigweed-venv/bin/python3 scripts/tools/memory/gh_sizes.py \
telink tlsr9528a light-switch-app-ota-shell-factory-data \
out/telink-tlsr9528a-light-switch-ota-shell-factory-data/zephyr/zephyr.elf \
telink tlsr9528a light-switch-app-rpc-shell-factory-data \
out/telink-tlsr9528a-light-switch-rpc-shell-factory-data/zephyr/zephyr.elf \
/tmp/bloat_reports/
- name: clean out build output
Expand Down
28 changes: 8 additions & 20 deletions config/telink/chip-module/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -166,13 +166,6 @@ 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
Expand All @@ -184,7 +177,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=${BLOCK_SIZE} seek=${boot_blocks}
dd if=${PROJECT_BINARY_DIR}/zephyr.signed.bin of=${PROJECT_BINARY_DIR}/zephyr.bin bs=1024 seek=100
)

chip_ota_image(chip-ota-image
Expand All @@ -196,21 +189,16 @@ 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=${BLOCK_SIZE} seek=${factory_blocks}
)
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=1024 seek=1052
)
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()

# ==============================================================================
Expand Down
11 changes: 0 additions & 11 deletions config/telink/chip-module/generate_factory_data.cmake
Original file line number Diff line number Diff line change
Expand Up @@ -116,17 +116,6 @@ 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)
Expand Down
12 changes: 2 additions & 10 deletions examples/air-quality-sensor-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
9 changes: 1 addition & 8 deletions examples/air-quality-sensor-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ You can use this example as a reference for creating your own application.
$ west build -b <build_target>
```

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:

```
Expand Down Expand Up @@ -122,7 +115,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 at least 2MB PCB).
- zephyr.bin - main binary to flash PCB (Use 2MB PCB).
- zephyr-ota.bin - binary for OTA Provider
All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have
Expand Down
12 changes: 2 additions & 10 deletions examples/all-clusters-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
9 changes: 1 addition & 8 deletions examples/all-clusters-app/telink/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ creating your own application.
$ west build -b <build_target>
```

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:

```
Expand Down Expand Up @@ -124,7 +117,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 at least 2MB PCB).
- zephyr.bin - main binary to flash PCB (Use 2MB PCB).
- zephyr-ota.bin - binary for OTA Provider
All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have
Expand Down
12 changes: 2 additions & 10 deletions examples/all-clusters-minimal-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -32,21 +32,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
9 changes: 1 addition & 8 deletions examples/all-clusters-minimal-app/telink/Readme.md
Original file line number Diff line number Diff line change
Expand Up @@ -33,13 +33,6 @@ for creating your own application.
$ west build -b <build_target>
```

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:

```
Expand Down Expand Up @@ -107,7 +100,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 at least 2MB PCB).
- zephyr.bin - main binary to flash PCB (Use 2MB PCB).
- zephyr-ota.bin - binary for OTA Provider

All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have
Expand Down
12 changes: 2 additions & 10 deletions examples/bridge-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
9 changes: 1 addition & 8 deletions examples/bridge-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -110,13 +110,6 @@ defined:
$ west build -b <build_target>
```

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:

```
Expand Down Expand Up @@ -269,7 +262,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 at least 2MB PCB).
- zephyr.bin - main binary to flash PCB (Use 2MB PCB).
- zephyr-ota.bin - binary for OTA Provider
All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have
Expand Down
12 changes: 2 additions & 10 deletions examples/chef/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -38,21 +38,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
12 changes: 2 additions & 10 deletions examples/contact-sensor-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
9 changes: 1 addition & 8 deletions examples/contact-sensor-app/telink/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -31,13 +31,6 @@ You can use this example as a reference for creating your own application.
$ west build -b <build_target>
```

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:

```
Expand Down Expand Up @@ -126,7 +119,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 at least 2MB PCB).
- zephyr.bin - main binary to flash PCB (Use 2MB PCB).
- zephyr-ota.bin - binary for OTA Provider
All binaries has the same SW version. To test OTA “zephyr-ota.bin” should have
Expand Down
12 changes: 2 additions & 10 deletions examples/light-switch-app/telink/CMakeLists.txt
Original file line number Diff line number Diff line change
Expand Up @@ -31,21 +31,13 @@ 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} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
"${DTC_OVERLAY_FILE} ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE}"
CACHE STRING "" FORCE
)
else()
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${FLASH_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
set(DTC_OVERLAY_FILE ${GLOBAL_DTC_OVERLAY_FILE} ${LOCAL_DTC_OVERLAY_FILE})
endif()

set(CONF_FILE prj.conf)
Expand Down
Loading

0 comments on commit b1ec0cd

Please sign in to comment.