diff --git a/examples/config/ot-core-config-check-size-br.h b/examples/config/ot-core-config-check-size-br.h new file mode 100644 index 000000000..e6bb8a6ea --- /dev/null +++ b/examples/config/ot-core-config-check-size-br.h @@ -0,0 +1,100 @@ +/* + * Copyright (c) 2023, 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. + */ + +/** + * This header file defines the OpenThread core configuration example for an Border Router. This is intended for use + * in `script/check-size`. + * + */ + +#ifndef OT_CORE_CONFIG_CHECK_SIZE_BR_H_ +#define OT_CORE_CONFIG_CHECK_SIZE_BR_H_ + +#define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_3 + +#define OPENTHREAD_CONFIG_ASSERT_ENABLE 1 +#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 1 +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 1 +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 1 +#define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 +#define OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 1 +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1 +#define OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 1 +#define OPENTHREAD_CONFIG_DUA_ENABLE 1 +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 1 +#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 1 +#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 +#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 1 +#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +#define OPENTHREAD_CONFIG_LINK_RAW_ENABLE 1 +#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO +#define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 1 +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 +#define OPENTHREAD_CONFIG_MESH_DIAG_ENABLE 1 +#define OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 1 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 +#define OPENTHREAD_CONFIG_MLR_ENABLE 1 +#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0 +#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 1 +#define OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE 1 +#define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE 1 +#define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 +#define OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 1 +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE 1 +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 +#define OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE 1 +#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 1 +#define OPENTHREAD_CONFIG_UPTIME_ENABLE 1 + +// Enable mock platform APIs +#define OPENTHREAD_CONFIG_DNS_DSO_MOCK_PLAT_APIS_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_MOCK_PLAT_APIS_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_MOCK_PLAT_APIS_ENABLE 1 + +#endif // OT_CORE_CONFIG_CHECK_SIZE_BR_H_ diff --git a/examples/config/ot-core-config-check-size-ftd.h b/examples/config/ot-core-config-check-size-ftd.h new file mode 100644 index 000000000..210df7972 --- /dev/null +++ b/examples/config/ot-core-config-check-size-ftd.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023, 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. + */ + +/** + * This header file defines the OpenThread core configuration example for an FTD device (not acting as BR). This is + * intended for use in `script/check-size`. + * + */ + +#ifndef OT_CORE_CONFIG_CHECK_SIZE_FTD_H_ +#define OT_CORE_CONFIG_CHECK_SIZE_FTD_H_ + +#define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_3 + +#define OPENTHREAD_CONFIG_ASSERT_ENABLE 1 +#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 1 +#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 0 +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 1 +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 1 +#define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 +#define OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 1 +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 1 +#define OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 1 +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0 +#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0 +#define OPENTHREAD_CONFIG_DUA_ENABLE 1 +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0 +#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0 +#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 +#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 1 +#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +#define OPENTHREAD_CONFIG_LINK_RAW_ENABLE 1 +#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO +#define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 0 +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 +#define OPENTHREAD_CONFIG_MESH_DIAG_ENABLE 1 +#define OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 1 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 1 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 +#define OPENTHREAD_CONFIG_MLR_ENABLE 1 +#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0 +#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 0 +#define OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE 0 +#define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE 0 +#define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 +#define OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE 1 +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 1 +#define OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE 0 +#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 1 +#define OPENTHREAD_CONFIG_UPTIME_ENABLE 1 + +#endif // OT_CORE_CONFIG_CHECK_SIZE_FTD_H_ diff --git a/examples/config/ot-core-config-check-size-mtd.h b/examples/config/ot-core-config-check-size-mtd.h new file mode 100644 index 000000000..7c2b8cd9d --- /dev/null +++ b/examples/config/ot-core-config-check-size-mtd.h @@ -0,0 +1,95 @@ +/* + * Copyright (c) 2023, 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. + */ + +/** + * This header file defines the OpenThread core configuration example for an MTD/SED device. This is intended for use + * in `script/check-size`. + * + */ + +#ifndef OT_CORE_CONFIG_CHECK_SIZE_MTD_H_ +#define OT_CORE_CONFIG_CHECK_SIZE_MTD_H_ + +#define OPENTHREAD_CONFIG_THREAD_VERSION OT_THREAD_VERSION_1_3 + +#define OPENTHREAD_CONFIG_ASSERT_ENABLE 1 +#define OPENTHREAD_CONFIG_BACKBONE_ROUTER_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_AGENT_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_AGENT_ID_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_ROUTER_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE 0 +#define OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE 0 +#define OPENTHREAD_CONFIG_CHANNEL_MANAGER_ENABLE 0 +#define OPENTHREAD_CONFIG_CHANNEL_MONITOR_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_API_ENABLE 1 +#define OPENTHREAD_CONFIG_COAP_BLOCKWISE_TRANSFER_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_OBSERVE_API_ENABLE 0 +#define OPENTHREAD_CONFIG_COAP_SECURE_API_ENABLE 1 +#define OPENTHREAD_CONFIG_COMMISSIONER_ENABLE 0 +#define OPENTHREAD_CONFIG_DATASET_UPDATER_ENABLE 0 +#define OPENTHREAD_CONFIG_DHCP6_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DHCP6_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_DIAG_ENABLE 1 +#define OPENTHREAD_CONFIG_DNSSD_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_DNS_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_DNS_DSO_ENABLE 0 +#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0 +#define OPENTHREAD_CONFIG_DUA_ENABLE 1 +#define OPENTHREAD_CONFIG_ECDSA_ENABLE 1 +#define OPENTHREAD_CONFIG_HISTORY_TRACKER_ENABLE 0 +#define OPENTHREAD_CONFIG_IP6_BR_COUNTERS_ENABLE 0 +#define OPENTHREAD_CONFIG_IP6_SLAAC_ENABLE 1 +#define OPENTHREAD_CONFIG_JAM_DETECTION_ENABLE 0 +#define OPENTHREAD_CONFIG_JOINER_ENABLE 1 +#define OPENTHREAD_CONFIG_LINK_RAW_ENABLE 1 +#define OPENTHREAD_CONFIG_LOG_LEVEL OT_LOG_LEVEL_INFO +#define OPENTHREAD_CONFIG_LOG_LEVEL_DYNAMIC_ENABLE 0 +#define OPENTHREAD_CONFIG_MAC_CSL_RECEIVER_ENABLE 1 +#define OPENTHREAD_CONFIG_MAC_FILTER_ENABLE 1 +#define OPENTHREAD_CONFIG_MESH_DIAG_ENABLE 0 +#define OPENTHREAD_CONFIG_MESSAGE_USE_HEAP_ENABLE 1 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_INITIATOR_ENABLE 0 +#define OPENTHREAD_CONFIG_MLE_LINK_METRICS_SUBJECT_ENABLE 1 +#define OPENTHREAD_CONFIG_MLR_ENABLE 1 +#define OPENTHREAD_CONFIG_MULTIPLE_INSTANCE_ENABLE 0 +#define OPENTHREAD_CONFIG_NAT64_BORDER_ROUTING_ENABLE 0 +#define OPENTHREAD_CONFIG_NAT64_TRANSLATOR_ENABLE 0 +#define OPENTHREAD_CONFIG_NETDATA_PUBLISHER_ENABLE 0 +#define OPENTHREAD_CONFIG_PING_SENDER_ENABLE 1 +#define OPENTHREAD_CONFIG_SNTP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_CLIENT_ENABLE 1 +#define OPENTHREAD_CONFIG_SRP_SERVER_ENABLE 0 +#define OPENTHREAD_CONFIG_TIME_SYNC_ENABLE 0 +#define OPENTHREAD_CONFIG_TMF_ANYCAST_LOCATOR_ENABLE 1 +#define OPENTHREAD_CONFIG_TMF_NETDATA_SERVICE_ENABLE 0 +#define OPENTHREAD_CONFIG_TMF_NETDIAG_CLIENT_ENABLE 0 +#define OPENTHREAD_CONFIG_TX_QUEUE_STATISTICS_ENABLE 0 +#define OPENTHREAD_CONFIG_UDP_FORWARD_ENABLE 1 +#define OPENTHREAD_CONFIG_UPTIME_ENABLE 1 + +#endif // OT_CORE_CONFIG_CHECK_SIZE_MTD_H_ diff --git a/script/check-arm-build b/script/check-arm-build index 398dff766..c44095829 100755 --- a/script/check-arm-build +++ b/script/check-arm-build @@ -91,7 +91,7 @@ build_nrf52840() main() { - export CPPFLAGS="${CPPFLAGS:-} -DNDEBUG" + export CPPFLAGS="${CPPFLAGS-} -DNDEBUG" if [[ $# == 0 ]]; then build_nrf52840 diff --git a/script/check-size b/script/check-size index 907662698..40ac58a3d 100755 --- a/script/check-size +++ b/script/check-size @@ -118,137 +118,166 @@ nm_size() diff -Nuar nmsize_old nmsize_new || true } -size_nrf52840_version() +build_nrf52840() { - local options=( - "-DOT_ANYCAST_LOCATOR=ON" - "-DOT_BORDER_AGENT=ON" - "-DOT_BORDER_ROUTER=ON" - "-DOT_CHANNEL_MANAGER=ON" - "-DOT_CHANNEL_MONITOR=ON" - "-DOT_COAP=ON" - "-DOT_COAPS=ON" - "-DOT_COMMISSIONER=ON" - "-DOT_DATASET_UPDATER=ON" - "-DOT_DHCP6_CLIENT=ON" - "-DOT_DHCP6_SERVER=ON" - "-DOT_DIAGNOSTIC=ON" - "-DOT_DNSSD_SERVER=ON" - "-DOT_DNS_CLIENT=ON" - "-DOT_ECDSA=ON" - "-DOT_FULL_LOGS=ON" - "-DOT_JAM_DETECTION=ON" - "-DOT_JOINER=ON" - "-DOT_LINK_RAW=ON" - "-DOT_MAC_FILTER=ON" - "-DOT_MESSAGE_USE_HEAP=ON" - "-DOT_NETDATA_PUBLISHER=ON" - "-DOT_PING_SENDER=ON" - "-DOT_SERVICE=ON" - "-DOT_SLAAC=ON" - "-DOT_SNTP_CLIENT=ON" - "-DOT_SRP_CLIENT=ON" - "-DOT_SRP_SERVER=ON" - "-DOT_TIME_SYNC=ON" - "-DOT_UDP_FORWARD=ON" - "-DOT_UPTIME=ON" - ) + case "$1" in + ftd) + local ot_ftd=ON + local ot_mtd=OFF + local ot_rcp=ON + ;; + mtd) + local ot_ftd=OFF + local ot_mtd=ON + local ot_rcp=ON + ;; + br) + local ot_ftd=ON + local ot_mtd=OFF + local ot_rcp=OFF + ;; + *) + exit 128 + ;; + esac - local thread_version=$1 + case "$2" in + new) + local sha=${OT_SHA_NEW} + ;; + old) + local sha=${OT_SHA_OLD} + ;; + *) + exit 128 + ;; + esac - if [[ ${thread_version} != "1.1" ]]; then - options+=( - "-DOT_THREAD_VERSION=1.3" - "-DOT_BACKBONE_ROUTER=ON" - "-DOT_DUA=ON" - "-DOT_MLR=ON" - "-DOT_CSL_RECEIVER=ON" - "-DOT_LINK_METRICS_INITIATOR=ON" - "-DOT_LINK_METRICS_SUBJECT=ON" - ) + local folder="$1_$2" + local config_name="ot-core-config-check-size-$1.h" + local config_file="../examples/config/${config_name}" + + mkdir -p "${OT_TMP_DIR}/${folder}" + script/git-tool clone https://github.com/openthread/ot-nrf528xx.git "${OT_TMP_DIR}/${folder}" + rm -rf "${OT_TMP_DIR}/${folder}/openthread/*" # replace openthread submodule with latest commit + git archive "${sha}" | tar x -C "${OT_TMP_DIR}/${folder}/openthread" + + if [ ! -e "${OT_TMP_DIR}/${folder}/openthread/examples/config/${config_name}" ]; then + # Check if the the config headers are not present, copy from + # the main sha. + case "$1" in + br) + rm -rf "${OT_TMP_DIR}/${folder}/openthread/*" + git archive "${OT_SHA_NEW}" | tar x -C "${OT_TMP_DIR}/${folder}/openthread" + ;; + *) + mkdir -p "${OT_TMP_DIR}/${folder}/openthread/examples/config" + cp "./examples/config/${config_name}" "${OT_TMP_DIR}/${folder}/openthread/examples/config" + ;; + esac fi - rm -rf "${OT_TMP_DIR}" + local cur_dir - local build_dir="build" + cur_dir=$(pwd) - # new commit - mkdir -p "${OT_TMP_DIR}/b" - script/git-tool clone https://github.com/openthread/ot-nrf528xx.git "${OT_TMP_DIR}/b" - rm -rf "${OT_TMP_DIR}/b/openthread/*" # replace openthread submodule with latest commit - git archive "${OT_SHA_NEW}" | tar x -C "${OT_TMP_DIR}/b/openthread" + cd "${OT_TMP_DIR}/${folder}" + OT_CMAKE_BUILD_DIR=build script/build nrf52840 UART_trans \ + -DOT_APP_CLI=ON -DOT_APP_NCP=ON -DOT_APP_RCP=${ot_rcp} \ + -DOT_FTD=${ot_ftd} -DOT_MTD=${ot_mtd} -DOT_RCP=${ot_rcp} \ + -DBUILD_TESTING=OFF \ + -DOT_PROJECT_CONFIG="${config_file}" - (cd "${OT_TMP_DIR}/b" \ - && OT_CMAKE_BUILD_DIR=${build_dir} script/build nrf52840 UART_trans "${options[@]}") - - # old commit - if [[ "${GITHUB_ACTIONS+x}" ]]; then - git fetch --depth 1 --no-recurse-submodules origin "${OT_SHA_OLD}" + if [[ $1 == "br" ]]; then + mv ./build/bin/ot-cli-ftd ./build/bin/ot-cli-ftd-br + mv ./build/lib/libopenthread-ftd.a ./build/lib/libopenthread-ftd-br.a + mv ./build/lib/libopenthread-cli-ftd.a ./build/lib/libopenthread-cli-ftd-br.a fi - mkdir -p "${OT_TMP_DIR}/a" - git clone https://github.com/openthread/ot-nrf528xx.git "${OT_TMP_DIR}/a" - rm -rf "${OT_TMP_DIR}/a/openthread/*" # replace openthread submodule with last commit - git archive "${OT_SHA_OLD}" | tar x -C "${OT_TMP_DIR}/a/openthread" + cd "${cur_dir}" +} - (cd "${OT_TMP_DIR}/a" \ - && OT_CMAKE_BUILD_DIR=${build_dir} script/build nrf52840 UART_trans "${options[@]}") +generate_report() +{ + local type="${1}" + shift - # rename the generated files to be ready for size-report - # shellcheck disable=SC2011 - ( - cd "${OT_TMP_DIR}"/a/"${build_dir}"/bin - ls | xargs -I{} mv {} {}_"${thread_version}" - cd "${OT_TMP_DIR}"/b/"${build_dir}"/bin - ls | xargs -I{} mv {} {}_"${thread_version}" + local old_file + local new_file - cd "${OT_TMP_DIR}"/a/"${build_dir}"/lib - ls ./*.a | xargs -I{} mv {} {}_"${thread_version}" - cd "${OT_TMP_DIR}"/b/"${build_dir}"/lib - ls ./*.a | xargs -I{} mv {} {}_"${thread_version}" - ) + for file in "$@"; do + case "${file}" in + lib*) + old_file="${OT_TMP_DIR}"/${type}_old/build/lib/"${file}" + new_file="${OT_TMP_DIR}"/${type}_new/build/lib/"${file}" + ;; + *) + old_file="${OT_TMP_DIR}"/${type}_old/build/bin/"${file}" + new_file="${OT_TMP_DIR}"/${type}_new/build/bin/"${file}" + ;; + esac - local bins=( - "ot-cli-ftd" - "ot-cli-mtd" - "ot-ncp-ftd" - "ot-ncp-mtd" - "ot-rcp" - ) - - local libs=( - "libopenthread-cli-ftd.a" - "libopenthread-cli-mtd.a" - "libopenthread-ftd.a" - "libopenthread-mtd.a" - "libopenthread-ncp-ftd.a" - "libopenthread-ncp-mtd.a" - "libopenthread-rcp.a" - "libopenthread-radio.a" - ) - - for file in "${bins[@]}"; do - "${reporter}" size "${OT_TMP_DIR}"/a/"${build_dir}"/bin/"${file}"_"${thread_version}" "${OT_TMP_DIR}"/b/"${build_dir}"/bin/"${file}"_"${thread_version}" - echo nm_size "${OT_TMP_DIR}"/a/"${build_dir}"/bin/"${file}"_"${thread_version}" "${OT_TMP_DIR}"/b/"${build_dir}"/bin/"${file}"_"${thread_version}" - nm_size "${OT_TMP_DIR}"/a/"${build_dir}"/bin/"${file}"_"${thread_version}" "${OT_TMP_DIR}"/b/"${build_dir}"/bin/"${file}"_"${thread_version}" + "${reporter}" size "${old_file}" "${new_file}" + echo "nm_size ${old_file} ${new_file}" + nm_size "${old_file}" "${new_file}" done - for file in "${libs[@]}"; do - "${reporter}" size "${OT_TMP_DIR}"/a/"${build_dir}"/lib/"${file}"_"${thread_version}" "${OT_TMP_DIR}"/b/"${build_dir}"/lib/"${file}"_"${thread_version}" - echo nm_size "${OT_TMP_DIR}"/a/"${build_dir}"/lib/"${file}"_"${thread_version}" "${OT_TMP_DIR}"/b/"${build_dir}"/lib/"${file}"_"${thread_version}" - nm_size "${OT_TMP_DIR}"/a/"${build_dir}"/lib/"${file}"_"${thread_version}" "${OT_TMP_DIR}"/b/"${build_dir}"/lib/"${file}"_"${thread_version}" - done } size_nrf52840() { export OT_SHA_NEW OT_SHA_OLD + rm -rf "${OT_TMP_DIR}" + + if [[ "${GITHUB_ACTIONS+x}" ]]; then + git fetch --depth 1 --no-recurse-submodules origin "${OT_SHA_OLD}" + fi + local reporter="${OT_SIZE_REPORTER:-markdown}" "${reporter}" init OpenThread - size_nrf52840_version 1.1 - size_nrf52840_version 1.3 + build_nrf52840 ftd new + build_nrf52840 mtd new + build_nrf52840 br new + + build_nrf52840 ftd old + build_nrf52840 mtd old + build_nrf52840 br old + + local ftd_files=( + "ot-cli-ftd" + "ot-ncp-ftd" + "libopenthread-ftd.a" + "libopenthread-cli-ftd.a" + "libopenthread-ncp-ftd.a" + ) + + local mtd_files=( + "ot-cli-mtd" + "ot-ncp-mtd" + "libopenthread-mtd.a" + "libopenthread-cli-mtd.a" + "libopenthread-ncp-mtd.a" + ) + + local br_files=( + "ot-cli-ftd-br" + "libopenthread-ftd-br.a" + "libopenthread-cli-ftd-br.a" + ) + + # `rcp`` is using same config as `ftd`. + local rcp_files=( + "ot-rcp" + "libopenthread-rcp.a" + "libopenthread-radio.a" + ) + + generate_report ftd "${ftd_files[@]}" + generate_report mtd "${mtd_files[@]}" + generate_report br "${br_files[@]}" + generate_report ftd "${rcp_files[@]}" "${reporter}" post } @@ -258,6 +287,7 @@ main() if [[ $# == 0 ]]; then setup size_nrf52840 + cd elif [[ $1 == setup ]]; then setup elif [[ $1 == nrf52840 ]]; then diff --git a/script/test b/script/test index 8a2372598..17cf0478e 100755 --- a/script/test +++ b/script/test @@ -656,7 +656,7 @@ main() { envsetup "$@" - if [[ -z ${1:-} ]]; then + if [[ -z ${1-} ]]; then print_usage 1 fi diff --git a/src/cli/cli_history.cpp b/src/cli/cli_history.cpp index e2fa08753..b44a74fc3 100644 --- a/src/cli/cli_history.cpp +++ b/src/cli/cli_history.cpp @@ -375,10 +375,10 @@ template <> otError History::Process(Arg aArgs[]) otHistoryTrackerEntryAgeToString(entryAge, ageString, sizeof(ageString)); - OutputLine(isList ? "%s -> role:%s mode:%s rloc16:0x%04x partition-id:%u" - : "| %20s | %-8s | %-4s | 0x%04x | %12u |", - ageString, otThreadDeviceRoleToString(info->mRole), - Interpreter::LinkModeToString(info->mMode, linkModeString), info->mRloc16, info->mPartitionId); + OutputLine( + isList ? "%s -> role:%s mode:%s rloc16:0x%04x partition-id:%lu" : "| %20s | %-8s | %-4s | 0x%04x | %12lu |", + ageString, otThreadDeviceRoleToString(info->mRole), + Interpreter::LinkModeToString(info->mMode, linkModeString), info->mRloc16, ToUlong(info->mPartitionId)); } exit: diff --git a/src/core/border_router/infra_if.cpp b/src/core/border_router/infra_if.cpp index acc3049a3..53e4fc2a6 100644 --- a/src/core/border_router/infra_if.cpp +++ b/src/core/border_router/infra_if.cpp @@ -194,4 +194,17 @@ extern "C" void otPlatInfraIfDiscoverNat64PrefixDone(otInstance *aInstanc } // namespace BorderRouter } // namespace ot +//--------------------------------------------------------------------------------------------------------------------- + +#if OPENTHREAD_CONFIG_BORDER_ROUTING_MOCK_PLAT_APIS_ENABLE +OT_TOOL_WEAK bool otPlatInfraIfHasAddress(uint32_t, const otIp6Address *) { return false; } + +OT_TOOL_WEAK otError otPlatInfraIfSendIcmp6Nd(uint32_t, const otIp6Address *, const uint8_t *, uint16_t) +{ + return OT_ERROR_FAILED; +} + +OT_TOOL_WEAK otError otPlatInfraIfDiscoverNat64Prefix(uint32_t) { return OT_ERROR_FAILED; } +#endif + #endif // OPENTHREAD_CONFIG_BORDER_ROUTING_ENABLE diff --git a/src/core/config/border_routing.h b/src/core/config/border_routing.h index b016eef6c..1b13a8e9f 100644 --- a/src/core/config/border_routing.h +++ b/src/core/config/border_routing.h @@ -117,4 +117,16 @@ #define OPENTHREAD_CONFIG_BORDER_ROUTING_DHCP6_PD_ENABLE 0 #endif +/** + * @def OPENTHREAD_CONFIG_BORDER_ROUTING_MOCK_PLAT_APIS_ENABLE + * + * Define to 1 to add mock (empty) implementation of infra-if platform APIs. + * + * This is intended for generating code size report only and should not be used otherwise. + * + */ +#ifndef OPENTHREAD_CONFIG_BORDER_ROUTING_MOCK_PLAT_APIS_ENABLE +#define OPENTHREAD_CONFIG_BORDER_ROUTING_MOCK_PLAT_APIS_ENABLE 0 +#endif + #endif // CONFIG_BORDER_ROUTING_H_ diff --git a/src/core/config/dns_dso.h b/src/core/config/dns_dso.h index 65a7171d4..8b7d5a529 100644 --- a/src/core/config/dns_dso.h +++ b/src/core/config/dns_dso.h @@ -75,4 +75,16 @@ #define OPENTHREAD_CONFIG_DNS_DSO_MAX_PENDING_REQUESTS 3 #endif +/** + * @def OPENTHREAD_CONFIG_DNS_DSO_MOCK_PLAT_APIS_ENABLE + * + * Define to 1 to add mock (empty) implementation of DSO platform APIs. + * + * This is intended for generating code size report only and should not be used otherwise. + * + */ +#ifndef OPENTHREAD_CONFIG_DNS_DSO_MOCK_PLAT_APIS_ENABLE +#define OPENTHREAD_CONFIG_DNS_DSO_MOCK_PLAT_APIS_ENABLE 0 +#endif + #endif // CONFIG_DNS_DSO_H_ diff --git a/src/core/config/dnssd_server.h b/src/core/config/dnssd_server.h index 3edc4097f..8d6bb46d4 100644 --- a/src/core/config/dnssd_server.h +++ b/src/core/config/dnssd_server.h @@ -86,4 +86,16 @@ #define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE 0 #endif +/** + * @def OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_MOCK_PLAT_APIS_ENABLE + * + * Define to 1 to add mock (empty) implementation of upstream query platform APIs. + * + * This is intended for generating code size report only and should not be used otherwise. + * + */ +#ifndef OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_MOCK_PLAT_APIS_ENABLE +#define OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_MOCK_PLAT_APIS_ENABLE 0 +#endif + #endif // CONFIG_DNSSD_SERVER_H_ diff --git a/src/core/net/dns_dso.cpp b/src/core/net/dns_dso.cpp index 82ee2915a..179e57cee 100644 --- a/src/core/net/dns_dso.cpp +++ b/src/core/net/dns_dso.cpp @@ -991,7 +991,8 @@ Error Dso::Connection::ProcessKeepAliveMessage(const Dns::Header &aHeader, const AdjustInactivityTimeout(keepAliveTlv.GetInactivityTimeout()); mKeepAlive.SetInterval(keepAliveTlv.GetKeepAliveInterval()); - LogInfo("Timeouts Inactivity:%u, KeepAlive:%u", mInactivity.GetInterval(), mKeepAlive.GetInterval()); + LogInfo("Timeouts Inactivity:%lu, KeepAlive:%lu", ToUlong(mInactivity.GetInterval()), + ToUlong(mKeepAlive.GetInterval())); error = kErrorNone; @@ -1020,7 +1021,7 @@ Error Dso::Connection::ProcessRetryDelayMessage(const Dns::Header &aHeader, cons mRetryDelay = retryDelayTlv.GetRetryDelay(); LogInfo("Received Retry Delay message from server %s", mPeerSockAddr.ToString().AsCString()); - LogInfo(" RetryDelay:%u ms, ResponseCode:%d", mRetryDelay, mRetryDelayErrorCode); + LogInfo(" RetryDelay:%lu ms, ResponseCode:%d", ToUlong(mRetryDelay), mRetryDelayErrorCode); Disconnect(kGracefullyClose, kReasonServerRetryDelayRequest); @@ -1510,4 +1511,32 @@ void Dso::HandleTimer(void) } // namespace Dns } // namespace ot +#if OPENTHREAD_CONFIG_DNS_DSO_MOCK_PLAT_APIS_ENABLE + +OT_TOOL_WEAK void otPlatDsoEnableListening(otInstance *aInstance, bool aEnable) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aEnable); +} + +OT_TOOL_WEAK void otPlatDsoConnect(otPlatDsoConnection *aConnection, const otSockAddr *aPeerSockAddr) +{ + OT_UNUSED_VARIABLE(aConnection); + OT_UNUSED_VARIABLE(aPeerSockAddr); +} + +OT_TOOL_WEAK void otPlatDsoSend(otPlatDsoConnection *aConnection, otMessage *aMessage) +{ + OT_UNUSED_VARIABLE(aConnection); + OT_UNUSED_VARIABLE(aMessage); +} + +OT_TOOL_WEAK void otPlatDsoDisconnect(otPlatDsoConnection *aConnection, otPlatDsoDisconnectMode aMode) +{ + OT_UNUSED_VARIABLE(aConnection); + OT_UNUSED_VARIABLE(aMode); +} + +#endif // OPENTHREAD_CONFIG_DNS_DSO_MOCK_PLAT_APIS_ENABLE + #endif // OPENTHREAD_CONFIG_DNS_DSO_ENABLE diff --git a/src/core/net/dnssd_server.cpp b/src/core/net/dnssd_server.cpp index 63fced4d7..3406c3d90 100644 --- a/src/core/net/dnssd_server.cpp +++ b/src/core/net/dnssd_server.cpp @@ -1291,4 +1291,18 @@ void Server::ResetUpstreamQueryTransaction(UpstreamQueryTransaction &aTxn, Error } // namespace Dns } // namespace ot +#if OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_ENABLE && OPENTHREAD_CONFIG_DNS_UPSTREAM_QUERY_MOCK_PLAT_APIS_ENABLE +void otPlatDnsStartUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn, const otMessage *aQuery) +{ + OT_UNUSED_VARIABLE(aInstance); + OT_UNUSED_VARIABLE(aTxn); + OT_UNUSED_VARIABLE(aQuery); +} + +void otPlatDnsCancelUpstreamQuery(otInstance *aInstance, otPlatDnsUpstreamQuery *aTxn) +{ + otPlatDnsUpstreamQueryDone(aInstance, aTxn, nullptr); +} +#endif + #endif // OPENTHREAD_CONFIG_DNS_SERVER_ENABLE diff --git a/src/core/net/nat64_translator.cpp b/src/core/net/nat64_translator.cpp index bdee98ee6..c7d93a65a 100644 --- a/src/core/net/nat64_translator.cpp +++ b/src/core/net/nat64_translator.cpp @@ -504,9 +504,9 @@ Error Translator::SetIp4Cidr(const Ip4::Cidr &aCidr) IgnoreError(mIp4AddressPool.PushBack(addr)); } - LogInfo("IPv4 CIDR for NAT64: %s (actual address pool: %s - %s, %u addresses)", aCidr.ToString().AsCString(), + LogInfo("IPv4 CIDR for NAT64: %s (actual address pool: %s - %s, %lu addresses)", aCidr.ToString().AsCString(), mIp4AddressPool.Front()->ToString().AsCString(), mIp4AddressPool.Back()->ToString().AsCString(), - numberOfHosts); + ToUlong(numberOfHosts)); mIp4Cidr = aCidr; // Always notify the platform when the CIDR is changed.