diff --git a/cpu/esp32/Makefile.include b/cpu/esp32/Makefile.include index dea8f3289d71..59aff47c79c5 100644 --- a/cpu/esp32/Makefile.include +++ b/cpu/esp32/Makefile.include @@ -268,25 +268,17 @@ LINKFLAGS += -T$(BINDIR)/memory.ld LINKFLAGS += -T$(BINDIR)/sections.ld LINKFLAGS += -T$(ESP32_SDK_DIR)/components/soc/$(CPU_FAM)/ld/$(CPU_FAM).peripherals.ld -LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.api.ld LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.ld +LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.api.ld +LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld -ifneq (,$(filter esp32 esp32s2,$(CPU_FAM))) - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-data.ld - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-funcs.ld - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib-time.ld +ifeq (esp32s2,$(CPU_FAM)) LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.spiflash.ld else ifeq (esp32c3,$(CPU_FAM)) - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib.ld - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.version.ld LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.eco3.ld else ifeq (esp32s3,$(CPU_FAM)) - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.libgcc.ld LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.newlib.ld - LINKFLAGS += -T$(ESP32_SDK_DIR)/components/esp_rom/$(CPU_FAM)/ld/$(CPU_FAM).rom.version.ld -else - $(error Unknown link flags for ESP32x SoC variant (family): $(CPU_FAM)) endif LINKFLAGS += -nostdlib -lgcc -Wl,-gc-sections diff --git a/cpu/esp32/include/sys/features.h b/cpu/esp32/include/sys/features.h index 6d01ef0f95ef..a8712f88269e 100644 --- a/cpu/esp32/include/sys/features.h +++ b/cpu/esp32/include/sys/features.h @@ -41,6 +41,13 @@ extern "C" { */ #undef _POSIX_THREADS +/* + * To avoid type conflicts between the `pthread_rwlockattr_t` definition + * in RIOT's `pthread` implementation and newlibc's `sys/_pthreadtypes.h`, + * the macro `_POSIX_READER_WRITER_LOCKS` must be undefined. + */ +#undef _POSIX_READER_WRITER_LOCKS + #ifdef __cplusplus } #endif diff --git a/cpu/esp32/syscalls.c b/cpu/esp32/syscalls.c index aa215985a97d..dc4df027c29a 100644 --- a/cpu/esp32/syscalls.c +++ b/cpu/esp32/syscalls.c @@ -278,32 +278,6 @@ extern struct __lock __attribute__((alias("s_shared_mutex"))) __lock___arc4rando void IRAM syscalls_init_arch(void) { -#if defined(_RETARGETABLE_LOCKING) - /* initialization of static locking variables in ROM, different ROM - * versions of newlib use different locking variables */ -#if defined(CPU_FAM_ESP32) - extern _lock_t __sfp_lock; - extern _lock_t __sinit_lock; - extern _lock_t __env_lock_object; - extern _lock_t __tz_lock_object; - - __sfp_lock = (_lock_t)&s_shared_rmutex; - __sinit_lock = (_lock_t)&s_shared_rmutex; - __env_lock_object = (_lock_t)&s_shared_mutex; - __tz_lock_object = (_lock_t)&s_shared_rmutex; -#elif defined(CPU_FAM_ESP32S2) - extern _lock_t __sinit_recursive_mutex; - extern _lock_t __sfp_recursive_mutex; - - __sinit_recursive_mutex = (_lock_t)&s_shared_rmutex; - __sfp_recursive_mutex = (_lock_t)&s_shared_rmutex; -#else - /* TODO: Other platforms don't provide access to these ROM variables. - * It could be necessary to call `esp_rom_newlib_init_common_mutexes`. For - * the moment it doesn't seems to be necessary to call this function. */ -#endif -#endif /* _RETARGETABLE_LOCKING */ - /* initialize and enable the system timer in us (TMG0 is enabled by default) */ timer_hal_init(&sys_timer, TIMER_SYSTEM_GROUP, TIMER_SYSTEM_INDEX); timer_hal_set_divider(&sys_timer, rtc_clk_apb_freq_get() / MHZ);