Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

cpu/esp*: code deduplication and cleanup #12955

Merged
merged 30 commits into from
Feb 22, 2020
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
30 commits
Select commit Hold shift + click to select a range
b132698
cpu/esp*: move parition table tool to dist/tools/esptool
gschorcht Dec 12, 2019
53a3756
cpu/esp*: common Makfile* added
gschorcht Dec 12, 2019
7d701f6
cpu/esp*: move common headers to cpu/esp_common
gschorcht Dec 27, 2019
45c71f1
esp/esp*: move common code to cpu/esp_common
gschorcht Dec 8, 2019
43b89a6
cpu/esp*: move common parts of gpio_arch to cpu/esp_common
gschorcht Dec 16, 2019
4c466e5
cpu/esp*: common irq_arch in cpu/esp_common
gschorcht Dec 16, 2019
90dc2ce
cpu/esp*: common parts of syscalls in cpu/esp_common
gschorcht Dec 16, 2019
75d23e8
cpu/esp*: common exception handling
gschorcht Dec 11, 2019
39ee806
cpu/esp*: move some vendor/esp code to cpu/esp_common
gschorcht Dec 12, 2019
0ef723c
cpu/esp_common: add module esp_periph_common
gschorcht Dec 16, 2019
b0517c6
cpu/esp*: move periph/uart to cpu/esp_common
gschorcht Dec 16, 2019
66ee155
cpu/esp*: move periph/flash to cpu/esp_common
gschorcht Dec 12, 2019
d90164b
cpu/esp*: move perioph/spi to cpu/esp_common
gschorcht Dec 12, 2019
0292f8b
cpu/esp*: move periph/hwrng to cpu/esp_common
gschorcht Dec 12, 2019
05faec7
cpu/esp*: move periph/i2c_sw to esp/common
gschorcht Dec 12, 2019
18659bd
cpu/esp*: move FreeRTOS headers to cpu/esp_common
gschorcht Dec 13, 2019
922429b
cpu/esp_common: add module esp_freertos_common
gschorcht Dec 13, 2019
6133900
cpu/esp*: move common freertos code to cpu/esp_common
gschorcht Dec 13, 2019
9723e3e
cpu/esp*: move freertos/task to cpu/esp_common
gschorcht Dec 13, 2019
98ca108
cpu/esp8266: move esp_wifi to cpu/esp_common
gschorcht Dec 16, 2019
b6e9ecb
cpu/esp32: remove esp_wifi
gschorcht Dec 16, 2019
32c7bd8
cpu/esp8266: remove unused function definitions
gschorcht Dec 16, 2019
71682bc
cpu/esp32: remove unused periph_cpu.c
gschorcht Dec 16, 2019
ccae24c
cpu/esp_common: enable esp_wifi as default for lwip
gschorcht Dec 17, 2019
350a0bb
cpu/esp32: remove extra isync from periph/timer
gschorcht Jan 3, 2020
5120036
boards/esp8266: fix ARDUINO_LED definitions
gschorcht Dec 17, 2019
d251ffd
boards/esp8266: enable arduino feature
gschorcht Jan 7, 2020
e869fbd
cpu/esp32: remove periph_rtc from used modules
gschorcht Feb 21, 2020
3230326
cpu/esp32: fix esp_spi_ram dependency and flash mode setting
gschorcht Feb 21, 2020
5b4389c
cpu/esp32: update of ld script for littlefs*
gschorcht Feb 22, 2020
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions boards/common/esp8266/Makefile.features
Original file line number Diff line number Diff line change
Expand Up @@ -11,3 +11,5 @@ FEATURES_PROVIDED += periph_pwm
FEATURES_PROVIDED += periph_spi
FEATURES_PROVIDED += periph_uart
FEATURES_PROVIDED += periph_uart_modecfg

FEATURES_PROVIDED += arduino
4 changes: 2 additions & 2 deletions boards/esp8266-esp-12x/include/arduino_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -27,9 +27,9 @@ extern "C" {
#endif

/**
* @brief The on-board LED is connected to pin 2 on this board
* @brief The on-board LED is connected to GPIO2 (Arduino pin 3) on this board
*/
#define ARDUINO_LED (GPIO2)
#define ARDUINO_LED (3)

/**
* @brief Look-up table for the Arduino's digital pins
Expand Down
4 changes: 2 additions & 2 deletions boards/esp8266-olimex-mod/include/arduino_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extern "C" {
#endif

/**
* @brief The on-board LED is connected to pin 2 on this board
* @brief The on-board LED is connected to GPIO1 (Arduino pin 0) on this board
*/
#define ARDUINO_LED (GPIO1)
#define ARDUINO_LED (0)

/**
* @brief Look-up table for the Arduino's digital pins
Expand Down
4 changes: 2 additions & 2 deletions boards/esp8266-sparkfun-thing/include/arduino_board.h
Original file line number Diff line number Diff line change
Expand Up @@ -25,9 +25,9 @@ extern "C" {
#endif

/**
* @brief The on-board LED is connected to pin 2 on this board
* @brief The on-board LED is connected to GPIO5 (Arduino pin 6) on this board
*/
#define ARDUINO_LED (GPIO5)
#define ARDUINO_LED (6)

/**
* @brief Look-up table for the Arduino's digital pins
Expand Down
6 changes: 1 addition & 5 deletions cpu/esp32/Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -14,11 +14,7 @@ ifneq (, $(filter esp_eth, $(USEMODULE)))
DIRS += esp-eth
endif

ifneq (, $(filter esp_wifi, $(USEMODULE)))
DIRS += esp-wifi
endif

ifneq (, $(filter riot_freertos, $(USEMODULE)))
ifneq (, $(filter esp_freertos, $(USEMODULE)))
DIRS += freertos
endif

Expand Down
123 changes: 41 additions & 82 deletions cpu/esp32/Makefile.dep
Original file line number Diff line number Diff line change
@@ -1,46 +1,36 @@
# additional modules dependencies

include $(RIOTCPU)/esp_common/Makefile.dep

ifneq (,$(filter cpp,$(FEATURES_USED)))
USEMODULE += pthread
BASELIBS += -lstdc++
USEMODULE += pthread
BASELIBS += -lstdc++
endif

ifneq (,$(filter esp_eth,$(USEMODULE)))
USEMODULE += esp_idf_eth
USEMODULE += esp_idf_eth_phy
USEMODULE += netdev_eth
USEMODULE += netopt
USEMODULE += riot_freertos
USEMODULE += xtimer
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet
INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include
endif

ifneq (,$(filter esp_now,$(USEMODULE)))
USEMODULE += esp_wifi_any
USEMODULE += netopt
endif

ifneq (,$(filter esp_wifi,$(USEMODULE)))
USEMODULE += esp_wifi_any
USEMODULE += netopt
USEMODULE += netdev_eth
USEMODULE += esp_freertos
USEMODULE += esp_idf_eth
USEMODULE += esp_idf_eth_phy
USEMODULE += netdev_eth
USEMODULE += netopt
USEMODULE += xtimer
INCLUDES += -I$(RIOTCPU)/$(CPU)/vendor/esp-idf/include/ethernet
INCLUDES += -I$(ESP32_SDK_DIR)/components/ethernet/include
endif

ifneq (,$(filter esp_wifi_any,$(USEMODULE)))
# add additional modules used for any WiFi interface
USEMODULE += esp_idf_heap
USEMODULE += esp_idf_wpa_supplicant_crypto
USEMODULE += esp_idf_wpa_supplicant_port
USEMODULE += esp_idf_nvs_flash
USEMODULE += riot_freertos
USEMODULE += xtimer
# add additional modules used for any WiFi interface
USEMODULE += esp_freertos
USEMODULE += esp_idf_heap
USEMODULE += esp_idf_nvs_flash
USEMODULE += esp_idf_wpa_supplicant_crypto
USEMODULE += esp_idf_wpa_supplicant_port
endif

ifneq (,$(filter esp_idf_nvs_flash,$(USEMODULE)))
# add additional modules required by esp_idf_nvs_flash
USEMODULE += mtd
USEMODULE += pthread
# add additional modules required by esp_idf_nvs_flash
USEMODULE += mtd
USEMODULE += pthread
endif

ifneq (,$(filter periph_rtc,$(USEMODULE)))
Expand All @@ -56,68 +46,37 @@ ifneq (,$(filter esp_rtc_timer_32k,$(USEMODULE)))
endif

ifneq (,$(filter periph_i2c,$(USEMODULE)))
ifneq (,$(filter esp_i2c_hw,$(USEMODULE)))
USEMODULE += core_thread_flags
USEMODULE += xtimer
USEMODULE += periph_i2c_hw
else
# PLEASE NOTE: because of the very poor and faulty hardware implementation
# we use software implementation by default for the moment (if module
# esp_i2c_hw is not explicitly used)
USEMODULE += esp_i2c_sw
USEMODULE += periph_i2c_sw
endif
ifneq (,$(filter esp_i2c_hw,$(USEMODULE)))
USEMODULE += core_thread_flags
USEMODULE += xtimer
USEMODULE += periph_i2c_hw
else
# PLEASE NOTE: because of the very poor and faulty hardware implementation
# we use software implementation by default for the moment (if module
# esp_i2c_hw is not explicitly used)
USEMODULE += esp_i2c_sw
USEMODULE += periph_i2c_sw
endif
endif

ifneq (, $(filter esp_spi_ram, $(DISABLE_MODULE)))
USEMODULE := $(filter-out esp_spi_ram, $(USEMODULE))
ifneq (,$(filter esp_spi_ram,$(DISABLE_MODULE)))
USEMODULE := $(filter-out esp_spi_ram,$(USEMODULE))
endif

# each device has SPI flash memory, but must be explicitly enabled
ifneq (,$(filter esp_spiffs,$(USEMODULE)))
USEMODULE += spiffs
ifneq (,$(filter esp_now esp_wifi esp_spi_ram,$(USEMODULE)))
# the ESP-IDF heap has to be used if SPI RAM is used
USEMODULE += esp_idf_heap
endif

ifneq (,$(filter mtd,$(USEMODULE)))
USEMODULE += esp_idf_spi_flash
USEMODULE += esp_idf_spi_flash
endif

ifneq (,$(filter ndn-riot,$(USEPKG)))
USEMODULE += crypto
USEMODULE += cipher_modes
USEMODULE += crypto
USEMODULE += cipher_modes
endif

ifneq (,$(filter shell,$(USEMODULE)))
USEMODULE += ps
endif

ifneq (,$(filter log_color,$(USEMODULE)))
USEMODULE += esp_log_colored
endif

# if SPI RAM is enabled, ESP-IDF heap and quot flash mode have to be used
ifneq (,$(filter esp_spi_ram,$(USEMODULE)))
USEMODULE += esp_idf_heap
export FLASH_MODE = qout
CFLAGS += -DFLASH_MODE_QOUT=1
else
ifeq ($(FLASH_MODE), qio)
CFLAGS += -DFLASH_MODE_QIO=1
endif
ifeq ($(FLASH_MODE), qout)
CFLAGS += -DFLASH_MODE_QOUT=1
endif
ifeq ($(FLASH_MODE), dio)
CFLAGS += -DFLASH_MODE_DIO=1
endif
ifeq ($(FLASH_MODE), dout)
CFLAGS += -DFLASH_MODE_DOUT=1
endif
endif

ifneq (,$(filter esp_idf_heap,$(USEMODULE)))
LINKFLAGS += -Wl,-wrap,_malloc_r
LINKFLAGS += -Wl,-wrap,_calloc_r
LINKFLAGS += -Wl,-wrap,_realloc_r
LINKFLAGS += -Wl,-wrap,_free_r
USEMODULE += ps
endif
11 changes: 4 additions & 7 deletions cpu/esp32/Makefile.features
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
FEATURES_PROVIDED += arch_32bit
# MCU defined features that are provided independent on board definitions

include $(RIOTCPU)/esp_common/Makefile.features

FEATURES_PROVIDED += arch_esp32
FEATURES_PROVIDED += cpp
FEATURES_PROVIDED += periph_cpuid
FEATURES_PROVIDED += periph_hwrng
FEATURES_PROVIDED += periph_pm
FEATURES_PROVIDED += periph_rtc
FEATURES_PROVIDED += periph_timer
FEATURES_PROVIDED += ssp
Loading