diff --git a/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp b/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp index 010291a775448fff7bfb36e80db16edc18501bf0..df8eef0640f41f933a90e416b0e99e2b5515d354 100644 --- a/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp +++ b/libraries/ESP32/examples/Camera/CameraWebServer/app_httpd.cpp @@ -20,7 +20,6 @@ #include "fb_gfx.h" #include "fd_forward.h" -#include "dl_lib.h" #include "fr_forward.h" #define ENROLL_CONFIRM_TIMES 5 diff --git a/platform.txt b/platform.txt index e3aa132f6bd976fc71acdf2290bfe1c66c58a418..9c18453da3480db110b0c3a9891a17682b9636fa 100644 --- a/platform.txt +++ b/platform.txt @@ -35,7 +35,7 @@ compiler.S.flags=-c -g3 -x assembler-with-cpp -MMD -mlongcalls compiler.c.elf.cmd=xtensa-esp32-elf-gcc compiler.c.elf.flags=-nostdlib "-L{compiler.sdk.path}/lib" "-L{compiler.sdk.path}/ld" -T esp32_out.ld -T esp32.common.ld -T esp32.rom.ld -T esp32.peripherals.ld -T esp32.rom.libgcc.ld -T esp32.rom.spiram_incompatible_fns.ld -u ld_include_panic_highint_hdl -u call_user_start_cpu0 -Wl,--gc-sections -Wl,-static -Wl,--undefined=uxTopUsedPriority -u __cxa_guard_dummy -u __cxx_fatal_exception -compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lfrmn -lapp_trace -lfr_coefficients -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lmdns -lvfs -lmtmn -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -lspiffs -lface_detection -lespnow -lnvs_flash -lesp_adc_cal -llog -ldl_lib -lsmartconfig_ack -lexpat -lfd_coefficients -lm -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lstdc++ +compiler.c.elf.libs=-lgcc -lopenssl -lbtdm_app -lfatfs -lwps -lcoexist -lwear_levelling -lesp_http_client -lprotobuf-c -lhal -lnewlib -ldriver -lbootloader_support -lpp -lfreemodbus -lmesh -lsmartconfig -ljsmn -lwpa -lethernet -lphy -lapp_trace -lconsole -lulp -lwpa_supplicant -lfreertos -lbt -lmicro-ecc -lesp32-camera -lcxx -lxtensa-debug-module -ltcp_transport -lmdns -lvfs -lesp_ringbuf -lsoc -lcore -lfb_gfx -lsdmmc -llibsodium -lcoap -ltcpip_adapter -lprotocomm -lesp_event -limage_util -lc_nano -lesp-tls -lasio -lrtc -lspi_flash -lwpa2 -lwifi_provisioning -lesp32 -lface_recognition -lapp_update -lnghttp -lspiffs -lface_detection -lespnow -lnvs_flash -lesp_adc_cal -llog -ldl_lib -lsmartconfig_ack -lexpat -lm -lfr -lmqtt -lc -lheap -lmbedtls -llwip -lnet80211 -lesp_http_server -lpthread -ljson -lesp_https_ota -lfd -lstdc++ compiler.as.cmd=xtensa-esp32-elf-as diff --git a/tools/platformio-build.py b/tools/platformio-build.py index 4791dc86dcef3899f3627672e420dedca16a6cdb..dd54d8feacf2b114730de76a6b2b931f0cc0d0a9 100644 --- a/tools/platformio-build.py +++ b/tools/platformio-build.py @@ -99,7 +99,7 @@ env.Append( ], CPPPATH=[ - join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"), + join(FRAMEWORK_DIR, "tools", "sdk", "include", "config"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_trace"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "app_update"), join(FRAMEWORK_DIR, "tools", "sdk", "include", "asio"), @@ -164,7 +164,7 @@ env.Append( ], LIBS=[ - "-lgcc", "-lopenssl", "-lbtdm_app", "-lfatfs", "-lwps", "-lcoexist", "-lwear_levelling", "-lesp_http_client", "-lprotobuf-c", "-lhal", "-lnewlib", "-ldriver", "-lbootloader_support", "-lpp", "-lfreemodbus", "-lmesh", "-lsmartconfig", "-ljsmn", "-lwpa", "-lethernet", "-lphy", "-lfrmn", "-lapp_trace", "-lfr_coefficients", "-lconsole", "-lulp", "-lwpa_supplicant", "-lfreertos", "-lbt", "-lmicro-ecc", "-lesp32-camera", "-lcxx", "-lxtensa-debug-module", "-ltcp_transport", "-lmdns", "-lvfs", "-lmtmn", "-lesp_ringbuf", "-lsoc", "-lcore", "-lfb_gfx", "-lsdmmc", "-llibsodium", "-lcoap", "-ltcpip_adapter", "-lprotocomm", "-lesp_event", "-limage_util", "-lc_nano", "-lesp-tls", "-lasio", "-lrtc", "-lspi_flash", "-lwpa2", "-lwifi_provisioning", "-lesp32", "-lface_recognition", "-lapp_update", "-lnghttp", "-lspiffs", "-lface_detection", "-lespnow", "-lnvs_flash", "-lesp_adc_cal", "-llog", "-ldl_lib", "-lsmartconfig_ack", "-lexpat", "-lfd_coefficients", "-lm", "-lmqtt", "-lc", "-lheap", "-lmbedtls", "-llwip", "-lnet80211", "-lesp_http_server", "-lpthread", "-ljson", "-lesp_https_ota", "-lstdc++" + "-lgcc", "-lopenssl", "-lbtdm_app", "-lfatfs", "-lwps", "-lcoexist", "-lwear_levelling", "-lesp_http_client", "-lprotobuf-c", "-lhal", "-lnewlib", "-ldriver", "-lbootloader_support", "-lpp", "-lfreemodbus", "-lmesh", "-lsmartconfig", "-ljsmn", "-lwpa", "-lethernet", "-lphy", "-lapp_trace", "-lconsole", "-lulp", "-lwpa_supplicant", "-lfreertos", "-lbt", "-lmicro-ecc", "-lesp32-camera", "-lcxx", "-lxtensa-debug-module", "-ltcp_transport", "-lmdns", "-lvfs", "-lesp_ringbuf", "-lsoc", "-lcore", "-lfb_gfx", "-lsdmmc", "-llibsodium", "-lcoap", "-ltcpip_adapter", "-lprotocomm", "-lesp_event", "-limage_util", "-lc_nano", "-lesp-tls", "-lasio", "-lrtc", "-lspi_flash", "-lwpa2", "-lwifi_provisioning", "-lesp32", "-lface_recognition", "-lapp_update", "-lnghttp", "-lspiffs", "-lface_detection", "-lespnow", "-lnvs_flash", "-lesp_adc_cal", "-llog", "-ldl_lib", "-lsmartconfig_ack", "-lexpat", "-lm", "-lfr", "-lmqtt", "-lc", "-lheap", "-lmbedtls", "-llwip", "-lnet80211", "-lesp_http_server", "-lpthread", "-ljson", "-lesp_https_ota", "-lfd", "-lstdc++" ], LIBSOURCE_DIRS=[ diff --git a/tools/sdk/bin/bootloader_dio_40m.bin b/tools/sdk/bin/bootloader_dio_40m.bin index 1397906afa30875d948ae4d732bd743bcb75b635..fbe601702784ce09fd1c28d280415569083daca8 100644 Binary files a/tools/sdk/bin/bootloader_dio_40m.bin and b/tools/sdk/bin/bootloader_dio_40m.bin differ diff --git a/tools/sdk/bin/bootloader_qout_40m.bin b/tools/sdk/bin/bootloader_qout_40m.bin index 1397906afa30875d948ae4d732bd743bcb75b635..26be118746f7b5b74863c93d8ac10f6cbeaef491 100644 Binary files a/tools/sdk/bin/bootloader_qout_40m.bin and b/tools/sdk/bin/bootloader_qout_40m.bin differ diff --git a/tools/sdk/include/bt/esp_gap_ble_api.h b/tools/sdk/include/bt/esp_gap_ble_api.h index a346f8e8eee0f730088f6e00165733478d00286f..ff30f5f354a0d76dfa80342c0baa63dbd981a091 100644 --- a/tools/sdk/include/bt/esp_gap_ble_api.h +++ b/tools/sdk/include/bt/esp_gap_ble_api.h @@ -584,12 +584,18 @@ typedef enum { typedef enum { ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_ADV_ADDR = 0, /*!< BLE advertising address , device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST */ ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_LINK_ID, /*!< BLE mesh link ID, it is for BLE mesh, device info will be added into ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_BEACON_TYPE, /*!< BLE mesh beacon AD type, the format is | Len | 0x2B | Beacon Type | Beacon Data | */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROV_SRV_ADV, /*!< BLE mesh provisioning service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1827 | .... |` */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_INFO_MESH_PROXY_SRV_ADV, /*!< BLE mesh adv with proxy service uuid, the format is | 0x02 | 0x01 | flags | 0x03 | 0x03 | 0x1828 | .... |` */ } esp_ble_duplicate_exceptional_info_type_t; typedef enum { - ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST = BLE_BIT(0), /*!< duplicate scan exceptional addr list */ - ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST = BLE_BIT(1), /*!< duplicate scan exceptional mesh link ID list */ - ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = (BLE_BIT(0) | BLE_BIT(1)), /*!< duplicate scan exceptional all list */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ADDR_LIST = BLE_BIT(0), /*!< duplicate scan exceptional addr list */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_LINK_ID_LIST = BLE_BIT(1), /*!< duplicate scan exceptional mesh link ID list */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_BEACON_TYPE_LIST = BLE_BIT(2), /*!< duplicate scan exceptional mesh beacon type list */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROV_SRV_ADV_LIST = BLE_BIT(3), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_MESH_PROXY_SRV_ADV_LIST = BLE_BIT(4), /*!< duplicate scan exceptional mesh adv with provisioning service uuid */ + ESP_BLE_DUPLICATE_SCAN_EXCEPTIONAL_ALL_LIST = 0xFFFF, /*!< duplicate scan exceptional all list */ } esp_duplicate_scan_exceptional_list_type_t; typedef uint8_t esp_duplicate_info_t[ESP_BD_ADDR_LEN]; @@ -1046,6 +1052,7 @@ esp_err_t esp_ble_gap_read_rssi(esp_bd_addr_t remote_addr); * * * @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t + * when type is MESH_BEACON_TYPE, MESH_PROV_SRV_ADV or MESH_PROXY_SRV_ADV , device_info is invalid. * @param[in] device_info: the device information. * @return * - ESP_OK : success @@ -1058,6 +1065,7 @@ esp_err_t esp_ble_gap_add_duplicate_scan_exceptional_device(esp_ble_duplicate_ex * * * @param[in] type: device info type, it is defined in esp_ble_duplicate_exceptional_info_type_t + * when type is MESH_BEACON_TYPE, MESH_PROV_SRV_ADV or MESH_PROXY_SRV_ADV , device_info is invalid. * @param[in] device_info: the device information. * @return * - ESP_OK : success diff --git a/tools/sdk/include/config/sdkconfig.h b/tools/sdk/include/config/sdkconfig.h index 218462bf63c54eb29bb23d5daec9a5c1e836a80f..238058bd2d59ba4f7d3390b89b41cb48d03e606e 100644 --- a/tools/sdk/include/config/sdkconfig.h +++ b/tools/sdk/include/config/sdkconfig.h @@ -190,8 +190,8 @@ #define CONFIG_MBEDTLS_SSL_PROTO_TLS1_1 1 #define CONFIG_LWIP_SO_REUSE_RXTOALL 1 #define CONFIG_MB_CONTROLLER_NOTIFY_TIMEOUT 20 +#define CONFIG_ESP32_WIFI_MGMT_SBUF_NUM 32 #define CONFIG_PARTITION_TABLE_SINGLE_APP 1 -#define CONFIG_XTENSA_IMPL 1 #define CONFIG_ESP32_WIFI_RX_BA_WIN 16 #define CONFIG_MBEDTLS_X509_CSR_PARSE_C 1 #define CONFIG_SPIFFS_USE_MTIME 1 @@ -278,6 +278,7 @@ #define CONFIG_MBEDTLS_ECP_DP_SECP256R1_ENABLED 1 #define CONFIG_MONITOR_BAUD 115200 #define CONFIG_ESP32_DEBUG_STUBS_ENABLE 1 +#define CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT 30 #define CONFIG_TCPIP_LWIP 1 #define CONFIG_WIFI_LWIP_ALLOCATION_FROM_SPIRAM_FIRST 1 #define CONFIG_REDUCE_PHY_TX_POWER 1 diff --git a/tools/sdk/include/esp-face/dl_lib.h b/tools/sdk/include/esp-face/dl_lib.h deleted file mode 100644 index c95fb1dce16406eca49d13a6c11489766c45360a..0000000000000000000000000000000000000000 --- a/tools/sdk/include/esp-face/dl_lib.h +++ /dev/null @@ -1,336 +0,0 @@ -#ifndef DL_LIB_H -#define DL_LIB_H -#ifdef __cplusplus -extern "C" { -#endif - -#include "dl_lib_matrix.h" -#include "dl_lib_matrixq.h" -#include "dl_lib_matrix3d.h" -#include "dl_lib_matrix3dq.h" - - typedef int padding_state; - /** - * @brief Does a fast version of the exp() operation on a floating point number. - * - * As described in https://codingforspeed.com/using-faster-exponential-approximation/ - * Should be good til an input of 5 or so with a steps factor of 8. - * - * @param in Floating point input - * @param steps Approximation steps. More is more precise. 8 or 10 should be good enough for most purposes. - * @return Exp()'ed output - */ - fptp_t fast_exp(double x, int steps); - - /** - * @brief Does a softmax operation on a matrix. - * - * @param in Input matrix - * @param out Output matrix. Can be the same as the input matrix; if so, - output results overwrite the input. - */ - void dl_softmax(const dl_matrix2d_t *in, - dl_matrix2d_t *out); - - /** - * @brief Does a softmax operation on a quantized matrix. - * - * @param in Input matrix - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_softmax_q(const dl_matrix2dq_t *in, dl_matrix2dq_t *out); - - /** - * @brief Does a sigmoid operation on a floating point number - * - * @param in Floating point input - * @return Sigmoid output - */ - fptp_t dl_sigmoid_op(fptp_t in); - - /** - * @brief Does a sigmoid operation on a matrix. - * - * @param in Input matrix - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_sigmoid(const dl_matrix2d_t *in, dl_matrix2d_t *out); - - /** - * @brief Does a tanh operation on a floating point number - * - * @param in Floating point input number - * @return Tanh value - */ - fptp_t dl_tanh_op(fptp_t v); - - /** - * @brief Does a tanh operation on a matrix. - * - * @param in Input matrix - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_tanh(const dl_matrix2d_t *in, dl_matrix2d_t *out); - - /** - * @brief Does a relu (Rectifier Linear Unit) operation on a floating point number - * - * @param in Floating point input - * @param clip If value is higher than this, it will be clipped to this value - * @return Relu output - */ - fptp_t dl_relu_op(fptp_t in, fptp_t clip); - - /** - * @brief Does a ReLu operation on a matrix. - * - * @param in Input matrix - * @param clip If values are higher than this, they will be clipped to this value - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_relu(const dl_matrix2d_t *in, fptp_t clip, dl_matrix2d_t *out); - - /** - * @brief Fully connected layer operation - * - * @param in Input vector - * @param weight Weights of the neurons - * @param bias Biases for the neurons. Can be NULL if a bias of 0 is required. - * @param out Output array. Outputs are placed here. Needs to be an initialized, weight->w by in->h in size, matrix. - */ - void dl_fully_connect_layer(const dl_matrix2d_t *in, - const dl_matrix2d_t *weight, - const dl_matrix2d_t *bias, - dl_matrix2d_t *out); - - /** - * @brief Pre-calculate the sqrtvari variable for the batch_normalize function. - * The sqrtvari matrix depends on the variance and epsilon values, which normally are constant. Hence, - * this matrix only needs to be calculated once. This function does that. - * - * @param - * @return - */ - void dl_batch_normalize_get_sqrtvar(const dl_matrix2d_t *variance, - fptp_t epsilon, - dl_matrix2d_t *out); - - /** - * @brief Batch-normalize a matrix - * - * @param m The matrix to normalize - * @param offset Offset matrix - * @param scale Scale matrix - * @param mean Mean matrix - * @param sqrtvari Matrix precalculated using dl_batch_normalize_get_sqrtvar - * @return - */ - void dl_batch_normalize(dl_matrix2d_t *m, - const dl_matrix2d_t *offset, - const dl_matrix2d_t *scale, - const dl_matrix2d_t *mean, - const dl_matrix2d_t *sqrtvari); - - /** - * @brief Do a basic LSTM layer pass. - * - * @warning Returns state_h pointer, so do not free result. - - * @param in Input vector - * @param state_c Internal state of the LSTM network - * @param state_h Internal state (previous output values) of the LSTM network - * @param weights Weights for the neurons - * @param bias Bias for the neurons. Can be NULL if no bias is required - * @return Output values of the neurons - */ - dl_matrix2d_t *dl_basic_lstm_layer(const dl_matrix2d_t *in, - dl_matrix2d_t *state_c, - dl_matrix2d_t *state_h, - const dl_matrix2d_t *weight, - const dl_matrix2d_t *bias); - - /** - * @brief Do a basic LSTM layer pass, partial quantized version. - * This LSTM function accepts 16-bit fixed-point weights and 32-bit float-point bias. - * - * @warning Returns state_h pointer, so do not free result. - - * @param in Input vector - * @param state_c Internal state of the LSTM network - * @param state_h Internal state (previous output values) of the LSTM network - * @param weights Weights for the neurons, need to be quantised - * @param bias Bias for the neurons. Can be NULL if no bias is required - * @return Output values of the neurons - */ - dl_matrix2d_t *dl_basic_lstm_layer_quantised_weights(const dl_matrix2d_t *in, - dl_matrix2d_t *state_c, - dl_matrix2d_t *state_h, - const dl_matrix2dq_t *weight, - const dl_matrix2d_t *bias); - - /** - * @brief Do a fully-connected layer pass, fully-quantized version. - * - * @param in Input vector - * @param weight Weights of the neurons - * @param bias Bias values of the neurons. Can be NULL if no bias is needed. - * @param shift Number of bits to shift the result back by. See dl_lib_matrixq.h for more info - * @return Output values of the neurons - */ - void dl_fully_connect_layer_q(const dl_matrix2dq_t *in, - const dl_matrix2dq_t *weight, - const dl_matrix2dq_t *bias, - dl_matrix2dq_t *out, - int shift); - - /** - * @brief Do a basic LSTM layer pass, fully-quantized version - * - * @warning Returns state_h pointer, so do not free result. - - * @param in Input vector - * @param state_c Internal state of the LSTM network - * @param state_h Internal state (previous output values) of the LSTM network - * @param weights Weights for the neurons - * @param bias Bias for the neurons. Can be NULL if no bias is required - * @param shift Number of bits to shift the result back by. See dl_lib_matrixq.h for more info - * @return Output values of the neurons - */ - dl_matrix2dq_t *dl_basic_lstm_layer_q(const dl_matrix2dq_t *in, - dl_matrix2dq_t *state_c, - dl_matrix2dq_t *state_h, - const dl_matrix2dq_t *weight, - const dl_matrix2dq_t *bias, - int shift); - - /** - * @brief Batch-normalize a matrix, fully-quantized version - * - * @param m The matrix to normalize - * @param offset Offset matrix - * @param scale Scale matrix - * @param mean Mean matrix - * @param sqrtvari Matrix precalculated using dl_batch_normalize_get_sqrtvar - * @param shift Number of bits to shift the result back by. See dl_lib_matrixq.h for more info - * @return - */ - void dl_batch_normalize_q(dl_matrix2dq_t *m, - const dl_matrix2dq_t *offset, - const dl_matrix2dq_t *scale, - const dl_matrix2dq_t *mean, - const dl_matrix2dq_t *sqrtvari, - int shift); - - /** - * @brief Does a relu (Rectifier Linear Unit) operation on a fixed-point number - * This accepts and returns fixed-point 32-bit number with the last 15 bits being the bits after the decimal - * point. (Equivalent to a mantissa in a quantized matrix with exponent -15.) - * - * @param in Fixed-point input - * @param clip If value is higher than this, it will be clipped to this value - * @return Relu output - */ - qtp_t dl_relu_q_op(qtp_t in, - qtp_t clip); - - /** - * @brief Does a ReLu operation on a matrix, quantized version - * - * @param in Input matrix - * @param clip If values are higher than this, they will be clipped to this value - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_relu_q(const dl_matrix2dq_t *in, - fptp_t clip, - dl_matrix2dq_t *out); - - /** - * @brief Does a sigmoid operation on a fixed-point number. - * This accepts and returns a fixed-point 32-bit number with the last 15 bits being the bits after the decimal - * point. (Equivalent to a mantissa in a quantized matrix with exponent -15.) - * - * @param in Fixed-point input - * @return Sigmoid output - */ - int dl_sigmoid_op_q(const int in); - - /** - * @brief Does a sigmoid operation on a matrix, quantized version - * - * @param in Input matrix - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_sigmoid_q(const dl_matrix2dq_t *in, - dl_matrix2dq_t *out); - - /** - * @brief Does a tanh operation on a matrix, quantized version - * - * @param in Input matrix - * @param out Output matrix. Can be the same as the input matrix; if so, output results overwrite the input. - */ - void dl_tanh_q(const dl_matrix2dq_t *in, - dl_matrix2dq_t *out); - - /** - * @brief Do a basic CNN layer pass. - * - * @Warning This just supports the single channel input image, and the output is single row matrix. - That is to say, the height of output is 1, and the weight of output is out_channels*out_image_width*out_image_height - * - * @param in Input single channel image - * @param weight Weights of the neurons, weight->w = out_channels, weight->h = filter_width*filter_height - * @param bias Bias for the CNN layer. - * @param filter_height The height of convolution kernel - * @param filter_width The width of convolution kernel - * @param out_channels The number of output channels of convolution kernel - * @param stride_x The step length of the convolution window in x(width) direction - * @param stride_y The step length of the convolution window in y(height) direction - * @param pad One of `"VALID"` or `"SAME"`, 0 is "VALID" and the other is "SAME" - * @param out The result of CNN layer, out->h=1. - * @return The result of CNN layer. - */ - dl_matrix2d_t *dl_basic_conv_layer(const dl_matrix2d_t *in, - const dl_matrix2d_t *weight, - const dl_matrix2d_t *bias, - int filter_width, - int filter_height, - const int out_channels, - const int stride_x, - const int stride_y, - padding_state pad, - const dl_matrix2d_t *out); - - /** - * @brief Do a basic CNN layer pass, quantised wersion. - * - * @Warning This just supports the single channel input image, and the output is single row matrix. - That is to say, the height of output is 1, and the weight of output is out_channels*out_image_width*out_image_height - * - * @param in Input single channel image - * @param weight Weights of the neurons, weight->w = out_channels, weight->h = filter_width*filter_height, - * @param bias Bias of the neurons. - * @param filter_height The height of convolution kernel - * @param filter_width The width of convolution kernel - * @param out_channels The number of output channels of convolution kernel - * @param stride_x The step length of the convolution window in x(width) direction - * @param stride_y The step length of the convolution window in y(height) direction - * @param pad One of `"VALID"` or `"SAME"`, 0 is "VALID" and the other is "SAME" - * @param out The result of CNN layer, out->h=1 - * @return The result of CNN layer - */ - dl_matrix2d_t *dl_basic_conv_layer_quantised_weight(const dl_matrix2d_t *in, - const dl_matrix2dq_t *weight, - const dl_matrix2d_t *bias, - int filter_width, - int filter_height, - const int out_channels, - const int stride_x, - const int stride_y, - padding_state pad, - const dl_matrix2d_t *out); - -#ifdef __cplusplus -} -#endif -#endif diff --git a/tools/sdk/include/esp-face/dl_lib_coefgetter_if.h b/tools/sdk/include/esp-face/dl_lib_coefgetter_if.h deleted file mode 100644 index 3fa532ce836c62bb4f458e5e43408566caa9f01a..0000000000000000000000000000000000000000 --- a/tools/sdk/include/esp-face/dl_lib_coefgetter_if.h +++ /dev/null @@ -1,47 +0,0 @@ -#ifndef DL_LIB_COEFGETTER_IF_H -#define DL_LIB_COEFGETTER_IF_H - -#include "dl_lib_matrix.h" -#include "dl_lib_matrixq.h" -#include "dl_lib_matrix3d.h" -#include "dl_lib_matrix3dq.h" - -//Set this if the coefficient requested is a batch-normalization popvar matrix which needs to be preprocessed by -//dl_batch_normalize_get_sqrtvar first. -#define COEF_GETTER_HINT_BNVAR (1<<0) - -/* -This struct describes the basic information of model data: -word_num: the number of wake words or speech commands -word_list: the name list of wake words or speech commands -thres_list: the threshold list of wake words or speech commands -info_str: the string used to reflect the version and information of model data - which consist of the architecture of network, the version of model data, wake words and their threshold -*/ -typedef struct { - int word_num; - char **word_list; - int *win_list; - float *thresh_list; - char *info_str; -} model_info_t; - -/* -This struct describes a generic coefficient getter: a way to get the constant coefficients needed for a neural network. -For the two getters, the name describes the name of the coefficient matrix, usually the same as the Numpy filename the -coefficient was originally stored in. The arg argument can be used to optionally pass an additional user-defined argument -to the getter (e.g. the directory to look for files in the case of the Numpy file loader getter). The hint argument -is a bitwise OR of the COEF_GETTER_HINT_* flags or 0 when none is needed. Use the free_f/free_q functions to release the -memory for the returned matrices, when applicable. -*/ -typedef struct { - const dl_matrix2d_t* (*getter_f)(const char *name, void *arg, int hint); - const dl_matrix2dq_t* (*getter_q)(const char *name, void *arg, int hint); - const dl_matrix3d_t* (*getter_3d)(const char *name, void *arg, int hint); - const dl_matrix3dq_t* (*getter_3dq)(const char *name, void *arg, int hint); - void (*free_f)(const dl_matrix2d_t *m); - void (*free_q)(const dl_matrix2dq_t *m); - const model_info_t* (*getter_info)(void *arg); -} model_coeff_getter_t; - -#endif diff --git a/tools/sdk/include/esp-face/dl_lib_matrix.h b/tools/sdk/include/esp-face/dl_lib_matrix.h deleted file mode 100644 index 41964a248e65562d5020d7c100609d7d36774ec2..0000000000000000000000000000000000000000 --- a/tools/sdk/include/esp-face/dl_lib_matrix.h +++ /dev/null @@ -1,216 +0,0 @@ -#ifndef DL_LIB_MATRIX_H -#define DL_LIB_MATRIX_H - -typedef float fptp_t; - - -//Flags for matrices -#define DL_MF_FOREIGNDATA (1<<0) /*< Matrix *item data actually points to another matrix and should not be freed */ - -//'Normal' float matrix -typedef struct { - int w; /*< Width */ - int h; /*< Height */ - int stride; /*< Row stride, essentially how many items to skip to get to the same position in the next row */ - int flags; /*< Flags. OR of DL_MF_* values */ - fptp_t *item; /*< Pointer to item array */ -} dl_matrix2d_t; - -//Macro to quickly access the raw items in a matrix -#define DL_ITM(m, x, y) m->item[(x)+(y)*m->stride] - - -//#define DL_ITM3D(m, n, x, y, z) (m)->item[(n) * (m)->stride * (m)->c + (z) * (m)->stride + (y) * (m)->w + (x)] - -/** - * @brief Allocate a matrix - * - * @param w Width of the matrix - * @param h Height of the matrix - * @return The matrix, or NULL if out of memory - */ -dl_matrix2d_t *dl_matrix_alloc(int w, int h); - - -/** - * @brief Free a matrix - * Frees the matrix structure and (if it doesn't have the DL_MF_FOREIGNDATA flag set) the m->items space as well. - * - * @param m Matrix to free - */ -void dl_matrix_free(dl_matrix2d_t *m); - -/** - * @brief Zero out the matrix - * Sets all entries in the matrix to 0. - * - * @param m Matrix to zero - */ -void dl_matrix_zero(dl_matrix2d_t *m); - -/** - * @brief Generate a new matrix using a range of items from an existing matrix. - * When using this, the data of the new matrix is not allocated/copied but it re-uses a pointer - * to the existing data. Changing the data in the resulting matrix, as a result, will also change - * the data in the existing matrix that has been sliced. - * - * @param x X-offset of the origin of the returned matrix within the sliced matrix - * @param y Y-offset of the origin of the returned matrix within the sliced matrix - * @param w Width of the resulting matrix - * @param h Height of the resulting matrix - * @param in Old matrix (with foreign data) to re-use. Passing NULL will allocate a new matrix. - * @return The resulting slice matrix, or NULL if out of memory - */ -dl_matrix2d_t *dl_matrix_slice(const dl_matrix2d_t *src, int x, int y, int w, int h, dl_matrix2d_t *in); - -/** - * @brief select a range of items from an existing matrix and flatten them into one dimension. - * - * @Warning The results are flattened in row-major order. - * - * @param x X-offset of the origin of the returned matrix within the sliced matrix - * @param y Y-offset of the origin of the returned matrix within the sliced matrix - * @param w Width of the resulting matrix - * @param h Height of the resulting matrix - * @param in Old matrix to re-use. Passing NULL will allocate a new matrix. - * @return The resulting flatten matrix, or NULL if out of memory - */ -dl_matrix2d_t *dl_matrix_flatten(const dl_matrix2d_t *src, int x, int y, int w, int h, dl_matrix2d_t *in); - -/** - * @brief Generate a matrix from existing floating-point data - * - * @param w Width of resulting matrix - * @param h Height of resulting matrix - * @param data Data to populate matrix with - * @return A newaly allocated matrix populated with the given input data, or NULL if out of memory. - */ -dl_matrix2d_t *dl_matrix_from_data(int w, int h, int stride, const void *data); - - -/** - * @brief Multiply a pair of matrices item-by-item: res=a*b - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Multiplicated data. Can be equal to a or b to overwrite that. - */ -void dl_matrix_mul(const dl_matrix2d_t *a, const dl_matrix2d_t *b, dl_matrix2d_t *res); - -/** - * @brief Do a dotproduct of two matrices : res=a.b - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Dotproduct data. *Must* be a *different* matrix from a or b! - */ -void dl_matrix_dot(const dl_matrix2d_t *a, const dl_matrix2d_t *b, dl_matrix2d_t *res); - -/** - * @brief Add a pair of matrices item-by-item: res=a-b - * - * @param a First matrix - * @param b Second matrix - * @param res Added data. Can be equal to a or b to overwrite that. - */ -void dl_matrix_add(const dl_matrix2d_t *a, const dl_matrix2d_t *b, dl_matrix2d_t *out); - - -/** - * @brief Divide a pair of matrices item-by-item: res=a/b - * - * @param a First matrix - * @param b Second matrix - * @param res Divided data. Can be equal to a or b to overwrite that. - */ -void dl_matrix_div(const dl_matrix2d_t *a, const dl_matrix2d_t *b, dl_matrix2d_t *out); - -/** - * @brief Subtract a matrix from another, item-by-item: res=a-b - * - * @param a First matrix - * @param b Second matrix - * @param res Subtracted data. Can be equal to a or b to overwrite that. - */ -void dl_matrix_sub(const dl_matrix2d_t *a, const dl_matrix2d_t *b, dl_matrix2d_t *out); - -/** - * @brief Add a constant to every item of the matrix - * - * @param subj Matrix to add the constant to - * @param add The constant - */ -void dl_matrix_add_const(dl_matrix2d_t *subj, const fptp_t add); - - -/** - * @brief Concatenate the rows of two matrices into a new matrix - * - * @param a First matrix - * @param b Second matrix - * @return A newly allocated array with as avlues a|b - */ -dl_matrix2d_t *dl_matrix_concat(const dl_matrix2d_t *a, const dl_matrix2d_t *b); - - -/** - * @brief Print the contents of a matrix to stdout. Used for debugging. - * - * @param a The matrix to print. - */ -void dl_printmatrix(const dl_matrix2d_t *a); - -/** - * @brief Return the average square error given a correct and a test matrix. - * - * ...Well, more or less. If anything, it gives an indication of the error between - * the two. Check the code for the exact implementation. - * - * @param a First of the two matrices to compare - * @param b Second of the two matrices to compare - * @return value indicating the relative difference between matrices - */ -float dl_matrix_get_avg_sq_err(const dl_matrix2d_t *a, const dl_matrix2d_t *b); - - - -/** - * @brief Check if two matrices have the same shape, that is, the same amount of rows and columns - * - * @param a First of the two matrices to compare - * @param b Second of the two matrices to compare - * @return true if the two matrices are shaped the same, false otherwise. - */ -int dl_matrix_same_shape(const dl_matrix2d_t *a, const dl_matrix2d_t *b); - - -/** - * @brief Get a specific item from the matrix - * - * Please use these for external matrix access instead of DL_ITM - * - * @param m Matrix to access - * @param x Column address - * @param y Row address - * @return Value in that position - */ -inline static fptp_t dl_matrix_get(const dl_matrix2d_t *m, const int x, const int y) { - return DL_ITM(m, x, y); -} - -/** - * @brief Set a specific item in the matrix to the given value - * - * Please use these for external matrix access instead of DL_ITM - * - * @param m Matrix to access - * @param x Column address - * @param y Row address - * @param val Value to write to that position - */ -inline static void dl_matrix_set(dl_matrix2d_t *m, const int x, const int y, fptp_t val) { - DL_ITM(m, x, y)=val; -} - -#endif - diff --git a/tools/sdk/include/esp-face/dl_lib_matrix3d.h b/tools/sdk/include/esp-face/dl_lib_matrix3d.h index fc304e251b4cb3be1c35d85f61df10eba5abfe36..d88c7bfc3440b3ed63be5cd6060d5cd69d576629 100644 --- a/tools/sdk/include/esp-face/dl_lib_matrix3d.h +++ b/tools/sdk/include/esp-face/dl_lib_matrix3d.h @@ -1,5 +1,6 @@ #pragma once +#include typedef float fptp_t; typedef uint8_t uc_t; @@ -92,6 +93,16 @@ void dl_matrix3d_free(dl_matrix3d_t *m); */ void dl_matrix3du_free(dl_matrix3du_t *m); + +/* + * @brief Dot product with a vector and matrix + * + * @param out Space to put the result + * @param in input vector + * @param f filter matrix + */ +void dl_matrix3d_dot_product(dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *f); + /** * @brief Do a relu (Rectifier Linear Unit) operation, update the input matrix3d * @@ -162,6 +173,9 @@ void dl_matrix3du_slice_copy(dl_matrix3du_t *dst, int w, int h); + +void dl_matrix3d_conv_1x1 (dl_matrix3d_t *out, dl_matrix3d_t *in, dl_matrix3d_t *f); + /** * @brief Do a general CNN layer pass, dimension is (number, width, height, channel) * @@ -183,6 +197,11 @@ dl_matrix3d_t *dl_matrix3d_conv(dl_matrix3d_t *in, int padding, int mode); +void dl_matrix3d_conv_3x3_normal (dl_matrix3d_t *out, + dl_matrix3d_t *in, + dl_matrix3d_t *f, + int step_x, + int step_y); /** * @brief Do a general CNN layer pass, dimension is (number, width, height, channel) * @@ -223,6 +242,11 @@ dl_matrix3d_t *dl_matrix3d_depthwise_conv(dl_matrix3d_t *in, int padding, int mode); +void dl_matrix3d_depthwise_conv_3x3_normal(dl_matrix3d_t *out, + dl_matrix3d_t *in, + dl_matrix3d_t *f, + int step_x, + int step_y); /** * @brief Do a mobilenet block forward, dimension is (number, width, height, channel) * @@ -418,3 +442,8 @@ void dl_matrix3d_print(dl_matrix3d_t *m, char *message); * @param message name of matrix */ void dl_matrix3du_print(dl_matrix3du_t *m, char *message); + + +void dl_matrix3d_init_bias (dl_matrix3d_t *out, dl_matrix3d_t *bias); + +void dl_matrix3d_multiply(dl_matrix3d_t *out, dl_matrix3d_t *in1, dl_matrix3d_t *in2); diff --git a/tools/sdk/include/esp-face/dl_lib_matrix3dq.h b/tools/sdk/include/esp-face/dl_lib_matrix3dq.h index 08bb8949aa20f032ce69f685c3546d93b704ebb1..1c84559db6aca958e21ae8fe5d228d7c5019ec2e 100644 --- a/tools/sdk/include/esp-face/dl_lib_matrix3dq.h +++ b/tools/sdk/include/esp-face/dl_lib_matrix3dq.h @@ -85,6 +85,22 @@ dl_matrix3dq_t *dl_matrix3dq_conv (dl_matrix3dq_t *in, dl_matrix3dq_t *filter, d dl_matrix3dq_t *dl_matrix3dq_conv_normal (dl_matrix3dq_t *in, dl_matrix3dq_t *filter, dl_matrix3dq_t *bias, int stride_x, int stride_y, int padding, int exponent, int mode); +void dl_matrix3dq_conv_1x1 (dl_matrix3dq_t *out, dl_matrix3dq_t *in, dl_matrix3dq_t *f, dl_conv_mode mode); + +void dl_matrix3dq_conv_3x3_normal (dl_matrix3dq_t *out, + dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + int step_x, + int step_y); +dl_matrix3dq_t *dl_matrix3dq_conv_3x3_with_bn (dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + dl_matrix3dq_t *scale, + dl_matrix3dq_t *offset, + int step_x, + int step_y, + int padding, + int exponent, + int relu); /** * @brief Print the matrix3d items * @@ -95,6 +111,15 @@ void dl_matrix3dq_print (dl_matrix3dq_t *m, char *message); dl_matrix3dq_t *dl_matrix3dq_depthwise_conv (dl_matrix3dq_t *in, dl_matrix3dq_t *filter, int stride_x, int stride_y, int padding, int exponent, int mode); +dl_matrix3dq_t *dl_matrix3dq_depthwise_conv_3x3_with_bn(dl_matrix3dq_t *in, + dl_matrix3dq_t *f, + dl_matrix3dq_t *scale, + dl_matrix3dq_t *offset, + int step_x, + int step_y, + int padding, + int exponent, + int relu); void dl_matrix3dq_relu (dl_matrix3dq_t *m, fptp_t clip); diff --git a/tools/sdk/include/esp-face/dl_lib_matrixq.h b/tools/sdk/include/esp-face/dl_lib_matrixq.h deleted file mode 100644 index a2ff3e38d568c03c467d4ef479fb1c3b919137f4..0000000000000000000000000000000000000000 --- a/tools/sdk/include/esp-face/dl_lib_matrixq.h +++ /dev/null @@ -1,359 +0,0 @@ -#ifndef DL_LIB_MATRIXQ_H -#define DL_LIB_MATRIXQ_H - -#include -#include "dl_lib_matrix.h" - -typedef int16_t qtp_t; - -//Quantized matrix. Uses fixed numbers and has the storage for the rows/columns inverted -//for easy use as a multiplicand without stressing out the flash cache too much. -typedef struct { - int w; - int h; - int stride; //Normally equals h, not w! - int flags; - int exponent; //The values in items should be multiplied by pow(2,exponent) to get the real values. - qtp_t *itemq; -} dl_matrix2dq_t; - -#define DL_QTP_SHIFT 15 -#define DL_QTP_RANGE ((1<itemq[(y)+(x)*m->stride] -#define DL_QTP_EXP_NA 255 //non-applicable exponent because matrix is null - -#define DL_SHIFT_AUTO 32 - -/** - * @info About quantized matrices and shift values - * - * Grab a coffee (or tea, or hot water) and sit down when you read this for the first - * time. Quantized matrices can speed up your operations, but come with some quirks, and - * it's good to understand how they work before using them. - * - * The data in the quantized matrix type is stored similarily to floating-point types: - * when storing a real value, the value is stored as a mantissa (base number) and an - * exponent. The 'real' value that can be re-derived from those two numbers is something - * similar to mantissa*2^exponent. Up to this point, there's not that much difference from - * the standard floating point implementations like e.g. IEEE-754. - * - * The difference with respect to quantized matrices is that for a quantized matrix, it is - * assumed all values stored have more-or-less the same order of magnitude. This allows the - * matrix to only store all the mantissas, while the exponents are shared; there is only one - * exponent for the entire matrix. This makes it quicker to handle matrix operations - the - * logic to fix the exponents only needs to happen once, while the rest can be done in simple - * integer arithmetic. It also nets us some memory savings - while normally a floating point - * number is 32-bit, storing only 16-bit mantissas as the matrix items almost halves the - * memory requirements. - * - * While most of the details of handling the intricacies of the quantized matrixes are done - * transparently by the code in dl_lib_matrixq.c, some implementation details leak out, - * specifically in places where addition/subtraction/division happens. - * - * The problem is that the routines do not know what the size of the resulting operation is. For - * instance, when adding two matrices of numbers, the resulting numbers *could* be large enough - * to overflow the mantissa of the result if the exponent is the same. However, if by default we - * assume the mantissas needs to be scaled back, we may lose precision. - * - * In order to counter this, all operations that have this issue have a ``shift`` argument. If - * the argument is zero, the routine will be conservative, that is, increase the exponent of - * the result to such an extent it's mathematically impossible a value in the result will exceed - * the maximum value that can be stored. However, when this argument is larger than zero, the - * algorithm will hold back on this scaling by the indicated amount of bits, preserving precision - * but increasing the chance of some of the calculated values not fitting in the mantissa anymore. - * If this happens, the value will be clipped to the largest (or, for negative values, smallest) - * value possible. (Neural networks usually are okay with this happening for a limited amount - * of matrix indices). - * - * For deciding on these shift values, it is recommended to start with a shift value of one, then - * use dl_matrixq_check_sanity on the result. If this indicates clipping, lower the shift value. - * If it indicates bits are under-used, increase it. Note that for adding and subtraction, only - * shift values of 0 or 1 make sense; these routines will error out if you try to do something - * else. - * - * For neural networks and other noise-tolerant applications, note that even when - * dl_matrixq_check_sanity does not indicate any problems, twiddling with the shift value may lead - * to slightly improved precision. Feel free to experiment. - **/ - - -/** - * @brief Allocate a matrix - * - * @param w Width of the matrix - * @param h Height of the matrix - * @return The matrix, or NULL if out of memory - */ -dl_matrix2dq_t *dl_matrixq_alloc(int w, int h); - -/** - * @brief Convert a floating-point matrix to a quantized matrix - * - * @param m Floating-point matrix to convert - * @param out Quantized matrix to re-use. If NULL, allocate a new one. - * @Return The quantized version of the floating-point matrix - */ -dl_matrix2dq_t *dl_matrixq_from_matrix2d(const dl_matrix2d_t *m, dl_matrix2dq_t *out); - - -/** - * TODO: DESCRIBE THIS FUNCTION - */ -dl_matrix2dq_t *dl_matrixq_from_matrix2d_by_qmf(const dl_matrix2d_t *m, dl_matrix2dq_t *out, int m_bit, int f_bit); - - -/** - * @brief Convert a quantized matrix to a floating-point one. - * - * @param m Floating-point matrix to convert - * @param out Quantized matrix to re-use. If NULL, allocate a new one. - * @Return The quantized version of the floating-point matrix - **/ -dl_matrix2d_t *dl_matrix2d_from_matrixq(const dl_matrix2dq_t *m, dl_matrix2d_t *out); - - -/** - * @brief Free a quantized matrix - * Frees the matrix structure and (if it doesn't have the DL_MF_FOREIGNDATA flag set) the m->items space as well. - * - * @param m Matrix to free - */ -void dl_matrixq_free(dl_matrix2dq_t *m); - -/** - * @brief Zero out the matrix - * Sets all entries in the matrix to 0. - * - * @param m Matrix to zero - */ -void dl_matrixq_zero(dl_matrix2dq_t *m); - - -/** - * @brief Do a dotproduct of two quantized matrices : res=a.b, Result is a fixed-point matrix. - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Dotproduct data. *Must* be a *different* matrix from a or b! - * @param shift Shift ratio - */ -void dl_matrixq_dot(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2dq_t *res, int shift); - -/** - * @brief Do a dotproduct of two quantized matrices: res=a.b, Result is a floating-point matrix. - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Dotproduct data. *Must* be a *different* matrix from a or b! - */ -void dl_matrixq_dot_matrix_out(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2d_t *res); - -/** - * @brief Do a dotproduct of two quantized matrices : res=a.b. This always uses the simple & stupid C algo for the dot product. - * - * Result is a fixed-point matrix. - * - * Use this only if you expect something is wrong with the accelerated routines that dl_matrixq_dot calls; this function can be - * much slower than dl_matrixq_dot . - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Dotproduct data. *Must* be a *different* matrix from a or b! - * @param shift Shift ratio - */ -void dl_matrixq_dot_c_impl(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2dq_t *res, int shift); - -/** - * @brief Do a dotproduct of two quantized matrices : res=a.b. This always uses the simple & stupid C algo for the dot product. - * - * Result is a floating-point matrix. - * - * Use this only if you expect something is wrong with the accelerated routines that dl_matrixq_dot_matrix_out calls; this function can be - * much slower than dl_matrixq_dot_matrix_out. - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Dotproduct data. *Must* be a *different* matrix from a or b! - */ -void dl_matrixq_dot_matrix_out_c_impl(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2d_t *res); - -/** - * @brief Do a dotproduct of a floating point and a quantized matrix. Result is a floating-point matrix. - * - * @param a First multiplicand; float matrix - * @param b Second multiplicand; quantized matrix - * @param res Dotproduct data; float matrix. *Must* be a *different* matrix from a or b! - */ -void dl_matrix_matrixq_dot(const dl_matrix2d_t *a, const dl_matrix2dq_t *b, dl_matrix2d_t *res); - - -/** - * @brief Print the contents of a quantized matrix to stdout. Used for debugging. - * - * @param a The matrix to print. - */ -void dl_printmatrixq(const dl_matrix2dq_t *a); - - -/** - * @brief Add a pair of quantizedmatrices item-by-item: res=a-b - * - * @param a First matrix - * @param b Second matrix - * @param res Added data. Can be equal to a or b to overwrite that. - * @param shift Shift value. Only 0 or 1 makes sense here. - */ -void dl_matrixq_add(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2dq_t *res, int shift); - -/** - * @brief Generate a new matrix using a range of items from an existing matrix. - * When using this, the data of the new matrix is not allocated/copied but it re-uses a pointer - * to the existing data. Changing the data in the resulting matrix, as a result, will also change - * the data in the existing matrix that has been sliced. - * - * @Warning In contrast to the floating point equivalent of this function, the fixed-point version - * of this has the issue that as soon as the output exponent of one of the slices changes, the data - * in the sliced matrix gets corrupted (because the exponent of that matrix is still the same.) If you - * use this function, either treat the slices as read-only, or assume the sliced matrix contains - * garbage after modifying the data in one of the slices. - * - * @param x X-offset of the origin of the returned matrix within the sliced matrix - * @param y Y-offset of the origin of the returned matrix within the sliced matrix - * @param w Width of the resulting matrix - * @param h Height of the resulting matrix - * @param in Old matrix (with foreign data) to re-use. Passing NULL will allocate a new matrix. - * @return The resulting slice matrix, or NULL if out of memory - */ -dl_matrix2dq_t *dl_matrixq_slice(const dl_matrix2dq_t *src, int x, int y, int w, int h, dl_matrix2dq_t *in); - -/** - * @brief select a range of items from an existing matrix and flatten them into one dimension. - * - * @Warning The results are flattened in row-major order. - * - * @param x X-offset of the origin of the returned matrix within the sliced matrix - * @param y Y-offset of the origin of the returned matrix within the sliced matrix - * @param w Width of the resulting matrix - * @param h Height of the resulting matrix - * @param in Old matrix to re-use. Passing NULL will allocate a new matrix. - * @return The resulting flatten matrix, or NULL if out of memory - */ -dl_matrix2dq_t *dl_matrixq_flatten(const dl_matrix2dq_t *src, int x, int y, int w, int h, dl_matrix2dq_t *in); - -/** - * @brief Subtract a quantized matrix from another, item-by-item: res=a-b - * - * @param a First matrix - * @param b Second matrix - * @param res Subtracted data. Can be equal to a or b to overwrite that. - * @param shift Shift value. Only 0 or 1 makes sense here. - */ -void dl_matrixq_sub(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2dq_t *res, int shift); - -/** - * @brief Multiply a pair of quantized matrices item-by-item: res=a*b - * - * @param a First multiplicand - * @param b Second multiplicand - * @param res Multiplicated data. Can be equal to a or b to overwrite that matrix. - */ -void dl_matrixq_mul(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2dq_t *res); - -/** - * @brief Divide a pair of quantized matrices item-by-item: res=a/b - * - * @param a First matrix - * @param b Second matrix - * @param res Divided data. Can be equal to a or b to overwrite that. - */ -void dl_matrixq_div(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b, dl_matrix2dq_t *out, int shift); - -/** - * @brief Check if two quantized matrices have the same shape, that is, the same amount of - * rows and columns - * - * @param a First of the two matrices to compare - * @param b Second of the two matrices to compare - * @return true if the two matrices are shaped the same, false otherwise. - */ -int dl_matrixq_same_shape(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b); - -/** - * @brief Concatenate the rows of two quantized matrices into a new matrix - * - * @param a First matrix - * @param b Second matrix - * @return A newly allocated quantized matrix with as values a|b - */ -dl_matrix2dq_t *dl_matrixq_concat(const dl_matrix2dq_t *a, const dl_matrix2dq_t *b); - -/** - * @brief Add a constant to every item of the quantized matrix - * - * @param subj Matrix to add the constant to - * @param add The constant - */ -void dl_matrixq_add_const(dl_matrix2dq_t *subj, const fptp_t add, int shift); - -/** - * @brief Check the sanity of a quantized matrix - * - * Due to the nature of quantized matrices, depending on the calculations a quantized - * matrix is the result of and the shift values chosen in those calculations, a quantized - * matrix may have an exponent and mantissas that lead to a loss of precision, either because - * most significant mantissa bits are unused, or because a fair amount of mantissas are - * clipped. This function checks if this is the case and will report a message to stdout - * if significant loss of precision is detected. - * - * @param m The quantized matrix to check - * @param name A string to be displayed in the message if the sanity check fails - * @return True if matrix is sane, false otherwise - **/ - -int dl_matrixq_check_sanity(dl_matrix2dq_t *m, const char *name); - -/** - * @brief re-adjust the exponent of the matrix to fit the mantissa better - * - * This function will shift up all the data in the mantissas so there are no - * most-significant bits that are unused in all mantissas. It will also adjust - * the exponent to keep the actua values in the matrix the same. - * - * Some operations done on a matrix, especially operations that re-use the - * result of earlier operations done in the same way, can lead to the loss of - * data because the exponent of the quantized matrix is never re-adjusted. You - * can do that implicitely by calling this function. - * - * @param m The matrix to re-adjust -**/ -void dl_matrixq_readjust_exp(dl_matrix2dq_t *m); - - - -/** - * @brief Get the floating-point value of a specific item from the quantized matrix - * - * @param m Matrix to access - * @param x Column address - * @param y Row address - * @return Value in that position - */ -fptp_t dl_matrixq_get(const dl_matrix2dq_t *m, const int x, const int y); - -/** - * @brief Set a specific item in the quantized matrix to the given - * floating-point value - * - * @warning If the given value is more than the exponent in the quantized matrix - * allows for, all mantissas in the matrix will be shifted down to make the value - * 'fit'. If, however, the exponent is such that the value would result in a - * quantized mantissa of 0, nothing is done. - * - * @param m Matrix to access - * @param x Column address - * @param y Row address - * @param val Value to write to that position - */ -void dl_matrixq_set(dl_matrix2dq_t *m, const int x, const int y, fptp_t val); - -#endif diff --git a/tools/sdk/include/esp-face/fd_forward.h b/tools/sdk/include/esp-face/fd_forward.h index 81c6d9b5c15b491d1a6d59465963a3be98c57783..dc719e9e8c90c0d78bcc2303e2f94ec23cbb805c 100644 --- a/tools/sdk/include/esp-face/fd_forward.h +++ b/tools/sdk/include/esp-face/fd_forward.h @@ -29,22 +29,41 @@ extern "C" #endif #include "image_util.h" -#include "dl_lib.h" +#include "dl_lib_matrix3d.h" #include "mtmn.h" + typedef enum + { + FAST = 0, + NORMAL = 1, + } mtmn_resize_type; + + typedef struct + { + float min_face; /// the minimum size of face can be detected + float pyramid; /// the pyramid scale + int pyramid_times; /// the pyramid resizing times + threshold_config_t p_threshold; /// score, nms and candidate threshold of pnet + threshold_config_t r_threshold; /// score, nms and candidate threshold of rnet + threshold_config_t o_threshold; /// score, nms and candidate threshold of onet + mtmn_resize_type type; /// image resize type. 'pyramid' will lose efficacy, when 'type'==FAST. + } mtmn_config_t; + static inline mtmn_config_t mtmn_init_config() { mtmn_config_t mtmn_config; + mtmn_config.type = FAST; mtmn_config.min_face = 80; - mtmn_config.pyramid = 0.7; + mtmn_config.pyramid = 0.707; + mtmn_config.pyramid_times = 4; mtmn_config.p_threshold.score = 0.6; mtmn_config.p_threshold.nms = 0.7; - mtmn_config.p_threshold.candidate_number = 100; - mtmn_config.r_threshold.score = 0.6; + mtmn_config.p_threshold.candidate_number = 20; + mtmn_config.r_threshold.score = 0.7; mtmn_config.r_threshold.nms = 0.7; - mtmn_config.r_threshold.candidate_number = 4; - mtmn_config.o_threshold.score = 0.6; - mtmn_config.o_threshold.nms = 0.4; + mtmn_config.r_threshold.candidate_number = 10; + mtmn_config.o_threshold.score = 0.7; + mtmn_config.o_threshold.nms = 0.7; mtmn_config.o_threshold.candidate_number = 1; return mtmn_config; diff --git a/tools/sdk/include/esp-face/fr_forward.h b/tools/sdk/include/esp-face/fr_forward.h index 8bd824579c09be6c7ddc4e1d9f38a3ac3856d2c6..2551d1e91bfd962852aa27d20b06ce68d63c3d2d 100644 --- a/tools/sdk/include/esp-face/fr_forward.h +++ b/tools/sdk/include/esp-face/fr_forward.h @@ -6,7 +6,7 @@ extern "C" #endif #include "image_util.h" -#include "dl_lib.h" +#include "dl_lib_matrix3d.h" #include "frmn.h" #define FACE_WIDTH 56 @@ -38,23 +38,22 @@ extern "C" typedef struct { - face_id_node *head; /*!< head pointer of the id list */ - face_id_node *tail; /*!< tail pointer of the id list */ - uint8_t count; /*!< number of enrolled ids */ - uint8_t confirm_times; /*!< images needed for one enrolling */ + face_id_node *head; /*!< head pointer of the id list */ + face_id_node *tail; /*!< tail pointer of the id list */ + uint8_t count; /*!< number of enrolled ids */ + uint8_t confirm_times; /*!< images needed for one enrolling */ } face_id_name_list; - + typedef struct { - uint8_t head; /*!< head index of the id list */ - uint8_t tail; /*!< tail index of the id list */ - uint8_t count; /*!< number of enrolled ids */ - uint8_t size; /*!< max len of id list */ - uint8_t confirm_times; /*!< images needed for one enrolling */ - dl_matrix3d_t **id_list; /*!< stores face id vectors */ + uint8_t head; /*!< head index of the id list */ + uint8_t tail; /*!< tail index of the id list */ + uint8_t count; /*!< number of enrolled ids */ + uint8_t size; /*!< max len of id list */ + uint8_t confirm_times; /*!< images needed for one enrolling */ + dl_matrix3d_t **id_list; /*!< stores face id vectors */ } face_id_list; - /** * @brief Initialize face id list * @@ -86,6 +85,10 @@ extern "C" dl_matrix3du_t *src, dl_matrix3du_t *dest); + int8_t align_face2(fptp_t *landmark, + dl_matrix3du_t *src, + dl_matrix3du_t *dest); + dl_matrix3d_t *get_face_id(dl_matrix3du_t *aligned_face); /** @@ -104,11 +107,9 @@ extern "C" * @param id_list An ID list * @return int8_t Matched face id */ - int8_t recognize_face(face_id_list *l, - dl_matrix3du_t *algined_face); - - face_id_node *recognize_face_with_name(face_id_name_list *l, - dl_matrix3d_t *face_id); + int8_t recognize_face(face_id_list *l, dl_matrix3du_t *algined_face); + + face_id_node *recognize_face_with_name(face_id_name_list *l, dl_matrix3d_t *face_id); /** * @brief Produce face id according to the input aligned face, and save it to dest_id. * @@ -119,12 +120,11 @@ extern "C" * @return 0 Enrollment finish * @return >=1 The left piece of aligned faces should be input */ - int8_t enroll_face(face_id_list *l, - dl_matrix3du_t *aligned_face); - - int8_t enroll_face_with_name(face_id_name_list *l, - dl_matrix3d_t *new_id, - char *name); + int8_t enroll_face(face_id_list *l, dl_matrix3du_t *aligned_face); + + int8_t enroll_face_with_name(face_id_name_list *l, + dl_matrix3d_t *new_id, + char *name); /** * @brief Alloc memory for aligned face. @@ -133,7 +133,7 @@ extern "C" * @return uint8_t left count */ uint8_t delete_face(face_id_list *l); - int8_t delete_face_with_name(face_id_name_list *l, char *name); + int8_t delete_face_with_name(face_id_name_list *l, char *name); void delete_face_all_with_name(face_id_name_list *l); #if __cplusplus } diff --git a/tools/sdk/include/esp-face/frmn.h b/tools/sdk/include/esp-face/frmn.h index b96b30700729e548b8b23df69e59707d6ea58c88..9c55410a53684a6f78e3f01594dd8ec9801eb76a 100644 --- a/tools/sdk/include/esp-face/frmn.h +++ b/tools/sdk/include/esp-face/frmn.h @@ -5,7 +5,8 @@ extern "C" { #endif -#include "dl_lib.h" +#include "dl_lib_matrix3d.h" +#include "dl_lib_matrix3dq.h" /** * @brief diff --git a/tools/sdk/include/esp-face/image_util.h b/tools/sdk/include/esp-face/image_util.h index 278ebaa2c3c0ba9af450ead0693e09e82de36b39..961a12299d13f2a41c6a56151096e795e6f17086 100644 --- a/tools/sdk/include/esp-face/image_util.h +++ b/tools/sdk/include/esp-face/image_util.h @@ -27,6 +27,7 @@ extern "C" { #endif #include +#include #include "mtmn.h" #define MAX_VALID_COUNT_PER_IMAGE (30) @@ -57,6 +58,7 @@ extern "C" typedef struct tag_box_list { + fptp_t *score; box_t *box; landmark_t *landmark; int len; @@ -142,12 +144,19 @@ extern "C" for (int i = 0; i < boxes->len; i++) { box_t *box = &(boxes->box[i]); - float w, h; - image_get_width_and_height(box, &w, &h); - float l = DL_IMAGE_MAX(w, h); - box->box_p[0] = DL_IMAGE_MAX(0, box->box_p[0] + 0.5 * (w - l)); - box->box_p[1] = DL_IMAGE_MAX(0, box->box_p[1] + 0.5 * (h - l)); + int x1 = round(box->box_p[0]); + int y1 = round(box->box_p[1]); + int x2 = round(box->box_p[2]); + int y2 = round(box->box_p[3]); + + int w = x2 - x1 + 1; + int h = y2 - y1 + 1; + int l = DL_IMAGE_MAX(w, h); + + box->box_p[0] = round(DL_IMAGE_MAX(0, x1) + 0.5 * (w - l)); + box->box_p[1] = round(DL_IMAGE_MAX(0, y1) + 0.5 * (h - l)); + box->box_p[2] = box->box_p[0] + l - 1; if (box->box_p[2] > width) { @@ -215,6 +224,25 @@ extern "C" */ void image_nms_process(image_list_t *image_list, fptp_t nms_threshold, int same_area); + /** + * @brief + * + * @param dimage + * @param dw + * @param dh + * @param dc + * @param simage + * @param sw + * @param sc + */ + void image_zoom_in_twice(uint8_t *dimage, + int dw, + int dh, + int dc, + uint8_t *simage, + int sw, + int sc); + /** * @brief * diff --git a/tools/sdk/include/esp-face/mtmn.h b/tools/sdk/include/esp-face/mtmn.h index 4b031c9f3004cb560fe2a72fe020086bf8a8bb52..4f4906b7902bf1413799a74a9481682b73ecc315 100644 --- a/tools/sdk/include/esp-face/mtmn.h +++ b/tools/sdk/include/esp-face/mtmn.h @@ -27,14 +27,7 @@ extern "C" { #endif -#include "dl_lib.h" - - typedef enum - { - PNET = 0, /// P-Net - RNET = 1, /// R-Net - ONET = 2, /// O-Net - } net_type_en; +#include "dl_lib_matrix3d.h" typedef struct { @@ -45,22 +38,11 @@ extern "C" typedef struct { - net_type_en net_type; /// net type - char *file_name; /// net name int w; /// net width int h; /// net height threshold_config_t threshold; /// threshold of net } net_config_t; - typedef struct - { - float min_face; /// the minimum size of face can be detected - float pyramid; /// the pyramid scale - threshold_config_t p_threshold; /// score, nms and candidate threshold of pnet - threshold_config_t r_threshold; /// score, nms and candidate threshold of rnet - threshold_config_t o_threshold; /// score, nms and candidate threshold of onet - } mtmn_config_t; - typedef struct { dl_matrix3d_t *category; diff --git a/tools/sdk/include/esp32/esp_coexist_adapter.h b/tools/sdk/include/esp32/esp_coexist_adapter.h new file mode 100644 index 0000000000000000000000000000000000000000..f2a38c31e63104527dd2a6e8d08a33e106b4dbef --- /dev/null +++ b/tools/sdk/include/esp32/esp_coexist_adapter.h @@ -0,0 +1,59 @@ +// 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. + +#ifndef __ESP_COEXIST_ADAPTER_H__ +#define __ESP_COEXIST_ADAPTER_H__ + +#include + +#ifdef __cplusplus +extern "C" { +#endif + +#define COEX_ADAPTER_VERSION 0x00000001 +#define COEX_ADAPTER_MAGIC 0xDEADBEAF + +#define COEX_ADAPTER_FUNCS_TIME_BLOCKING 0xffffffff + +typedef struct { + int32_t _version; + void *(* _spin_lock_create)(void); + void (* _spin_lock_delete)(void *lock); + uint32_t (*_int_disable)(void *mux); + void (*_int_enable)(void *mux, uint32_t tmp); + void (*_task_yield_from_isr)(void); + void *(*_semphr_create)(uint32_t max, uint32_t init); + void (*_semphr_delete)(void *semphr); + int32_t (*_semphr_take_from_isr)(void *semphr, void *hptw); + int32_t (*_semphr_give_from_isr)(void *semphr, void *hptw); + int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick); + int32_t (*_semphr_give)(void *semphr); + int32_t (* _is_in_isr)(void); + void * (* _malloc_internal)(size_t size); + void (* _free)(void *p); + void (* _timer_disarm)(void *timer); + void (* _timer_done)(void *ptimer); + void (* _timer_setfn)(void *ptimer, void *pfunction, void *parg); + void (* _timer_arm_us)(void *ptimer, uint32_t us, bool repeat); + int64_t (* _esp_timer_get_time)(void); + int32_t _magic; +} coex_adapter_funcs_t; + +extern coex_adapter_funcs_t g_coex_adapter_funcs; + +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_COEXIST_ADAPTER_H__ */ diff --git a/tools/sdk/include/esp32/esp_coexist_internal.h b/tools/sdk/include/esp32/esp_coexist_internal.h new file mode 100644 index 0000000000000000000000000000000000000000..1d94d6db79606d63d1db4a9a3fbc195c92ef3039 --- /dev/null +++ b/tools/sdk/include/esp32/esp_coexist_internal.h @@ -0,0 +1,163 @@ +// Copyright 2018-2018 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. + +#ifndef __ESP_COEXIST_INTERNAL_H__ +#define __ESP_COEXIST_INTERNAL_H__ + +#include +#include "esp_coexist_adapter.h" + +#ifdef __cplusplus +extern "C" { +#endif + +typedef enum { + COEX_PREFER_WIFI = 0, + COEX_PREFER_BT, + COEX_PREFER_BALANCE, + COEX_PREFER_NUM, +} coex_prefer_t; + +typedef void (* coex_func_cb_t)(uint32_t event, int sched_cnt); + +/** + * @brief Init software coexist + * extern function for internal use. + * + * @return Init ok or failed. + */ +esp_err_t coex_init(void); + +/** + * @brief De-init software coexist + * extern function for internal use. + */ +void coex_deinit(void); + +/** + * @brief Pause software coexist + * extern function for internal use. + */ +void coex_pause(void); + +/** + * @brief Resume software coexist + * extern function for internal use. + */ +void coex_resume(void); + +/** + * @brief Get software coexist version string + * extern function for internal use. + * @return : version string + */ +const char *coex_version_get(void); + +/** + * @brief Coexist performance preference set from libbt.a + * extern function for internal use. + * + * @param prefer : the prefer enumeration value + * @return : ESP_OK - success, other - failed + */ +esp_err_t coex_preference_set(coex_prefer_t prefer); + +/** + * @brief Get software coexist status. + * @return : software coexist status + */ +uint32_t coex_status_get(void); + +/** + * @brief WiFi requests coexistence. + * + * @param event : WiFi event + * @param latency : WiFi will request coexistence after latency + * @param duration : duration for WiFi to request coexistence + * @return : 0 - success, other - failed + */ +int coex_wifi_request(uint32_t event, uint32_t latency, uint32_t duration); + +/** + * @brief WiFi release coexistence. + * + * @param event : WiFi event + * @return : 0 - success, other - failed + */ +int coex_wifi_release(uint32_t event); + +/** + * @brief Blue tooth requests coexistence. + * + * @param event : blue tooth event + * @param latency : blue tooth will request coexistence after latency + * @param duration : duration for blue tooth to request coexistence + * @return : 0 - success, other - failed + */ +int coex_bt_request(uint32_t event, uint32_t latency, uint32_t duration); + +/** + * @brief Blue tooth release coexistence. + * + * @param event : blue tooth event + * @return : 0 - success, other - failed + */ +int coex_bt_release(uint32_t event); + +/** + * @brief Register callback function for blue tooth. + * + * @param cb : callback function + * @return : 0 - success, other - failed + */ +int coex_register_bt_cb(coex_func_cb_t cb); + +/** + * @brief Lock before reset base band. + * + * @return : lock value + */ +uint32_t coex_bb_reset_lock(void); + +/** + * @brief Unlock after reset base band. + * + * @param restore : lock value + */ +void coex_bb_reset_unlock(uint32_t restore); + +/** + * @brief Register coexistence adapter functions. + * + * @param funcs : coexistence adapter functions + * @return : ESP_OK - success, other - failed + */ +esp_err_t esp_coex_adapter_register(coex_adapter_funcs_t *funcs); + +/** + * @brief Check the MD5 values of the coexistence adapter header files in IDF and WiFi library + * + * @attention 1. It is used for internal CI version check + * + * @return + * - ESP_OK : succeed + * - ESP_WIFI_INVALID_ARG : MD5 check fail + */ +esp_err_t esp_coex_adapter_funcs_md5_check(const char *md5); + +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_COEXIST_INTERNAL_H__ */ diff --git a/tools/sdk/include/esp32/esp_wifi.h b/tools/sdk/include/esp32/esp_wifi.h index c9899fa7cb0fa53ff5fcef558509a47548f61c69..e67f4606bd55867687fb5b07a37321204ca0c46c 100644 --- a/tools/sdk/include/esp32/esp_wifi.h +++ b/tools/sdk/include/esp32/esp_wifi.h @@ -110,6 +110,7 @@ typedef struct { int rx_ba_win; /**< WiFi Block Ack RX window size */ int wifi_task_core_id; /**< WiFi Task Core ID */ int beacon_max_len; /**< WiFi softAP maximum length of the beacon */ + int mgmt_sbuf_num; /**< WiFi management short buffer number, the minimum value is 6, the maximum value is 32 */ int magic; /**< WiFi init magic number, it should be the last field */ } wifi_init_config_t; @@ -183,6 +184,12 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; #define WIFI_SOFTAP_BEACON_MAX_LEN 752 #endif +#ifdef CONFIG_ESP32_WIFI_MGMT_SBUF_NUM +#define WIFI_MGMT_SBUF_NUM CONFIG_ESP32_WIFI_MGMT_SBUF_NUM +#else +#define WIFI_MGMT_SBUF_NUM 32 +#endif + #define WIFI_INIT_CONFIG_DEFAULT() { \ .event_handler = &esp_event_send, \ .osi_funcs = &g_wifi_osi_funcs, \ @@ -201,6 +208,7 @@ extern const wpa_crypto_funcs_t g_wifi_default_wpa_crypto_funcs; .rx_ba_win = WIFI_DEFAULT_RX_BA_WIN,\ .wifi_task_core_id = WIFI_TASK_CORE_ID,\ .beacon_max_len = WIFI_SOFTAP_BEACON_MAX_LEN, \ + .mgmt_sbuf_num = WIFI_MGMT_SBUF_NUM, \ .magic = WIFI_INIT_CONFIG_MAGIC\ }; @@ -1094,6 +1102,19 @@ esp_err_t esp_wifi_set_ant(const wifi_ant_config_t *config); */ esp_err_t esp_wifi_get_ant(wifi_ant_config_t *config); +/** + * @brief A general API to set/get WiFi internal configuration, it's for debug only + * + * @param cmd : ioctl command type + * @param cfg : configuration for the command + * + * @return + * - ESP_OK: succeed + * - others: failed + */ +esp_err_t esp_wifi_internal_ioctl(int cmd, wifi_ioctl_config_t *cfg); + + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp32/esp_wifi_internal.h b/tools/sdk/include/esp32/esp_wifi_internal.h index acb78eaae358e78e8316697079956db18d70b8c6..252f5a27c3308ce18edc5da2523c8ceef5a78aae 100644 --- a/tools/sdk/include/esp32/esp_wifi_internal.h +++ b/tools/sdk/include/esp32/esp_wifi_internal.h @@ -215,6 +215,15 @@ void *wifi_realloc( void *ptr, size_t size ); */ void *wifi_calloc( size_t n, size_t size ); +/** + * @brief Update WiFi MAC time + * + * @param uint32_t time_delta : time duration since the WiFi/BT common clock is disabled + * + * @return Always returns ESP_OK + */ +typedef esp_err_t (* wifi_mac_time_update_cb_t)( uint32_t time_delta ); + /** * @brief Update WiFi MAC time * diff --git a/tools/sdk/include/esp32/esp_wifi_os_adapter.h b/tools/sdk/include/esp32/esp_wifi_os_adapter.h index 1dd522c49c0b1a8bf32608871121a877d177759b..752ccf990d77c3612d4916cf996f5671db08909d 100644 --- a/tools/sdk/include/esp32/esp_wifi_os_adapter.h +++ b/tools/sdk/include/esp32/esp_wifi_os_adapter.h @@ -21,7 +21,7 @@ extern "C" { #endif -#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000001 +#define ESP_WIFI_OS_ADAPTER_VERSION 0x00000002 #define ESP_WIFI_OS_ADAPTER_MAGIC 0xDEADBEAF #define OSI_FUNCS_TIME_BLOCKING 0xffffffff @@ -39,12 +39,9 @@ typedef struct { void (* _spin_lock_delete)(void *lock); uint32_t (*_wifi_int_disable)(void *wifi_int_mux); void (*_wifi_int_restore)(void *wifi_int_mux, uint32_t tmp); - void (*_task_yield)(void); void (*_task_yield_from_isr)(void); void *(*_semphr_create)(uint32_t max, uint32_t init); void (*_semphr_delete)(void *semphr); - int32_t (*_semphr_take_from_isr)(void *semphr, void *hptw); - int32_t (*_semphr_give_from_isr)(void *semphr, void *hptw); int32_t (*_semphr_take)(void *semphr, uint32_t block_time_tick); int32_t (*_semphr_give)(void *semphr); void *(*_mutex_create)(void); @@ -59,7 +56,6 @@ typedef struct { int32_t (* _queue_send_to_back)(void *queue, void *item, uint32_t block_time_tick); int32_t (* _queue_send_to_front)(void *queue, void *item, uint32_t block_time_tick); int32_t (* _queue_recv)(void *queue, void *item, uint32_t block_time_tick); - int32_t (* _queue_recv_from_isr)(void *queue, void * const item, int32_t * const hptw); uint32_t (* _queue_msg_waiting)(void *queue); void *(* _event_group_create)(void); void (* _event_group_delete)(void *event); @@ -73,19 +69,15 @@ typedef struct { int32_t (* _task_ms_to_tick)(uint32_t ms); void *(* _task_get_current_task)(void); int32_t (* _task_get_max_priority)(void); - int32_t (* _is_in_isr)(void); void *(* _malloc)(uint32_t size); void (* _free)(void *p); uint32_t (* _get_free_heap_size)(void); uint32_t (* _rand)(void); void (* _dport_access_stall_other_cpu_start_wrap)(void); void (* _dport_access_stall_other_cpu_end_wrap)(void); - int32_t (* _phy_rf_init)(const void * init_data, uint32_t mode, void * calibration_data, uint32_t module); int32_t (* _phy_rf_deinit)(uint32_t module); void (* _phy_load_cal_and_init)(uint32_t module); int32_t (* _read_mac)(uint8_t* mac, uint32_t type); - void (* _timer_init)(void); - void (* _timer_deinit)(void); void (* _timer_arm)(void *timer, uint32_t tmout, bool repeat); void (* _timer_disarm)(void *timer); void (* _timer_done)(void *ptimer); @@ -127,6 +119,9 @@ typedef struct { int32_t (* _modem_sleep_deregister)(uint32_t module); void (* _sc_ack_send)(void *param); void (* _sc_ack_send_stop)(void); + uint32_t (* _coex_status_get)(void); + int32_t (* _coex_wifi_request)(uint32_t event, uint32_t latency, uint32_t duration); + int32_t (* _coex_wifi_release)(uint32_t event); int32_t _magic; } wifi_osi_funcs_t; diff --git a/tools/sdk/include/esp32/esp_wifi_types.h b/tools/sdk/include/esp32/esp_wifi_types.h index e16ca19bdf75533a8331004dad43e81fa4d7b87e..cfe45ac6c7c280c674c2e0e5e2bf96bb9b4eb717 100644 --- a/tools/sdk/include/esp32/esp_wifi_types.h +++ b/tools/sdk/include/esp32/esp_wifi_types.h @@ -93,6 +93,7 @@ typedef enum { WIFI_REASON_AUTH_FAIL = 202, WIFI_REASON_ASSOC_FAIL = 203, WIFI_REASON_HANDSHAKE_TIMEOUT = 204, + WIFI_REASON_CONNECTION_FAIL = 205, } wifi_err_reason_t; typedef enum { @@ -491,6 +492,34 @@ typedef enum { WIFI_PHY_RATE_MAX, } wifi_phy_rate_t; +/** + * @brief WiFi ioctl command type + * + */ +typedef enum { + WIFI_IOCTL_SET_STA_HT2040_COEX = 1, /**< Set the configuration of STA's HT2040 coexist management */ + WIFI_IOCTL_GET_STA_HT2040_COEX, /**< Get the configuration of STA's HT2040 coexist management */ + WIFI_IOCTL_MAX, +} wifi_ioctl_cmd_t; + +/** + * @brief Configuration for STA's HT2040 coexist management + * + */ +typedef struct { + int enable; /**< Indicate whether STA's HT2040 coexist management is enabled or not */ +} wifi_ht2040_coex_t; + +/** + * @brief Configuration for WiFi ioctl + * + */ +typedef struct { + union { + wifi_ht2040_coex_t ht2040_coex; /**< Configuration of STA's HT2040 coexist management */ + } data; /**< Configuration of ioctl command */ +} wifi_ioctl_config_t; + #ifdef __cplusplus } #endif diff --git a/tools/sdk/include/esp_http_client/esp_http_client.h b/tools/sdk/include/esp_http_client/esp_http_client.h index 4e940a6d10a771fd8e6abea74300ccc91032add2..0929e4d755230ded74fdf51e3618f32ae10850ce 100644 --- a/tools/sdk/include/esp_http_client/esp_http_client.h +++ b/tools/sdk/include/esp_http_client/esp_http_client.h @@ -115,6 +115,7 @@ typedef struct { int buffer_size; /*!< HTTP buffer size (both send and receive) */ void *user_data; /*!< HTTP user_data context */ bool is_async; /*!< Set asynchronous mode, only supported with HTTPS for now */ + bool use_global_ca_store; /*!< Use a global ca_store for all the connections in which this bool is set. */ } esp_http_client_config_t; @@ -373,6 +374,18 @@ esp_err_t esp_http_client_cleanup(esp_http_client_handle_t client); */ esp_http_client_transport_t esp_http_client_get_transport_type(esp_http_client_handle_t client); +/** + * @brief Set redirection URL. + * When received the 30x code from the server, the client stores the redirect URL provided by the server. + * This function will set the current URL to redirect to enable client to execute the redirection request. + * + * @param[in] client The esp_http_client handle + * + * @return + * - ESP_OK + * - ESP_FAIL + */ +esp_err_t esp_http_client_set_redirection(esp_http_client_handle_t client); #ifdef __cplusplus } diff --git a/tools/sdk/include/idf_test/idf_performance.h b/tools/sdk/include/idf_test/idf_performance.h index 60040303f00b258ae5ec3f6556c8ecebed6ab24a..e864b293299daab7f82ea7d7f117114bd87f5a68 100644 --- a/tools/sdk/include/idf_test/idf_performance.h +++ b/tools/sdk/include/idf_test/idf_performance.h @@ -30,3 +30,6 @@ // events dispatched per second by event loop library #define IDF_PERFORMANCE_MIN_EVENT_DISPATCH 25000 #define IDF_PERFORMANCE_MIN_EVENT_DISPATCH_PSRAM 21000 +// esp_sha() time to process 32KB of input data from RAM +#define IDF_PERFORMANCE_MAX_ESP32_TIME_SHA1_32KB 5000 +#define IDF_PERFORMANCE_MAX_ESP32_TIME_SHA512_32KB 4500 diff --git a/tools/sdk/include/newlib/sys/poll.h b/tools/sdk/include/newlib/sys/poll.h index 6e0067347c8ff0a658f91bb19c5f68193c0908da..030da6bf4801b321c0c45ede69ca2a8de104a967 100644 --- a/tools/sdk/include/newlib/sys/poll.h +++ b/tools/sdk/include/newlib/sys/poll.h @@ -1,4 +1,4 @@ -// Copyright 2018 Espressif Systems (Shanghai) PTE LTD +// Copyright 2018-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. @@ -11,22 +11,38 @@ // 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. + #ifndef _ESP_PLATFORM_SYS_POLL_H_ #define _ESP_PLATFORM_SYS_POLL_H_ -#define POLLIN 0x0001 /* any readable data available */ -#define POLLOUT 0x0004 /* file descriptor is writeable */ -#define POLLPRI 0x0002 /* OOB/Urgent readable data */ -#define POLLERR 0x0008 /* some poll error occurred */ -#define POLLHUP 0x0010 /* file descriptor was "hung up" */ +#define POLLIN (1u << 0) /* data other than high-priority may be read without blocking */ +#define POLLRDNORM (1u << 1) /* normal data may be read without blocking */ +#define POLLRDBAND (1u << 2) /* priority data may be read without blocking */ +#define POLLPRI (POLLRDBAND) /* high-priority data may be read without blocking */ +// Note: POLLPRI is made equivalent to POLLRDBAND in order to fit all these events into one byte +#define POLLOUT (1u << 3) /* normal data may be written without blocking */ +#define POLLWRNORM (POLLOUT) /* equivalent to POLLOUT */ +#define POLLWRBAND (1u << 4) /* priority data my be written */ +#define POLLERR (1u << 5) /* some poll error occurred */ +#define POLLHUP (1u << 6) /* file descriptor was "hung up" */ +#define POLLNVAL (1u << 7) /* the specified file descriptor is invalid */ + +#ifdef __cplusplus +extern "C" { +#endif struct pollfd { - int fd; /* The descriptor. */ - short events; /* The event(s) is/are specified here. */ - short revents; /* Events found are returned here. */ + int fd; /* The descriptor. */ + short events; /* The event(s) is/are specified here. */ + short revents; /* Events found are returned here. */ }; typedef unsigned int nfds_t; + int poll(struct pollfd *fds, nfds_t nfds, int timeout); +#ifdef __cplusplus +} // extern "C" +#endif + #endif // _ESP_PLATFORM_SYS_POLL_H_ diff --git a/tools/sdk/include/soc/soc/efuse_reg.h b/tools/sdk/include/soc/soc/efuse_reg.h index 6c3f45c542d01cb4d28a6c39deb5c2b24f4ff9e3..a2ee03d31428afaef7e41af29713f788e8d85ff2 100644 --- a/tools/sdk/include/soc/soc/efuse_reg.h +++ b/tools/sdk/include/soc/soc/efuse_reg.h @@ -17,11 +17,11 @@ #include "soc.h" #define EFUSE_BLK0_RDATA0_REG (DR_REG_EFUSE_BASE + 0x000) -/* EFUSE_RD_FLASH_CRYPT_CNT : RO ;bitpos:[27:20] ;default: 8'b0 ; */ +/* EFUSE_RD_FLASH_CRYPT_CNT : RO ;bitpos:[26:20] ;default: 7'b0 ; */ /*description: read for flash_crypt_cnt*/ -#define EFUSE_RD_FLASH_CRYPT_CNT 0x000000FF +#define EFUSE_RD_FLASH_CRYPT_CNT 0x0000007F #define EFUSE_RD_FLASH_CRYPT_CNT_M ((EFUSE_RD_FLASH_CRYPT_CNT_V)<<(EFUSE_RD_FLASH_CRYPT_CNT_S)) -#define EFUSE_RD_FLASH_CRYPT_CNT_V 0xFF +#define EFUSE_RD_FLASH_CRYPT_CNT_V 0x7F #define EFUSE_RD_FLASH_CRYPT_CNT_S 20 /* EFUSE_RD_EFUSE_RD_DIS : RO ;bitpos:[19:16] ;default: 4'b0 ; */ /*description: read for efuse_rd_disable*/ @@ -302,11 +302,11 @@ #define EFUSE_CODING_SCHEME_VAL_34 0x1 #define EFUSE_BLK0_WDATA0_REG (DR_REG_EFUSE_BASE + 0x01c) -/* EFUSE_FLASH_CRYPT_CNT : R/W ;bitpos:[27:20] ;default: 8'b0 ; */ +/* EFUSE_FLASH_CRYPT_CNT : R/W ;bitpos:[26:20] ;default: 7'b0 ; */ /*description: program for flash_crypt_cnt*/ -#define EFUSE_FLASH_CRYPT_CNT 0x000000FF +#define EFUSE_FLASH_CRYPT_CNT 0x0000007F #define EFUSE_FLASH_CRYPT_CNT_M ((EFUSE_FLASH_CRYPT_CNT_V)<<(EFUSE_FLASH_CRYPT_CNT_S)) -#define EFUSE_FLASH_CRYPT_CNT_V 0xFF +#define EFUSE_FLASH_CRYPT_CNT_V 0x7F #define EFUSE_FLASH_CRYPT_CNT_S 20 /* EFUSE_RD_DIS : R/W ;bitpos:[19:16] ;default: 4'b0 ; */ /*description: program for efuse_rd_disable*/ diff --git a/tools/sdk/include/tcp_transport/esp_transport_ssl.h b/tools/sdk/include/tcp_transport/esp_transport_ssl.h index 34045ae7778396649572e185b0be08e05afd7c71..c42fd09353e257ddaa02694e39ae5a5fbaa82c71 100644 --- a/tools/sdk/include/tcp_transport/esp_transport_ssl.h +++ b/tools/sdk/include/tcp_transport/esp_transport_ssl.h @@ -40,6 +40,13 @@ esp_transport_handle_t esp_transport_ssl_init(); */ void esp_transport_ssl_set_cert_data(esp_transport_handle_t t, const char *data, int len); +/** + * @brief Enable global CA store for SSL connection + * + * @param t ssl transport + */ +void esp_transport_ssl_enable_global_ca_store(esp_transport_handle_t t); + /** * @brief Set SSL client certificate data for mutual authentication (as PEM format). * Note that, this function stores the pointer to data, rather than making a copy. diff --git a/tools/sdk/include/vfs/esp_vfs.h b/tools/sdk/include/vfs/esp_vfs.h index d7467d227f54b922ec66f610028c2970258f1a18..57a0320f18772becd86d104b0a2701d9d5b00300 100644 --- a/tools/sdk/include/vfs/esp_vfs.h +++ b/tools/sdk/include/vfs/esp_vfs.h @@ -1,4 +1,4 @@ -// Copyright 2015-2016 Espressif Systems (Shanghai) PTE LTD +// Copyright 2015-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. @@ -27,6 +27,7 @@ #include #include #include +#include #include #include #include "sdkconfig.h" @@ -379,6 +380,22 @@ void esp_vfs_select_triggered(SemaphoreHandle_t *signal_sem); */ void esp_vfs_select_triggered_isr(SemaphoreHandle_t *signal_sem, BaseType_t *woken); +/** + * @brief Implements the VFS layer for synchronous I/O multiplexing by poll() + * + * The implementation is based on esp_vfs_select. The parameters and return values are compatible with POSIX poll(). + * + * @param fds Pointer to the array containing file descriptors and events poll() should consider. + * @param nfds Number of items in the array fds. + * @param timeout Poll() should wait at least timeout milliseconds. If the value is 0 then it should return + * immediately. If the value is -1 then it should wait (block) until the event occurs. + * + * @return A positive return value indicates the number of file descriptors that have been selected. The 0 + * return value indicates a timed-out poll. -1 is return on failure and errno is set accordingly. + * + */ +int esp_vfs_poll(struct pollfd *fds, nfds_t nfds, int timeout); + #ifdef __cplusplus } // extern "C" #endif diff --git a/tools/sdk/lib/libapp_trace.a b/tools/sdk/lib/libapp_trace.a index e8137129c1334b6c9f0abb94a0b7c2554e1613a9..02d98405328a0cea02ac598df73a678dab502afe 100644 Binary files a/tools/sdk/lib/libapp_trace.a and b/tools/sdk/lib/libapp_trace.a differ diff --git a/tools/sdk/lib/libapp_update.a b/tools/sdk/lib/libapp_update.a index 8837d790cf9cac35445874641b296a5c3a4fb96d..347497f8687e110b5844ad0c5fd012f1b0162f9f 100644 Binary files a/tools/sdk/lib/libapp_update.a and b/tools/sdk/lib/libapp_update.a differ diff --git a/tools/sdk/lib/libasio.a b/tools/sdk/lib/libasio.a index 44ec5a05c9989a05b5271fa7514563db8dff79fb..ffb74873d770167f8c0af313f286d8a03d56cf24 100644 Binary files a/tools/sdk/lib/libasio.a and b/tools/sdk/lib/libasio.a differ diff --git a/tools/sdk/lib/libbootloader_support.a b/tools/sdk/lib/libbootloader_support.a index 57828afb6e44f14d407203cbc73948e74b7c4c74..f638cacfe4ed1f8d5a2fe0a97930299d29d0b1cc 100644 Binary files a/tools/sdk/lib/libbootloader_support.a and b/tools/sdk/lib/libbootloader_support.a differ diff --git a/tools/sdk/lib/libbt.a b/tools/sdk/lib/libbt.a index 4946e950820e6cbe791c9264a21dffd53acaaf23..fbf5693db72cc5842b36effbcb19506b5534a899 100644 Binary files a/tools/sdk/lib/libbt.a and b/tools/sdk/lib/libbt.a differ diff --git a/tools/sdk/lib/libbtdm_app.a b/tools/sdk/lib/libbtdm_app.a old mode 100755 new mode 100644 index 2206640dc4cb117efd8901ec29fc6a26ea1bd700..f2b6cc1763a751c7235bda934cd0381f5493d355 Binary files a/tools/sdk/lib/libbtdm_app.a and b/tools/sdk/lib/libbtdm_app.a differ diff --git a/tools/sdk/lib/libcoap.a b/tools/sdk/lib/libcoap.a index c1292473e50bb9e5fe686142f9ecd51008d39d8c..71dc10d8c370a4851055c18a75aa7034edc73247 100644 Binary files a/tools/sdk/lib/libcoap.a and b/tools/sdk/lib/libcoap.a differ diff --git a/tools/sdk/lib/libcoexist.a b/tools/sdk/lib/libcoexist.a index 88029df6a138ad690ad6543da9c77e0145e2269f..9ef80903844a8bb9115c9386c0df51c72e28e886 100644 Binary files a/tools/sdk/lib/libcoexist.a and b/tools/sdk/lib/libcoexist.a differ diff --git a/tools/sdk/lib/libconsole.a b/tools/sdk/lib/libconsole.a index bdd72ba72cb9e8665ad79e478df823d5d61bbee8..202c8624df63decec033079c3a4b05ea85e744db 100644 Binary files a/tools/sdk/lib/libconsole.a and b/tools/sdk/lib/libconsole.a differ diff --git a/tools/sdk/lib/libcore.a b/tools/sdk/lib/libcore.a index 88eb6c3b0ed9e3e5b683f773ef9c9280d3994e72..066760e8104ee3cfc02d00d6ae4300aeb4103f3f 100644 Binary files a/tools/sdk/lib/libcore.a and b/tools/sdk/lib/libcore.a differ diff --git a/tools/sdk/lib/libcxx.a b/tools/sdk/lib/libcxx.a index 2593f2d8dd808e2e73a27311001f33a20e02844d..a3119171f6a6c09afa4da0fa8e38ad935c33fba7 100644 Binary files a/tools/sdk/lib/libcxx.a and b/tools/sdk/lib/libcxx.a differ diff --git a/tools/sdk/lib/libdl_lib.a b/tools/sdk/lib/libdl_lib.a index 7f816cdb0b4c9332c5cc0e53d9c3e4bb8da4be70..df99a2279ae38f2faf51804f667c6d2b38d85538 100644 Binary files a/tools/sdk/lib/libdl_lib.a and b/tools/sdk/lib/libdl_lib.a differ diff --git a/tools/sdk/lib/libdriver.a b/tools/sdk/lib/libdriver.a index b03718123008203407d1697908a73e2ebdf1a8d0..010dec801b9dbf6be7e7ee847d8f141bd1b82e3d 100644 Binary files a/tools/sdk/lib/libdriver.a and b/tools/sdk/lib/libdriver.a differ diff --git a/tools/sdk/lib/libesp-tls.a b/tools/sdk/lib/libesp-tls.a index 02000fc64b457f91124471d2e1b84afa262c21be..382f7911439fcbfffff7ca1893cb38b42169b259 100644 Binary files a/tools/sdk/lib/libesp-tls.a and b/tools/sdk/lib/libesp-tls.a differ diff --git a/tools/sdk/lib/libesp32-camera.a b/tools/sdk/lib/libesp32-camera.a index b9dda8e56d36b5e4a246c2a5db037955fdfacd8c..a99f4b5bf8336965361764b20747be1b387decaa 100644 Binary files a/tools/sdk/lib/libesp32-camera.a and b/tools/sdk/lib/libesp32-camera.a differ diff --git a/tools/sdk/lib/libesp32.a b/tools/sdk/lib/libesp32.a index 7aee27db898746ae495cf7b6e308a7ae207b0597..3b02574fc3f0f1dd81e78f5c05551213cdb7ea74 100644 Binary files a/tools/sdk/lib/libesp32.a and b/tools/sdk/lib/libesp32.a differ diff --git a/tools/sdk/lib/libesp_adc_cal.a b/tools/sdk/lib/libesp_adc_cal.a index 0d46c8a466fdff610b7265fd33abb6dc512c932b..a14fb4b8792de5e4f607c1437df80cbc7a78ed2c 100644 Binary files a/tools/sdk/lib/libesp_adc_cal.a and b/tools/sdk/lib/libesp_adc_cal.a differ diff --git a/tools/sdk/lib/libesp_event.a b/tools/sdk/lib/libesp_event.a index fafa5966333ab2faa262a023bf3ad7fbe3a20026..7c16f99111a34fe3d32491f42791d2c0d780fe3c 100644 Binary files a/tools/sdk/lib/libesp_event.a and b/tools/sdk/lib/libesp_event.a differ diff --git a/tools/sdk/lib/libesp_http_client.a b/tools/sdk/lib/libesp_http_client.a index cfacbdb88305b14cbe0ddd709dbf69bfef1b182d..f58bf4cdfdf111f1184508f8c5d685ac3eaac95f 100644 Binary files a/tools/sdk/lib/libesp_http_client.a and b/tools/sdk/lib/libesp_http_client.a differ diff --git a/tools/sdk/lib/libesp_http_server.a b/tools/sdk/lib/libesp_http_server.a index e0ec592f2c4f4e52d913a1174af6deae2a152205..4bc32d883756f64d56868b8f95a1625f826c4e89 100644 Binary files a/tools/sdk/lib/libesp_http_server.a and b/tools/sdk/lib/libesp_http_server.a differ diff --git a/tools/sdk/lib/libesp_https_ota.a b/tools/sdk/lib/libesp_https_ota.a index 8cca0c1c30992da5c03df74a19020f9e2ddc1061..fd5669dc25cfb2f2d62ddcd1855d66c0288ca053 100644 Binary files a/tools/sdk/lib/libesp_https_ota.a and b/tools/sdk/lib/libesp_https_ota.a differ diff --git a/tools/sdk/lib/libesp_ringbuf.a b/tools/sdk/lib/libesp_ringbuf.a index bdde7654a1234d440f038d17a045f35c15b9dd41..64ff77ca3ebb66a42805c0336914c880148013e6 100644 Binary files a/tools/sdk/lib/libesp_ringbuf.a and b/tools/sdk/lib/libesp_ringbuf.a differ diff --git a/tools/sdk/lib/libespnow.a b/tools/sdk/lib/libespnow.a index 74fe6ab6cd8a93a5252bb1c68221c61b555a5604..1292cc3839124fbd2130f6d36cc4a399bf76affb 100644 Binary files a/tools/sdk/lib/libespnow.a and b/tools/sdk/lib/libespnow.a differ diff --git a/tools/sdk/lib/libethernet.a b/tools/sdk/lib/libethernet.a index b1ed8930305e3642557128a0d8ebf69c37d77e4f..a64cd5f2cd5292da747996606baf6a823d66eede 100644 Binary files a/tools/sdk/lib/libethernet.a and b/tools/sdk/lib/libethernet.a differ diff --git a/tools/sdk/lib/libexpat.a b/tools/sdk/lib/libexpat.a index 99280b4800f01fcb467392facf3fc85891c3e84d..839085fccd76474a150e3c7a90fa4e38c8476078 100644 Binary files a/tools/sdk/lib/libexpat.a and b/tools/sdk/lib/libexpat.a differ diff --git a/tools/sdk/lib/libface_detection.a b/tools/sdk/lib/libface_detection.a index a6772fba2bb184dbedd0b066cc2952127f4f61f0..2c0f4960f66ec78cdd17035641952c57bb9b4ee7 100644 Binary files a/tools/sdk/lib/libface_detection.a and b/tools/sdk/lib/libface_detection.a differ diff --git a/tools/sdk/lib/libface_recognition.a b/tools/sdk/lib/libface_recognition.a index 9c419e465b0bd875c51bebaa9f0000e39b66004f..ef9ce28c370347a712bafa2be41a824964bbc651 100644 Binary files a/tools/sdk/lib/libface_recognition.a and b/tools/sdk/lib/libface_recognition.a differ diff --git a/tools/sdk/lib/libfatfs.a b/tools/sdk/lib/libfatfs.a index 077ae51aaac73b3674ae172a43d0e8df1f83eff6..4b149774b710a521d3813aaa1e920d4f3cb33654 100644 Binary files a/tools/sdk/lib/libfatfs.a and b/tools/sdk/lib/libfatfs.a differ diff --git a/tools/sdk/lib/libfb_gfx.a b/tools/sdk/lib/libfb_gfx.a index d066e652984f9748d4c7102a48ba4409f1495e8a..3baccc17dadcd33b6dee2d982ca89e90a1675f66 100644 Binary files a/tools/sdk/lib/libfb_gfx.a and b/tools/sdk/lib/libfb_gfx.a differ diff --git a/tools/sdk/lib/libfd_coefficients.a b/tools/sdk/lib/libfd.a similarity index 88% rename from tools/sdk/lib/libfd_coefficients.a rename to tools/sdk/lib/libfd.a index 63758945159789a9a0fc8950ddee4bdd66688109..631229f8f5c58d35483d055d6fd05e25a832bc21 100644 Binary files a/tools/sdk/lib/libfd_coefficients.a and b/tools/sdk/lib/libfd.a differ diff --git a/tools/sdk/lib/libfr_coefficients.a b/tools/sdk/lib/libfr.a similarity index 92% rename from tools/sdk/lib/libfr_coefficients.a rename to tools/sdk/lib/libfr.a index 2860ebf8c6d94e041be5181b0bc150cb6949b481..3e2064ca1c12f3f7daffda0d309d77aaa4e80c2f 100644 Binary files a/tools/sdk/lib/libfr_coefficients.a and b/tools/sdk/lib/libfr.a differ diff --git a/tools/sdk/lib/libfreemodbus.a b/tools/sdk/lib/libfreemodbus.a index fee56649b1f45bb5b21febca1e2abb94bf80fdec..fbc330aa8e5fe69bbbda42f054c106e0f3010bfb 100644 Binary files a/tools/sdk/lib/libfreemodbus.a and b/tools/sdk/lib/libfreemodbus.a differ diff --git a/tools/sdk/lib/libfreertos.a b/tools/sdk/lib/libfreertos.a index 1fae04806f2464f98e633a9e508faec6f33d9a09..b70fc8157bffc7be3ad7c5023ace0b2352c5f62b 100644 Binary files a/tools/sdk/lib/libfreertos.a and b/tools/sdk/lib/libfreertos.a differ diff --git a/tools/sdk/lib/libfrmn.a b/tools/sdk/lib/libfrmn.a deleted file mode 100644 index 38df354b70cc5756cea901e2708231cd151715c6..0000000000000000000000000000000000000000 Binary files a/tools/sdk/lib/libfrmn.a and /dev/null differ diff --git a/tools/sdk/lib/libheap.a b/tools/sdk/lib/libheap.a index 49e1aa2f9e7760f292967f22f01333907bfa562b..370077363cc4604e3f28a7a6b6b4218e74094c1c 100644 Binary files a/tools/sdk/lib/libheap.a and b/tools/sdk/lib/libheap.a differ diff --git a/tools/sdk/lib/libimage_util.a b/tools/sdk/lib/libimage_util.a index d936547879d3131317c82bf60e5ce9b55482c961..dd95648c95c0a19b4c62a31ffa0ebf5fb6f20b88 100644 Binary files a/tools/sdk/lib/libimage_util.a and b/tools/sdk/lib/libimage_util.a differ diff --git a/tools/sdk/lib/libjsmn.a b/tools/sdk/lib/libjsmn.a index 44e33b5feb3cf7bb5ef414262a69d79949a0498d..35d5e4fa17ee1de3faa135c9ce8e31f12499c889 100644 Binary files a/tools/sdk/lib/libjsmn.a and b/tools/sdk/lib/libjsmn.a differ diff --git a/tools/sdk/lib/libjson.a b/tools/sdk/lib/libjson.a index 45fd443f8e8a52a9f3542cf7ee23460d63a4047d..27a2435ca67bd398ea137aa430b052de04653c2a 100644 Binary files a/tools/sdk/lib/libjson.a and b/tools/sdk/lib/libjson.a differ diff --git a/tools/sdk/lib/liblibsodium.a b/tools/sdk/lib/liblibsodium.a index d93944e678c0661c19c9bcac741de52830d09355..ceffc08dda573e6e886224112bf17d7814d4d026 100644 Binary files a/tools/sdk/lib/liblibsodium.a and b/tools/sdk/lib/liblibsodium.a differ diff --git a/tools/sdk/lib/liblog.a b/tools/sdk/lib/liblog.a index 24324b4b22f6b383596798a1388046611cb593ce..bb4c09d15ccebae3b9cb096c0d35bceb6281d2b5 100644 Binary files a/tools/sdk/lib/liblog.a and b/tools/sdk/lib/liblog.a differ diff --git a/tools/sdk/lib/liblwip.a b/tools/sdk/lib/liblwip.a index 65d40d19a2f0de7e127f26c34995691584ca348a..133ea79866e919adc17baa584d192242aafdbd95 100644 Binary files a/tools/sdk/lib/liblwip.a and b/tools/sdk/lib/liblwip.a differ diff --git a/tools/sdk/lib/libmbedtls.a b/tools/sdk/lib/libmbedtls.a index cdc69346cab647385939c609a548b4c6599217f1..71f9d7e883d8127d1b2353f9ab03fae76d521736 100644 Binary files a/tools/sdk/lib/libmbedtls.a and b/tools/sdk/lib/libmbedtls.a differ diff --git a/tools/sdk/lib/libmdns.a b/tools/sdk/lib/libmdns.a index ad6e9391fed7d8b7ca24d7369255a3115ff928ad..3a7f074afd89935bd7f49b4070c9256017f12bc9 100644 Binary files a/tools/sdk/lib/libmdns.a and b/tools/sdk/lib/libmdns.a differ diff --git a/tools/sdk/lib/libmesh.a b/tools/sdk/lib/libmesh.a index 777aa6cd8d642cb2bc6002cbf80ce6d104b8d8b7..ea1c67f2f6693a9fff230d4cfba0a3c7609684fd 100644 Binary files a/tools/sdk/lib/libmesh.a and b/tools/sdk/lib/libmesh.a differ diff --git a/tools/sdk/lib/libmicro-ecc.a b/tools/sdk/lib/libmicro-ecc.a index c008815fcac0179bcb74d6cb1cc7c987702e892b..569cdd8d3de3c74f48a64152170b22e8840d9633 100644 Binary files a/tools/sdk/lib/libmicro-ecc.a and b/tools/sdk/lib/libmicro-ecc.a differ diff --git a/tools/sdk/lib/libmqtt.a b/tools/sdk/lib/libmqtt.a index 83a7157668e57340a96c1157b11adb6ad0129715..0c750f97cf3930f575d8b801f23e26745d2cd271 100644 Binary files a/tools/sdk/lib/libmqtt.a and b/tools/sdk/lib/libmqtt.a differ diff --git a/tools/sdk/lib/libmtmn.a b/tools/sdk/lib/libmtmn.a deleted file mode 100644 index 033cb54bc7a64d4a89e88919bea78f14d182777c..0000000000000000000000000000000000000000 Binary files a/tools/sdk/lib/libmtmn.a and /dev/null differ diff --git a/tools/sdk/lib/libnet80211.a b/tools/sdk/lib/libnet80211.a index b278d9764fe27fc520f9a16ce26ff213777baffa..6735928a05d67c05bfdb79c4c6e73a679c8f5efc 100644 Binary files a/tools/sdk/lib/libnet80211.a and b/tools/sdk/lib/libnet80211.a differ diff --git a/tools/sdk/lib/libnewlib.a b/tools/sdk/lib/libnewlib.a index 957f3438d611eda37181f102ea3856b3f001d274..407f02ce2d93d53ebfe1044f21461500370811a1 100644 Binary files a/tools/sdk/lib/libnewlib.a and b/tools/sdk/lib/libnewlib.a differ diff --git a/tools/sdk/lib/libnghttp.a b/tools/sdk/lib/libnghttp.a index 814a393f1fee962112459f982e48d45f033a2cf8..a9106c84dfa6baeddc5d7be900d9ca4eae51300b 100644 Binary files a/tools/sdk/lib/libnghttp.a and b/tools/sdk/lib/libnghttp.a differ diff --git a/tools/sdk/lib/libnvs_flash.a b/tools/sdk/lib/libnvs_flash.a index acf41020d6825a05d87f3b77a386ebe8f65291a1..4e1e0fc25af6305bfa5825839709423eaedec5f4 100644 Binary files a/tools/sdk/lib/libnvs_flash.a and b/tools/sdk/lib/libnvs_flash.a differ diff --git a/tools/sdk/lib/libopenssl.a b/tools/sdk/lib/libopenssl.a index 9b651451a77432570dd48b86803924cbc65a4ff9..9c393105cded739978898d9a805aede1fc9d147a 100644 Binary files a/tools/sdk/lib/libopenssl.a and b/tools/sdk/lib/libopenssl.a differ diff --git a/tools/sdk/lib/libphy.a b/tools/sdk/lib/libphy.a old mode 100644 new mode 100755 index 0ef93ee77a45e3d899954dd903d83ba964603af0..8d7464c80ce0c2963231feee710344f296b316ac Binary files a/tools/sdk/lib/libphy.a and b/tools/sdk/lib/libphy.a differ diff --git a/tools/sdk/lib/libpp.a b/tools/sdk/lib/libpp.a index 02fbc04cf7dee4333584d0088abd320cc48830fc..440066f5e2bf08ddaa3f6e1b40bf327c3612a270 100644 Binary files a/tools/sdk/lib/libpp.a and b/tools/sdk/lib/libpp.a differ diff --git a/tools/sdk/lib/libprotobuf-c.a b/tools/sdk/lib/libprotobuf-c.a index 2ebae02fe55dc45034940752ba1f333c62d0e050..7704e15c5e864d4b6792347b24cde864b1f9a0ed 100644 Binary files a/tools/sdk/lib/libprotobuf-c.a and b/tools/sdk/lib/libprotobuf-c.a differ diff --git a/tools/sdk/lib/libprotocomm.a b/tools/sdk/lib/libprotocomm.a index 1492aa3842a2fa403b96f6cbcb5f658b69dad9cf..c3da55ed08d3c13bcf92d965d60c6fcbc36b0490 100644 Binary files a/tools/sdk/lib/libprotocomm.a and b/tools/sdk/lib/libprotocomm.a differ diff --git a/tools/sdk/lib/libpthread.a b/tools/sdk/lib/libpthread.a index 807d392c4a1b595b11db277c4af7d5b253f67006..04d8f98093f57b493786ed346fbb268814c472ff 100644 Binary files a/tools/sdk/lib/libpthread.a and b/tools/sdk/lib/libpthread.a differ diff --git a/tools/sdk/lib/libsdmmc.a b/tools/sdk/lib/libsdmmc.a index d1c61cecb4e3a5d1c24c1be0aea4c73d34a55706..1adf583a9deec7b50b5b5f0c6d8451a2ffa64005 100644 Binary files a/tools/sdk/lib/libsdmmc.a and b/tools/sdk/lib/libsdmmc.a differ diff --git a/tools/sdk/lib/libsmartconfig.a b/tools/sdk/lib/libsmartconfig.a index 291a17fd213b2b06835919e0ac5b53eae9dcacbf..5e1dfd8cab6f17abe85dc8bcc669bc40ccba2936 100644 Binary files a/tools/sdk/lib/libsmartconfig.a and b/tools/sdk/lib/libsmartconfig.a differ diff --git a/tools/sdk/lib/libsmartconfig_ack.a b/tools/sdk/lib/libsmartconfig_ack.a index 7ec1e803f650ddea3ec50cfa315faf5eba807e85..5f9be26acf0302db8abebd80c64a6ed1e536ae0a 100644 Binary files a/tools/sdk/lib/libsmartconfig_ack.a and b/tools/sdk/lib/libsmartconfig_ack.a differ diff --git a/tools/sdk/lib/libsoc.a b/tools/sdk/lib/libsoc.a index 456087cba91ba41a67652267d7c35e0a8e609ff9..1865433f80d650db08815e445c010c6a918a5f80 100644 Binary files a/tools/sdk/lib/libsoc.a and b/tools/sdk/lib/libsoc.a differ diff --git a/tools/sdk/lib/libspi_flash.a b/tools/sdk/lib/libspi_flash.a index 07f6ab9ac8f5f90176991849f745e72c7d3d0943..82f10c9812d45e33c22203ff85ccfd0c49317390 100644 Binary files a/tools/sdk/lib/libspi_flash.a and b/tools/sdk/lib/libspi_flash.a differ diff --git a/tools/sdk/lib/libspiffs.a b/tools/sdk/lib/libspiffs.a index b9ed6429a24a66c7a900dbf48dbacfaa9e38c3eb..a04cda06981e642be1406aa2518dc4dd6400af30 100644 Binary files a/tools/sdk/lib/libspiffs.a and b/tools/sdk/lib/libspiffs.a differ diff --git a/tools/sdk/lib/libtcp_transport.a b/tools/sdk/lib/libtcp_transport.a index 7a7e0f2d0c30354a5a2a5cfcae484c6aeecd2b79..d4b83188c677bfa1741c8abd75bcfe8216412f63 100644 Binary files a/tools/sdk/lib/libtcp_transport.a and b/tools/sdk/lib/libtcp_transport.a differ diff --git a/tools/sdk/lib/libtcpip_adapter.a b/tools/sdk/lib/libtcpip_adapter.a index dcd5feb51871c9d7cdfeeb6616e44e8da0973b47..d585b7970fb970049c580ca209884c47319592e7 100644 Binary files a/tools/sdk/lib/libtcpip_adapter.a and b/tools/sdk/lib/libtcpip_adapter.a differ diff --git a/tools/sdk/lib/libulp.a b/tools/sdk/lib/libulp.a index a40c7de45c28117a2b4d7a40835a923939480f86..a71e6d5b7415e220b337791806196edcb43877eb 100644 Binary files a/tools/sdk/lib/libulp.a and b/tools/sdk/lib/libulp.a differ diff --git a/tools/sdk/lib/libvfs.a b/tools/sdk/lib/libvfs.a index 580757514e73be09cd5ffc5f08b1029e03e0dfe8..544f28bdf3a0fe78adc26973536a720e4c30c7ae 100644 Binary files a/tools/sdk/lib/libvfs.a and b/tools/sdk/lib/libvfs.a differ diff --git a/tools/sdk/lib/libwear_levelling.a b/tools/sdk/lib/libwear_levelling.a index 90ed42732acdb647dee1dc9545df8cfa76d3a6c9..88a34dcfd8707705316e65a199b7bd86ebbc3e98 100644 Binary files a/tools/sdk/lib/libwear_levelling.a and b/tools/sdk/lib/libwear_levelling.a differ diff --git a/tools/sdk/lib/libwifi_provisioning.a b/tools/sdk/lib/libwifi_provisioning.a index 408a9c8ec545b346511c0484642503a08db10834..87e1d20f5954ee3cc6d60a1d68c23a3dfe78143f 100644 Binary files a/tools/sdk/lib/libwifi_provisioning.a and b/tools/sdk/lib/libwifi_provisioning.a differ diff --git a/tools/sdk/lib/libwpa.a b/tools/sdk/lib/libwpa.a index da0d1edb94ec54e4671bb15e2f007e8857be408b..dab425baa83444663ccbc939ba4e1b278641f0df 100644 Binary files a/tools/sdk/lib/libwpa.a and b/tools/sdk/lib/libwpa.a differ diff --git a/tools/sdk/lib/libwpa2.a b/tools/sdk/lib/libwpa2.a index 0a1372c7a61516a848d270a39b6f70c911eac604..72e66afd533ab088c10c4e5515f8d35cda091acf 100644 Binary files a/tools/sdk/lib/libwpa2.a and b/tools/sdk/lib/libwpa2.a differ diff --git a/tools/sdk/lib/libwpa_supplicant.a b/tools/sdk/lib/libwpa_supplicant.a index 7bcd251dc8f87a38d19d6e61e7efef907ce1a534..461519908275a81b563b1d24db705eb255729eb8 100644 Binary files a/tools/sdk/lib/libwpa_supplicant.a and b/tools/sdk/lib/libwpa_supplicant.a differ diff --git a/tools/sdk/lib/libwps.a b/tools/sdk/lib/libwps.a index 1b4a8a2a1e93bd370feacc28ff55b25e58a904aa..7541de51983a335456c84f3d33f28f9df8f4d21f 100644 Binary files a/tools/sdk/lib/libwps.a and b/tools/sdk/lib/libwps.a differ diff --git a/tools/sdk/lib/libxtensa-debug-module.a b/tools/sdk/lib/libxtensa-debug-module.a index 4f3279eb8f522f37c5e76782f06613f7a7d8f625..3600483524fa8a0078b5201933a2aba6769b5109 100644 Binary files a/tools/sdk/lib/libxtensa-debug-module.a and b/tools/sdk/lib/libxtensa-debug-module.a differ diff --git a/tools/sdk/sdkconfig b/tools/sdk/sdkconfig index 2888682c3ee497d99f1133d5bd664548111388b6..0e967810336b0778d1436cca6ae2cc2127556380 100644 --- a/tools/sdk/sdkconfig +++ b/tools/sdk/sdkconfig @@ -224,6 +224,7 @@ CONFIG_GATTS_SEND_SERVICE_CHANGE_MODE=0 CONFIG_GATTC_ENABLE=y CONFIG_GATTC_CACHE_NVS_FLASH= CONFIG_BLE_SMP_ENABLE=y +CONFIG_SMP_SLAVE_CON_PARAMS_UPD_ENABLE= CONFIG_BT_STACK_NO_LOG=y CONFIG_BT_ACL_CONNECTIONS=4 CONFIG_BT_ALLOCATION_FROM_SPIRAM_FIRST=y @@ -231,6 +232,7 @@ CONFIG_BT_BLE_DYNAMIC_ENV_MEMORY=y CONFIG_BLE_HOST_QUEUE_CONGESTION_CHECK= CONFIG_SMP_ENABLE=y CONFIG_BLE_ACTIVE_SCAN_REPORT_ADV_SCAN_RSP_INDIVIDUALLY= +CONFIG_BLE_ESTABLISH_LINK_CONNECTION_TIMEOUT=30 CONFIG_BT_RESERVE_DRAM=0xdb5c # @@ -376,6 +378,7 @@ CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_0=y CONFIG_ESP32_WIFI_TASK_PINNED_TO_CORE_1= CONFIG_ESP32_WIFI_SOFTAP_BEACON_MAX_LEN=752 CONFIG_ESP32_WIFI_IRAM_OPT=y +CONFIG_ESP32_WIFI_MGMT_SBUF_NUM=32 # # PHY @@ -433,8 +436,6 @@ CONFIG_EMAC_L2_TO_L3_RX_BUF_MODE=y CONFIG_EMAC_CHECK_LINK_PERIOD_MS=2000 CONFIG_EMAC_TASK_PRIORITY=20 CONFIG_EMAC_TASK_STACK_SIZE=3072 -CONFIG_C_IMPL= -CONFIG_XTENSA_IMPL=y # # FAT Filesystem support @@ -752,6 +753,7 @@ CONFIG_SPI_FLASH_ROM_DRIVER_PATCH=y CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ABORTS=y CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_FAILS= CONFIG_SPI_FLASH_WRITING_DANGEROUS_REGIONS_ALLOWED= +CONFIG_SPI_FLASH_YIELD_DURING_ERASE= # # SPIFFS Configuration