1
0
mirror of https://github.com/RIOT-OS/RIOT.git synced 2025-12-25 06:23:53 +01:00

cpu/esp32: fixes dependency problem for timer

Xtensa newlib version requires pthread_setcancelstate as symbol. Therefore, the module pthread was always used, which in turn requires the module xtimer. The xtimer module, however, uses TIMER_DEV(0). Therefore, tests/timers failed for TIMER_DEV(0).
This commit is contained in:
Gunar Schorcht 2018-10-14 13:50:38 +02:00
parent 8e0d69c807
commit fddfe86a4b
5 changed files with 29 additions and 6 deletions

View File

@ -52,6 +52,7 @@ endif
# each device has SPI flash memory, but must be explicitly enabled
ifneq (,$(filter esp_spiffs,$(USEMODULE)))
USEMODULE += esp_idf_spi_flash
USEMODULE += spiffs
USEMODULE += vfs
export SPIFFS_STD_OPTION = -std=c99
@ -70,6 +71,7 @@ endif
ifneq (,$(filter shell,$(USEMODULE)))
USEMODULE += newlib_syscalls_default
USEMODULE += ps
USEMODULE += xtimer
endif

View File

@ -29,6 +29,10 @@ endif
# SPECIAL module dependencies
# cannot be done in Makefile.dep since Makefile.dep is included too late
ifneq (,$(findstring core_thread_flags,$(USEMODULE)))
USEMODULE += pthread
endif
ifneq (,$(filter esp_gdbstub,$(USEMODULE)))
USEMODULE += esp_gdb
endif
@ -57,18 +61,13 @@ export CPU ?= esp32
export TARGET_ARCH ?= xtensa-esp32-elf
export ESPTOOL ?= $(ESP32_SDK_DIR)/components/esptool_py/esptool/esptool.py
USEMODULE += core_thread_flags
USEMODULE += esp_idf
USEMODULE += esp_idf_driver
USEMODULE += esp_idf_esp32
USEMODULE += esp_idf_soc
USEMODULE += esp_idf_spi_flash
USEMODULE += log
USEMODULE += mtd
USEMODULE += periph
USEMODULE += periph_common
USEMODULE += pthread
USEMODULE += ps
USEMODULE += random
USEMODULE += xtensa
@ -137,7 +136,7 @@ ifneq (,$(filter pthread,$(USEMODULE)))
LINKFLAGS += $(BINDIR)/pthread.a
endif
LINKFLAGS += -lhal -lc -lg
LINKFLAGS += -lhal -lg -lc -lg
LINKFLAGS += -Wl,--end-group
LINKFLAGS += -L$(RIOTCPU)/$(CPU)/ld/
LINKFLAGS += -T$(RIOTCPU)/$(CPU)/ld/esp32.ld

View File

@ -18,6 +18,8 @@
* @}
*/
#if MODULE_MTD
#define ENABLE_DEBUG (0)
#include "debug.h"
@ -429,3 +431,5 @@ static int _flash_power (mtd_dev_t *dev, enum mtd_power_state power)
return -ENOTSUP;
}
#endif /* MODULE_MTD */

View File

@ -316,9 +316,11 @@ static NORETURN void IRAM system_init (void)
_sys_time.tm_year + 1900, _sys_time.tm_mon + 1, _sys_time.tm_mday,
_sys_time.tm_hour, _sys_time.tm_min, _sys_time.tm_sec);
#if MODULE_MTD
/* init flash drive */
extern void spi_flash_drive_init (void);
spi_flash_drive_init();
#endif
/* initialize the board */
board_init();

View File

@ -113,6 +113,22 @@ int IRAM printf(const char* format, ...)
return ret;
}
#ifndef MODULE_PTHREAD
#define PTHREAD_CANCEL_DISABLE 1
/*
* This is a dummy function to avoid undefined references when linking
* against newlib and module pthread is not used.
*/
int pthread_setcancelstate(int state, int *oldstate)
{
if (oldstate) {
*oldstate = PTHREAD_CANCEL_DISABLE;
}
return 0;
}
#endif /* MODULE_PTHREAD*/
/**
* @name Locking functions
*