From 66683050c529c2637524cae3e00a3dfede4b6f9a Mon Sep 17 00:00:00 2001 From: Gunar Schorcht <gunar@schorcht.net> Date: Wed, 26 Dec 2018 16:03:38 +0100 Subject: [PATCH] cpu/esp8266: Makefile fixes for ets_task thread Changes of ETS task handling require the context switch by software interrupt. The context switch based on interrupt is therefore enabled by default. Furthermore, the number of priority levels are increased due to the new additional thread. --- cpu/esp8266/Makefile.dep | 20 +++++++------- cpu/esp8266/Makefile.include | 52 +++++++++++++++++++----------------- 2 files changed, 38 insertions(+), 34 deletions(-) diff --git a/cpu/esp8266/Makefile.dep b/cpu/esp8266/Makefile.dep index 8ad433be38..cbbab23324 100644 --- a/cpu/esp8266/Makefile.dep +++ b/cpu/esp8266/Makefile.dep @@ -1,5 +1,15 @@ # additional modules dependencies +ifneq (, $(filter esp_sdk, $(USEMODULE))) + USEMODULE += core_thread_flags +endif + +ifneq (, $(filter esp_spiffs, $(USEMODULE))) + export SPIFFS_STD_OPTION = -std=c99 + USEMODULE += spiffs + USEMODULE += vfs +endif + ifneq (, $(filter lua, $(USEPKG))) USEMODULE += newlib_syscalls_default USEMODULE += xtimer @@ -35,13 +45,3 @@ endif ifneq (, $(filter newlib_syscalls_default, $(USEMODULE))) USEMODULE += stdio_uart endif - -# network interface dependencies -ifneq (, $(filter netdev_default, $(USEMODULE))) - # if NETDEV_DEFAULT is empty, we use module mrf24j40 as default network device - ifndef NETDEV_DEFAULT - USEMODULE += mrf24j40 - else - USEMODULE += $(NETDEV_DEFAULT) - endif -endif diff --git a/cpu/esp8266/Makefile.include b/cpu/esp8266/Makefile.include index b3802d6c9e..72fcdaace0 100644 --- a/cpu/esp8266/Makefile.include +++ b/cpu/esp8266/Makefile.include @@ -24,6 +24,16 @@ endif ifeq ($(ENABLE_GDBSTUB), 1) USEMODULE += esp_gdbstub +endif + +# SPECIAL module dependencies +# cannot be done in Makefile.dep since Makefile.dep is included too late + +ifneq (, $(filter esp_sw_timer, $(USEMODULE))) + USEMODULE += esp_sdk +endif + +ifneq (, $(filter esp_gdbstub, $(USEMODULE))) USEMODULE += esp_gdb endif @@ -39,7 +49,17 @@ PSEUDOMODULES += esp_sdk_int_handling PSEUDOMODULES += esp_sw_timer PSEUDOMODULES += esp_spiffs +USEMODULE += esp +USEMODULE += mtd +USEMODULE += periph +USEMODULE += periph_common +USEMODULE += ps +USEMODULE += random +USEMODULE += sdk +USEMODULE += xtensa + ifneq (, $(filter pthread, $(USEMODULE))) + # has to be included before $(ESP8266_NEWLIB_DIR) INCLUDES += -I$(RIOTBASE)/sys/posix/pthread/include endif @@ -49,13 +69,14 @@ INCLUDES += -I$(RIOTCPU)/$(CPU) INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/espressif -CFLAGS += -DESP_OPEN_SDK +CFLAGS += -DESP_OPEN_SDK -DSCHED_PRIO_LEVELS=32 CFLAGS += -Wno-unused-parameter -Wformat=0 -CFLAGS += -mlongcalls -mtext-section-literals -fdata-sections +CFLAGS += -mlongcalls -mtext-section-literals +CFLAGS += -fdata-sections -fzero-initialized-in-bss ASFLAGS += --longcalls --text-section-literals -ifneq (, $(filter esp_sw_timer, $(USEMODULE))) - USEMODULE += esp_sdk +ifeq (, $(filter esp_sdk_int_handling, $(USEMODULE))) + CFLAGS += -DCONTEXT_SWITCH_BY_INT endif ifneq (, $(filter esp_sdk, $(USEMODULE))) @@ -70,17 +91,9 @@ ifneq (, $(filter esp_gdbstub, $(USEMODULE))) endif ifneq (, $(filter esp_gdb, $(USEMODULE))) - CFLAGS_OPT = -fzero-initialized-in-bss -Og -ggdb -g3 + CFLAGS += -Og -ggdb -g3 else - CFLAGS_OPT = -fzero-initialized-in-bss -O2 -endif - -CFLAGS += $(CFLAGS_OPT) - -ifneq (, $(filter esp_spiffs, $(USEMODULE))) - export SPIFFS_STD_OPTION = -std=c99 - USEMODULE += spiffs - USEMODULE += vfs + CFLAGS += -Os endif ifeq ($(QEMU), 1) @@ -115,15 +128,6 @@ LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/eagle.rom.addr.v6.ld LINKFLAGS += -nostdlib -lgcc -u ets_run -Wl,-gc-sections # -Wl,--print-gc-sections LINKFLAGS += -Wl,--warn-unresolved-symbols -USEMODULE += esp -USEMODULE += mtd -USEMODULE += periph -USEMODULE += periph_common -USEMODULE += ps -USEMODULE += random -USEMODULE += sdk -USEMODULE += xtensa - # configure preflasher to convert .elf to .bin before flashing FLASH_SIZE = -fs 8m export PREFLASHER ?= esptool.py @@ -143,5 +147,5 @@ else export FFLAGS += -p $(PORT) -b $(PROGRAMMER_SPEED) write_flash export FFLAGS += -fm $(FLASH_MODE) export FFLAGS += 0 $(ELFFILE)-0x00000.bin - export FFLAGS += 0x10000 $(ELFFILE)-0x10000.bin + export FFLAGS += 0x10000 $(ELFFILE)-0x10000.bin; esptool.py -p $(PORT) run endif -- GitLab