mirror of
https://github.com/espressif/openthread.git
synced 2026-07-08 13:20:25 +00:00
7db8c6815c
This commit implements the CSL feature in Thread 1.2. - Add macro definitions for low power to control the compiling of source code. - Add data and methods for running CSL in Mac and SubMac. This mainly includes setting CSL parameters, starting/stopping CSL, and the timer handling process. - Add otPlatTimeGetAPI and implementation. - Add CSL transmission implementation. CSL transmission is a new kind of transmission, the related definition and implementaion for the whole transmitting process is added. - Add calling of start/stop CSL in certain cases. - Implement CSL synchronization maintainence. If a CSL cordinator didn't get a frame containing CSL IE for CSLTimeout, the CSL receiver is regarded as de-synchronized. - Add Cli interface for using CSL. - Implement enhanced Ack with IE. The original code can only generate auto ack for Imm-Ack. As CSL requires CSL IE included in enhanced ack. This PR implements it. - Add basic functional test for CSL transmission. More tests corresponding to test plan would be added later.
198 lines
7.1 KiB
Bash
Executable File
198 lines
7.1 KiB
Bash
Executable File
#!/bin/bash
|
|
#
|
|
# Copyright (c) 2020, The OpenThread Authors.
|
|
# All rights reserved.
|
|
#
|
|
# Redistribution and use in source and binary forms, with or without
|
|
# modification, are permitted provided that the following conditions are met:
|
|
# 1. Redistributions of source code must retain the above copyright
|
|
# notice, this list of conditions and the following disclaimer.
|
|
# 2. Redistributions in binary form must reproduce the above copyright
|
|
# notice, this list of conditions and the following disclaimer in the
|
|
# documentation and/or other materials provided with the distribution.
|
|
# 3. Neither the name of the copyright holder nor the
|
|
# names of its contributors may be used to endorse or promote products
|
|
# derived from this software without specific prior written permission.
|
|
#
|
|
# THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS"
|
|
# AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE
|
|
# IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE
|
|
# ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT HOLDER OR CONTRIBUTORS BE
|
|
# LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR
|
|
# CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF
|
|
# SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS
|
|
# INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN
|
|
# CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE)
|
|
# ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE
|
|
# POSSIBILITY OF SUCH DAMAGE.
|
|
#
|
|
|
|
set -euxo pipefail
|
|
|
|
readonly OT_BUILD_JOBS=$(getconf _NPROCESSORS_ONLN)
|
|
|
|
reset_source()
|
|
{
|
|
rm -rf build output tmp
|
|
}
|
|
|
|
build_all_features()
|
|
{
|
|
local options=(
|
|
"-DOPENTHREAD_CONFIG_ANNOUNCE_SENDER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_BORDER_AGENT_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_COAP_API_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_COMMISSIONER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_DIAG_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_DNS_CLIENT_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_ECDSA_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_HEAP_EXTERNAL_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_IP6_FRAGMENTATION_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_IP6_SLAAC_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_JOINER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_LEGACY_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_LINK_RAW_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_BEACON_RSP_WHEN_JOINABLE_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_RETRY_SUCCESS_HISTOGRAM_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_SOFTWARE_ACK_TIMEOUT_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_SOFTWARE_CSMA_BACKOFF_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_SOFTWARE_ENERGY_SCAN_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_SOFTWARE_RETRANSMIT_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_SOFTWARE_TX_SECURITY_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MLE_ATTACH_BACKOFF_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MLE_STEERING_DATA_SET_OOB_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MPL_DYNAMIC_INTERVAL_ENABLE"
|
|
"-DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_PLATFORM_RADIO_COEX_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_PLATFORM_USEC_TIMER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_REFERENCE_DEVICE_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_TMF_NETWORK_DIAG_MTD_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_UDP_FORWARD_ENABLE=1"
|
|
)
|
|
|
|
local options_1_2=(
|
|
"-DOPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_DUA_ENABLE=1"
|
|
)
|
|
|
|
export CPPFLAGS="${options[*]} -DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE"
|
|
reset_source
|
|
make -f examples/Makefile-simulation
|
|
|
|
export CPPFLAGS="${options[*]}"
|
|
reset_source
|
|
make -f examples/Makefile-simulation FULL_LOGS=1
|
|
|
|
export CPPFLAGS="${options[*]} ${options_1_2[*]} -DOPENTHREAD_CONFIG_LOG_LEVEL=OT_LOG_LEVEL_NONE"
|
|
reset_source
|
|
make -f examples/Makefile-simulation THREAD_VERSION=1.2
|
|
|
|
export CPPFLAGS="${options[*]} ${options_1_2[*]}"
|
|
reset_source
|
|
make -f examples/Makefile-simulation THREAD_VERSION=1.2 FULL_LOGS=1
|
|
|
|
export CPPFLAGS="${options[*]} -DOPENTHREAD_CONFIG_ASSERT_ENABLE=0"
|
|
reset_source
|
|
make -f examples/Makefile-simulation
|
|
|
|
export CPPFLAGS="${options[*]}"
|
|
reset_source
|
|
make -f examples/Makefile-simulation OTNS=1
|
|
}
|
|
|
|
build_nest_common()
|
|
{
|
|
local options=(
|
|
"-DOPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_CHILD_SUPERVISION_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_DIAG_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_JAM_DETECTION_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_LEGACY_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_MAC_FILTER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_NCP_SPI_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE=1"
|
|
)
|
|
export CPPFLAGS="${options[*]}"
|
|
|
|
reset_source
|
|
mkdir build && cd build
|
|
../configure \
|
|
--enable-cli \
|
|
--enable-mtd \
|
|
--with-examples=simulation \
|
|
--disable-docs \
|
|
--disable-tests
|
|
make -j"${OT_BUILD_JOBS}"
|
|
cd ..
|
|
|
|
options=(
|
|
"-DOPENTHREAD_CONFIG_ANOUNCE_SENDER_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_TIME_SYNC_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
|
|
)
|
|
export CPPFLAGS="${options[*]}"
|
|
|
|
reset_source
|
|
mkdir build && cd build
|
|
../configure \
|
|
--enable-cli \
|
|
--enable-ftd \
|
|
--enable-mtd \
|
|
--enable-ncp \
|
|
--enable-radio-only \
|
|
--disable-docs \
|
|
--disable-tests \
|
|
--with-examples=simulation
|
|
make -j"${OT_BUILD_JOBS}"
|
|
cd ..
|
|
|
|
options=(
|
|
"-DOPENTHREAD_CONFIG_NCP_UART_ENABLE=1"
|
|
"-DOPENTHREAD_CONFIG_PLATFORM_FLASH_API_ENABLE=1"
|
|
)
|
|
export CPPFLAGS="${options[*]}"
|
|
|
|
reset_source
|
|
mkdir build && cd build
|
|
../configure \
|
|
--enable-ftd \
|
|
--enable-mtd \
|
|
--enable-ncp \
|
|
--with-examples=simulation \
|
|
--disable-docs \
|
|
--disable-tests \
|
|
--with-vendor-extension=../src/core/common/extension_example.cpp \
|
|
--with-ncp-vendor-hook-source=../src/ncp/example_vendor_hook.cpp
|
|
make -j"${OT_BUILD_JOBS}"
|
|
cd ..
|
|
}
|
|
|
|
main()
|
|
{
|
|
./bootstrap
|
|
|
|
build_all_features
|
|
build_nest_common
|
|
}
|
|
|
|
main "$@"
|