diff --git a/components/esp8266/Kconfig b/components/esp8266/Kconfig index 6fe1f85a..9a9a4250 100644 --- a/components/esp8266/Kconfig +++ b/components/esp8266/Kconfig @@ -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 diff --git a/components/esp8266/Makefile.projbuild b/components/esp8266/Makefile.projbuild index 3bccee87..221482c4 100644 --- a/components/esp8266/Makefile.projbuild +++ b/components/esp8266/Makefile.projbuild @@ -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