mirror of
https://github.com/espressif/ESP8266_RTOS_SDK.git
synced 2025-09-21 22:06:46 +08:00
Merge branch 'feature/add_macro_of_filename' into 'master'
Add macro "__ESP_FILE__" and its configuration See merge request sdk/ESP8266_RTOS_SDK!511
This commit is contained in:
@ -28,6 +28,27 @@ config NEWLIB_STDOUT_LINE_ENDING_CR
|
||||
bool "CR"
|
||||
endchoice
|
||||
|
||||
choice ESP_FILENAME_MACRO
|
||||
prompt "File name macro text"
|
||||
default ESP_FILENAME_MACRO_NO_PATH
|
||||
help
|
||||
This option allows configuring the macro __ESP_FILE__ text.
|
||||
Three options are possible:
|
||||
|
||||
no PATH: strip the path of macro __FILE__, for example: __FILE__="a/b/c/d.h", then __ESP_FILE__="d.h"
|
||||
|
||||
raw: same as macro __FILE__
|
||||
|
||||
null: text is string "null"
|
||||
|
||||
config ESP_FILENAME_MACRO_NO_PATH
|
||||
bool "no PATH"
|
||||
config ESP_FILENAME_MACRO_RAW
|
||||
bool "raw"
|
||||
config ESP_FILENAME_MACRO_NULL
|
||||
bool "null"
|
||||
endchoice
|
||||
|
||||
config SOC_FULL_ICACHE
|
||||
bool "Enable full cache mode"
|
||||
default n
|
||||
|
@ -66,3 +66,18 @@ endif
|
||||
|
||||
# global CFLAGS for ESP8266
|
||||
CFLAGS += -DICACHE_FLASH
|
||||
|
||||
ifdef CONFIG_ESP_FILENAME_MACRO_NO_PATH
|
||||
CFLAGS += -D__ESP_FILE__='"$$(subst $$(dir $$<),,$$<)"'
|
||||
CXXFLAGS += -D__ESP_FILE__='"$$(subst $$(dir $$<),,$$<)"'
|
||||
endif
|
||||
|
||||
ifdef CONFIG_ESP_FILENAME_MACRO_RAW
|
||||
CFLAGS += -D__ESP_FILE__=__FILE__
|
||||
CXXFLAGS += -D__ESP_FILE__=__FILE__
|
||||
endif
|
||||
|
||||
ifdef CONFIG_ESP_FILENAME_MACRO_NULL
|
||||
CFLAGS += -D__ESP_FILE__='"null"'
|
||||
CXXFLAGS += -D__ESP_FILE__='"null"'
|
||||
endif
|
||||
|
@ -105,7 +105,7 @@ void _esp_error_check_failed(esp_err_t rc, const char *file, int line, const cha
|
||||
#define ESP_ERROR_CHECK(x) do { \
|
||||
esp_err_t __err_rc = (x); \
|
||||
if (__err_rc != ESP_OK) { \
|
||||
_esp_error_check_failed(__err_rc, __FILE__, __LINE__, \
|
||||
_esp_error_check_failed(__err_rc, __ESP_FILE__, __LINE__, \
|
||||
__ASSERT_FUNC, #x); \
|
||||
} \
|
||||
} while(0);
|
||||
|
@ -126,19 +126,19 @@ extern wifi_osi_funcs_t s_wifi_osi_funcs;
|
||||
s_wifi_osi_funcs.timer_delete(t, tk)
|
||||
|
||||
#define wifi_malloc(s, c) \
|
||||
s_wifi_osi_funcs.malloc(s, c, __FILE__, __LINE__)
|
||||
s_wifi_osi_funcs.malloc(s, c, __ESP_FILE__, __LINE__)
|
||||
|
||||
#define wifi_zalloc(s, c) \
|
||||
s_wifi_osi_funcs.zalloc(s, c, __FILE__, __LINE__)
|
||||
s_wifi_osi_funcs.zalloc(s, c, __ESP_FILE__, __LINE__)
|
||||
|
||||
#define wifi_calloc(cnt, s, c) \
|
||||
s_wifi_osi_funcs.calloc(cnt, s, c, __FILE__, __LINE__)
|
||||
s_wifi_osi_funcs.calloc(cnt, s, c, __ESP_FILE__, __LINE__)
|
||||
|
||||
#define wifi_realloc(ptr, s, c) \
|
||||
s_wifi_osi_funcs.realloc(ptr, s, c, __FILE__, __LINE__)
|
||||
s_wifi_osi_funcs.realloc(ptr, s, c, __ESP_FILE__, __LINE__)
|
||||
|
||||
#define wifi_free(p) \
|
||||
s_wifi_osi_funcs.free(p, __FILE__, __LINE__)
|
||||
s_wifi_osi_funcs.free(p, __ESP_FILE__, __LINE__)
|
||||
|
||||
#define wifi_get_free_heap_size() \
|
||||
s_wifi_osi_funcs.get_free_heap_size()
|
||||
|
Reference in New Issue
Block a user