From 6a51a13b70b12df39439c788cb8e9a96baebd8fd Mon Sep 17 00:00:00 2001 From: robotrovsky Date: Thu, 23 Nov 2017 20:51:17 +0100 Subject: [PATCH 1/3] Bugfix I_DELAY macro When compiling > const ulp_insn_t program[] = { > I_DELAY(1) > }; with the xtensa-esp32-elf-g++ compiler i always got the error: > sorry, unimplemented: non-trivial designated initializers not supported > > }; This was due to the different order in the macro and the struct. The struct has another order of the fields (opcode, unused, cycles) vs (cycles, unused, opcode): > struct { > uint32_t cycles : 16; /*!< Number of cycles to sleep */ > uint32_t unused : 12; /*!< Unused */ > uint32_t opcode : 4; /*!< Opcode (OPCODE_DELAY) */ > } delay; /*!< Format of DELAY instruction */ After updating the order in the macro it is possible to compile with the g++ compiler. Merges https://github.com/espressif/esp-idf/pull/1310 --- components/ulp/include/esp32/ulp.h | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/ulp/include/esp32/ulp.h b/components/ulp/include/esp32/ulp.h index 302a47a0ca..ae539d84da 100644 --- a/components/ulp/include/esp32/ulp.h +++ b/components/ulp/include/esp32/ulp.h @@ -266,9 +266,9 @@ _Static_assert(sizeof(ulp_insn_t) == 4, "ULP coprocessor instruction size should * Delay (nop) for a given number of cycles */ #define I_DELAY(cycles_) { .delay = {\ - .opcode = OPCODE_DELAY, \ + .cycles = cycles_, \ .unused = 0, \ - .cycles = cycles_ } } + .opcode = OPCODE_DELAY } } /** * Halt the coprocessor. From 78855211fe00e5bf5d1532c135fe8c622b0f43c7 Mon Sep 17 00:00:00 2001 From: Paul Reimer Date: Sat, 25 Nov 2017 16:28:34 -0800 Subject: [PATCH 2/3] build system: Add *.cc files to list of file extensions compiled by default Merges https://github.com/espressif/esp-idf/pull/1318 --- docs/api-guides/build-system.rst | 2 +- make/component_wrapper.mk | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/docs/api-guides/build-system.rst b/docs/api-guides/build-system.rst index f3d6153cab..2ef47a4689 100644 --- a/docs/api-guides/build-system.rst +++ b/docs/api-guides/build-system.rst @@ -156,7 +156,7 @@ Minimal Component Makefile The minimal ``component.mk`` file is an empty file(!). If the file is empty, the default component behaviour is set: -- All source files in the same directory as the makefile (``*.c``, ``*.cpp``, ``*.S``) will be compiled into the component library +- All source files in the same directory as the makefile (``*.c``, ``*.cpp``, ``*.cc``, ``*.S``) will be compiled into the component library - A sub-directory "include" will be added to the global include search path for all other components. - The component library will be linked into the project app. diff --git a/make/component_wrapper.mk b/make/component_wrapper.mk index 84edc0a835..cc0afaa05d 100644 --- a/make/component_wrapper.mk +++ b/make/component_wrapper.mk @@ -85,11 +85,12 @@ include $(COMPONENT_MAKEFILE) ifndef COMPONENT_CONFIG_ONLY # Skip steps 3-5 if COMPONENT_CONFIG_ONLY is set # Object files which need to be linked into the library -# By default we take all .c, .cpp & .S files in COMPONENT_SRCDIRS. +# By default we take all .c, .cpp, .cc & .S files in COMPONENT_SRCDIRS. ifndef COMPONENT_OBJS # Find all source files in all COMPONENT_SRCDIRS COMPONENT_OBJS := $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.c,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.c))) COMPONENT_OBJS += $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.cpp,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.cpp))) +COMPONENT_OBJS += $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.cc,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.cc))) COMPONENT_OBJS += $(foreach compsrcdir,$(COMPONENT_SRCDIRS),$(patsubst %.S,%.o,$(wildcard $(COMPONENT_PATH)/$(compsrcdir)/*.S))) # Make relative by removing COMPONENT_PATH from all found object paths COMPONENT_OBJS := $(patsubst $(COMPONENT_PATH)/%,%,$(COMPONENT_OBJS)) @@ -221,6 +222,11 @@ $(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.cpp $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE $$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) $$(addprefix -I,$$(COMPONENT_INCLUDES)) $$(addprefix -I,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@ $(call AppendSourceToDependencies,$$<,$$@) +$(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.cc $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS) + $$(summary) CXX $$(patsubst $$(PWD)/%,%,$$(CURDIR))/$$@ + $$(CXX) $$(CXXFLAGS) $$(CPPFLAGS) $$(addprefix -I,$$(COMPONENT_INCLUDES)) $$(addprefix -I,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@ + $(call AppendSourceToDependencies,$$<,$$@) + $(1)/%.o: $$(COMPONENT_PATH)/$(1)/%.S $(COMMON_MAKEFILES) $(COMPONENT_MAKEFILE) | $(COMPONENT_SRCDIRS) $$(summary) AS $$(patsubst $$(PWD)/%,%,$$(CURDIR))/$$@ $$(CC) $$(CPPFLAGS) $$(DEBUG_FLAGS) $$(addprefix -I ,$$(COMPONENT_INCLUDES)) $$(addprefix -I ,$$(COMPONENT_EXTRA_INCLUDES)) -I$(1) -c $$< -o $$@ From 8a47679d046aa1f256d87060653568e9e4d595a7 Mon Sep 17 00:00:00 2001 From: Paul Reimer Date: Wed, 6 Dec 2017 09:09:40 -0800 Subject: [PATCH 3/3] Add #include guards and __cplusplus guards to esp_debug.h Merges https://github.com/espressif/esp-idf/pull/1358 --- components/mbedtls/port/include/mbedtls/esp_debug.h | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/components/mbedtls/port/include/mbedtls/esp_debug.h b/components/mbedtls/port/include/mbedtls/esp_debug.h index bf39cc73ba..8e23a5ea32 100644 --- a/components/mbedtls/port/include/mbedtls/esp_debug.h +++ b/components/mbedtls/port/include/mbedtls/esp_debug.h @@ -11,6 +11,12 @@ // 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_DEBUG_H_ +#define _ESP_DEBUG_H_ + +#ifdef __cplusplus +extern "C" { +#endif #include "sdkconfig.h" #ifdef CONFIG_MBEDTLS_DEBUG @@ -43,3 +49,9 @@ void mbedtls_esp_disable_debug_log(mbedtls_ssl_config *conf); #endif + +#ifdef __cplusplus +} +#endif + +#endif /* __ESP_DEBUG_H__ */