1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-01-17 05:12:57 +01:00

cpu/esp_common: replace FLASH_MODE_* by CONFIG_*FLASHMODE_* defines

The former FLASH_MODE_{DOUT,DIO,QOUT,QIO} defines are replaced by the corresponding CONFIG_FLASHMODE_{DOUT,DIO,QOUT,QIO} and CONFIG_ESPTOOLPY_FLASHMODE_{DOUT,DIO,QOUT,QIO} as used by the ESP-IDF. This is also needed for the migration of defining flash mode in Kconfig.
This commit is contained in:
Gunar Schorcht 2022-08-01 15:17:33 +02:00
parent cd3c053d32
commit b4fafef6e7
6 changed files with 34 additions and 37 deletions

View File

@ -155,6 +155,8 @@ INCLUDES = \
-I$(ESP32_SDK_DIR)/components/spi_flash/include/spi_flash \
#
# include CFLAGS from cpu/esp_common/Makefile.include including the defines of
# CONFIG_ESPTOOLPY_FLASHFREQ_* and CONFIG_FLASHMODE_*
CFLAGS = -include '$(RIOTBUILD_CONFIG_HEADER_C)' \
ifneq (,$(filter riscv32%,$(TARGET_ARCH)))

View File

@ -63,20 +63,14 @@ extern "C" {
#endif
#endif
#if FLASH_MODE_QIO
#define CONFIG_FLASHMODE_QIO 1
#define CONFIG_ESPTOOLPY_FLASHMODE_QIO 1
#elif FLASH_MODE_QOUT
#define CONFIG_FLASHMODE_QOUT 1
#define CONFIG_ESPTOOLPY_FLASHMODE_QOUT 1
#elif FLASH_MODE_DIO
#define CONFIG_FLASHMODE_DIO 1
#define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1
#elif FLASH_MODE_DOUT
#define CONFIG_FLASHMODE_DOUT 1
#define CONFIG_ESPTOOLPY_FLASHMODE_DOUT 1
#else
#error "Unknown flash mode selected."
/**
* Serial flasher config (defined by CFLAGS, only sanity check here)
*/
#if !defined(CONFIG_FLASHMODE_DOUT) && \
!defined(CONFIG_FLASHMODE_DIO) && \
!defined(CONFIG_FLASHMODE_QOUT) && \
!defined(CONFIG_FLASHMODE_QIO)
#error "Flash mode not configured"
#endif
/*

View File

@ -183,23 +183,13 @@ extern "C" {
#define CONFIG_ETH_DMA_TX_BUFFER_NUM 10
/**
* Serial flasher config (DO NOT CHANGE)
* Serial flasher config (defined by CFLAGS, only sanity check here)
*/
#define CONFIG_ESPTOOLPY_FLASHFREQ_40M 1
#if defined(FLASH_MODE_QIO)
#define CONFIG_FLASHMODE_QIO 1
#define CONFIG_ESPTOOLPY_FLASHMODE_QIO 1
#elif defined(FLASH_MODE_QOUT)
#define CONFIG_FLASHMODE_QOUT 1
#define CONFIG_ESPTOOLPY_FLASHMODE_QOUT 1
#elif defined(FLASH_MODE_DIO)
#define CONFIG_FLASHMODE_DIO 1
#define CONFIG_ESPTOOLPY_FLASHMODE_DIO 1
#elif defined(FLASH_MODE_DOUT)
#define CONFIG_FLASHMODE_DOUT 1
#define CONFIG_ESPTOOLPY_FLASHMODE_DOUT 1
#else
#error "Unknown flash mode selected."
#if !defined(CONFIG_FLASHMODE_DOUT) && \
!defined(CONFIG_FLASHMODE_DIO) && \
!defined(CONFIG_FLASHMODE_QOUT) && \
!defined(CONFIG_FLASHMODE_QIO)
#error "Flash mode not configured"
#endif
/**

View File

@ -83,7 +83,7 @@ gpio_pin_usage_t _gpio_pin_usage [GPIO_PIN_NUMOF] = {
_SPIF, /* GPIO6 is used as direct I/O SPI SCK for Flash */
_SPIF, /* GPIO7 is used as direct I/O SPI MISO for Flash */
_SPIF, /* GPIO8 is used as direct I/O SPI MOSI for Flash */
#if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT)
#if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT)
/* in qio and qout mode these pins are used in Flash */
_SPIF, /* GPIO9 is used as direct I/O SPI HD for Flash */
_SPIF, /* GPIO10 is used as direct I/O SPI WP for Flash */

View File

@ -62,7 +62,7 @@ gpio_pin_usage_t _gpio_pin_usage [GPIO_PIN_NUMOF] =
_SPIF, /* gpio6 SPI flash CLK */
_SPIF, /* gpio7 SPI flash MISO */
_SPIF, /* gpio8 SPI flash MOSI */
#if defined(FLASH_MODE_QIO) || defined(FLASH_MODE_QOUT)
#if defined(CONFIG_FLASHMODE_QIO) || defined(CONFIG_FLASHMODE_QOUT)
_SPIF, /* gpio9 SPI flash HD (qio/qout flash mode) */
_SPIF, /* gpio10 SPI flash WP (qio/qout flash mode) */
#else

View File

@ -78,11 +78,22 @@ ifneq (,$(filter lwip,$(USEMODULE)))
CFLAGS += -DTCPIP_THREAD_PRIO=5
endif
# set CFLAG for the correspondant FLASH_MODE
CFLAGS += $(if $(findstring qout,$(FLASH_MODE)),-DFLASH_MODE_QOUT=1)
CFLAGS += $(if $(findstring qio,$(FLASH_MODE)),-DFLASH_MODE_QIO=1)
CFLAGS += $(if $(findstring dio,$(FLASH_MODE)),-DFLASH_MODE_DIO=1)
CFLAGS += $(if $(findstring dout,$(FLASH_MODE)),-DFLASH_MODE_DOUT=1)
# extend CFLAGS by the corresponding CONFIG_FLASHMODE_* defines
ifeq (dout,$(FLASH_MODE))
CFLAGS += -DCONFIG_FLASHMODE_DOUT
CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_DOUT
else ifeq (dio,$(FLASH_MODE))
CFLAGS += -DCONFIG_FLASHMODE_DIO
CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_DIO
else ifeq (qout,$(FLASH_MODE))
CFLAGS += -DCONFIG_FLASHMODE_QOUT
CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_QUOT
else ifeq (qio,$(FLASH_MODE))
CFLAGS += -DCONFIG_FLASHMODE_QIO
CFLAGS += -DCONFIG_ESPTOOLPY_FLASHMODE_QIO
else
$(error Undefined FLASH_MODE, possible values are: dout, dio, qout and qio)
endif
ARCHIVES += -lg -lc