From a20c2f10881abb082184cab36067bc9866459971 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 4 Oct 2016 10:12:17 +1100 Subject: [PATCH 1/6] 'make flash' targets: Print serial port when flashing Inspired by github #30 and related mentions where selected serial port is not clear from the make output. --- components/esptool_py/Makefile.projbuild | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index 49f0548369..a3d49b7df9 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -24,10 +24,11 @@ $(APP_BIN): $(APP_ELF) $(ESPTOOLPY_SRC) $(Q) $(ESPTOOLPY) elf2image --flash_mode $(ESPFLASHMODE) --flash_freq $(ESPFLASHFREQ) -o $@ $< flash: all_binaries $(ESPTOOLPY_SRC) - @echo "Flashing project app to $(CONFIG_APP_OFFSET)..." + @echo "Flashing binaries to serial port $(ESPPORT) (app at offset $(CONFIG_APP_OFFSET))..." $(Q) $(ESPTOOLPY_WRITE_FLASH) $(ESPTOOL_ALL_FLASH_ARGS) app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) + @echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..." $(Q) $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN) $(eval $(call SubmoduleRequiredForFiles,$(ESPTOOLPY_SRC))) From 71c09d8f66445b029620e1f97602d0b2ca5d15c9 Mon Sep 17 00:00:00 2001 From: "rudi ;-)" Date: Sun, 2 Oct 2016 02:04:09 +0200 Subject: [PATCH 2/6] Fix stack overflow message format Poorly formatted message for stack overflow for task. Closes #36 --- components/freertos/panic.c | 4 ++-- 1 file changed, 2 insertions(+), 2 deletions(-) diff --git a/components/freertos/panic.c b/components/freertos/panic.c index b575022369..9400867356 100644 --- a/components/freertos/panic.c +++ b/components/freertos/panic.c @@ -79,9 +79,9 @@ inline static void panicPutDec(int a) { } int xPortGetCoreID(); void __attribute__((weak)) vApplicationStackOverflowHook( TaskHandle_t xTask, signed char *pcTaskName ) { - panicPutStr("***ERROR*** A stack overflow in task"); + panicPutStr("***ERROR*** A stack overflow in task "); panicPutStr((char*)pcTaskName); - panicPutStr("has been detected.\r\n"); + panicPutStr(" has been detected.\r\n"); } static const char *edesc[]={ From 79bd6af7e74cc174f83b36c026f0788ebbc38143 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Tue, 4 Oct 2016 16:33:18 +1100 Subject: [PATCH 3/6] build system: Print a WARNING if any submodule is out of date Inspired by Github #27 and related "gotchas" with keeping submodules up to date. --- components/bt/component.mk | 4 +--- components/esp32/component.mk | 2 +- components/esptool_py/Makefile.projbuild | 2 +- make/common.mk | 24 ++++++++++++++++-------- 4 files changed, 19 insertions(+), 13 deletions(-) diff --git a/components/bt/component.mk b/components/bt/component.mk index a9233cc74a..e88651aa13 100644 --- a/components/bt/component.mk +++ b/components/bt/component.mk @@ -4,8 +4,6 @@ #COMPONENT_ADD_INCLUDEDIRS := -CURRENT_DIR=$(IDF_PATH)/components/bt - COMPONENT_ADD_INCLUDEDIRS := include CFLAGS += -Wno-error=unused-label -Wno-error=return-type -Wno-error=missing-braces -Wno-error=pointer-sign -Wno-error=parentheses @@ -22,4 +20,4 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) $(COMPONENT_LIBRARY): $(ALL_LIB_FILES) # automatically trigger a git submodule update if BT library is missing -$(eval $(call SubmoduleRequiredForFiles,$(ALL_LIB_FILES))) +$(eval $(call SubmoduleCheck,$(ALL_LIB_FILES),$(COMPONENT_PATH)/lib)) diff --git a/components/esp32/component.mk b/components/esp32/component.mk index 6eac77afd3..b41acee60d 100644 --- a/components/esp32/component.mk +++ b/components/esp32/component.mk @@ -27,7 +27,7 @@ ALL_LIB_FILES := $(patsubst %,$(COMPONENT_PATH)/lib/lib%.a,$(LIBS)) # automatically trigger a git submodule update # if any libraries are missing -$(eval $(call SubmoduleRequiredForFiles,$(ALL_LIB_FILES))) +$(eval $(call SubmoduleCheck,$(ALL_LIB_FILES),$(COMPONENT_PATH)/lib)) # this is a hack to make sure the app is re-linked if the binary # libraries change or are updated. If they change, the main esp32 diff --git a/components/esptool_py/Makefile.projbuild b/components/esptool_py/Makefile.projbuild index a3d49b7df9..4d0dd1b3e5 100644 --- a/components/esptool_py/Makefile.projbuild +++ b/components/esptool_py/Makefile.projbuild @@ -31,4 +31,4 @@ app-flash: $(APP_BIN) $(ESPTOOLPY_SRC) @echo "Flashing app to serial port $(ESPPORT), offset $(CONFIG_APP_OFFSET)..." $(Q) $(ESPTOOLPY_WRITE_FLASH) $(CONFIG_APP_OFFSET) $(APP_BIN) -$(eval $(call SubmoduleRequiredForFiles,$(ESPTOOLPY_SRC))) +$(eval $(call SubmoduleCheck,$(ESPTOOLPY_SRC),$(COMPONENT_PATH)/esptool)) diff --git a/make/common.mk b/make/common.mk index a515584a9b..14aa4074b3 100644 --- a/make/common.mk +++ b/make/common.mk @@ -23,19 +23,27 @@ summary := @echo details := @true endif -# Pseudo-target to handle the case where submodules need to be -# re-initialised. +# Pseudo-target to check a git submodule has been properly initialised # -# $(eval $(call SubmoduleRequiredForFiles,FILENAMES)) to create a target that -# automatically runs 'git submodule update --init' if those files -# are missing, and fails if this is not possible. -define SubmoduleRequiredForFiles +# $(eval $(call SubmoduleCheck,FILENAMES,SUBMODULE_PATH)) to create a target that +# automatically runs 'git submodule update --init SUBMODULE_PATH' if any of +# the files in FILENAMES are missing, and fails if this is not possible. +# +# Will also print a WARNING if the submodule at SUBMODULE_PATH appears +# to require an update. +define SubmoduleCheck $(1): - @echo "WARNING: Missing submodule for $$@..." + @echo "WARNING: Missing submodule $(2) for $$@..." $(Q) [ -d ${IDF_PATH}/.git ] || ( echo "ERROR: esp-idf must be cloned from git to work."; exit 1) $(Q) [ -x $(which git) ] || ( echo "ERROR: Need to run 'git submodule --init' in esp-idf root directory."; exit 1) @echo "Attempting 'git submodule update --init' in esp-idf root directory..." - cd ${IDF_PATH} && git submodule update --init + cd ${IDF_PATH} && git submodule update --init $(2) + +# Parse 'git submodule status' output for out-of-date submodule. +# Status output prefixes status line with '+' if the submodule commit doesn't match +ifneq ("$(shell cd ${IDF_PATH} && git submodule status $(2) | grep '^+')","") +$$(info WARNING: git submodule $2 may be out of date. Run 'git submodule update' to update.) +endif endef From c12582c122a0141119a38d518e0bb9510976024d Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 6 Oct 2016 09:55:43 +1100 Subject: [PATCH 4/6] bootloader: Fix accidental tabs introduced in !78 --- .../bootloader/src/main/bootloader_start.c | 16 ++++++++-------- 1 file changed, 8 insertions(+), 8 deletions(-) diff --git a/components/bootloader/src/main/bootloader_start.c b/components/bootloader/src/main/bootloader_start.c index e0ab7f9e2a..a61ea77d59 100644 --- a/components/bootloader/src/main/bootloader_start.c +++ b/components/bootloader/src/main/bootloader_start.c @@ -411,15 +411,15 @@ void unpack_load_app(const partition_pos_t* partition) map = true; } - if(!load_rtc_memory && address >= RTC_IRAM_LOW && address < RTC_IRAM_HIGH) { - ESP_LOGD(TAG, "Skipping RTC code section at %08x\n", pos); - load = false; - } + if (!load_rtc_memory && address >= RTC_IRAM_LOW && address < RTC_IRAM_HIGH) { + ESP_LOGD(TAG, "Skipping RTC code section at %08x\n", pos); + load = false; + } - if(!load_rtc_memory && address >= RTC_DATA_LOW && address < RTC_DATA_HIGH) { - ESP_LOGD(TAG, "Skipping RTC data section at %08x\n", pos); - load = false; - } + if (!load_rtc_memory && address >= RTC_DATA_LOW && address < RTC_DATA_HIGH) { + ESP_LOGD(TAG, "Skipping RTC data section at %08x\n", pos); + load = false; + } ESP_LOGI(TAG, "section %d: paddr=0x%08x vaddr=0x%08x size=0x%05x (%6d) %s", section_index, pos, section_header.load_addr, section_header.data_len, section_header.data_len, (load)?"load":(map)?"map":""); From 1bae606ccce4f6925f33726a14067c0624db37f5 Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Thu, 6 Oct 2016 10:06:01 +1100 Subject: [PATCH 5/6] FreeRTOS KConfig: Limit tick rate to 1000Hz >1000Hz breaks portTICK_PERIOD_MS (see gitlab 4) A working >1000Hz tick rate is possible with some changes, but beyond a certain point it's dimishing returns to preempt tasks this often. --- components/freertos/Kconfig | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/components/freertos/Kconfig b/components/freertos/Kconfig index 7e0245e92d..1a65e1eeb7 100644 --- a/components/freertos/Kconfig +++ b/components/freertos/Kconfig @@ -39,7 +39,7 @@ endchoice config FREERTOS_HZ int "Tick rate (Hz)" - range 1 10000 + range 1 1000 default 100 help Select the tick rate at which FreeRTOS does pre-emptive context switching. From 609c1c2cdba08d75613673a252c0e8e1a83ab3be Mon Sep 17 00:00:00 2001 From: Angus Gratton Date: Mon, 10 Oct 2016 17:19:13 +1100 Subject: [PATCH 6/6] build system: Add -fno-rtti when compiling C++ code --- make/project.mk | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/make/project.mk b/make/project.mk index 35dccaf248..d91165cfd7 100644 --- a/make/project.mk +++ b/make/project.mk @@ -165,7 +165,7 @@ CPPFLAGS = -DESP_PLATFORM -Og -g3 -Wpointer-arith -Werror -Wno-error=unused-func CFLAGS = $(CPPFLAGS) -std=gnu99 -g3 -fstrict-volatile-bitfields # CXXFLAGS uses by C++ only -CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions -fstrict-volatile-bitfields +CXXFLAGS = $(CPPFLAGS) -Og -std=gnu++11 -g3 -fno-exceptions -fstrict-volatile-bitfields -fno-rtti export CFLAGS CPPFLAGS CXXFLAGS