Merge branch 'bugfix/err_to_name_include' into 'master'

Fixes for error code generator

Closes IDFGH-1103

See merge request idf/esp-idf!4946
pull/3456/head
Ivan Grokhotkov 2019-05-09 11:21:52 +08:00
commit c549581b7c
3 zmienionych plików z 17 dodań i 13 usunięć

Wyświetl plik

@ -1,6 +1,7 @@
//Do not edit this file because it is autogenerated by gen_esp_err_to_name.py
#include <string.h>
#include "esp_err.h"
#if __has_include("soc/soc.h")
#include "soc/soc.h"
#endif
@ -10,9 +11,6 @@
#if __has_include("esp_efuse.h")
#include "esp_efuse.h"
#endif
#if __has_include("esp_err.h")
#include "esp_err.h"
#endif
#if __has_include("esp_http_client.h")
#include "esp_http_client.h"
#endif
@ -59,7 +57,7 @@ typedef struct {
} esp_err_msg_t;
static const esp_err_msg_t esp_err_msg_table[] = {
// components/esp32/include/esp_err.h
// components/esp_common/include/esp_err.h
# ifdef ESP_FAIL
ERR_TBL_IT(ESP_FAIL), /* -1 Generic esp_err_t code indicating failure */
# endif
@ -271,11 +269,11 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# ifdef ESP_ERR_IMAGE_INVALID
ERR_TBL_IT(ESP_ERR_IMAGE_INVALID), /* 8194 0x2002 */
# endif
// components/esp32/include/esp_err.h
// components/esp_common/include/esp_err.h
# ifdef ESP_ERR_WIFI_BASE
ERR_TBL_IT(ESP_ERR_WIFI_BASE), /* 12288 0x3000 Starting number of WiFi error codes */
# endif
// components/esp32/include/esp_wifi.h
// components/esp_wifi/include/esp_wifi.h
# ifdef ESP_ERR_WIFI_NOT_INIT
ERR_TBL_IT(ESP_ERR_WIFI_NOT_INIT), /* 12289 0x3001 WiFi driver was not installed by esp_wifi_init */
# endif
@ -322,7 +320,7 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# ifdef ESP_ERR_WIFI_NOT_CONNECT
ERR_TBL_IT(ESP_ERR_WIFI_NOT_CONNECT), /* 12303 0x300f Station still in disconnect status */
# endif
// components/esp32/include/esp_wps.h
// components/esp_wifi/include/esp_wps.h
# ifdef ESP_ERR_WIFI_REGISTRAR
ERR_TBL_IT(ESP_ERR_WIFI_REGISTRAR), /* 12339 0x3033 WPS registrar is not supported */
# endif
@ -332,7 +330,7 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# ifdef ESP_ERR_WIFI_WPS_SM
ERR_TBL_IT(ESP_ERR_WIFI_WPS_SM), /* 12341 0x3035 WPS state machine is not initialized */
# endif
// components/esp32/include/esp_now.h
// components/esp_wifi/include/esp_now.h
# ifdef ESP_ERR_ESPNOW_BASE
ERR_TBL_IT(ESP_ERR_ESPNOW_BASE), /* 12388 0x3064 ESPNOW error number base. */
# endif
@ -360,11 +358,11 @@ static const esp_err_msg_t esp_err_msg_table[] = {
# ifdef ESP_ERR_ESPNOW_IF
ERR_TBL_IT(ESP_ERR_ESPNOW_IF), /* 12396 0x306c Interface error */
# endif
// components/esp32/include/esp_err.h
// components/esp_common/include/esp_err.h
# ifdef ESP_ERR_MESH_BASE
ERR_TBL_IT(ESP_ERR_MESH_BASE), /* 16384 0x4000 Starting number of MESH error codes */
# endif
// components/esp32/include/esp_mesh.h
// components/esp_wifi/include/esp_mesh.h
# ifdef ESP_ERR_MESH_WIFI_NOT_START
ERR_TBL_IT(ESP_ERR_MESH_WIFI_NOT_START), /* 16385 0x4001 */
# endif

Wyświetl plik

@ -1,6 +1,7 @@
@COMMENT@
#include <string.h>
#include "esp_err.h"
#if __has_include("soc/soc.h")
#include "soc/soc.h"
#endif

Wyświetl plik

@ -46,7 +46,11 @@ ignore_files = ['components/mdns/test_afl_fuzz_host/esp32_compat.h']
ignore_dirs = ('examples')
# macros from here have higher priorities in case of collisions
priority_headers = ['components/esp32/include/esp_err.h']
priority_headers = ['components/esp_common/include/esp_err.h']
# The following headers won't be included. This is useful if they are permanently included from esp_err_to_name.c.in.
dont_include = ['soc/soc.h',
'esp_err.h']
err_dict = collections.defaultdict(list) # identified errors are stored here; mapped by the error code
rev_err_dict = dict() # map of error string to error code
@ -265,7 +269,8 @@ def generate_c_output(fin, fout):
elif re.match(r'@HEADERS@', line):
for i in include_list:
fout.write("#if __has_include(\"" + i + "\")\n#include \"" + i + "\"\n#endif\n")
if i not in dont_include:
fout.write("#if __has_include(\"" + i + "\")\n#include \"" + i + "\"\n#endif\n")
elif re.match(r'@ERROR_ITEMS@', line):
last_file = ""
for k in sorted(err_dict.keys()):
@ -321,7 +326,7 @@ def main():
parser = argparse.ArgumentParser(description='ESP32 esp_err_to_name lookup generator for esp_err_t')
parser.add_argument('--c_input', help='Path to the esp_err_to_name.c.in template input.',
default=idf_path + '/components/esp_common/src/esp_err_to_name.c.in')
parser.add_argument('--c_output', help='Path to the esp_err_to_name.c output.', default=idf_path + '/components/esp32/esp_err_to_name.c')
parser.add_argument('--c_output', help='Path to the esp_err_to_name.c output.', default=idf_path + '/components/esp_common/src/esp_err_to_name.c')
parser.add_argument('--rst_output', help='Generate .rst output and save it into this file')
args = parser.parse_args()