diff --git a/CMakeLists.txt b/CMakeLists.txt index ec4e2bcc66..04fb12f481 100644 --- a/CMakeLists.txt +++ b/CMakeLists.txt @@ -195,6 +195,7 @@ if(CONFIG_ESP_SYSTEM_USE_EH_FRAME) endif() list(APPEND link_options "-fno-lto") +list(APPEND link_options "-Wl,--warn-common") if(CONFIG_IDF_TARGET_LINUX AND CMAKE_HOST_SYSTEM_NAME STREQUAL "Darwin") list(APPEND link_options "-Wl,-dead_strip") diff --git a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c index d55007de50..ff0b96600a 100644 --- a/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c +++ b/components/bt/common/btc/profile/esp/blufi/bluedroid_host/esp_blufi.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -35,12 +35,6 @@ #if (BLUFI_INCLUDED == TRUE) -#if GATT_DYNAMIC_MEMORY == FALSE -tBLUFI_ENV blufi_env; -#else -tBLUFI_ENV *blufi_env_ptr; -#endif - static uint8_t server_if; static uint16_t conn_id; static uint8_t blufi_service_uuid128[32] = { diff --git a/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c b/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c index d2828df0d8..24f81c5fab 100644 --- a/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c +++ b/components/bt/common/btc/profile/esp/blufi/blufi_protocol.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2015-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -18,7 +18,6 @@ //#include "esp_wifi.h" #if (BLUFI_INCLUDED == TRUE) -// extern tBLUFI_ENV blufi_env; void btc_blufi_protocol_handler(uint8_t type, uint8_t *data, int len) { diff --git a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c index b95a793e23..fdc19fedce 100644 --- a/components/bt/host/bluedroid/bta/dm/bta_dm_main.c +++ b/components/bt/host/bluedroid/bta/dm/bta_dm_main.c @@ -42,6 +42,7 @@ tBTA_DM_DI_CB bta_dm_di_cb; tBTA_DM_CB *bta_dm_cb_ptr; tBTA_DM_SEARCH_CB *bta_dm_search_cb_ptr; tBTA_DM_DI_CB *bta_dm_di_cb_ptr; +SemaphoreHandle_t deinit_semaphore; #endif diff --git a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h index 8d2f106d0d..30b3b5a995 100644 --- a/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h +++ b/components/bt/host/bluedroid/bta/dm/include/bta_dm_int.h @@ -1481,7 +1481,7 @@ extern tBTA_DM_DI_CB bta_dm_di_cb; #else extern tBTA_DM_DI_CB *bta_dm_di_cb_ptr; #define bta_dm_di_cb (*bta_dm_di_cb_ptr) -SemaphoreHandle_t deinit_semaphore; +extern SemaphoreHandle_t deinit_semaphore; #endif #if BTA_DYNAMIC_MEMORY == FALSE diff --git a/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c b/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c index 1d26596016..d165c80a88 100644 --- a/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c +++ b/components/bt/host/bluedroid/external/sbc/decoder/srce/dequant.c @@ -112,8 +112,8 @@ #define SBC_DEQUANT_SCALING_FACTOR 1.38019122262781f #endif -const OI_UINT32 dequant_long_scaled[17]; -const OI_UINT32 dequant_long_unscaled[17]; +extern const OI_UINT32 dequant_long_scaled[17]; +extern const OI_UINT32 dequant_long_unscaled[17]; /** Scales x by y bits to the right, adding a rounding factor. */ diff --git a/components/fatfs/test/test_fatfs_common.h b/components/fatfs/test/test_fatfs_common.h index 30ee3431e5..46cf3b8909 100644 --- a/components/fatfs/test/test_fatfs_common.h +++ b/components/fatfs/test/test_fatfs_common.h @@ -1,16 +1,8 @@ -// Copyright 2015-2017 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2015-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once @@ -30,8 +22,8 @@ } \ } while(0) -const char* fatfs_test_hello_str; -const char* fatfs_test_hello_str_utf; +extern const char* fatfs_test_hello_str; +extern const char* fatfs_test_hello_str_utf; void test_fatfs_create_file_with_text(const char* name, const char* text); diff --git a/components/riscv/include/esp_private/panic_reason.h b/components/riscv/include/esp_private/panic_reason.h index 6cb14d8c5c..09da6cbb43 100644 --- a/components/riscv/include/esp_private/panic_reason.h +++ b/components/riscv/include/esp_private/panic_reason.h @@ -1,19 +1,11 @@ -// Copyright 2020 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2020-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #pragma once -enum _panic_reasons { +typedef enum { PANIC_RSN_NONE = 0, PANIC_RSN_INTWDT_CPU0, #if SOC_CPU_NUM > 1 @@ -24,4 +16,4 @@ enum _panic_reasons { PANIC_RSN_MEMPROT, #endif PANIC_RSN_COUNT -} panic_reasons; +} panic_reasons_t; diff --git a/components/tinyusb/additions/include_private/descriptors_control.h b/components/tinyusb/additions/include_private/descriptors_control.h index 7f441cc041..63685ef081 100644 --- a/components/tinyusb/additions/include_private/descriptors_control.h +++ b/components/tinyusb/additions/include_private/descriptors_control.h @@ -48,7 +48,6 @@ enum { CFG_TUD_HID * TUD_HID_DESC_LEN }; -bool tusb_desc_set; void tusb_set_descriptor(tusb_desc_device_t *desc, const char **str_desc); tusb_desc_device_t *tusb_get_active_desc(void); char **tusb_get_active_str_desc(void); diff --git a/components/tinyusb/additions/src/descriptors_control.c b/components/tinyusb/additions/src/descriptors_control.c index ebeaa20292..02e4a4bf80 100644 --- a/components/tinyusb/additions/src/descriptors_control.c +++ b/components/tinyusb/additions/src/descriptors_control.c @@ -171,7 +171,6 @@ void tusb_set_descriptor(tusb_desc_device_t *dev_desc, const char **str_desc) memcpy(s_str_descriptor, str_desc, sizeof(s_str_descriptor[0])*USB_STRING_DESCRIPTOR_ARRAY_SIZE); } - tusb_desc_set = true; } tusb_desc_device_t *tusb_get_active_desc(void) @@ -188,5 +187,4 @@ void tusb_clear_descriptor(void) { memset(&s_descriptor, 0, sizeof(s_descriptor)); memset(&s_str_descriptor, 0, sizeof(s_str_descriptor)); - tusb_desc_set = false; } diff --git a/components/usb/test/common/test_usb_mock_classes.h b/components/usb/test/common/test_usb_mock_classes.h index b225a37517..f057670e46 100644 --- a/components/usb/test/common/test_usb_mock_classes.h +++ b/components/usb/test/common/test_usb_mock_classes.h @@ -21,7 +21,7 @@ extern "C" { // ---------------------------------------------------- MSC SCSI ------------------------------------------------------- -const char *MSC_CLIENT_TAG; +extern const char *MSC_CLIENT_TAG; /* Note: The mock MSC SCSI tests requires that USB flash drive be connected. The flash drive should... diff --git a/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h b/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h index f448b737c7..f79f5c55a6 100644 --- a/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h +++ b/components/wpa_supplicant/esp_supplicant/include/esp_wpa.h @@ -1,16 +1,8 @@ -// Copyright 2019 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2019-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef __ESP_WPA_H__ #define __ESP_WPA_H__ @@ -42,9 +34,10 @@ extern "C" { * @{ */ /* Crypto callback functions */ -const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; +extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; // NOLINT(readability-redundant-declaration) + /* Mesh crypto callback functions */ -const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs; +extern const mesh_crypto_funcs_t g_wifi_default_mesh_crypto_funcs; /** * @brief Supplicant initialization diff --git a/components/wpa_supplicant/src/drivers/driver.h b/components/wpa_supplicant/src/drivers/driver.h index 22bf5978b9..150002b211 100644 --- a/components/wpa_supplicant/src/drivers/driver.h +++ b/components/wpa_supplicant/src/drivers/driver.h @@ -173,7 +173,7 @@ struct scan_info { int nl_scan_event; u64 scan_start_tsf; u8 scan_start_tsf_bssid[ETH_ALEN]; -} scan_info; +}; struct wpa_bss_trans_info { u8 mbo_transition_reason; diff --git a/components/wpa_supplicant/src/eap_peer/eap.c b/components/wpa_supplicant/src/eap_peer/eap.c index 7cc829d0c3..f904148032 100644 --- a/components/wpa_supplicant/src/eap_peer/eap.c +++ b/components/wpa_supplicant/src/eap_peer/eap.c @@ -42,6 +42,27 @@ #include "supplicant_opt.h" +u8 *g_wpa_anonymous_identity; +int g_wpa_anonymous_identity_len; +u8 *g_wpa_username; +int g_wpa_username_len; +const u8 *g_wpa_client_cert; +int g_wpa_client_cert_len; +const u8 *g_wpa_private_key; +int g_wpa_private_key_len; +const u8 *g_wpa_private_key_passwd; +int g_wpa_private_key_passwd_len; +const u8 *g_wpa_ca_cert; +int g_wpa_ca_cert_len; +u8 *g_wpa_password; +int g_wpa_password_len; +u8 *g_wpa_new_password; +int g_wpa_new_password_len; +char *g_wpa_ttls_phase2_type; +char *g_wpa_phase1_options; +u8 *g_wpa_pac_file; +int g_wpa_pac_file_len; +bool g_wpa_suiteb_certification; void eap_peer_config_deinit(struct eap_sm *sm); void eap_peer_blob_deinit(struct eap_sm *sm); diff --git a/components/wpa_supplicant/src/eap_peer/eap.h b/components/wpa_supplicant/src/eap_peer/eap.h index 3db3c9907a..9ef8224fab 100644 --- a/components/wpa_supplicant/src/eap_peer/eap.h +++ b/components/wpa_supplicant/src/eap_peer/eap.h @@ -19,33 +19,33 @@ struct eap_method_type { EapType method; }; -u8 *g_wpa_anonymous_identity; -int g_wpa_anonymous_identity_len; -u8 *g_wpa_username; -int g_wpa_username_len; -const u8 *g_wpa_client_cert; -int g_wpa_client_cert_len; -const u8 *g_wpa_private_key; -int g_wpa_private_key_len; -const u8 *g_wpa_private_key_passwd; -int g_wpa_private_key_passwd_len; +extern u8 *g_wpa_anonymous_identity; +extern int g_wpa_anonymous_identity_len; +extern u8 *g_wpa_username; +extern int g_wpa_username_len; +extern const u8 *g_wpa_client_cert; +extern int g_wpa_client_cert_len; +extern const u8 *g_wpa_private_key; +extern int g_wpa_private_key_len; +extern const u8 *g_wpa_private_key_passwd; +extern int g_wpa_private_key_passwd_len; -const u8 *g_wpa_ca_cert; -int g_wpa_ca_cert_len; +extern const u8 *g_wpa_ca_cert; +extern int g_wpa_ca_cert_len; -u8 *g_wpa_password; -int g_wpa_password_len; +extern u8 *g_wpa_password; +extern int g_wpa_password_len; -u8 *g_wpa_new_password; -int g_wpa_new_password_len; +extern u8 *g_wpa_new_password; +extern int g_wpa_new_password_len; -char *g_wpa_ttls_phase2_type; -char *g_wpa_phase1_options; +extern char *g_wpa_ttls_phase2_type; +extern char *g_wpa_phase1_options; -u8 *g_wpa_pac_file; -int g_wpa_pac_file_len; +extern u8 *g_wpa_pac_file; +extern int g_wpa_pac_file_len; -bool g_wpa_suiteb_certification; +extern bool g_wpa_suiteb_certification; const u8 * eap_get_eapKeyData(struct eap_sm *sm, size_t *len); void eap_deinit_prev_method(struct eap_sm *sm, const char *txt); diff --git a/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/bt_app_hf.h b/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/bt_app_hf.h index f60c7a8da4..a58648aad5 100644 --- a/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/bt_app_hf.h +++ b/examples/bluetooth/bluedroid/classic_bt/hfp_ag/main/bt_app_hf.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -11,7 +11,7 @@ #include "esp_hf_ag_api.h" #include "esp_bt_defs.h" -esp_bd_addr_t hf_peer_addr; // Declaration of peer device bdaddr +extern esp_bd_addr_t hf_peer_addr; // Declaration of peer device bdaddr #define BT_HF_TAG "BT_APP_HF" diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/sync.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/sync.h index 85efed4a61..a8b9265d65 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/sync.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_coex_test/components/case/sync.h @@ -1,7 +1,7 @@ /* * ESP BLE Mesh Example * - * SPDX-FileCopyrightText: 2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Unlicense OR CC0-1.0 */ @@ -86,7 +86,7 @@ typedef struct { uint8_t case_id; const uint16_t excpet_param_bit; } auto_tc; -auto_tc auto_tb[6]; +extern auto_tc auto_tb[6]; typedef enum { @@ -113,7 +113,7 @@ struct sync_t { esp_timer_handle_t sync_timer; sync_recv cmd_recv; }; -struct sync_t sync_obj; +extern struct sync_t sync_obj; extern SemaphoreHandle_t client_mutex; void sync_init(void); diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.c index 469bd06fae..064abfd860 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.c @@ -7,6 +7,9 @@ #include "esp_ble_mesh_networking_api.h" #include "ble_mesh_adapter.h" +ble_mesh_performance_statistics_t test_perf_statistics; +ble_mesh_node_statistics_t ble_mesh_node_statistics; + esp_ble_mesh_model_t *ble_mesh_get_model(uint16_t model_id) { esp_ble_mesh_model_t *model = NULL; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.h index 3ed7655b3a..7ac523d59e 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_adapter.h @@ -53,7 +53,7 @@ typedef struct { uint16_t *package_index; uint8_t ttl; } ble_mesh_performance_statistics_t; -ble_mesh_performance_statistics_t test_perf_statistics; +extern ble_mesh_performance_statistics_t test_perf_statistics; typedef struct { uint32_t statistics; @@ -61,7 +61,7 @@ typedef struct { uint16_t *package_index; uint32_t total_package_num; } ble_mesh_node_statistics_t; -ble_mesh_node_statistics_t ble_mesh_node_statistics; +extern ble_mesh_node_statistics_t ble_mesh_node_statistics; extern SemaphoreHandle_t ble_mesh_node_sema; diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.c b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.c index 4cd84fce16..fd5f2099fb 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.c +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.c @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -8,6 +8,7 @@ #include "esp_ble_mesh_generic_model_api.h" uint8_t dev_uuid[16] = {0xdd, 0xdd}; +ble_mesh_node_config_params ble_mesh_node_prestore_params[NODE_MAX_GROUP_CONFIG]; esp_ble_mesh_prov_t prov = { #if CONFIG_BLE_MESH_NODE @@ -66,6 +67,8 @@ esp_ble_mesh_comp_t config_server_comp = { }; // config client model +esp_ble_mesh_client_t cfg_cli; + esp_ble_mesh_model_t config_client_models[] = { ESP_BLE_MESH_MODEL_CFG_SRV(&cfg_srv), ESP_BLE_MESH_MODEL_CFG_CLI(&cfg_cli), diff --git a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.h b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.h index ae087c818b..7fbb7ee47c 100644 --- a/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.h +++ b/examples/bluetooth/esp_ble_mesh/ble_mesh_console/main/ble_mesh_cfg_srv_model.h @@ -1,5 +1,5 @@ /* - * SPDX-FileCopyrightText: 2017-2021 Espressif Systems (Shanghai) CO LTD + * SPDX-FileCopyrightText: 2017-2022 Espressif Systems (Shanghai) CO LTD * * SPDX-License-Identifier: Apache-2.0 */ @@ -23,7 +23,7 @@ typedef struct { uint16_t net_idx; uint16_t unicast_addr; } ble_mesh_node_config_params; -ble_mesh_node_config_params ble_mesh_node_prestore_params[NODE_MAX_GROUP_CONFIG]; +extern ble_mesh_node_config_params ble_mesh_node_prestore_params[NODE_MAX_GROUP_CONFIG]; extern esp_ble_mesh_prov_t prov; @@ -39,7 +39,7 @@ extern esp_ble_mesh_elem_t config_server_elements[]; extern esp_ble_mesh_comp_t config_server_comp; // config client model -esp_ble_mesh_client_t cfg_cli; +extern esp_ble_mesh_client_t cfg_cli; extern esp_ble_mesh_model_t config_client_models[]; extern esp_ble_mesh_elem_t config_client_elements[]; diff --git a/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c b/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c index c8fd0e5917..c09955f1ce 100644 --- a/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c +++ b/examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "bluedroid_gatts.h" #include "esp_log.h" @@ -19,6 +11,7 @@ #if CONFIG_BT_BLE_ENABLED static const char *TAG = "bluedroid_gatts"; +static prepare_type_env_t a_prepare_write_env; uint8_t adv_service_uuid128[32] = { /* LSB <--------------------------------------------------------------------------------> MSB */ diff --git a/examples/system/ota/advanced_https_ota/main/ble_helper/include/bluedroid_gatts.h b/examples/system/ota/advanced_https_ota/main/ble_helper/include/bluedroid_gatts.h index 13aee0cc01..b685a3d031 100644 --- a/examples/system/ota/advanced_https_ota/main/ble_helper/include/bluedroid_gatts.h +++ b/examples/system/ota/advanced_https_ota/main/ble_helper/include/bluedroid_gatts.h @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef H_BLUEDROID_GATTS_ #define H_BLUEDROID_GATTS_ @@ -68,8 +60,6 @@ typedef struct { int prepare_len; } prepare_type_env_t; -prepare_type_env_t a_prepare_write_env; - void gatts_profile_a_event_handler(esp_gatts_cb_event_t event, esp_gatt_if_t gatts_if, esp_ble_gatts_cb_param_t *param); void example_write_event_env(esp_gatt_if_t gatts_if, prepare_type_env_t *prepare_write_env, esp_ble_gatts_cb_param_t *param); diff --git a/examples/system/ota/advanced_https_ota/main/ble_helper/include/nimble_gatts.h b/examples/system/ota/advanced_https_ota/main/ble_helper/include/nimble_gatts.h index 0133136df3..8c52e7e81a 100644 --- a/examples/system/ota/advanced_https_ota/main/ble_helper/include/nimble_gatts.h +++ b/examples/system/ota/advanced_https_ota/main/ble_helper/include/nimble_gatts.h @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #ifndef H_NIMBLE_GATTS_ #define H_NIMBLE_GATTS_ @@ -37,7 +29,6 @@ struct ble_hs_cfg; struct ble_gatt_register_ctxt; int bleprph_gap_event(struct ble_gap_event *event, void *arg); -uint8_t own_addr_type; /** GATT server. */ #define GATT_SVR_SVC_ALERT_UUID 0x1811 diff --git a/examples/system/ota/advanced_https_ota/main/ble_helper/nimble_gatts.c b/examples/system/ota/advanced_https_ota/main/ble_helper/nimble_gatts.c index 9037549a34..9045cb4f18 100644 --- a/examples/system/ota/advanced_https_ota/main/ble_helper/nimble_gatts.c +++ b/examples/system/ota/advanced_https_ota/main/ble_helper/nimble_gatts.c @@ -1,16 +1,8 @@ -// Copyright 2021 Espressif Systems (Shanghai) PTE LTD -// -// 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. +/* + * SPDX-FileCopyrightText: 2021-2022 Espressif Systems (Shanghai) CO LTD + * + * SPDX-License-Identifier: Apache-2.0 + */ #include "sdkconfig.h" @@ -21,6 +13,7 @@ #include "services/gatt/ble_svc_gatt.h" static const char *TAG = "nimble_gatts"; +static uint8_t own_addr_type; static const ble_uuid128_t gatt_svr_svc_sec_test_uuid = BLE_UUID128_INIT(0x2d, 0x71, 0xa2, 0x59, 0xb4, 0x58, 0xc8, 0x12, diff --git a/examples/wifi/ftm/main/ftm_main.c b/examples/wifi/ftm/main/ftm_main.c index 2d3eaf23ba..0fa5546ae2 100644 --- a/examples/wifi/ftm/main/ftm_main.c +++ b/examples/wifi/ftm/main/ftm_main.c @@ -66,19 +66,19 @@ static int s_retry_num = 0; static const char *TAG_STA = "ftm_station"; static const char *TAG_AP = "ftm_ap"; -static EventGroupHandle_t wifi_event_group; -const int CONNECTED_BIT = BIT0; -const int DISCONNECTED_BIT = BIT1; +static EventGroupHandle_t s_wifi_event_group; +static const int CONNECTED_BIT = BIT0; +static const int DISCONNECTED_BIT = BIT1; -static EventGroupHandle_t ftm_event_group; -const int FTM_REPORT_BIT = BIT0; -const int FTM_FAILURE_BIT = BIT1; -wifi_ftm_report_entry_t *g_ftm_report; -uint8_t g_ftm_report_num_entries; -static uint32_t g_rtt_est, g_dist_est; -bool g_ap_started; -uint8_t g_ap_channel; -uint8_t g_ap_bssid[ETH_ALEN]; +static EventGroupHandle_t s_ftm_event_group; +static const int FTM_REPORT_BIT = BIT0; +static const int FTM_FAILURE_BIT = BIT1; +static wifi_ftm_report_entry_t *s_ftm_report; +static uint8_t s_ftm_report_num_entries; +static uint32_t s_rtt_est, s_dist_est; +static bool s_ap_started; +static uint8_t s_ap_channel; +static uint8_t s_ap_bssid[ETH_ALEN]; const int g_report_lvl = #ifdef CONFIG_ESP_FTM_REPORT_SHOW_DIAG @@ -107,10 +107,10 @@ static void event_handler(void *arg, esp_event_base_t event_base, ESP_LOGI(TAG_STA, "Connected to %s (BSSID: "MACSTR", Channel: %d)", event->ssid, MAC2STR(event->bssid), event->channel); - memcpy(g_ap_bssid, event->bssid, ETH_ALEN); - g_ap_channel = event->channel; - xEventGroupClearBits(wifi_event_group, DISCONNECTED_BIT); - xEventGroupSetBits(wifi_event_group, CONNECTED_BIT); + memcpy(s_ap_bssid, event->bssid, ETH_ALEN); + s_ap_channel = event->channel; + xEventGroupClearBits(s_wifi_event_group, DISCONNECTED_BIT); + xEventGroupSetBits(s_wifi_event_group, CONNECTED_BIT); } else if (event_id == WIFI_EVENT_STA_DISCONNECTED) { if (s_reconnect && ++s_retry_num < MAX_CONNECT_RETRY_ATTEMPTS) { ESP_LOGI(TAG_STA, "sta disconnect, retry attempt %d...", s_retry_num); @@ -118,26 +118,26 @@ static void event_handler(void *arg, esp_event_base_t event_base, } else { ESP_LOGI(TAG_STA, "sta disconnected"); } - xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); - xEventGroupSetBits(wifi_event_group, DISCONNECTED_BIT); + xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT); + xEventGroupSetBits(s_wifi_event_group, DISCONNECTED_BIT); } else if (event_id == WIFI_EVENT_FTM_REPORT) { wifi_event_ftm_report_t *event = (wifi_event_ftm_report_t *) event_data; if (event->status == FTM_STATUS_SUCCESS) { - g_rtt_est = event->rtt_est; - g_dist_est = event->dist_est; - g_ftm_report = event->ftm_report_data; - g_ftm_report_num_entries = event->ftm_report_num_entries; - xEventGroupSetBits(ftm_event_group, FTM_REPORT_BIT); + s_rtt_est = event->rtt_est; + s_dist_est = event->dist_est; + s_ftm_report = event->ftm_report_data; + s_ftm_report_num_entries = event->ftm_report_num_entries; + xEventGroupSetBits(s_ftm_event_group, FTM_REPORT_BIT); } else { ESP_LOGI(TAG_STA, "FTM procedure with Peer("MACSTR") failed! (Status - %d)", MAC2STR(event->peer_mac), event->status); - xEventGroupSetBits(ftm_event_group, FTM_FAILURE_BIT); + xEventGroupSetBits(s_ftm_event_group, FTM_FAILURE_BIT); } } else if (event_id == WIFI_EVENT_AP_START) { - g_ap_started = true; + s_ap_started = true; } else if (event_id == WIFI_EVENT_AP_STOP) { - g_ap_started = false; + s_ap_started = false; } } @@ -160,22 +160,22 @@ static void ftm_process_report(void) g_report_lvl & BIT3 ? " RSSI |":""); ESP_LOGI(TAG_STA, "FTM Report:"); ESP_LOGI(TAG_STA, "|%s", log); - for (i = 0; i < g_ftm_report_num_entries; i++) { + for (i = 0; i < s_ftm_report_num_entries; i++) { char *log_ptr = log; bzero(log, 200); if (g_report_lvl & BIT0) { - log_ptr += sprintf(log_ptr, "%6d|", g_ftm_report[i].dlog_token); + log_ptr += sprintf(log_ptr, "%6d|", s_ftm_report[i].dlog_token); } if (g_report_lvl & BIT1) { - log_ptr += sprintf(log_ptr, "%7u |", g_ftm_report[i].rtt); + log_ptr += sprintf(log_ptr, "%7u |", s_ftm_report[i].rtt); } if (g_report_lvl & BIT2) { - log_ptr += sprintf(log_ptr, "%14llu |%14llu |%14llu |%14llu |", g_ftm_report[i].t1, - g_ftm_report[i].t2, g_ftm_report[i].t3, g_ftm_report[i].t4); + log_ptr += sprintf(log_ptr, "%14llu |%14llu |%14llu |%14llu |", s_ftm_report[i].t1, + s_ftm_report[i].t2, s_ftm_report[i].t3, s_ftm_report[i].t4); } if (g_report_lvl & BIT3) { - log_ptr += sprintf(log_ptr, "%6d |", g_ftm_report[i].rssi); + log_ptr += sprintf(log_ptr, "%6d |", s_ftm_report[i].rssi); } ESP_LOGI(TAG_STA, "|%s", log); } @@ -192,8 +192,8 @@ void initialise_wifi(void) } ESP_ERROR_CHECK(esp_netif_init()); - wifi_event_group = xEventGroupCreate(); - ftm_event_group = xEventGroupCreate(); + s_wifi_event_group = xEventGroupCreate(); + s_ftm_event_group = xEventGroupCreate(); ESP_ERROR_CHECK( esp_event_loop_create_default() ); wifi_init_config_t cfg = WIFI_INIT_CONFIG_DEFAULT(); ESP_ERROR_CHECK(esp_wifi_init(&cfg)); @@ -213,7 +213,7 @@ void initialise_wifi(void) static bool wifi_cmd_sta_join(const char *ssid, const char *pass) { - int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 0); + int bits = xEventGroupWaitBits(s_wifi_event_group, CONNECTED_BIT, 0, 1, 0); wifi_config_t wifi_config = { 0 }; @@ -224,9 +224,9 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass) if (bits & CONNECTED_BIT) { s_reconnect = false; - xEventGroupClearBits(wifi_event_group, CONNECTED_BIT); + xEventGroupClearBits(s_wifi_event_group, CONNECTED_BIT); ESP_ERROR_CHECK( esp_wifi_disconnect() ); - xEventGroupWaitBits(wifi_event_group, DISCONNECTED_BIT, 0, 1, portTICK_RATE_MS); + xEventGroupWaitBits(s_wifi_event_group, DISCONNECTED_BIT, 0, 1, portTICK_RATE_MS); } s_reconnect = true; @@ -235,7 +235,7 @@ static bool wifi_cmd_sta_join(const char *ssid, const char *pass) ESP_ERROR_CHECK( esp_wifi_set_config(ESP_IF_WIFI_STA, &wifi_config) ); ESP_ERROR_CHECK( esp_wifi_connect() ); - xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS); + xEventGroupWaitBits(s_wifi_event_group, CONNECTED_BIT, 0, 1, 5000 / portTICK_RATE_MS); return true; } @@ -362,7 +362,7 @@ static int wifi_cmd_query(int argc, char **argv) esp_wifi_get_config(WIFI_IF_AP, &cfg); ESP_LOGI(TAG_AP, "AP mode, %s %s", cfg.ap.ssid, cfg.ap.password); } else if (WIFI_MODE_STA == mode) { - int bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 0); + int bits = xEventGroupWaitBits(s_wifi_event_group, CONNECTED_BIT, 0, 1, 0); if (bits & CONNECTED_BIT) { esp_wifi_get_config(WIFI_IF_STA, &cfg); ESP_LOGI(TAG_STA, "sta mode, connected %s", cfg.ap.ssid); @@ -436,10 +436,10 @@ static int wifi_cmd_ftm(int argc, char **argv) if (ftm_args.responder->count != 0) goto ftm_responder; - bits = xEventGroupWaitBits(wifi_event_group, CONNECTED_BIT, 0, 1, 0); + bits = xEventGroupWaitBits(s_wifi_event_group, CONNECTED_BIT, 0, 1, 0); if (bits & CONNECTED_BIT && !ftm_args.ssid->count) { - memcpy(ftmi_cfg.resp_mac, g_ap_bssid, ETH_ALEN); - ftmi_cfg.channel = g_ap_channel; + memcpy(ftmi_cfg.resp_mac, s_ap_bssid, ETH_ALEN); + ftmi_cfg.channel = s_ap_channel; } else if (ftm_args.ssid->count == 1) { ap_record = find_ftm_responder_ap(ftm_args.ssid->sval[0]); if (ap_record) { @@ -481,16 +481,16 @@ static int wifi_cmd_ftm(int argc, char **argv) return 0; } - bits = xEventGroupWaitBits(ftm_event_group, FTM_REPORT_BIT | FTM_FAILURE_BIT, + bits = xEventGroupWaitBits(s_ftm_event_group, FTM_REPORT_BIT | FTM_FAILURE_BIT, pdTRUE, pdFALSE, portMAX_DELAY); /* Processing data from FTM session */ if (bits & FTM_REPORT_BIT) { ftm_process_report(); - free(g_ftm_report); - g_ftm_report = NULL; - g_ftm_report_num_entries = 0; + free(s_ftm_report); + s_ftm_report = NULL; + s_ftm_report_num_entries = 0; ESP_LOGI(TAG_STA, "Estimated RTT - %d nSec, Estimated Distance - %d.%02d meters", - g_rtt_est, g_dist_est / 100, g_dist_est % 100); + s_rtt_est, s_dist_est / 100, s_dist_est % 100); } else { /* Failure case */ } @@ -505,7 +505,7 @@ ftm_responder: } if (ftm_args.enable->count != 0) { - if (!g_ap_started) { + if (!s_ap_started) { ESP_LOGE(TAG_AP, "Start the SoftAP first with 'ap' command"); return 0; } @@ -517,7 +517,7 @@ ftm_responder: } if (ftm_args.disable->count != 0) { - if (!g_ap_started) { + if (!s_ap_started) { ESP_LOGE(TAG_AP, "Start the SoftAP first with 'ap' command"); return 0; } diff --git a/tools/ci/check_copyright_ignore.txt b/tools/ci/check_copyright_ignore.txt index 52fd47aa4a..d79d5228a4 100644 --- a/tools/ci/check_copyright_ignore.txt +++ b/tools/ci/check_copyright_ignore.txt @@ -859,7 +859,6 @@ components/fatfs/src/ffconf.h components/fatfs/src/ffsystem.c components/fatfs/src/ffunicode.c components/fatfs/test/test_fatfs_common.c -components/fatfs/test/test_fatfs_common.h components/fatfs/test/test_fatfs_rawflash.c components/fatfs/test/test_fatfs_spiflash.c components/fatfs/test_fatfs_host/main.cpp @@ -1509,7 +1508,6 @@ components/pthread/test/test_pthread.c components/pthread/test/test_pthread_cond_var.c components/pthread/test/test_pthread_cxx.cpp components/pthread/test/test_pthread_local_storage.c -components/riscv/include/esp_private/panic_reason.h components/riscv/include/riscv/csr.h components/riscv/include/riscv/encoding.h components/riscv/include/riscv/instruction_decode.h @@ -2111,7 +2109,6 @@ components/wifi_provisioning/src/wifi_provisioning_priv.h components/wifi_provisioning/src/wifi_scan.c components/wpa_supplicant/esp_supplicant/include/esp_dpp.h components/wpa_supplicant/esp_supplicant/include/esp_rrm.h -components/wpa_supplicant/esp_supplicant/include/esp_wpa.h components/wpa_supplicant/esp_supplicant/include/esp_wps.h components/wpa_supplicant/esp_supplicant/src/esp_dpp_i.h components/wpa_supplicant/esp_supplicant/src/esp_scan_i.h @@ -2789,11 +2786,7 @@ examples/system/light_sleep/main/light_sleep_example_main.c examples/system/ota/advanced_https_ota/example_test.py examples/system/ota/advanced_https_ota/main/advanced_https_ota_example.c examples/system/ota/advanced_https_ota/main/ble_helper/ble_api.c -examples/system/ota/advanced_https_ota/main/ble_helper/bluedroid_gatts.c examples/system/ota/advanced_https_ota/main/ble_helper/include/ble_api.h -examples/system/ota/advanced_https_ota/main/ble_helper/include/bluedroid_gatts.h -examples/system/ota/advanced_https_ota/main/ble_helper/include/nimble_gatts.h -examples/system/ota/advanced_https_ota/main/ble_helper/nimble_gatts.c examples/system/ota/native_ota_example/example_test.py examples/system/ota/native_ota_example/main/native_ota_example.c examples/system/ota/otatool/example_test.py